feat(lifecycle): rules 12 liquid owner on format 10 with brake traces
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
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 5s
Foundation / checks (deploy) (push) Successful in 4m23s
Foundation / postgres-tools (push) Successful in 29s
Foundation / server-image (push) Successful in 4m10s
Foundation / image (push) Successful in 4m31s
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
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 5s
Foundation / checks (deploy) (push) Successful in 4m23s
Foundation / postgres-tools (push) Successful in 29s
Foundation / server-image (push) Successful in 4m10s
Foundation / image (push) Successful in 4m31s
The cellular owner gains rules 12 on owner format 10: an explicit no-tick format-9/rules-11 upgrade declares the region's liquid rules (current configuration, founder handling and deposit motion, from the tuning file and a seed when the region opens), converts the habitat to format 3 and starts lives at rest. Founders born afterwards are founder 5 (genome schema 6). Each tick derives every life's handling from its genome and the declared founder handling, samples the current at its footprint and steps the shared liquid motion; afterwards bubbles move with the current and the drift moving cells induce, and touching bubbles merge. Format 10 persists the rules and each life's motion state; restore regenerates the identical current field. Brake is a new step intent, valid only under rules 12, carried in trace 4 as flag bit 1 (SQL never parses that byte; player action records keep it zero). Tests cover the upgrade, exact restore, swimming and braking, moving food with fixed pools, restore continuing a live run, and brake traces replaying exactly. Genomes from before schema 6 handle as founders. Refreshes the DEV session window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -57,7 +57,7 @@ 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.engulf || step.bud || step.brake));
|
||||
}
|
||||
bool valid_ticks(std::span<const CellularTickIntents> ticks) {
|
||||
std::set<std::uint64_t> identities;
|
||||
@@ -162,7 +162,10 @@ void put_intent(std::vector<std::uint8_t>& out, const CellularLifeIntent& life)
|
||||
: life.intent.engulf ? 2
|
||||
: life.intent.bud ? 3
|
||||
: 0);
|
||||
out.push_back(life.intent.frozen ? 1 : 0); // Flags (ADR-0128): bit 0 frozen.
|
||||
// Flags: bit 0 frozen (ADR-0128), bit 1 brake (rules 12). SQL never parses this byte, and
|
||||
// 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);
|
||||
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);
|
||||
@@ -301,7 +304,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] > 1 || !all_zero(record.subspan(14, 2)))
|
||||
if (record[12] > 3 || record[13] > 3 || !all_zero(record.subspan(14, 2)))
|
||||
return std::unexpected{CellularBatchError::format};
|
||||
CellularLifeIntent life;
|
||||
life.life_id = get(record, 0, 8);
|
||||
@@ -316,9 +319,10 @@ decode_cellular_batch(std::span<const std::uint8_t> bytes) {
|
||||
} else if (!all_zero(record.subspan(16, 8))) {
|
||||
return std::unexpected{CellularBatchError::format};
|
||||
}
|
||||
life.intent.engulf = record[12] == 2; // ADR-0124 target kind.
|
||||
life.intent.bud = record[12] == 3; // ADR-0125.
|
||||
life.intent.frozen = record[13] == 1; // ADR-0128.
|
||||
life.intent.engulf = record[12] == 2; // ADR-0124 target kind.
|
||||
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.
|
||||
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