● S2 WebGPU wasm32

Asteroids

A ship that turns, thrusts and wraps; rocks that split twice; waves that grow — the same apps/asteroids that builds a native binary, running here.

asteroids — crcbl
Starting…
Click the canvas first. A canvas has to hold keyboard focus to receive keys, and browsers will not start audio until you have interacted with the page. Clicking away pauses the game and lets go of whatever key was held — no platform sends the release for a key that was down when focus left.
Touch reaches the engine. A contact arrives as an ordinary pointer, and the first one is also the gesture a browser waits for before it will start audio. Whether this demo can be played with one is in its controls below — not all of them can. Switching tabs pauses the game and lets go of whatever was held: no platform sends the release for an input that was down when focus left.

controls

Four keys, plus the three the loop keeps.

why a third game

To find out what happens when entities never stop dying.

Breakout spawns its world once. Flappy runs a treadmill at a couple of entities a second. This one fires a bullet every sixth of a second, turns one rock into two, and deals a whole wave at a time — so generational ids, deferred destruction and pool slot recycling all get hammered, and a leak shows up as a number that climbs. A test asserts the entity and collider accounting on every tick of an eighteen-thousand-tick soak.

It is also the first consumer of the second physics slice: thrust and damping through the force pipeline, bullets through segment CCD, and ship-versus-rock through a broadphase sphere overlap — with the screen wrap as the thing that had to decide what a teleport means to a BVH.

what is actually running

The native sample, with four differences the browser forces.

Start-up is polled across several frames, because requestDevice is a promise and the main thread cannot block on it. The frame loop is driven by requestAnimationFrame out here rather than by a loop inside the engine. The clock is the browser's, because wasm32-unknown-unknown has no Instant. And the best score lives in the Origin Private File System instead of ~/.config.

Everything else — the ECS, the fixed-tick server, the physics, the render graph, the spatial audio — is the same code the native build runs. This is also the first demo where a drawn thing turns: every angle is integrated once per tick and interpolated the short way round across the frame, so the ship and the rocks are smooth at whatever rate your display happens to run.

Open the console for the engine's log. The wasm module imports nothing, not even console.log, so log lines are queued inside wasm and drained by the page each frame. crcbl.audio(), crcbl.saves() and crcbl.logLevel(4) are there too.