Context
Evolution is easy to describe and hard to watch. Living Islands is a sandbox for watching it happen: you shape an environment, then follow asexual populations as heritable variation and differential reproduction change them over generations.
Its defining feature is the fork. Pause the world at any moment, split it into a control branch and a treatment branch, change one thing in the treatment (a drought, a new predator, a hotter climate) and run both side by side. That turns "what if" into a controlled experiment.
It is a simplified model meant to make selection visible, not to predict real populations; an in-app guide explains the model and its limits.
What I built
Built it end to end, from the simulation model to the renderer, the analytics, the save format, and the tests.
- A headless engine in which organisms with six heritable traits forage, hunt, flee, scavenge, age and reproduce with mutation, on seasonal temperature and fertility grids.
- A PixiJS world view where any organism can be selected and inspected, down to its dead ancestors, and a world editor that paints environment layers with deterministic undo.
- Forking with synchronized playback and a comparison view that pairs both branches tick by tick on shared axes, plus analytics with CSV export.
- Four curated scenarios, a guided walkthrough, an in-app guide to the model, and colour-blind-safe lineage markers.
Scope
- Tested in Chromium and Firefox. Safari is untested.
- A five-seed review of the curated scenarios found two that don't behave as their descriptions suggest: Drought Ramp collapses harder than intended, and Two Valleys doesn't reliably split into separate lineages within 30 seasons. Both are documented for a later tuning pass.
Decisions and trade-offs
- One serializable xoshiro128** generator passed into every system, a fixed system order, and stable ID-order iterationover Math.random() and a wall-clock time stepA fork is only a fair experiment if both branches are bit-identical at the moment they split, and saves only replay if a seed and a config fully determine the run. Math.random() is banned in the engine by a lint rule, the engine never reads the clock, and golden state hashes catch any change that breaks this.cost · An optimisation that reorders iteration or floating-point operations can silently break determinism, so changing system order counts as a model change with a version bump. Bit-identical results are promised within the pinned test runtime, not across every browser.
- A framework-free engine in a Web Worker as the only owner of organism stateover keeping the population in React state or letting the renderer write to itThe UI can never drift from the simulation, and ticking stays off the main thread. The engine's tsconfig has no DOM library, so the boundary is enforced by the type checker, not by convention.cost · Every new capability needs a typed message in the UI-to-worker protocol before the interface can use it.
- Half the organism budget per branch when a world is forkedover letting each fork branch run at the full single-world sizeTwo branches run in two workers and draw on two canvases. Capping each at 1,000 organisms keeps a fork inside the same total compute envelope as one 2,000-organism world, which is the budget the performance tests already hold.cost · A forked comparison runs smaller populations than a single world can.
- Plain TypeScript for the engineover starting with a Rust/WASM coreProfile first. The engine's tick benchmarks clear the throughput target at both 1,000 and 2,000 organisms, so a rewrite would have added a toolchain and a language boundary without solving a measured problem.cost · Performance work goes into allocation-free hot paths and a spatial hash in TypeScript instead. A WASM engine can still slot in later behind the same worker protocol without UI changes.
Results
| Quantity | min | typ | max | Unit |
|---|---|---|---|---|
| p95 frame time, 2,000 organisms (Chromium) | – | 16.7 | – | ms |
| p95 frame time, 2,000 organisms (Firefox) | – | 17.1 | – | ms |
| headless engine throughput, 2,000 organisms | 289,000 | – | 595,000 | ticks/min |
| production bundle, gzipped | – | 273 | – | kB |
The budget was a p95 frame time under 20 ms with 2,000 organisms on screen. Both browsers clear it at their 60 fps frame cap, so the figures above are the cap, not headroom. The engine target was 8,000 ticks a minute; the range above covers five benchmark runs of one 2,000-tick season each.
- Forked branches start bit-identical and run together, so the changed condition is the only difference at the split
- Default model constants chosen by a 100-seed sweep over three candidate parameter sets, not by guesswork
- Versioned binary saves with rotating autosaves; corrupt, oversized or unknown-version imports fail without touching the running world
- 354 unit and integration tests at 96.5% statement coverage, plus 46 end-to-end tests in Chromium and Firefox, including an automated WCAG 2.1 AA scan and a keyboard-only walkthrough
- Ships as a fully static build with no backend, and a test confirms a session makes zero cross-origin requests
