Case study 20 / 26
Emberline
A 2D game engine where time is a data structure: fixed-step deterministic simulation, hold-to-rewind, replays and save files that are verifiable input logs.
- Status
- Research
- Period
- 2026
- Domain
- web · experiments
- Language
- TypeScript
- Last push
- 05 SEP 2026
- License
- MIT
- Source of claims
- README.md, ARCHITECTURE.md
Emberline records every input frame of a deterministic, fixed-step simulation — which gives rewind, replays, tamper-evident saves and, in the demo, a bot that completes a level by searching the future and rewinding. TypeScript with zero runtime dependencies; runs in the browser and headless in Node.
01/The problem
In most engines, time travel, replays and deterministic saves are things you build yourself — and you discover too late that randomness and wall-clock time are scattered through your systems.
02/The system
Emberline records every input frame of a deterministic, fixed-step simulation — which gives rewind, replays, tamper-evident saves and, in the demo, a bot that completes a level by searching the future and rewinding. TypeScript with zero runtime dependencies; runs in the browser and headless in Node.
03/Implementation
- 01An ECS with JSON-only components, deterministic query order and deep snapshot/restore.
- 02A timeline at the core: fixed-hz steps, keyframes, rewind, seek, hashing and serialisation, with an accumulator loop and render interpolation.
- 03AABB physics, scenes, a Canvas2D renderer with camera and DPR-aware backing store, an asset packer that reads PNG headers, and Web Audio triggered from tick events.
- 04Saves are a keyframe plus the input log; loading replays them and rejects a file whose replay diverges.
- 05A debug overlay and an entity inspector.
04/Engineering
Determinism is enforced, not hoped for
A lint fails the build if engine code touches Math.random, Date.now, performance.now or the DOM outside the backends that own them.
The engine can search
Because stepping and rewinding are cheap and exact, the headless bot completes the level by depth-first search over inputs — the same code path players use.
05/Interface
No product screenshots are published for this project. The visual above is a code-driven representation of how it behaves, built from the repository source — not a screenshot.
06/Tech stack
- TypeScript
- Zero runtime dependencies
- ECS
- Canvas2D
- Web Audio
- Node test runner
07/Result
Verified outcomes
- 17 tests: identical hashes for identical inputs, exact rewind, save/load round trip and tamper rejection; CI runs the headless demo end to end.
Known limitations
- Canvas2D only; AABB physics without dynamic-vs-dynamic response; cross-browser bit-exactness not yet verified in CI.
08/Links
Next case study
SLM →