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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user