feat(cellular): session v14, bundle 15 and rules-13 wildlife
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m29s
Foundation / postgres-tools (push) Successful in 24s
Foundation / server-image (push) Successful in 4m33s
Foundation / image (push) Successful in 4m59s

Session v14 carries the rules-13 revamp: a body block in the owner's view
(members, emergence threshold, exclusions, Emerge open, payable energy,
mass and the 20 traits), become, emerge and channel exclusions on actions,
become on mutation choices, catalog offers (id, chance, cost) and the
emerged ending. Older sessions never see a v14 field. The client shows
Stay / Become offspring offers named from the shared catalog, continuing
as a bud, the organism and its Emerge button, kept channels, the body and
the emerged end screen.

Bundle 15 (rules 13 on owner format 11) is durable: schema 60 admits it
raw-only, stores become as bit 15 of the choice's operator, widens the
action input and mutation results, and publishes the 14 -> 15 revamp
profile migration. evo-world-clone opens cellular-v10 (cellular-v9 plus the
revamp upgrade from --revamp-tuning), resumable and recoverable.

Wildlife counts reserve matter as energy, waits for the bud fee, grows
organisms one short of emerging, and hunts by the region step's rules-13
engulf test. The play summary adds organisms, offers and the spent pool.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-26 07:31:32 -04:00
co-authored by Claude Opus 5.5
parent f454e038a1
commit 4bc5d5eee7
48 changed files with 1602 additions and 174 deletions
+135 -3
View File
@@ -1,4 +1,5 @@
#include "panels.hpp"
#include "evo/biology/cellular_catalog.hpp"
#include "evo/client/labels.hpp"
#include <algorithm>
#include <array>
@@ -565,6 +566,8 @@ const char* cell_action_name(CellAction kind) {
return "Bud";
case CellAction::mutation:
return "Mutation";
case CellAction::emerge:
return "Emerge";
}
return "Action";
}
@@ -1275,9 +1278,28 @@ void hud_dock(const PanelView& v, FormBuffers& form, PanelActions& a, bool compa
if (action_button("Engulf", {each, px(44)}, {0.38F, 0.68F, 1.0F, 1}))
a.cell_action = CellAction::engulf;
ImGui::SameLine();
if (action_button("Bud", {each, px(44)}, {0.82F, 0.53F, 0.96F, 1}))
if (action_button("Bud", {each, px(44)}, {0.82F, 0.53F, 0.96F, 1})) {
a.cell_action = CellAction::bud;
a.cell_become = form.bud_become && d && d->members == 1;
}
ImGui::EndDisabled();
// Rules 13 (v14): continue as the bud, or grow the organism toward Emerge.
if (d && d->members != 0 && play && play->life() != 0) {
if (d->members == 1) {
ImGui::Checkbox("Continue as the bud", &form.bud_become);
} else {
ImGui::TextColored(lavender, "Organism of %u cells (Emerge at %u)",
static_cast<unsigned>(d->members),
static_cast<unsigned>(d->emerge_members));
ImGui::BeginDisabled(!play->can_act() || !d->can_emerge);
if (action_button("Emerge", {-1, px(40)}, {0.98F, 0.82F, 0.35F, 1}))
a.cell_action = CellAction::emerge;
ImGui::EndDisabled();
if (!d->can_emerge)
disabled_wrapped("Emerge opens at the threshold of cells, mass and reserve. Buds "
"add cells to the organism.");
}
}
// What a bud needs, by nutrient (ADR-0129 amendment).
if (d && play && play->life() != 0) {
if (!bud_known(*d)) {
@@ -1386,6 +1408,35 @@ void hud_notes(const PanelView& v, FormBuffers& form, PanelActions& a, bool comp
}
ImGui::EndDisabled();
}
// Rules 13 (v14): which reserve matter may stand in for energy, and the heritable body.
if (const auto* d = diagnostics(v); d && d->members != 0) {
if (ImGui::CollapsingHeader("Burning reserve matter")) {
for (std::size_t c = 0; c < 4; ++c) {
const auto bit = static_cast<std::uint8_t>(1U << c);
bool keep = (form.cellular_controls.exclude & bit) != 0;
const std::string label = std::string{"Keep "} + nutrient_names.at(c + 1);
if (ImGui::Checkbox(label.c_str(), &keep))
form.cellular_controls.exclude =
static_cast<std::uint8_t>(keep ? form.cellular_controls.exclude | bit
: form.cellular_controls.exclude & ~bit);
}
ImGui::TextDisabled("Can pay %s now", energy_text(d->payable_energy_pj).c_str());
disabled_wrapped("Matter you keep is never burned for movement or mutations; upkeep "
"still burns it when nothing else can pay.");
}
if (ImGui::CollapsingHeader("Body")) {
const auto& t = d->traits;
ImGui::Text("Mass %s", mass_text(d->total_mass_fg).c_str());
ImGui::TextDisabled("Density %u Upkeep efficiency %u Growth %u", unsigned{t[0]},
unsigned{t[1]}, unsigned{t[2]});
ImGui::TextDisabled("Engulf capacity %u Kill absorption %u", unsigned{t[12]},
unsigned{t[13]});
ImGui::TextDisabled("Litter %u Recipe C%u N%u P%u O%u", unsigned{t[14]},
unsigned{t[15]}, unsigned{t[16]}, unsigned{t[17]}, unsigned{t[18]});
if (t[19] != 0)
ImGui::TextColored(lavender, "Adhesive: a multicellular organism");
}
}
if (ImGui::CollapsingHeader("Steering")) {
ImGui::Checkbox("Slow near food", &form.cellular_controls.slow_near_food);
ImGui::Checkbox("Precision steering (20%)", &form.cellular_controls.precision);
@@ -1494,10 +1545,83 @@ void candidate_glyph(const network::CellularOfferedCandidate& c, float width) {
IM_COL32(173, 164, 184, 255), "->");
ImGui::Dummy({width, height});
}
// Rules 13 (v14): a named catalog mutation, with its pro, con, chance and tuned cost. The
// choice splits a single cell (stay as the founder or become the offspring that expresses it);
// an organism expresses it as a whole.
const biology::CellularMutationSpec* named_mutation(const network::CellularLifeDiagnostics* d,
const network::CellularOfferedCandidate& c) {
if (!d || d->members == 0 || c.capability != 0 || c.effect != 0)
return nullptr;
return biology::cellular_mutation(c.operator_id);
}
void named_offer_card(const PanelView& v, const network::CellularMutationOffer& offer,
const network::CellularOfferedCandidate& c,
const biology::CellularMutationSpec& spec, PanelActions& a) {
const auto* play = v.cellular_play;
const auto* d = diagnostics(v);
ImGui::TextDisabled("%.1f%% chance", static_cast<double>(c.parameter) / 10'000.0);
ImGui::PushFont(nullptr, px(18));
ImGui::TextWrapped("%.*s", static_cast<int>(spec.name.size()), spec.name.data());
ImGui::PopFont();
ImGui::TextColored({0.32F, 0.90F, 0.73F, 1}, "+ %.*s", static_cast<int>(spec.pro.size()),
spec.pro.data());
ImGui::TextColored(amber, "- %.*s", static_cast<int>(spec.con.size()), spec.con.data());
bool affordable = d != nullptr;
const bool table = begin_nutrient_table("cost");
for (std::size_t channel = 0; channel < 5; ++channel) {
const auto need = channel == 0 ? c.cost_energy_pj : c.cost_matter_fg.at(channel - 1);
if (need == 0)
continue;
// Energy may be paid with burnable matter standing in.
const auto have =
d ? (channel == 0 ? d->payable_energy_pj : d->reserve_matter_fg.at(channel - 1)) : 0;
affordable = affordable && have >= need;
if (table)
nutrient_row(channel, nutrient_names.at(channel),
static_cast<float>(static_cast<double>(have) / static_cast<double>(need)),
channel == 0 ? energy_text(need) : mass_text(need));
}
if (table)
ImGui::EndTable();
const bool organism = d && d->members > 1;
const bool adhesion = spec.effect == biology::CellularEffect::acquire_adhesion;
if (adhesion)
disabled_wrapped("Your cell and its split-off offspring stay joined: one organism with "
"one genome and one reserve, growing toward Emerge.");
else if (organism)
disabled_wrapped("Your whole organism changes, paid from its reserve.");
else
disabled_wrapped("Your cell splits: both keep the change in their plan; only the "
"offspring expresses it.");
const bool ready =
play && play->can_act() && v.remote && v.remote->server_tick > offer.offer_tick;
ImGui::BeginDisabled(!affordable || !ready);
const MutationChoice stay{offer.life_identity, offer.event_index, offer.offer_tick,
c.operator_id, false};
if (organism || adhesion) {
if (ImGui::Button(affordable ? "Choose" : "Feed first", {-1, px(40)}))
a.mutation = stay;
} else {
const float half = (ImGui::GetContentRegionAvail().x - ImGui::GetStyle().ItemSpacing.x) / 2;
if (ImGui::Button(affordable ? "Stay" : "Feed first", {half, px(40)}))
a.mutation = stay;
ImGui::SameLine();
if (ImGui::Button("Become offspring", {half, px(40)})) {
auto become = stay;
become.become = true;
a.mutation = become;
}
}
ImGui::EndDisabled();
}
void offer_card(const PanelView& v, const network::CellularMutationOffer& offer,
const network::CellularOfferedCandidate& c, PanelActions& a) {
const auto* play = v.cellular_play;
const auto* d = diagnostics(v);
if (const auto* spec = named_mutation(d, c)) {
named_offer_card(v, offer, c, *spec, a);
return;
}
ImGui::TextDisabled("%s", capability_kinds.at(c.capability));
const float width = ImGui::GetContentRegionAvail().x;
candidate_glyph(c, width);
@@ -1573,10 +1697,14 @@ void evolution_window(const PanelView& v, FormBuffers& form, PanelActions& a, bo
ImGui::TextWrapped(
"%s", cause == network::CellularDeathReason::starved ? "Your cell starved"
: cause == network::CellularDeathReason::engulfed ? "Your cell was engulfed"
: cause == network::CellularDeathReason::emerged ? "Your organism emerged"
: "Your cell died");
ImGui::PopFont();
disabled_wrapped(cause == network::CellularDeathReason::starved
? "Its reserve could not pay upkeep. Its body became food."
: cause == network::CellularDeathReason::emerged
? "It left the cellular region for the world, taking all its "
"matter with it. This cellular life is complete."
: "Its body became food for another cell.");
ImGui::TextWrapped("Your descendants live on as wildlife. You return as a new "
"primitive cell.");
@@ -1602,8 +1730,12 @@ void evolution_window(const PanelView& v, FormBuffers& form, PanelActions& a, bo
ImGui::PushFont(nullptr, px(24));
ImGui::TextUnformatted("Shape this life");
ImGui::PopFont();
disabled_wrapped("Your feeding earned one change. Each trades a capability against upkeep "
"and body mass. Buds inherit what you choose.");
const bool named = !offer->candidates.empty() &&
named_mutation(diagnostics(v), offer->candidates.front()) != nullptr;
disabled_wrapped(named ? "Your play earned one change. Each has a benefit and a cost; what "
"you do makes some more likely to appear."
: "Your feeding earned one change. Each trades a capability against "
"upkeep and body mass. Buds inherit what you choose.");
const auto count = static_cast<int>(offer->candidates.size());
const int columns = compact ? 1 : std::max(1, count);
if (ImGui::BeginTable("offers", columns, ImGuiTableFlags_SizingStretchSame)) {