feat(cellular): show growth and gate splits; DEV splits at half growth
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 5s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m32s
Foundation / postgres-tools (push) Successful in 28s
Foundation / server-image (push) Successful in 4m21s
Foundation / image (push) Successful in 5m1s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 5s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m32s
Foundation / postgres-tools (push) Successful in 28s
Foundation / server-image (push) Successful in 4m21s
Foundation / image (push) Successful in 5m1s
Playtest: after one mutation every later choice came back "split refused"
because a split needs a grown cell, and the client gave no reason. The v14
body block now carries the body's growth per thousand (the reserved bytes)
and a split-ready flag; the client disables Stay / Become until the cell can
split ("Grow to split (now 62%)") and shows growth in the Body panel.
Adhesion and organism choices do not split and stay open.
The DEV revamp tuning splits once half grown (split_min_growth 500, was full
growth); it takes effect in the next region opened.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1426,7 +1426,8 @@ void hud_notes(const PanelView& v, FormBuffers& form, PanelActions& a, bool comp
|
||||
}
|
||||
if (ImGui::CollapsingHeader("Body")) {
|
||||
const auto& t = d->traits;
|
||||
ImGui::Text("Mass %s", mass_text(d->total_mass_fg).c_str());
|
||||
ImGui::Text("Mass %s Grown %u%%", mass_text(d->total_mass_fg).c_str(),
|
||||
static_cast<unsigned>(d->growth_per_thousand / 10));
|
||||
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]},
|
||||
@@ -1585,6 +1586,9 @@ void named_offer_card(const PanelView& v, const network::CellularMutationOffer&
|
||||
ImGui::EndTable();
|
||||
const bool organism = d && d->members > 1;
|
||||
const bool adhesion = spec.effect == biology::CellularEffect::acquire_adhesion;
|
||||
// A choice that splits the cell waits until it has grown enough (the offer waits too).
|
||||
const bool splits = !organism && !adhesion;
|
||||
const bool grown = !splits || (d && d->split_ready);
|
||||
if (adhesion)
|
||||
disabled_wrapped("Your cell and its split-off offspring stay joined: one organism with "
|
||||
"one genome and one reserve, growing toward Emerge.");
|
||||
@@ -1593,9 +1597,12 @@ void named_offer_card(const PanelView& v, const network::CellularMutationOffer&
|
||||
else
|
||||
disabled_wrapped("Your cell splits: both keep the change in their plan; only the "
|
||||
"offspring expresses it.");
|
||||
if (!grown)
|
||||
ImGui::TextColored(amber, "Grow to split (now %u%%). Feed; the offer waits.",
|
||||
d ? static_cast<unsigned>(d->growth_per_thousand / 10) : 0U);
|
||||
const bool ready =
|
||||
play && play->can_act() && v.remote && v.remote->server_tick > offer.offer_tick;
|
||||
ImGui::BeginDisabled(!affordable || !ready);
|
||||
ImGui::BeginDisabled(!affordable || !ready || !grown);
|
||||
const MutationChoice stay{offer.life_identity, offer.event_index, offer.offer_tick,
|
||||
c.operator_id, false};
|
||||
if (organism || adhesion) {
|
||||
|
||||
@@ -286,6 +286,8 @@ class CellularBridge {
|
||||
}
|
||||
// Rules 13 (v14): the body block. Older sessions never see it.
|
||||
diagnostics.members = life.revamp.members;
|
||||
diagnostics.growth_per_thousand = static_cast<std::uint16_t>(
|
||||
std::min<std::uint32_t>(life.growth.realized_per_thousand, 1000));
|
||||
if (const auto genome = state.archive().find(life.identity.genome)) {
|
||||
const auto& traits = genome->cellular_traits();
|
||||
const auto t = traits.value_or(biology::CellularTraits{});
|
||||
@@ -302,6 +304,9 @@ class CellularBridge {
|
||||
diagnostics.emerge_members = static_cast<std::uint16_t>(
|
||||
std::min<std::uint32_t>(rules.emerge_members, 0xFFFF));
|
||||
diagnostics.can_emerge = server::cellular_can_emerge(life, rules);
|
||||
diagnostics.split_ready =
|
||||
life.revamp.members == 1 &&
|
||||
life.growth.realized_per_thousand >= rules.split_min_growth;
|
||||
if (feedback != state.last_tick_feedback().end() &&
|
||||
feedback->life_id == life.identity.life && feedback->tick == tick)
|
||||
diagnostics.exclude = feedback->exclude;
|
||||
|
||||
@@ -12,7 +12,7 @@ spec:
|
||||
env:
|
||||
- {name: REGION_SESSION, value: "dev"}
|
||||
- {name: REGION_SESSION_LISTEN, value: "0.0.0.0:7400"}
|
||||
- {name: REGION_SESSION_WINDOW, value: "dev-20261026T120359-8e97f3ea:1793030639"}
|
||||
- {name: REGION_SESSION_WINDOW, value: "dev-20261026T122846-560e1ebf:1793032126"}
|
||||
- {name: REGION_M10_MAX_GRANT_LIFETIME, value: "14400"}
|
||||
ports:
|
||||
# QUIC (ADR-0090): UDP only; nothing listens on TCP 7400.
|
||||
|
||||
@@ -49,7 +49,7 @@ mutation.buds_for_adhesion = 5 # on-demand buds before Adhesion is offe
|
||||
|
||||
# Reproduction (reproduction plan).
|
||||
reproduction.split_share_per_mille = 500 # the offspring's share of a mutation split
|
||||
reproduction.split_min_growth_per_mille = 1_000 # a cell splits only fully grown
|
||||
reproduction.split_min_growth_per_mille = 500 # a cell splits once half grown
|
||||
reproduction.bud_fee_e_pj = 0 # on-demand bud fee per channel, times the scale; reclaimed
|
||||
reproduction.bud_fee_c_fg = 0
|
||||
reproduction.bud_fee_n_fg = 0
|
||||
|
||||
@@ -387,6 +387,9 @@ struct CellularLifeDiagnostics {
|
||||
std::uint16_t members{}, emerge_members{};
|
||||
std::uint8_t exclude{};
|
||||
bool can_emerge{};
|
||||
// How grown the body is (per thousand), and whether a mutation choice can split it now.
|
||||
std::uint16_t growth_per_thousand{};
|
||||
bool split_ready{};
|
||||
std::uint64_t payable_energy_pj{}, total_mass_fg{};
|
||||
std::array<std::uint16_t, 20> traits{};
|
||||
friend bool operator==(const CellularLifeDiagnostics&,
|
||||
|
||||
@@ -11,8 +11,8 @@ v13's. Older versions keep their exact layouts and never see a v14 field.
|
||||
| 2 | Members: cells in the organism (1 for a single cell; at least 1 with a life) |
|
||||
| 2 | Emergence threshold in members (0 below rules 13) |
|
||||
| 1 | Matter channels kept from burning this tick (bits 0-3: C, N, P, other) |
|
||||
| 1 | Flags: bit 0 Emerge is open; other bits zero |
|
||||
| 2 | Reserved zero |
|
||||
| 1 | Flags: bit 0 Emerge is open; bit 1 a mutation choice can split the cell now (single cell, grown to the region's split threshold); other bits zero |
|
||||
| 2 | Growth per thousand of full size (0-1,000) |
|
||||
| 8 | Payable energy (pJ): the reserve's energy plus what its burnable matter stands in for |
|
||||
| 8 | Total mass (fg): body and reserve matter |
|
||||
| 2 each | The 20 heritable body traits in `biology::CellularTraits` order: density, upkeep efficiency, growth speed, collection (E, C, N, P, O), burn (C, N, P, O), engulf capacity, kill absorption, litter, recipe (C, N, P, O), adhesion |
|
||||
|
||||
@@ -38,8 +38,8 @@ constexpr std::size_t cellular_liquid_block_bytes = 4 + 4 + 2 + 1 + 1 + 8 + (9 *
|
||||
constexpr std::size_t cellular_perception_v13_prefix_bytes =
|
||||
cellular_perception_v12_prefix_bytes + cellular_liquid_block_bytes;
|
||||
// v14 (rules 13) appends the body block: members and threshold (2 x u16), exclusions, flags
|
||||
// (bit 0 Emerge open), two reserved bytes, payable energy and total mass (2 x u64) and twenty
|
||||
// u16 traits.
|
||||
// (bit 0 Emerge open, bit 1 a choice can split now), growth per thousand (u16), payable energy
|
||||
// and total mass (2 x u64) and twenty u16 traits.
|
||||
constexpr std::size_t cellular_revamp_block_bytes = 2 + 2 + 1 + 1 + 2 + 8 + 8 + (20 * 2);
|
||||
constexpr std::size_t cellular_perception_v14_prefix_bytes =
|
||||
cellular_perception_v13_prefix_bytes + cellular_revamp_block_bytes;
|
||||
@@ -265,10 +265,12 @@ std::vector<std::uint8_t> encode_session(const SessionMessage& message, std::uin
|
||||
const auto& body = perception->diagnostics;
|
||||
if (version != session_protocol_v14 && body &&
|
||||
(body->members || body->emerge_members || body->exclude || body->can_emerge ||
|
||||
body->payable_energy_pj || body->total_mass_fg ||
|
||||
body->growth_per_thousand || body->split_ready || body->payable_energy_pj ||
|
||||
body->total_mass_fg ||
|
||||
std::ranges::any_of(body->traits, [](std::uint16_t value) { return value != 0; })))
|
||||
return {};
|
||||
if (version == session_protocol_v14 && body && (body->members == 0 || body->exclude > 0x0F))
|
||||
if (version == session_protocol_v14 && body &&
|
||||
(body->members == 0 || body->exclude > 0x0F || body->growth_per_thousand > 1000))
|
||||
return {};
|
||||
if (!liquid && (perception->currents ||
|
||||
(perception->diagnostics && (perception->diagnostics->velocity_x_q10 ||
|
||||
@@ -501,8 +503,9 @@ std::vector<std::uint8_t> encode_session(const SessionMessage& message, std::uin
|
||||
put(out, b.members, 2);
|
||||
put(out, b.emerge_members, 2);
|
||||
out.push_back(b.exclude);
|
||||
out.push_back(b.can_emerge ? 1 : 0);
|
||||
put(out, 0, 2);
|
||||
out.push_back(static_cast<std::uint8_t>((b.can_emerge ? 1U : 0U) |
|
||||
(b.split_ready ? 2U : 0U)));
|
||||
put(out, b.growth_per_thousand, 2);
|
||||
put(out, b.payable_energy_pj, 8);
|
||||
put(out, b.total_mass_fg, 8);
|
||||
for (const auto value : b.traits)
|
||||
@@ -1003,17 +1006,19 @@ std::expected<SessionMessage, SessionCodecError> decode_session(std::span<const
|
||||
b.members = static_cast<std::uint16_t>(get(payload, at, 2));
|
||||
b.emerge_members = static_cast<std::uint16_t>(get(payload, at + 2, 2));
|
||||
b.exclude = payload[at + 4];
|
||||
b.can_emerge = payload[at + 5] == 1;
|
||||
b.can_emerge = (payload[at + 5] & 1U) != 0;
|
||||
b.split_ready = (payload[at + 5] & 2U) != 0;
|
||||
b.growth_per_thousand = static_cast<std::uint16_t>(get(payload, at + 6, 2));
|
||||
b.payable_energy_pj = get(payload, at + 8, 8);
|
||||
b.total_mass_fg = get(payload, at + 16, 8);
|
||||
for (std::size_t i = 0; i < b.traits.size(); ++i)
|
||||
b.traits.at(i) = static_cast<std::uint16_t>(get(payload, at + 24 + i * 2, 2));
|
||||
const bool empty = b.members == 0 && b.emerge_members == 0 && b.exclude == 0 &&
|
||||
payload[at + 5] == 0 && b.payable_energy_pj == 0 &&
|
||||
b.total_mass_fg == 0 &&
|
||||
payload[at + 5] == 0 && b.growth_per_thousand == 0 &&
|
||||
b.payable_energy_pj == 0 && b.total_mass_fg == 0 &&
|
||||
std::ranges::all_of(b.traits, [](auto v) { return v == 0; });
|
||||
if (b.exclude > 0x0F || payload[at + 5] > 1 || payload[at + 6] != 0 ||
|
||||
payload[at + 7] != 0 || (m.diagnostics ? b.members == 0 : !empty))
|
||||
if (b.exclude > 0x0F || payload[at + 5] > 3 || b.growth_per_thousand > 1000 ||
|
||||
(m.diagnostics ? b.members == 0 : !empty))
|
||||
return std::unexpected(SessionCodecError::invalid_value);
|
||||
if (m.diagnostics) {
|
||||
auto& d = *m.diagnostics;
|
||||
@@ -1021,6 +1026,8 @@ std::expected<SessionMessage, SessionCodecError> decode_session(std::span<const
|
||||
d.emerge_members = b.emerge_members;
|
||||
d.exclude = b.exclude;
|
||||
d.can_emerge = b.can_emerge;
|
||||
d.split_ready = b.split_ready;
|
||||
d.growth_per_thousand = b.growth_per_thousand;
|
||||
d.payable_energy_pj = b.payable_energy_pj;
|
||||
d.total_mass_fg = b.total_mass_fg;
|
||||
d.traits = b.traits;
|
||||
|
||||
@@ -974,7 +974,8 @@ bool RegionSessions::send_cellular_perception(const network::AccountId& account,
|
||||
auto& d = *delivered.diagnostics;
|
||||
d.members = d.emerge_members = 0;
|
||||
d.exclude = 0;
|
||||
d.can_emerge = false;
|
||||
d.can_emerge = d.split_ready = false;
|
||||
d.growth_per_thousand = 0;
|
||||
d.payable_energy_pj = d.total_mass_fg = 0;
|
||||
d.traits = {};
|
||||
}
|
||||
|
||||
@@ -617,6 +617,8 @@ void v14_carries_the_revamp() {
|
||||
d.emerge_members = 8;
|
||||
d.exclude = 0b0101;
|
||||
d.can_emerge = false;
|
||||
d.split_ready = true;
|
||||
d.growth_per_thousand = 620;
|
||||
d.payable_energy_pj = 12'000;
|
||||
d.total_mass_fg = 24'000'000;
|
||||
for (std::size_t i = 0; i < d.traits.size(); ++i)
|
||||
@@ -638,10 +640,11 @@ void v14_carries_the_revamp() {
|
||||
bad[block + 4] = 0x10;
|
||||
CHECK(!decode_session(bad));
|
||||
bad = bytes;
|
||||
bad[block + 5] = 2;
|
||||
bad[block + 5] = 4; // Flags: bit 0 Emerge open, bit 1 split ready.
|
||||
CHECK(!decode_session(bad));
|
||||
bad = bytes;
|
||||
bad[block + 6] = 1;
|
||||
bad[block + 6] = 0xE9; // Growth 1,001 per thousand.
|
||||
bad[block + 7] = 0x03;
|
||||
CHECK(!decode_session(bad));
|
||||
// A cleared view carries an empty block.
|
||||
CellularPerception cleared{78, 0, {}, std::nullopt};
|
||||
|
||||
@@ -48,7 +48,7 @@ CellularRevampTuning trial() {
|
||||
.mutation_carbon_for_light_fg = 20'000'000,
|
||||
.mutation_buds_for_adhesion = 5,
|
||||
.reproduction_split_share_per_mille = 500,
|
||||
.reproduction_split_min_growth_per_mille = 1'000,
|
||||
.reproduction_split_min_growth_per_mille = 500,
|
||||
.reproduction_bud_fee_e_pj = 0,
|
||||
.reproduction_bud_fee_c_fg = 0,
|
||||
.reproduction_bud_fee_n_fg = 0,
|
||||
|
||||
Reference in New Issue
Block a user