The first layer that is engineering, not biology: how one tick actually executes. It assembles the principles already locked in §2 and §3, grounded in how real cell simulators (PhysiCell / BioFVM) implement their main loop.
frame lockedsingle-threadedgrounded: PhysiCell
4.1
The tick is the slow clock
Cell decisions are the expensive part, so they run least often — the tick is the cell-decision cadence. Cheaper physics can iterate finer within a tick.
PhysiCell exploits the multiple time scales of a multicellular system by running three separate step sizes — diffusion fastest, mechanics medium, cell processes slowest — each on its own clock rather than every step. We borrow the structure, adapted to our solver:
Tick = one GRN decision per cell (the slow clock, ≈ their Δtcell).
Mechanics substeps finer within a tick — movement, bond springs and overlap resolution need small steps to stay stable.
Diffusion = one implicit solve per tick. Because our solver is unconditionally stable (§2.4), it does not need the many small steps PhysiCell uses; it takes the whole tick in one shot.
4.2
One tick, seven phases
A fixed order, the same every tick, closing on the conservation check. Reading top to bottom is one tick; the loop repeats.
Operator splitting: phase 3 applies cell exchange live (the reaction half); phase 5 is the single diffusion solve (the diffusion half). Phase 4 alone substeps.
Why this order
Clusters first (1) — engulf needs each cell's colony-effective size, so the bond graph's connected components are computed once at tick start and read all tick. Resolves carry-in H5.
Light before action (2) — cells sense the current light field when they decide.
Act is the reaction half (3) — cells run in a shuffled, asynchronous, live-state pass: each sees the effects of those before it. Uptake/excretion/fixation/engulf/secrete/emit apply immediately to the field and to prey; a cell drained to nothing dies, drops its matter as POM, and leaves the remaining order.
Mechanics after intent (4) — cells set swim/buoyancy intent during the act phase; positions, bond springs and soft-collision overlaps are then integrated, substepped for stability.
One diffusion solve (5) — the operator-split companion to the act phase: a single implicit solve moves the 4 matter species and 3 marker channels (markers also decay), then detritus physics (POM sinks, passive hydrolysis).
Resolve structure (6) — queued newborns are instantiated (they act next tick); deaths finalized.
Canary closes the tick (7) — every matter pool summed against the fixed totals within tolerance, no-negative guard, monitored not renormalized: drift means a bug, not a nudge.
4.3
Structure & determinism
Two rules keep the loop conservation-safe and exactly reproducible.
Structural changes are queued
Bonds formed or broken, and new cells, take effect next tick — and the cluster snapshot (phase 1) is taken at tick start. This mirrors PhysiCell, which flags division and removal during the cell pass and processes those queues serially afterward to avoid corruption. It keeps the live act-phase from mutating the structure it is iterating over.
Multi-stream RNG
One master seed derives independent substreams — one for the shuffle, one for mutation (§5), one for movement noise. Same master seed reproduces a run bit-for-bit; changing the mutation rate never shifts the shuffle order, so an effect stays attributable to its cause. This generalizes §2.5's separate shuffle stream.
4.4
Performance & threading
Settled against the real runtime, by probing the actual artifact sandbox rather than assuming.
SINGLE-THREADED — CONFIRMED
Browser JS runs one thread per context, and the only CPU-parallel escape hatch is a Web Worker. Probes showed every standard Worker route (classic-blob, module-blob, data:) blocked by the sandbox CSP, and SharedArrayBuffer absent / not cross-origin-isolated. So the simulation logic is single-threaded. The asynchronous loop loses no parallelism we could have had.
Where speed actually comes from
Algorithms first. Implicit diffusion (no substepping), a capped grid + field count, and spatial binning — cells registered in the lattice so contact-sense, engulf and mechanics neighbour queries stay O(n) instead of O(n²). This is the main answer to the 7-field cost (H6) and is exactly PhysiCell's interaction-mesh trick.
WebGPU — the one real accelerator. Probed end-to-end (device, WGSL compile, dispatch, correct readback): the field/diffusion solve is a legitimate GPU candidate. Optional, high-complexity, device-dependent.
WASM — opportunistic only. It runs, but on a tight numeric loop it benchmarked slower than JS (≈0.7×) — the JIT already optimizes such loops well. Not a default; adopt for a specific kernel only if measured to help.
Floor: everything must run correctly in plain single-threaded JS. WebGPU and WASM are detected at runtime and used only as graceful bonuses, since another device or browser may lack them.
log
Decisions & carry-ins
H5Engulf's colony-effective size — resolved: connected components computed once in phase 1, read all tick.H67-field + neighbour cost — resolved: spatial binning on the lattice (O(n)); WebGPU optional for the field solve.G4 / H4Newborn / death ordering — resolved: deaths leave the act order immediately (matter → POM); newborns instantiated in phase 6, act next tick.splitOperator splitting — reaction (cell exchange) applied live in phase 3; diffusion one implicit solve in phase 5.rngMulti-stream RNG locked — master seed → independent shuffle / mutation / noise streams.→ §5Genome & mutation feed the mutation stream; must support recurrence / memory (H7) so small cells can run-and-tumble.