feat(cellular): rules 13 feeding, matter as energy, spent pool and predation
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 4s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 4s
Foundation / checks (tsan) (push) Successful in 4s
Foundation / checks (deploy) (push) Successful in 4m29s
Foundation / postgres-tools (push) Successful in 31s
Foundation / server-image (push) Successful in 4m24s
Foundation / image (push) Successful in 5m3s
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 4s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 4s
Foundation / checks (tsan) (push) Successful in 4s
Foundation / checks (deploy) (push) Successful in 4m29s
Foundation / postgres-tools (push) Successful in 31s
Foundation / server-image (push) Successful in 4m24s
Foundation / image (push) Successful in 5m3s
Phase 2 of the cellular revamp build plan (ADR-0179), server half. - Matter as energy: when an energy cost exceeds the reserve's energy, reserve matter stands in for the rest at each channel's burn rate (pJ per 1,000 fg, scaled by the genome's burn efficiency), largest channel first. Upkeep may burn any channel; thrust only channels the player has not excluded. Burned matter adds no heat; it goes to the region's spent pool. A cell dies only when nothing can pay its upkeep. - Collection: per-channel limits scaled by the genome's collection indices, a shared limit on all matter, a tunable cost per membrane point, and only the genome's kept share (energy conversion) of bubble energy reaching the reserve. - Predation: engulf mass carries a tunable share of reserve matter, the predator's engulf capacity scales its side and the prey's membrane (now in nanometres) its own; kill absorption scales the predator's intake; the kill's remainder is split between bubbles at the prey and the spent pool, and a full habitat sends overflow to the pool. - The spent pool is owner format 11 state, counted in conservation, and drips back as seeded random bubbles every interval tick. - Reserve matter is carried as load: slower thrust and turning, costlier thrust. - Channel exclusions are a 4-bit step intent field, trace byte 14; only owned lives under rules 13 may send them. All values come from the revamp tuning file. Rules up to 12 are unchanged. Tests cover payments and their conservation over 400 seeds, the rules-13 region step (collection, membrane, kept energy, burning, engulfment and kill splits with closure), the drip, load, exclusions, a 700-tick run with closure and exact restore, and trace replay with exclusions. Session v14 and the client follow the server phases (build plan). Refreshes the DEV session window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -57,7 +57,8 @@ bool valid_intent(const CellularLifeIntent& life) {
|
||||
step.movement.y <= movement_limit && !(step.engulf && step.intake_target) &&
|
||||
!(step.bud && (step.intake_target || step.engulf)) &&
|
||||
!(step.frozen && (step.movement != biology::CellularIntent{} || step.intake_target ||
|
||||
step.engulf || step.bud || step.brake));
|
||||
step.engulf || step.bud || step.brake || step.exclude != 0)) &&
|
||||
step.exclude <= 0x0F;
|
||||
}
|
||||
bool valid_ticks(std::span<const CellularTickIntents> ticks) {
|
||||
std::set<std::uint64_t> identities;
|
||||
@@ -167,7 +168,9 @@ void put_intent(std::vector<std::uint8_t>& out, const CellularLifeIntent& life)
|
||||
// player action records keep it zero: the trace alone carries a brake.
|
||||
out.push_back(
|
||||
static_cast<std::uint8_t>((life.intent.frozen ? 1U : 0U) | (life.intent.brake ? 2U : 0U)));
|
||||
put(out, 0, 2);
|
||||
// Byte 14 (rules 13): kept matter channels, bits 0-3; byte 15 stays zero.
|
||||
out.push_back(life.intent.exclude);
|
||||
out.push_back(0);
|
||||
put(out, life.intent.intake_target ? life.intent.intake_target->x_um : 0, 4);
|
||||
put(out, life.intent.intake_target ? life.intent.intake_target->y_um : 0, 4);
|
||||
}
|
||||
@@ -305,7 +308,7 @@ decode_cellular_batch(std::span<const std::uint8_t> bytes) {
|
||||
step.lives.reserve(static_cast<std::size_t>(count));
|
||||
for (std::uint64_t i = 0; i < count; ++i) {
|
||||
const auto record = bytes.subspan(offset, cellular_batch_intent_bytes);
|
||||
if (record[12] > 3 || record[13] > 3 || !all_zero(record.subspan(14, 2)))
|
||||
if (record[12] > 3 || record[13] > 3 || record[14] > 0x0F || record[15] != 0)
|
||||
return std::unexpected{CellularBatchError::format};
|
||||
CellularLifeIntent life;
|
||||
life.life_id = get(record, 0, 8);
|
||||
@@ -324,6 +327,7 @@ decode_cellular_batch(std::span<const std::uint8_t> bytes) {
|
||||
life.intent.bud = record[12] == 3; // ADR-0125.
|
||||
life.intent.frozen = (record[13] & 1U) != 0; // ADR-0128.
|
||||
life.intent.brake = (record[13] & 2U) != 0; // Rules 12; owners below refuse it.
|
||||
life.intent.exclude = record[14]; // Rules 13; owners below refuse it.
|
||||
if (!valid_intent(life) ||
|
||||
(!step.lives.empty() && step.lives.back().life_id >= life.life_id))
|
||||
return std::unexpected{CellularBatchError::format};
|
||||
|
||||
Reference in New Issue
Block a user