Overview
LifeSimulator v4 (repo name: lifev4) is the fourth pass at a life-and-evolution
simulation I keep coming back to. You seed a world with plants and animals, each carrying a
real genome, and then watch ecosystems form, drift, and occasionally collapse. Plants
photosynthesize and spread seeds; animals perceive, hunt, eat, fight, and reproduce; genes
mutate and species split off on their own. Underneath all of it runs a planetary climate
model that can cool the world into an ice age or warm it back out.
The headline change in v4 is engineering, not features: the simulation is now a headless, fully deterministic C# core with no UI baked in -; same seed and same commands always produce a bit-identical world, and a run can be saved and resumed without drifting.
Background
This is descended from a string of earlier attempts (the simlife Godot/Python
prototypes). Those proved the idea was fun but tangled the simulation up with the rendering,
which made it hard to test, hard to reason about, and easy to break. v4 starts over with a
hard rule: the engine knows nothing about pixels.
The whole thing is written against three internal specs -; genome layout, world generation, and the life models -; and the README maps every spec section to the file that implements it. Where the specs were ambiguous, the code documents the interpretive call it made and keeps it tunable, which is the kind of bookkeeping past versions never had.
How It Works
The core is split into a handful of cooperating systems, run in a fixed order every tick so nothing reorders behind your back: commands, then time and climate, then the environment, then plants, then animals, then genetics bookkeeping, then events and census.
- Determinism -; a xoshiro256** RNG whose full state lives in the snapshot, so save→resume continues exactly where it left off.
- Genome -; packed bit-layouts (15 genes for plants, 46 for animals); mutation only flips bits that are safe to flip, so every result still decodes.
- World -; a structure-of-arrays grid built by a generator that lays down altitude, rivers, rain-shadow moisture, temperature, and soil.
- Planetary seam -; a pluggable climate model (static or scripted drift) that can, for example, ramp an ice age across the whole map.
- Census & graphs -; gene-pool histograms, food-web edges, mortality ledgers, all pulled on demand so they never slow the per-tick hot loop.
A Blazor web front-end is deliberately not built yet. Instead the engine exposes a clean snapshot/command/event contract so a UI can be bolted on later without the engine ever learning what a UI is.
Current Status
The engine runs and its acceptance tests are green -; this is a working simulation you drive from a console runner, not yet a clickable game.
- Determinism, predator-;prey co-existence, world-gen rain-shadow, and the climate seam all pass as acceptance tests.
- Headless runner loads a scenario JSON, runs N ticks, and emits CSV (plus optional ASCII frames) -; the demo shows Lotka-;Volterra-style oscillation over 4000 ticks.
- Next real step is wiring up the deferred
SimLife.WebBlazor front-end against the existing snapshot contract.