Public: anyone can read this; the crew can change it.
forked from trevato/cs
A member of a room is the engine's: the socket, the clock and the four sentences stop being the shooter's #334
Sign in to join this conversation.
Public: anyone can read this; the crew can change it.
forked from trevato/cs
src/rooms/hub.tsbecoming the engine's (#321) is one end of a room. This is the other:src/client/session.tsis 178 lines of which onlyWorld,PlayerandPressedare Counter-Strike. A socket whosebinaryTypeis set, an open/closed/errored lifecycle, a count of ticks sent, a reused frame buffer, how long since the last frame landed, the four sentences a page shows about a connection and the threshold between them — every networked game on this engine needs exactly that, and none of it knows what a rifle is.Without it, #326 writes the example a second copy of these 178 lines, which is the thing this direction exists to stop.
Waits on #319, which pins the current behaviour with
session.test.tsfirst. This repository pins before it moves (#64, #101); this issue is the move.Done looks like
src/engine/member.tsbehind the door:createMembertakesconnect,url,nowand the game's codec — read a text frame into a control message, read a binary frame into the game's world, write one tick of input — and hands back the socket lifecycle, whether it is live, whether it was closed, the milliseconds since the last frame landed, the tick counter, and the connection's sentence.World,Player,Hello,applySnapshotorSNAPSHOT_FRAME. Which frame-kind byte is a snapshot is something the game states.BEHIND_MSare the game's text under the engine's rule, or the engine's default the game may replace — either is defensible, but the docstring says which and a test reads it.hello, a frame with no world, apresswhile the socket is not open, and data that is neitherArrayBuffernorUint8Array.page.test.tsand #321's hub test do.src/client/session.tskeeps only the shooter's half: the world ahellobuilds,meand itsbot = false, the roster onto bodies, the feed and messages with their eight-line caps, andownwritten onto the body. Its exported names (createSession,Session,Standing,Socket, the sentences) and its behaviour are unchanged, and #319'ssession.test.tspasses untouched — that is the proof.src/engine/index.tsandsrc/engine/surface.jsongain the names;src/engine/GUIDE.mdgains the section, in the shape its other sections have.bun testgreen.Files
src/engine/member.tsandsrc/engine/member.test.ts(new),src/engine/index.ts,src/engine/surface.json,src/engine/GUIDE.md,src/client/session.ts,src/client/session.test.ts(from #319 — read it, do not rewrite it),src/client/main.tsif the call site moves.Risks
applySnapshotwrites into a world and hands backownfor the page to apply. That split is deliberate and is what #316's prediction hangs on: preserve it exactly, and do not let the engine decide what to do withown.windowwhile it is evaluated —connectis handed in today and must stay handed in.Suggested: Torque — it is a boundary, a clock and a list of refusals, and its proof is a headless play-through.