Motocross
A 2D physics dirt-bike — with a built-in level editor.
- Controls
- Status
- Difficulty
- Session
- Stack
- Zero-Shot Engine on Three.js (WebGL2)
- Generations
- 2
- Bundle
- play/motocross/index.html
About the machine
A 2D physics dirt-bike game with a built-in level editor. Reach the checkered finish from the start without the rider hitting the dirt; best time is kept per track. The editor builds terrain as a smooth spline through control points, places start/finish flags, and saves, exports and imports tracks as JSON — three demo tracks ship built in (Rolling Hills, Whoops, Big Air).
Generations
Generations
PromptPromptmotocross single player with level editor
What changed
The original zero-shot build. A custom rigid-body simulation: a chassis with two wheels doing spin-based traction (friction opposes the slip between tyre surface speed and ground), wheelies from a rider weight-shift model, free rigid-body air rotation under lean torque, suspension that absorbs landings, and crash rules. Heightfield terrain sub-stepped at 1/240s so fast wheels cannot tunnel on steep faces.
The Audio department synthesized a continuous throttle-tracking engine plus landing/crash/finish sounds procedurally via Web Audio. QA'd against headless physics tests (settles at rest, accelerates and rolls, pops wheelies, flips in the air, all demo tracks completable) plus editor round-trip checks.
PromptPromptfirst iteration, all games as they stand must be ported to threejs
What changed
The same game, ported to Three.js on the Zero-Shot Engine (v0.3.0). Gameplay is unchanged: the bike physics is generation 1's own code, line for line, with the same constants and integration order, and no physics engine swapped in. Tests run the original generation-1 script next to the port and match it bit for bit. The level editor, the three demo tracks, the JSON track format, and the Save, Export and Import buttons are all as before. Tracks you saved, files you exported and your best times carry over unchanged.
Under the hood: generation 1 stepped its physics once per screen refresh, so its sub-step and its results shifted slightly with the monitor's refresh rate; on the Whoops track, a full-throttle run even crashed at some refresh rates and finished at others. Generation 2 runs the same loop at a fixed 1/60 s, always four 1/240 s sub-steps, so a run plays out the same on every machine: best times no longer depend on the display's refresh rate. Best times set in generation 1 are kept exactly as stored. Three.js draws the scene with its WebGPURenderer on the WebGL2 backend, through an orthographic side camera at generation 1's exact scale. The bike is drawn between physics steps, so motion stays smooth on fast displays. The top bar, hint and toasts are the original page, and the procedural engine, landing, crash and finish sounds play through the engine's audio system. WebGPU is built in and opt-in (?backend=webgpu).
New and visual only: on capable machines the quality tier adds parallax hills, rear-wheel roost, landing and crash dust, flying dirt clods and a moonlit sky. A test proves every tier rides exactly the same. One static folder, one classic script (about 270 KB gzipped), no network requests; it still opens from disk.