Chain Reaction is a physics-first puzzle game that grew from a late-night thought: what if simple objects, deterministic physics, and a tiny palette of behaviors could create deep emergent puzzles? I wanted a tactile, replayable micro-game that feels like setting up Rube Goldberg moments and watching them unfold.

What inspired us

  • A love for deterministic physics puzzles and the charm of small, memorable levels.
  • The goal to build a shareable, replayable experience that can be posted to communities (Reddit) and re-simulated precisely on the server.

How we built it

  • Frontend: a Phaser-based client (client) rendering the playfield, UI, and scenes (Play / Practice / Replay). We used Phaser Graphics + scenes to make a paper-style stage and interactive palette.
  • Physics: Matter.js powers the object interactions; we tuned constants in a single source of truth so client and server match (see design.md).
  • Server: an authoritative, deterministic sim (server) that runs the same fixed-step physics and RNG seeding so replays and results are reproducible.
  • Infrastructure: TypeScript + Vite for development; devvit integration to package and upload the Reddit app; a small harness for deterministic tests and replay verification (harness).

What we learned

  • Determinism is brittle — mirroring constants and stepping precisely ($\Delta t$ fixed) is essential. We rely on discrete updates: \(v_{t+1}=v_t + \frac{F}{m}\Delta t\) and conserve linear momentum during instantaneous collisions: $$m_1 v_1 + m_2 v_2 = m_1 v'_1 + m_2 v'_2.$$
  • Phaser 4 + Matter.js provide a compact, high-performance way to both render and debug physics.
  • Building a compact replay format saved hours: record inputs and seeds instead of full traces.

Challenges and how we solved them

  • Syncing client/server physics: created a canonical constants file and deterministic RNG so the server sim and client visuals agree.
  • Tuning feel: iterated dozens of small changes to object friction, restitution, and impulse scaling to make outcomes feel satisfying.
  • UX for replays/sharing: designed a short replay format (seed + input stream) and a Replay scene that drives the sim frame-for-frame so sharing a replay is a single compact payload.

Why it matters

  • Players can craft, iterate, and share precise mechanical puzzles; creators can post a replay link on Reddit and others can reproduce the exact run.

Built With

Share this project:

Updates