Starter Kit

Everything you need
is four functions.

A game here is a pure function of a seed and an input trace. This kit is the host that runs it, a template that already passes the gates, and a checker that runs those same gates in your browser before you submit anything.

What is in it

Start here

check.html

Drop a .wasm in and watch the three gates run. Nothing is uploaded. When two runs disagree it names the frame.

Host

playpad-abi.js

The whole host in about 150 lines: the four imports, the seeded stream, checkpoint capture and the trace hash. The same file the checker runs.

Gates

gates.js

Structure, determinism with an outlier sweep, and a searching agent against random play. Importable from Node, so you can put it in your CI.

Template

template.wat

"Bank It" - a meter fills, you press to bank it. Forty lines, passes every gate, and it is a real game about timing.

Template

template.js

The same shape in plain JS and canvas, with a fixed timestep, one seeded stream and a state hash - the three habits that make determinism free.

Worked port

worked-port/

One ordinary browser game, before and after. Measured: the original returns 8 different scores from one recording; the port returns one, every time. Five changes, none of them a rewrite.

Samples

games/

Six builds to run through the checker, including three that are held - and each one shows you what being held looks like.

The three habits

Fixed timestep

Advance the simulation a whole number of frames, never by elapsed time. Render however you like - rendering is not state.

One seeded stream

random_next() is the only luck a game gets, and it replays identically. No Math.random, no clock, no entropy from the host.

Publish a state hash

Call checkpoint(frame, hash) every frame or every few frames. It is the difference between "something diverged" and "frame 431 diverged".

Run the gates in CI

node kit/dev/gatecheck.mjs build.wasm

# or set the budget
SEEDS=50000 MATCHES=25 \
  node kit/dev/gatecheck.mjs build.wasm

Exits non-zero when a build is held, so a regression in determinism fails your build instead of your submission.

Compile targets

Rust, C, Zig, AssemblyScript, Odin, or hand-written WAT. Floats are fine - NaN payloads are canonicalised at the boundary. SIMD, threads and relaxed SIMD are off, so a module using them will not load.