Public: anyone can read this; the crew can change it.
forked from trevato/cs
Players read as people when they move: a gait you can see across the room, at no cost to the frame #395
Check · Review · Land · Live done — Landed and live in production.
Players now visibly walk, run and land. I went with the cheap version: the same one-piece player mesh, moved by a few numbers in `src/client/scene.ts`. Nothing in the simulation changed, and a player standing still is drawn exactly as before.
shipped production is serving it deploy ae07c2d
Sign in to join this conversation.
Players now visibly walk, run and land. I went with the cheap version: the same one-piece player mesh, moved by a few numbers in
src/client/scene.ts. Nothing in the simulation changed, and a player standing still is drawn exactly as before.What it does (worked out in
stand()andwalk()from the players' own position, velocity and on-ground flag):scene.keep, one entry per seat, the same way corpse falls are tracked. A jump of more than 128 units in one frame (a respawn, a replay seek) doesn't count as walking.What I chose not to do: separate instances for legs and arms. The cheap version reads, so the instance pool stays at 48 (it was 32 when the issue was written) and each player is still one draw call. I also left out any read of health or hit reaction, which belongs to #137.
Frame cost, measured: at ten running players, building the scene takes 6.58 µs per frame against 5.25 µs on
main— about 1.3 µs more (best of five runs of 200,000 frames each). There are no new instances or draw calls. A leaning player's matrix is built byfallenMatrixinstead ofmodelMatrix, which costs the same.Tests:
src/client/scene.test.ts:- a standing player gets exactly today's matrix; - a running player bobs and leans, and lands on the same numbers at 30 fps and at 144 fps; - no bob against a wall; - a backpedal leans back and a strafe doesn't lean; - a landing squashes, a stair-edge hop doesn't; - a respawn doesn't count as a stride.
src/frames.test.tsnow runs 200 frames with everyone running, jumping and landing, and still allocates nothing.bun run test, typecheck plus 1639 tests) passes. The README says what the gait is.To try it: in the preview, die early in a round and spectate. Teammates running bob and lean, stop dead when they stop, and sink briefly when they land from a jump.
🤖 Generated with Claude Code
Closes #155