Overview
This section is a set of complete programs. Each page shows every file the build it describes consists of, whole, so the engine’s surface can be judged from working code. Every file compiles against the types the APIs section declares.
Each build has the same shape. index.html is the page the build is served as,
src/main.ts creates the engine and boots it, src/game.ts exports the
Game<S, D> the engine drives, assets/ holds the files the game loads, and
tests/ holds the build’s own vitest suites; a case’s validators are staged
beside src/ at validation/, as
Validating a Game shows. A
build declares three beside the engine in its own package.json, and a game
imports it directly wherever it needs a three object.
index.htmlsrc/main.tssrc/game.tsassets/tests/validation/The boot sequence is the same on every page as well: construct the engine, subscribe to anything the caller wants to observe, initialize, and run.
const engine = createEngine({ canvas, width, height, game });await engine.initialize();await engine.run();| Page | Shows |
|---|---|
| A Minimal Game | The smallest complete build: a page, a boot module, and a game that moves a mesh by the frame’s delta and draws a readout on the screen layer. |
| Input and Actions | Registering a dual-stick layout’s vocabulary, driving a mesh and the camera from held analog actions, reading a digital edge, and driving the same code from a key and from a test. |
| Audio and Assets | Loading a model and a produced audio file during initialization, placing the model’s clone in the scene, playing a synthesized cue and a positioned file-backed cue, and surfacing a failed load. |
| Diagnostics and Overlay | Registering overlay sources during initialization and reading them back while the game runs. |
| Validating a Game | A vitest suite that imports the build’s own game, steps it in the page under vitest’s browser mode with engine.advance, and checks the scene, the projection, and the screen layer’s draw calls. |
| Scripted Clocks | One scenario stepped under a constant, a repeating sequence, and a seeded jitter clock. |