● S1
WebGPU
wasm32
Breakout
The first playable Crucible sample — the same
apps/breakout that builds a native binary, running here.
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.
controls
Two keys and a bar.
- Move the paddle ← →
- Launch the ball Space
- Restart after a win or loss Space
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 high score lives in the Origin Private File
System instead of ~/.config.
Everything else — the ECS, the fixed-tick server, the swept-sphere collision, the render graph, the spatial audio — is the same code the native build runs.
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.