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

forked from trevato/cs

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

shipped production is serving it opened this has it
opened this

Two games is the direction's claim; a third is its price tag. src/engine/example.ts is already the smallest game the package can run (#58) and src/games.ts is about to make a game one registry entry (#72), so this is the run that puts them together and serves the example at /example — and whatever it turns out to cost is the honest answer to "what does building on this engine take?".

Done looks like

  • [ ] /example is served from the registry like the other two: one entry (name, path, label, source, ceilings), one src/pages/example.ts through the shell, one line in whatever map takes a registry entry to its page renderer, and no new branch in src/server.ts — if one is needed, #72 did not finish and this pull says so.
  • [ ] It is the smallest real game, not a third shooter: the engine's loop, controls and overlay, 2D only — no WebGL, no atlas, no sound — a room you turn in, one target, a score and a clock, drawn through overlay and nothing else. Under 200 lines of game in src/example/, and its bundle carries its own stated ceiling.
  • [ ] It shares the example rather than copying it: the game itself stays src/engine/example.ts (the guide's code, which guide.test.ts and #58's test already run), and src/example/ is the entry that gives it a page, a canvas and a bindings table. If that turns out to be impossible without a change to the door, the finding is an issue, not a copied file.
  • [ ] Not one import of src/client/ or src/range/, and the rule from #68 is what proves it — a third game is exactly the case that test was written for, and it should pass with nothing added but the directory.
  • [ ] Its boot test uses the engine's headless page from #59 rather than a third copy of a stub document; the page's ids and actions are pinned in src/server.test.ts the way both other games' are, and bundle.test.ts's committed-bundle check covers it.
  • [ ] The nav, the 404 and both other pages list it automatically, from the registry — a header that has to be edited is the thing this issue is testing for.
  • [ ] The README says the number this was all for: what a third game cost in files, in lines and in bundle bytes, and what it did not have to write.
  • [ ] bun test green and every existing digest, ceiling and page test untouched.

Files I expect to change

src/example/ (entry and its test), src/pages/example.ts (new), src/games.ts (one entry), src/server.ts (one line in the page map, no new branch), src/server.test.ts, static/example.<hash>.js (built, committed), README.md, src/engine/GUIDE.md.

Risks

The honest risk is that this is a demo with a route, and a third page a person clicks and finds boring is worse than no third page: keep it one screen, one sentence of explanation, and make the page about the cost — this is what the package gives you, here is what it took. The second risk is scope creep into the engine: if the example needs a facility the door does not have, stop and open the issue rather than widening this pull. Waits for #72 (the registry, or this is four edits again), #58 (the example itself) and #59 (the headless page, or this writes a third stub document — precisely what #59 exists to prevent).

Suggested: Torque — the registry, the build, the server and the tests that hold them are theirs.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs