Skip to content

five-on-it / packages/protocol/src

packages/protocol/src ​

The wire contract between the game server and its clients. Two kinds of frames travel over one Transport:

  • Binary (hand-written DataView codecs, little-endian): the 60 Hz client inputs and the 20 Hz server snapshot: whole (codec.ts), as ordered deltas (snapshot-v2.ts) or as deltas onto the frame the client acknowledged, over a transport that loses frames (snapshot-acked.ts), every kind read by one SnapshotReader (snapshot-reader.ts).
  • Text (JSON validated by zod): the one-off welcome message; the player's mission tracker and the notice lines (texts, phone messages, missions started and ended); the player's inventory (the container they have open, the cars they stored); the keys the room's cars answer to; each reset of the level; the player's wanted level (stars, Heat, whether the police see them, an arrest); the player's phone (contacts, messages, apps, calls, the conversation and the app screen open, the waypoint) and the client's phone commands; the player's stealth (whether a guard or a camera sees them, the room's alert); the rtc signalling that sets up a WebRTC data channel beside the WebSocket for the inputs and the snapshots (rtc.ts), and falls back from it; and while debug commands are on, the client's debug commands and the server's ai readouts. See messages.ts. The room's social frames: the client's room commands (say, quick-chat, emotes, a vote to kick) and the server's chat lines and roster. See social.ts.

Beside the wire, the platform API's lobby shapes and its standing's (Respect, the leaderboard, a run's Respect), shared by the API and the web client (lobby.ts, standing.ts): they never travel on a room's socket.

Only inputs ever travel client → server (the phone's commands are inputs too: what the player pressed, which the server checks); positions never do.

References ​

ACKED_REQUEST ​

Re-exports ACKED_REQUEST


AckedEncoder ​

Re-exports AckedEncoder


AiReadout ​

Re-exports AiReadout


atRest ​

Re-exports atRest


BuildManifest ​

Re-exports BuildManifest


CHAT_MAX ​

Re-exports CHAT_MAX


ChatLine ​

Re-exports ChatLine


CLIMATE_NAMES ​

Re-exports CLIMATE_NAMES


CLOSE_CODES ​

Re-exports CLOSE_CODES


CONDUCT_BANDS ​

Re-exports CONDUCT_BANDS


ConductBand ​

Re-exports ConductBand


CreateLobbyRequest ​

Re-exports CreateLobbyRequest


Re-exports createMemoryLink


currentManifest ​

Re-exports currentManifest


DebugCommand ​

Re-exports DebugCommand


decodeMessage ​

Re-exports decodeMessage


decodeSnapshots ​

Re-exports decodeSnapshots


DeltaFrame ​

Re-exports DeltaFrame


EMOTES ​

Re-exports EMOTES


encodeAiReadout ​

Re-exports encodeAiReadout


encodeChat ​

Re-exports encodeChat


encodeClock ​

Re-exports encodeClock


encodeDebugCommand ​

Re-exports encodeDebugCommand


encodeInput ​

Re-exports encodeInput


encodeInputBatch ​

Re-exports encodeInputBatch


encodeInventory ​

Re-exports encodeInventory


encodeKeys ​

Re-exports encodeKeys


encodeMission ​

Re-exports encodeMission


encodeNotices ​

Re-exports encodeNotices


encodePauseRequest ​

Re-exports encodePauseRequest


encodePauseState ​

Re-exports encodePauseState


encodePhone ​

Re-exports encodePhone


encodePhoneCommand ​

Re-exports encodePhoneCommand


encodeReset ​

Re-exports encodeReset


encodeRoomCommand ​

Re-exports encodeRoomCommand


encodeRoster ​

Re-exports encodeRoster


encodeRtcSignal ​

Re-exports encodeRtcSignal


encodeRun ​

Re-exports encodeRun


encodeSignals ​

Re-exports encodeSignals


encodeSkip ​

Re-exports encodeSkip


encodeSnapshot ​

Re-exports encodeSnapshot


encodeSpectate ​

Re-exports encodeSpectate


encodeStealth ​

Re-exports encodeStealth


encodeWanted ​

Re-exports encodeWanted


encodeWeather ​

Re-exports encodeWeather


encodeWelcome ​

Re-exports encodeWelcome


EndorseRequest ​

Re-exports EndorseRequest


EntityArena ​

Re-exports EntityArena


EntitySnapshot ​

Re-exports EntitySnapshot


FleetHeartbeat ​

Re-exports FleetHeartbeat


FrameNews ​

Re-exports FrameNews


GameArtifact ​

Re-exports GameArtifact


GameEvent ​

Re-exports GameEvent


guessedInput ​

Re-exports guessedInput


heldInput ​

Re-exports heldInput


InputMessage ​

Re-exports InputMessage


InventoryMessage ​

Re-exports InventoryMessage


isResyncRequest ​

Re-exports isResyncRequest


isRtcFrame ​

Re-exports isRtcFrame


ItemInfo ​

Re-exports ItemInfo


JoinClaims ​

Re-exports JoinClaims


KeysMessage ​

Re-exports KeysMessage


KIND_ACKED ​

Re-exports KIND_ACKED


KIND_INPUTS ​

Re-exports KIND_INPUTS


LeaderboardView ​

Re-exports LeaderboardView


levelFilePath ​

Re-exports levelFilePath


LevelRef ​

Re-exports LevelRef


levelRoomId ​

Re-exports levelRoomId


LEVELS_BY_HASH ​

Re-exports LEVELS_BY_HASH


LOBBY_NOTICES ​

Re-exports LOBBY_NOTICES


LOBBY_OUTCOMES ​

Re-exports LOBBY_OUTCOMES


LOBBY_STATES ​

Re-exports LOBBY_STATES


LOBBY_VISIBILITIES ​

Re-exports LOBBY_VISIBILITIES


LOBBY_WHYS ​

Re-exports LOBBY_WHYS


LobbyAccountRequest ​

Re-exports LobbyAccountRequest


LobbyFeedEvent ​

Re-exports LobbyFeedEvent


LobbyInvite ​

Re-exports LobbyInvite


LobbyMember ​

Re-exports LobbyMember


LobbyOffer ​

Re-exports LobbyOffer


LobbyReadyRequest ​

Re-exports LobbyReadyRequest


LobbyResults ​

Re-exports LobbyResults


LobbyRules ​

Re-exports LobbyRules


LobbySeatResult ​

Re-exports LobbySeatResult


LobbyState ​

Re-exports LobbyState


LobbySummary ​

Re-exports LobbySummary


LobbyTeam ​

Re-exports LobbyTeam


LobbyTeamRequest ​

Re-exports LobbyTeamRequest


LobbyView ​

Re-exports LobbyView


LobbyVote ​

Re-exports LobbyVote


LobbyVoteRequest ​

Re-exports LobbyVoteRequest


MapZone ​

Re-exports MapZone


Re-exports MemoryLink


minimumRelease ​

Re-exports minimumRelease


MISSION_MODES ​

Re-exports MISSION_MODES


MissionEntry ​

Re-exports MissionEntry


MissionMessage ​

Re-exports MissionMessage


MissionRatingRequest ​

Re-exports MissionRatingRequest


ModerationVerdict ​

Re-exports ModerationVerdict


NOT_INSIDE ​

Re-exports NOT_INSIDE


NoticeMessage ​

Re-exports NoticeMessage


OFFER_KINDS ​

Re-exports OFFER_KINDS


OfferKind ​

Re-exports OfferKind


ONE_SHOT_PRESSES ​

Re-exports ONE_SHOT_PRESSES


ORDERED_REQUEST ​

Re-exports ORDERED_REQUEST


parseAiReadout ​

Re-exports parseAiReadout


parseArtifact ​

Re-exports parseArtifact


parseChat ​

Re-exports parseChat


parseClock ​

Re-exports parseClock


parseDebugCommand ​

Re-exports parseDebugCommand


parseInventory ​

Re-exports parseInventory


parseKeys ​

Re-exports parseKeys


parseMission ​

Re-exports parseMission


parseNotices ​

Re-exports parseNotices


parsePauseRequest ​

Re-exports parsePauseRequest


parsePauseState ​

Re-exports parsePauseState


parsePhone ​

Re-exports parsePhone


parsePhoneCommand ​

Re-exports parsePhoneCommand


parseReset ​

Re-exports parseReset


parseRoomCommand ​

Re-exports parseRoomCommand


parseRoster ​

Re-exports parseRoster


parseRtcSignal ​

Re-exports parseRtcSignal


parseRun ​

Re-exports parseRun


parseSignals ​

Re-exports parseSignals


parseSkip ​

Re-exports parseSkip


parseSpectate ​

Re-exports parseSpectate


parseStealth ​

Re-exports parseStealth


parseWanted ​

Re-exports parseWanted


parseWeather ​

Re-exports parseWeather


parseWelcome ​

Re-exports parseWelcome


PhoneCommand ​

Re-exports PhoneCommand


PhoneMessage ​

Re-exports PhoneMessage


Playlist ​

Re-exports Playlist


PlaylistMission ​

Re-exports PlaylistMission


PLAYLISTS ​

Re-exports PLAYLISTS


PlaylistView ​

Re-exports PlaylistView


PublicStanding ​

Re-exports PublicStanding


QUANT ​

Re-exports QUANT


quantizeInput ​

Re-exports quantizeInput


QUICK_PHRASES ​

Re-exports QUICK_PHRASES


QuickPlayRequest ​

Re-exports QuickPlayRequest


ReaderStats ​

Re-exports ReaderStats


ReadFrame ​

Re-exports ReadFrame


Refusal ​

Re-exports Refusal


refusalOf ​

Re-exports refusalOf


RELIABLE_ABOVE ​

Re-exports RELIABLE_ABOVE


RespectBreakdown ​

Re-exports RespectBreakdown


REST_STEPS ​

Re-exports REST_STEPS


RESYNC_REQUEST ​

Re-exports RESYNC_REQUEST


RoomCommand ​

Re-exports RoomCommand


RoomOpenRequest ​

Re-exports RoomOpenRequest


RoomStatus ​

Re-exports RoomStatus


RosterMessage ​

Re-exports RosterMessage


RosterPlayer ​

Re-exports RosterPlayer


RTC_CHANNEL ​

Re-exports RTC_CHANNEL


RTC_FALLBACKS ​

Re-exports RTC_FALLBACKS


RtcCandidate ​

Re-exports RtcCandidate


RtcFallback ​

Re-exports RtcFallback


RtcSignal ​

Re-exports RtcSignal


RUN_ID_PATTERN ​

Re-exports RUN_ID_PATTERN


RUN_OUTCOMES ​

Re-exports RUN_OUTCOMES


RUN_PHASES ​

Re-exports RUN_PHASES


runHolds ​

Re-exports runHolds


RunMessage ​

Re-exports RunMessage


RunResult ​

Re-exports RunResult


RunSeatSpec ​

Re-exports RunSeatSpec


RunSpec ​

Re-exports RunSpec


RunStandingView ​

Re-exports RunStandingView


SignalsMessage ​

Re-exports SignalsMessage


signJoinToken ​

Re-exports signJoinToken


SnapshotDecoder ​

Re-exports SnapshotDecoder


SnapshotEncoder ​

Re-exports SnapshotEncoder


SnapshotMessage ​

Re-exports SnapshotMessage


SnapshotMode ​

Re-exports SnapshotMode


snapshotModeRequest ​

Re-exports snapshotModeRequest


SnapshotReader ​

Re-exports SnapshotReader


SpectateRequest ​

Re-exports SpectateRequest


StandingView ​

Re-exports StandingView


StealthMessage ​

Re-exports StealthMessage


SYSTEM_LINES ​

Re-exports SYSTEM_LINES


TIER_EVERY ​

Re-exports TIER_EVERY


TierView ​

Re-exports TierView


Transport ​

Re-exports Transport


TransportMessage ​

Re-exports TransportMessage


unplayableReason ​

Re-exports unplayableReason


VehicleInput ​

Re-exports VehicleInput


verifyJoinToken ​

Re-exports verifyJoinToken


WantedMessage ​

Re-exports WantedMessage


WEATHER_KIND_NAMES ​

Re-exports WEATHER_KIND_NAMES


WelcomeMessage ​

Re-exports WelcomeMessage