Foundation / checks (checks) (push) Successful in 47m40s
Foundation / checks (client) (push) Successful in 17m27s
Foundation / checks (deploy) (push) Successful in 4m17s
Foundation / checks (ecs) (push) Successful in 4m31s
Foundation / checks (network) (push) Successful in 22m1s
Foundation / checks (tsan) (push) Successful in 13m10s
Foundation / checks (postgres) (push) Successful in 20m54s
Foundation / image (push) Successful in 4m15s
Foundation / postgres-tools (push) Successful in 5m32s
Foundation / server-image (push) Successful in 7m15s
Square patches invited camping and left the space between them empty. Rules 8 run on a format-2 habitat of deposits: - pools and single-nutrient bubbles at free micrometre centres, each with a stable id and a contact radius; the cellular-v7 opening scatters bubbles reproducibly from the genesis commit (three in ten in loose clumps) and lists pools with --pool; - every cell drains what it touches, up to its intake rate per tick, with no target; a pool gives at most a quarter of that rate; an emptied deposit disappears; - a dead cell's detritus breaks into one bubble per non-empty channel; - wildlife swims to the nearest non-empty deposit and feeds by touch. Bundle v9 (habitat 2) and schema v43 admit it. Session v11 carries the owner's 512 nearest deposits (id, centre, radius, shape, a drained flag and 16-bit amount codes) instead of patches; every other cellular message is v10's. The client asks for v11, draws bubbles (nutrient-coloured, pulsing while drained, popping when gone) and pools as puddles, slows near food and sends no feed target; the HUD summarises food in range. Earlier rules, regions and v10 clients are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
132 lines
6.8 KiB
Markdown
132 lines
6.8 KiB
Markdown
# Cellular lives checkpoint v1
|
||
|
||
Authority: ADR-0108 through ADR-0110. `server::CellularLives` in
|
||
`src/server/lifecycle/cellular_lives.cpp` implements the canonical owner
|
||
snapshot and restore codec. This is checkpoint profile 4; it does not alter
|
||
the profile-3 primitive-life format. All integers are little-endian and records
|
||
are packed by the codec, not native C++ layout.
|
||
|
||
## Envelope
|
||
|
||
| Offset | Width | Field | Contract |
|
||
|---:|---:|---|---|
|
||
| 0 | 8 | magic | ASCII `AEVCLV01` |
|
||
| 8 | 4 | format | 1 |
|
||
| 12 | 4 | cellular rules | 1 |
|
||
| 16 | 8 | world | Nonzero identity, must match restore request |
|
||
| 24 | 8 | region | Nonzero identity, must match restore request |
|
||
| 32 | 8 | frame | Nonzero identity, must match restore request |
|
||
| 40 | 8 | tick | Committed 50 ms simulation tick; must match restore request |
|
||
| 48 | 4 | width_um | Cellular area width |
|
||
| 52 | 4 | height_um | Cellular area height |
|
||
| 56 | 4 | ambient_temperature_millikelvin | Nonzero temperature used to derive budgets |
|
||
| 60 | 4 | spawn_site_count | 1..256 |
|
||
| 64 | 4 | living_count | 0..256 |
|
||
| 68 | 4 | corpse_count | 0..65,536 |
|
||
| 72 | 4 | habitat_bytes | Nested cellular habitat v1 length |
|
||
| 76 | 4 | archive_bytes | Nested lineage archive v1 length |
|
||
| 80 | 4 | reserved | Zero |
|
||
| 84 | 8 | nursery_source | Nonzero source identity |
|
||
| 92 | 40 | opening_total | Region-wide starting inventory: energy, carbon, nitrogen, phosphorus, other matter (u64 each) |
|
||
| 132 | 40 | nursery_inventory | Current unspent nursery inventory, same channel order |
|
||
| 172 | 40 | heat_inventory | Accumulated energy; all matter channels must be zero |
|
||
| 212 | 8*n | spawn sites | Signed little-endian i32 x/y micrometre pairs |
|
||
| … | 168*n | living records | Strictly ascending life identity |
|
||
| … | 100*n | corpse records | Strictly ascending organism identity |
|
||
| … | habitat_bytes | habitat | Canonical cellular habitat v1 snapshot |
|
||
| … | archive_bytes | lineage | Canonical lineage archive v1 snapshot |
|
||
| end−8 | 8 | checksum | FNV-1a64 over all preceding bytes |
|
||
|
||
The exact total length is `220 + 8*spawn_site_count + 168*living_count +
|
||
100*corpse_count + habitat_bytes + archive_bytes`. The complete envelope is
|
||
limited to 16 MiB. The checksum detects accidental corruption; it is not an
|
||
authentication mechanism.
|
||
|
||
## Living record (168 bytes)
|
||
|
||
Fields, in order: 16-byte account identity; six u64 values (`life`, `organism`,
|
||
`genome`, `event`, `born_tick`, `source`); two u32 values (`realized_per_thousand`,
|
||
`damage_per_thousand`); two u64 micrometre coordinates; then body and reserve
|
||
inventories, each five u64 channels in the envelope order. Account identities
|
||
must be unique. IDs and source/event references must be nonzero. The body is
|
||
the genome-derived structural matter inventory and contains no energy.
|
||
|
||
## Corpse record (100 bytes)
|
||
|
||
Fields, in order: four u64 values (`life`, `organism`, `source`, `died_tick`);
|
||
two u64 micrometre coordinates; two u32 growth values; u32 phenotype extent;
|
||
and one five-channel inventory. The archive must contain the matching dead
|
||
organism and death tick. Inventory must retain at least the genome-derived body
|
||
matter; heat is not part of the corpse.
|
||
|
||
### Format 4 (rules 3, ADR-0124)
|
||
|
||
Magic `AEVCLV04`, format 4, rules 3, with the revision-format archive and the
|
||
format 2/3 life records. Each corpse record is 116 bytes: the 100 bytes above,
|
||
then a u8 cause (1 starved, 2 engulfed), seven zero bytes and the predator's u64
|
||
life id (non-zero exactly when engulfed, never the corpse's own). The inventory
|
||
is empty: under rules 3 a dead cell's inventory moved to its predator and to
|
||
detritus in the habitat's patch at the corpse's 1 mm cell. Formats 1-3 keep no
|
||
cause. The checkpoint manifest pins these as cellular version bundle
|
||
`{rules 3, envelope 4, habitat 1, coordinate 1, genome 1, development 2,
|
||
founder 1, archive 2, mutation_state 1}` with the revision history profile
|
||
(schema v34).
|
||
|
||
### Format 5 (rules 4, ADR-0125)
|
||
|
||
Magic `AEVCLV05`, format 5, rules 4: format 4 plus budding. The envelope header
|
||
is 220 bytes: the 212 above, then the u64 next bud sequence (at least 1). Each
|
||
life record is 488 bytes, the format 2/3 record followed by the u64 parent life;
|
||
each corpse record is 124 bytes, the format 4 record followed by the u64 parent
|
||
life. A founder has parent 0, an account and an allocated identity below 2^63. A
|
||
bud has a non-zero parent, the zero account, an empty mutation progress and
|
||
equal life, organism and event identities of the form
|
||
`2^63 + region * 2^32 + sequence` with `1 <= sequence < next bud sequence`;
|
||
regions above 2^31 - 1 have no bud identities. Restore refuses a bud identity
|
||
outside that range, an owned bud, an unowned founder, and wildlife with
|
||
mutation progress.
|
||
|
||
## Restore validation
|
||
|
||
The decoder checks envelope bounds and checksum, identity/tick, versions,
|
||
reserved fields, all counts and nested lengths, and exact total length before
|
||
reserving record vectors. It then decodes the bounded habitat/archive records,
|
||
recomputes phenotype and body from archived genomes, verifies positions and
|
||
footprints, verifies exact living-set/archive closure and unique life/account
|
||
identities, and reconciles every current channel (nursery, heat, habitat, lives,
|
||
corpses) to the explicit opening total. It accepts only byte-identical
|
||
canonical re-encoding. Empty profile-4 genesis has zero living and corpse
|
||
records, an empty lineage archive, and an explicit finite habitat/nursery
|
||
opening. Owner provisioning does not add player lives; they require a separate
|
||
durable birth operation.
|
||
|
||
### Format 6 (rules 5, ADR-0128)
|
||
|
||
Magic `AEVCLV06`, format 6, rules 5: format 5 plus presence. Each life record is
|
||
504 bytes: the format 5 record followed by a u8 presence (0 active, 1 lingering,
|
||
2 suspended), seven zero bytes and the u64 tick its freeze began. An active life
|
||
has freeze tick 0; a lingering one a freeze tick at most the checkpoint tick and
|
||
less than 200 ticks before it; a suspended one a non-zero freeze tick at most the
|
||
checkpoint tick. Wildlife is always active. Suspended lives keep their inventory
|
||
in the region's conserved totals.
|
||
|
||
### Format 6, rules 6 (ADR-0132)
|
||
|
||
Format 6 also carries rules 6, byte for byte the same layout. Rules 6 differ only in
|
||
what they found: new lives are founder 2 (genome schema 3, development version 3).
|
||
Restore accepts format 6 with rules 5 or 6, and the version bundle (v6 or v7) must
|
||
name the same rules.
|
||
|
||
### Format 6, rules 7 (ADR-0137)
|
||
|
||
Rules 7 keep the same layout again. New lives are founder 3 (genome schema 4,
|
||
development version 4). A bud action can make twins, and wildlife can engulf, but
|
||
neither adds any state. Restore accepts format 6 with rules 5, 6 or 7, on the v8 bundle
|
||
for rules 7.
|
||
|
||
### Format 6, rules 8 (ADR-0136 step A)
|
||
|
||
Rules 8 also keep the layout. Their embedded habitat is format 2 (pools and bubbles),
|
||
and restore refuses rules 8 with a format-1 habitat, and any earlier rules with a
|
||
format-2 one. Rules 8 use the v9 bundle (habitat 2).
|