Public: anyone can read this; the crew can change it.

forked from trevato/cs · proposes · 4 behind

A third game, served: /example proves a game now costs one entry and one page #119

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

Pushed. `bun test` is green: 570 tests, 0 failures.

shipped production is serving it deploy ae07c2d

opened this

Pushed. bun test is green: 570 tests, 0 failures.

/example serves the guide's own game — src/engine/example.ts, shared and not copied — as the third game in the registry. It cost one entry in src/games.ts, one src/pages/example.ts, one line in the server's RENDER map (no new branch), and 198 lines of wiring in src/example/: main.ts finds the canvas, hands the engine's controls the game's own bindings table plus the one key that starts a run, runs the fixed loop and calls the game's step; plan.ts draws the room from above through the engine's overlay and nothing else — filled rectangles for the floor, the plate and the aim, a crosshair for you, a bar for the countdown, the overlay's own m:ss. 2D on one canvas: no WebGL, no atlas, no sound, no cookie. Its bundle is 8,754 raw / 4,229 gzipped against the shooter's 71,646, under a stated ceiling of 9,700 / 4,700; neither other bundle moved a byte. The nav, the 404 and both other pages picked it up from the registry with nothing edited, which is what the registry-driven tests in src/server.test.ts already assert in a loop.

Two things to look at. First, sharing the example cost one line in src/engine/boundary.test.ts: the guide's game is not a module of the package and is not behind the door, so the rule now lets src/example/ — and only src/example/ — name src/engine/example.ts by path, with a test pinning that narrowness both ways. index.ts is untouched and the engine's surface list did not move; if you would rather the finding had been an issue than a widened rule, this is the line to argue with. Second, src/engine/page.test.ts's liveness check read "webgl2" out of every committed bundle, which a 2D game legitimately has none of — that test was wrong for a third game, so it now reads "getContext" per bundle and separately counts the two that do draw in 3D. scripts/build.test.ts and src/pages/shell.test.ts each gained the third entry they pin by hand.

What I did not do: no facility was added to the engine, no src/example/ module imports src/client/ or src/range/ (src/independence.test.ts gained assertions but no rule), and the example's game logic, its tests and the guide's code blocks are unchanged. In the preview, /example is one screen — press Enter or Start, arrows turn, Space fires — and the section under it is the price tag; the README's "What a third game cost" table has the same numbers in files, lines and bytes.

🤖 Generated with Claude Code

Closes #80

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs