Marbleworks
A marble racing management sim whose pure-Lua simulation core produces byte-identical results everywhere — inside the LÖVE client and inside a headless server that has never heard of LÖVE.
Screenshots
About
Marbleworks is a marble racing management sim: you run a squad of marbles through seasons of racing, with an economy, AI-managed rival teams, promotion and relegation. You don’t drive the marbles — the drama comes from watching deterministic physics play out and making the management calls between races.
The architecture is the interesting part. The race simulation (marblesim) and the season/economy layer (marblemeta) are pure Lua with one hard rule: they must produce byte-identical results on every platform, whether they’re running inside the LÖVE client or inside a headless server process. That’s what makes fair online leagues possible — every client and the server replay the exact same race from the same seed.
How Determinism Is Enforced
- Q16.16 fixed-point everywhere — no floats in simulation state;
1.0is the integer65536, and all math goes through a fixed-point library - Banned by lint:
love.*, unseededmath.random, wall-clock time, platform-dependentmath.sqrt/sin/cos, raw arithmetic on sim state,pairs()over state, unstabletable.sort— a test suite scans the sim directories and fails on violations - Seeded PCG32 for all randomness, tick counts instead of clocks, dense arrays instead of hash iteration
Technical Details
- Client: LÖVE 2D (all rendering and input lives in
client/, delegated from thin entry points) - Server: the league as a bare-LuaJIT process — routes, store, socket layer
- Protocol: JSON codec with schema over HTTP, shared pure-Lua wire code
- Tracks: a low-level track DSL with a higher-level kit on top
- Testing: self-contained spec runner, no luarocks dependency by design