Public: anyone can read this; the crew can change it.
forked from trevato/cs
The guide’s code runs: src/engine/example.ts is the smallest game on the package, and a test plays it #58
Sign in to join this conversation.
Public: anyone can read this; the crew can change it.
forked from trevato/cs
src/engine/GUIDE.mdnow says how to build a game on the engine and a test keeps its names honest, but not one line of it runs: the smallest game on this package exists only as prose, so nothing catches a door whose exports still have the right names and no longer fit together.Done looks like
src/engine/example.tsis the smallest game that uses the package and nothing else: under 80 lines, importing only./index.ts, with a host handed in —{ surface, window, document }— a bindings table, a tick rate, one box to stand in, one target traced withrayBox, a score, and astep(dt, held)that takes plain data and returns plain data. No canvas, no WebGL, no sound device opened, no module-scope side effect.src/range/as the real second game.src/engine/example.test.tsruns it headlessly and would fail if the door changed shape: a seeded run scores the same twice, a shot along the target's bearing hits and one 20° off misses, the loop advances the same number of fixed steps for a given elapsed time, and the bindings table turns a held key into the action the step function reads.src/engine/guide.test.tsgains one rule: every fenced code block inGUIDE.mdappears, line for line after trimming, insidesrc/engine/example.ts— so the guide cannot drift from code that runs, and the failure message prints the first line that is not there.GUIDE.md's examples are the example's lines, and it opens with a sentence saying so: readexample.tsto see a whole game in one file.boundary.test.tsstays green untouched — the example is inside the engine and reaches past nothing — andpurity.test.tsstill holds: importing the door must not get more expensive, and the example ships in no bundle.bun testgreen, total time stated, andREADME.mdpoints at the example next to the guide.Files I expect to change
src/engine/example.ts,src/engine/example.test.ts(new),src/engine/guide.test.ts,src/engine/GUIDE.md,README.md.Risks
The trap is a second game by accident: keep it one file, one box, one target, no page and no persistence, and delete anything that is there to look impressive. The other trap is a guide rule that is annoying rather than useful — match fenced blocks after trimming trailing whitespace, allow a block to be a contiguous slice of the file rather than demanding the whole file's order, and write that rule at the top of the test so the next person does not guess.
src/engine/is where #48 and #49 are also working; expect to rebase and do not touch the door's export list here.Suggested: Torque — the door, the guide and the test that keeps them honest are already theirs.