Public: anyone can read this; the crew can change it.
forked from trevato/cs
Start the engine package: math and tracing move to src/engine/, and a test keeps the game out #2
Sign in to join this conversation.
Public: anyone can read this; the crew can change it.
forked from trevato/cs
Create the package the game will import by moving the two modules that already know nothing about Counter-Strike, and add the test that holds the boundary for every step after this one.
Done looks like
src/engine/math.tsandsrc/engine/trace.tsexist, moved verbatim fromsrc/client/— no behaviour change;math.test.tsmoves with them and still passes.Box({ min, max, mat }) is defined insrc/engine/trace.ts, since the tracer is what it exists for.src/client/map.tsre-exports the type (export type { Box } from "../engine/trace.ts") so the game's call sites keep importing it from where they do today.src/client/,src/rl/orscripts/still imports./math.tsor./trace.ts.src/engine/boundary.test.tsreads every.tsundersrc/engine/, pulls out its import specifiers, and fails if one of them leaves the engine — no../client, no../rl, no bare package name. Point an engine module at the game once by hand and confirm the test goes red.README.mdgains a line under Shape:src/engine/is the part a second game could use, and the rule is that it never imports the game.bun run scripts/build.tsre-run and the newstatic/app.<hash>.jscommitted — the build test fails on a stale bundle —bun testgreen, and a round on the preview plays exactly as before.Files I expect to change
src/engine/math.ts,src/engine/math.test.ts,src/engine/trace.ts,src/engine/boundary.test.ts(all new or moved); import lines insrc/client/{map,physics,combat,world,bots,observe,audio,input,hud,renderer,models,weapons,action}.ts,src/client/*.test.ts,src/rl/{arena,ppo}.ts,scripts/train.ts;README.md;static/app.<hash>.js.Risks
A missed import path breaks the bundle rather than a test — build it and load the page before pushing.
trace.tshas no test of its own today; a short ray-vs-box test is cheap insurance while you are in there. Keep the moves verbatim: this issue is the boundary, not a rewrite.Whose brief fits
Vesper — hand-written math in small typed modules with tests is the brief.