feat(ecology): make photosynthesis regions playable on DEV
Foundation / checks (ecs) (push) Successful in 2m19s
Foundation / checks (deploy) (push) Successful in 4m47s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 16m48s
Foundation / checks (network) (push) Canceled after 16m46s
Foundation / checks (postgres) (push) Canceled after 16m47s
Foundation / checks (client) (push) Canceled after 16m53s
Foundation / checks (tsan) (push) Canceled after 14m33s

ADR-0176 and schema 57 admit raw cellular bundle 13 (rules 11 on owner
format 9) through parser-local normalization to bundle 12, and a fenced
no-tick 12 -> 13 upgrade that declares the region's light; recovery reads
the light from the target and re-derives the whole target from the source.
The resumable cellular-v8 opening provisions a cellular-v7 genesis, one
empty tick and the durable upgrades to bundle 13.

Session v12 adds the owner's captured light and the producers it can see
to its perception, and lets offers name photosynthesis; older sessions keep
their layouts and never receive photosynthesis candidates. The client
draws chloroplasts by efficiency, shows sunlight in the HUD and offers
photosynthesis cards. DEV now provisions and serves region 9 with the
trial light; region 8 stays stored but unserved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-19 23:04:34 -04:00
co-authored by Claude Opus 5.5
parent 108f29eda5
commit b73ccbae9a
38 changed files with 1106 additions and 140 deletions
+26 -7
View File
@@ -740,6 +740,15 @@ void draw_cell(ImDrawList& list, const SceneCell& c, float time) {
add(add(centre, times(axis, u * radius.x * 1.1F)), times(normal, v * radius.y * 0.9F)),
std::max(1.5F, r * 0.16F), organelle);
}
// Producers (ADR-0176): chloroplasts, more of them for more efficient cells.
for (int k = 0; k < c.chloroplasts; ++k) {
const auto key = c.seed * 53U + 11U + static_cast<std::uint64_t>(k);
const float u = unit_of(key) - 0.55F, v = unit_of(key + 5U) - 0.5F;
const ImVec2 at =
add(add(centre, times(axis, u * radius.x * 1.1F)), times(normal, v * radius.y * 0.9F));
list.AddCircleFilled(at, std::max(1.8F, r * 0.18F), IM_COL32(64, 168, 84, 230));
list.AddCircleFilled(at, std::max(0.8F, r * 0.08F), IM_COL32(150, 222, 128, 230));
}
const ImVec2 nucleus = add(centre, times(axis, radius.x * 0.42F));
list.AddCircleFilled(nucleus, std::max(2.0F, r * 0.3F), IM_COL32(224, 86, 63, 220));
list.AddCircleFilled(nucleus, std::max(1.0F, r * 0.14F), IM_COL32(255, 156, 134, 235));
@@ -895,6 +904,8 @@ void inspect_cell(ImDrawList& list, const SceneCell& c) {
c.mass_fg == 0 ? 0U : static_cast<unsigned>(c.membrane_fg * 100 / c.mass_fg));
ImGui::Text("Intake %s/s", mass_text(c.ingestion_fg_s).c_str());
ImGui::Text("Converts %u%% of food energy", c.conversion_per_thousand / 10);
if (c.photosynthesis_per_thousand != 0)
ImGui::Text("Light %u%% photosynthesis", c.photosynthesis_per_thousand / 10);
}
ImGui::EndTooltip();
}
@@ -1059,6 +1070,8 @@ void hud_vitals(const PanelView& v, bool compact) {
movement.at(static_cast<std::size_t>(d->movement)),
intake.at(static_cast<std::size_t>(d->intake)),
energy_text(d->maintenance_cost_pj).c_str());
if (d->light_pj != 0)
ImGui::TextDisabled("Sunlight +%s", energy_text(d->light_pj).c_str());
}
ImGui::End();
}
@@ -1259,11 +1272,11 @@ void hud_callout(const PanelView& v, FormBuffers& form) {
ImGui::PopStyleColor(3);
ImGui::End();
}
constexpr std::array capability_names{"Energy conversion", "Membrane", "Movement",
"Ingestion", "Reproduction", "Size",
"Thermal tolerance"};
constexpr std::array capability_kinds{"Metabolism", "Defense", "Movement", "Feeding",
"Reproduction", "Size", "Environment"};
constexpr std::array capability_names{"Energy conversion", "Membrane", "Movement",
"Ingestion", "Reproduction", "Size",
"Thermal tolerance", "Photosynthesis"};
constexpr std::array capability_kinds{"Metabolism", "Defense", "Movement", "Feeding",
"Reproduction", "Size", "Environment", "Producer"};
constexpr std::array effect_names{"Increase", "Decrease", "Acquire", "Shed"};
constexpr std::array increase_text{"Convert more of what you eat into usable energy.",
"A thicker wall: prey must be much larger to engulf you.",
@@ -1271,14 +1284,16 @@ constexpr std::array increase_text{"Convert more of what you eat into usable ene
"Take food faster from every patch you touch.",
"Better at budding: cheaper buds, more twins (+10%).",
"Grow toward a larger body: harder to engulf, slower to fill.",
"Tolerate a wider range of temperatures."};
"Tolerate a wider range of temperatures.",
"Capture 10% more light while still; heavier and slower."};
constexpr std::array decrease_text{"Convert less of what you eat into energy.",
"A thinner, cheaper wall that is easier to breach.",
"Swim 10% slower and spend less on movement.",
"Take food more slowly from each patch.",
"Worse at budding: dearer buds, fewer twins (-10%).",
"Grow toward a smaller body that is cheaper to keep.",
"Tolerate a narrower range of temperatures."};
"Tolerate a narrower range of temperatures.",
"Capture 10% less light; lighter and a little faster."};
// A small before/after drawing of the cell for one candidate.
void candidate_glyph(const network::CellularOfferedCandidate& c, float width) {
const ImVec2 at = ImGui::GetCursorScreenPos();
@@ -1303,6 +1318,10 @@ void candidate_glyph(const network::CellularOfferedCandidate& c, float width) {
case 0:
after.organelles = up ? 5 : 1;
break;
case 7:
after.chloroplasts = c.effect == 3 ? 0 : up ? 5 : 2;
before.chloroplasts = c.effect == 2 ? 0 : 3;
break;
default:
break;
}