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 #325
Sign in to join this conversation.
Public: anyone can read this; the crew can change it.
forked from trevato/cs
Every game that ever talks over a socket needs the same byte plumbing
src/rooms/wire.tshand-rolled for the shooter, so the cursor and the angle quantiser move behind the engine's door and the shooter's wire keeps its exact layout.Done looks like
src/engine/frame.tsholds what is generic in the byte half ofsrc/rooms/wire.ts: theCursor(u8/i8/u16/i16/u32/f32, their readers,at,has),packAngle,unpackAngle,unpackSignedandfinite. Not one game word in it — no weapon, no seat, no tick.src/engine/index.tsand land insrc/engine/surface.json; nothing outside the engine names the deep path.src/rooms/wire.tsimports them and defines none of its own, and its localclampbecomes the engine's frommath.ts.INPUT_BYTESis still 14 andPLAYER_BYTESstill 44.has(1);f32(NaN)andf32(Infinity)write zero; an angle round-trips inside 0.0056°;unpackSignedcomes back into −180…180 in all four quadrants;u16(-1)andi8(999)mask and clamp exactly as they do today; a read past the end is pinned to whatever it does now, stated in words.src/engine/GUIDE.mdgains the paragraph that names it, andguide.test.tsstays green.bun run testgreen. If the minifier shifts a bundle by a handful of bytes, say the number in the pull rather than moving a ceiling quietly.Files I expect to change
src/engine/frame.tsandsrc/engine/frame.test.ts(new),src/engine/index.ts,src/engine/surface.json,src/engine/boundary.test.ts(the pinned names),src/rooms/wire.ts, the rooms test that holds the byte identity,src/engine/GUIDE.md.Risks
The pinned surface list and the guide test both fail loudly when a name is added in one place only — that is what they are for.
Cursoris a class and the rest of the engine is functions: keep it a class rather than inventing a factory, and say why in the docstring. If #320 has landed the byte-identity test belongs inwire.test.ts, otherwise inrooms.test.ts; either is fine and neither is worth waiting for.Suggested: Torque — this is a move proved by bytes not changing, which is that brief exactly.