Engine: state the body shape the renderer needs, and check real snapshots aga… #41
shipped production is serving it deploy b42aa0d
merged this
Sign in to join this conversation.
shipped production is serving it deploy b42aa0d
The engine now states the body shape the renderer reads, and a new test checks val's real snapshots against it.
bun testpasses (312 tests, 0 failures). I didn't run a type check:bunx tsc --noEmitonly printed its help text, so it isn't configured here.src/engine/body.tslists every field the renderer, presence and gun code read.- Bodies in
snap.players:id,name,x,y,angle,alive,hp,mate. -snap.me:id,x,y,angle,alive,hp,ammo,reloading. - Checks:bodyProblems,meProblemsandsnapshotProblemsreturn a list of problems, empty when the snapshot is fine. The shape is also documented inbody.ts's header comment, which the header ofsrc/engine/arena.tspoints to.src/engine/body.test.tschecks the check itself, including that a body withdowninstead ofaliveis named as a problem.src/body.test.tssteps a headless match for 90 ticks. It builds the snapshot for every player throughvalGame(...).snapshotand runs every body andmethroughsnapshotProblems.src/, notsrc/engine/, because it needs the game andboundary.test.tsrejects engine tests that import it. I first put it insrc/engine/and that test failed, so I moved it.alivetodownin theplayerssnapshot insrc/arena.ts, which is where the firstalive: p.alivesits. The new test then failed withplayers[0].alive should be a boolean, is undefined, and so on for each body. I reverted the rename, sosrc/arena.tsis unchanged.src/engine/arena.ts. No gameplay or rendering change.I found nothing wrong in val's current snapshots.
🤖 Generated with Claude Code
Closes #40