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

forked from trevato/cs

The bytes a frame is made of are the engine's: a bounds-checked cursor and a packed angle behind the door #343

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

The byte half of `src/rooms/wire.ts` is now `src/engine/frame.ts` and goes out through the door: `Cursor`, `packAngle`, `unpackAngle`, `unpackSigned` and `finite`, with not a weapon, a seat or a tick in the module. The wire imports them, defines none of its own, and its local `clamp` is the engine's from `math.ts`. `Cursor` stays a class — one mutable position walked by two dozen calls a frame — a…

shipped production is serving it deploy ae07c2d

opened this

The byte half of src/rooms/wire.ts is now src/engine/frame.ts and goes out through the door: Cursor, packAngle, unpackAngle, unpackSigned and finite, with not a weapon, a seat or a tick in the module. The wire imports them, defines none of its own, and its local clamp is the engine's from math.ts. Cursor stays a class — one mutable position walked by two dozen calls a frame — and the docstring says why rather than leaving it to a reader.

The move is proved by bytes that did not change: src/rooms/rooms.test.ts pinned one input frame (0192100000097f811cbfab1a0f01) and one whole snapshot of a fixed-seed room in hex in the commit before the move, and the same literals pass after it; INPUT_BYTES is still 14 and PLAYER_BYTES still 44. src/engine/frame.test.ts holds the cursor to what it does today as numbers, not round trips — has(1) refused at the end of the buffer, f32(NaN) and f32(Infinity) written as zero, u16(-1) masking to ffff and i8(999) clamping to 127, an angle back inside 0.0056° in all four quadrants, and a read past the end throwing a RangeError rather than answering a quiet zero, which the docstring states in words because it is the one behaviour that is not a returned value.

Surface moved 0.3.0 → 0.4.0 (five names arrived, none left) and GUIDE.md gained the frame section between effects and renderer. Two numbers worth looking at: the shooter's bundle got 60 bytes smaller raw (117567 → 117507; gzip 45659 → 45649) and no ceiling moved; the guide's whole-door line, which was written at 36.1 kB, is re-measured at 39.7 kB raw / 15.9 kB gzipped — 1.0 kB of that is the new group and the rest was drift already on the page inside the cost test's tolerance. DataView, RangeError and Uint8Array join NOT_THE_ENGINES in guide.test.ts, which is the list that file exists to be extended with. bun run test: 1308 pass, 0 fail.

🤖 Generated with Claude Code

Closes #325

commented

The byte half of src/rooms/wire.ts is now src/engine/frame.ts and goes out through the door: Cursor, packAngle, unpackAngle, unpackSigned and finite, with not a weapon, a seat or a tick in the module. The wire imports them, defines none of its own, and its local clamp is the engine's from math.ts. Cursor stays a class — one mutable position walked by two dozen calls a frame — and the docstring says why rather than leaving it to a reader.

The move is proved by bytes that did not change: one input frame (0192100000097f811cbfab1a0f01) and one whole snapshot of a fixed-seed room were recorded in hex in the commit before the move, and the same literals pass after it; INPUT_BYTES is still 14 and PLAYER_BYTES still 44. Main split rooms.test.ts into a test file per module while this was open, so that pinned test now lives in src/rooms/wire.test.ts beside the codec it pins, on the same room() fixture from stage.test-helper.ts — the literals came through the merge untouched, which is the merge's own evidence. src/engine/frame.test.ts holds the cursor to what it does today as numbers rather than round trips: has(1) refused at the end of the buffer, f32(NaN) and f32(Infinity) written as zero, u16(-1) masking to ffff and i8(999) clamping to 127, an angle back inside 0.0056° in all four quadrants, and a read past the end throwing a RangeError rather than answering a quiet zero, stated in words because it is the one behaviour that is not a returned value.

Surface 0.6.0 → 0.7.0 (five names arrived, none left; main's pixels had taken it to 0.6.0), and GUIDE.md gained the frame section between effects and renderer. Numbers worth a look: the shooter's bundle got 60 bytes smaller raw when this landed and no ceiling moved, and the guide's whole-door line is re-measured with both new groups in it at 42.1 kB raw / 16.9 kB gzipped — 1.0 kB of that is frame, the rest main's. DataView, RangeError and Uint8Array join NOT_THE_ENGINES in guide.test.ts, keeping main's auxclick beside them. bun run test: 1358 pass, 0 fail.

🤖 Generated with Claude Code

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs