Files
aevolution/docs/adr/0136-open-energy-and-scattered-nutrients.md
T
dingo 8ce609d344
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 4s
Foundation / checks (deploy) (push) Successful in 4m32s
Foundation / postgres-tools (push) Successful in 26s
Foundation / server-image (push) Successful in 4m11s
Foundation / image (push) Successful in 4m36s
feat(client): add liquid presentation and clearer cellular HUD
2026-10-22 09:08:03 -04:00

199 lines
10 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ADR-0136: Open energy, scattered nutrients and photosynthesis
## Status
Proposed (2026-10-16) by the maintainer after the region 6 playtest. Design for new
cellular rules versions, delivered in three steps (below), each built and playtested on
its own. Every number marked **tunable** is a trial value.
**Step A is implemented (2026-10-17)** as rules 8 on habitat format 2: bundle v9,
schema v43, session v11, the `cellular-v7` opening, served as DEV region 8. Where step A
differs from the plan below:
- **Boundary account:** not added yet. Step A creates nothing, so totals still equal the
opening; the account arrives with infall (step B).
- **Perception:** amounts travel as 16-bit log codes, 26 bytes per deposit. The view
carries the 512 nearest deposits.
- **Bubble size:** a bubble's contact radius is a fixed 30 µm; clients size its drawing
by its amount.
- **Bubble colour:** each bubble holds one channel, cycling through the channels the
opening stocks.
- **Placement:** three in ten bubbles fall in loose clumps. Positions come from the
genesis commit.
- **Pools:** the opening lists them explicitly with `--pool`.
- **Empty deposits:** removed from the habitat.
- **Intake targets:** ignored by the step, and the v11 client sends none.
Steps B (infall) and C (photosynthesis) are not implemented.
## Context
Food is a handful of 1 mm square patches (ADR-0120 habitat). Playtests show the loop
this creates: swim to the nearest square, sit on it until it is empty, repeat (M11.9
feedback, question 7). The space between patches holds nothing, so moving is only
travel, never foraging.
The world is also closed: every picojoule and femtogram comes from the opening stock,
and ADR-0024 rules out "a mint/burn API or perpetual light fixture". ADR-0025 already
noted that a finite source "models a prepaid budget, not a star". No planet works that
way. Sunlight arrives continuously, and impacts deliver fresh matter. A closed budget
also leaves no room for a cell that stays still and makes its own energy.
The maintainer's decisions:
- **Inflow:** sunlight every tick, plus rare infall events that deliver nutrients.
Matter otherwise recycles through death.
- **Eating:** by contact. A touched bubble drains over a few ticks while it pulses,
then vanishes.
- **Photosynthesis:** a mutation path, made likelier by staying still (ADR-0135).
- **Patches:** become a few rich pools, drawn as puddles, with bubbles everywhere in
between.
## Decision
### 1. An open region with an audited boundary
A cellular region gains a **boundary account**: cumulative counters of everything that
entered from outside, per channel (energy, C, N, P, other). They live in the owner state,
the checkpoint and the trace, like every other balance. Inflow is never minted silently.
It is credited from the boundary, and the conservation check becomes, per channel:
current total (lives + corpses + motes + pools + nursery + heat)
== opening total + boundary inflow
ADR-0024's ledger is unchanged: the boundary is one more reservoir with an unbounded
(u64-saturating, refused before overflow) opening. Its credits are deterministic
functions of the region configuration, the tick and the region seed, so replay and
recovery reproduce them without storing extra data. An inflow that would overflow a
u64 total is refused and recorded as skipped, never wrapped.
There are exactly two inflows:
- **Sunlight:** energy only, and only as much as photosynthetic cells capture in a
tick. Light that nobody captures is not modelled and never enters the books.
- **Infall:** an event that drops a clump of nutrient bubbles (section 3).
### 2. Pools and bubbles replace square patches
**Pools.** A few large, rich stocks at arbitrary µm positions, each with a radius.
Contact means a cell's footprint overlaps the pool's disc. A pool yields at most
**a quarter** (tunable) of a cell's intake rate per tick. Pools are still worth
finding, but sitting on one is slower than foraging. The client draws a pool as a
puddle: a noise-perturbed outline, seeded by the pool's position, with granules
coloured by remaining nutrient.
**Bubbles (motes).** Small, single-channel nutrient stocks scattered over the whole
region: energy, carbon, nitrogen, phosphorus or other. Each has an id, a µm position,
a channel and an amount. Its radius on screen grows with its amount. A seeded opening
generator spreads them with loose clumps, so no part of the region is empty.
**Opening density:** about one bubble per 0.25 mm² (tunable). A bubble holds about
**4 ticks** (tunable) of a founder's intake on its channel.
**Contact feeding.** Every committed tick, each living cell drains the bubbles and
pools its footprint overlaps, at up to its intake rate per channel. No action or
target is needed. Contention is resolved in a fixed order (cell id, then bubble id),
so the result is deterministic. A bubble being drained pulses; at zero it is removed.
The ADR-0120 intake target becomes unnecessary and is retired in this rules version.
Corpses no longer feed a patch: a corpse's detritus (ADR-0124) **breaks into bubbles**
at its position, one per non-zero channel, which closes the matter cycle.
**Limits:** at most 4,096 bubbles and 32 pools per region (tunable). A credit that
would exceed the bubble limit stays in the boundary and is recorded as skipped.
### 3. Infall
On a seeded schedule, averaging one event every **2 minutes** of simulated time
(tunable), an infall drops a clump of **12–24 bubbles** (tunable) with mixed channels
within a 1 mm disc at a seeded point. Its matter and energy are credited from the
boundary. Infall happens only while the region ticks, so an empty region accumulates
nothing (ADR-0128 offline rule).
### 4. Photosynthesis
A new genome capability, **photosynthesis** (genome schema 4), in a new **producer**
trait family related to stillness and growth (ADR-0135 families). Founders start at
zero. Mutation offers can raise it, and under ADR-0135 still ticks raise its odds.
- **Capture per tick:** irradiance × the cell's cross-section × photosynthesis
efficiency. Irradiance is a region setting, **0.5 pJ per µm² per tick** (tunable).
Capture is full on a tick with no movement and **a quarter** (tunable) while moving.
- **Cost:** photosynthetic organelles add body matter (paid like any mutation,
ADR-0118), raise maintenance and slow movement. A producer cell is a slow cell.
- **Matter is still needed:** light gives energy, never matter. A producer still
collects carbon, nitrogen and phosphorus by contact to grow and bud.
- **Wildlife:** a photosynthetic wildlife cell stays still while its reserve can pay
maintenance from light, and forages otherwise.
### 5. Perception and wire (session v11)
The owner's perception lists the pools and bubbles within the perception radius,
nearest first: up to 32 pools and 512 bubbles (tunable). A bubble entry is 12 bytes:
id (u32), x and y relative to the cell (i16 each, in 2 µm units), channel (u8),
amount (u8, log-scaled, enough to size and fade it) and a "being drained" flag. The
exact amounts the HUD needs (the cell's own reserve and bud cost) keep their v10
fields. v10 clients stay on regions of older rules versions.
### 6. Client
- **Bubbles:** circles coloured by channel (energy gold, carbon umber, nitrogen blue,
phosphorus rose, other grey), sized by amount. They pulse while drained and pop when
gone.
- **Pools:** puddles with granules that fade by channel as they drain.
- **Feed target:** the feed-target UI and its key go. Steering assistance (ADR-0129)
points toward the densest nearby bubbles.
- **Producer cells:** draw green organelles in proportion to their photosynthesis.
## Delivery
1. **Step A — bubbles, pools, contact feeding.** The boundary account (its inflow is
still zero), the motes and pools habitat, contact feeding, detritus to bubbles,
v11 perception, client rendering and the wildlife controller. A new opening profile
is provisioned as a new DEV region.
2. **Step B — infall.** Seeded infall events credited from the boundary.
3. **Step C — photosynthesis.** Genome schema 4, the producer family, sunlight
capture, producer wildlife behaviour and the client's producer look.
Existing regions keep their rules versions and are never migrated in place
(ADR-0119).
## Consequences
- Foraging becomes active: the best food is collected on the move. Pools reward
finding them, not camping on them.
- Energy is no longer a hard cap on a region's life. Matter still is, apart from
infall, so predation, scavenging and recycling stay central.
- Conservation stays exact and auditable: totals equal the opening plus recorded
inflow, and every replay re-derives the same inflow.
- The wire grows (up to about 6 KB per perception at 512 bubbles). That is acceptable
for DEV. Delta encoding is a later optimization.
- A stationary producer lineage becomes possible, which is the plant-like branch
ADR-0135's colonies and coalescence can build on.
## Alternatives considered
- **Keep a closed world and add more patches.** Rejected by the maintainer. It keeps
the camping loop and gives no basis for photosynthesis.
- **Steady nutrient rain.** Rejected in favour of rare infall, so matter stays scarce.
- **Every cell photosynthesizes a little.** Rejected. It removes the cost of idling and
the plant/animal split.
- **Instant absorption on contact.** Rejected in favour of a few-tick drain, so that
contact is visible (pulsing) and passing cells share food.
## Amends
- **ADR-0024:** a cellular region's boundary is an audited inflow reservoir. It is
not a mint and not a perpetual light fixture: sunlight credits only captured energy.
- **ADR-0025:** a region's energy source is no longer only a prepaid budget.
- **ADR-0120:** in the new rules version, square patches and the intake target become
pools, bubbles and contact feeding.
- **ADR-0124:** detritus becomes bubbles.
## Presentation amendment, 2026-10-22
The maintainer requested nutrient silhouettes, a thin enclosing pool membrane and
a more colorful liquid scene. The native client now uses nutrient-specific glyphs
inside the unchanged contact discs, with a zero-stock channel absent. These are
presentation symbols, not new chemical species, resource identities or membrane
physics. The existing single-channel deposit and contact-feeding contracts remain
unchanged. See [the scoped visual refresh](../engineering/CLIENT_VISUAL_REFRESH.md).