Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

RoomState

Property Type Description
buildMismatch BuildMismatchReason | null The room’s build and the page’s where they differ, which the engine’s note names while the player plays: from the room’s welcome, or from a room from before the warning that refused the player for it; null otherwise.
bytesPerSecond number What those messages weighed over the last second.
characterId string | null The client’s own character, by the id the room’s dump keys the character under; null until the welcome.
correctionFields string[] The rewound fields whose values differed in those corrections, each once, such as transform or facing.rotation.
correctionMetres number The largest of those corrections, in metres.
correctionMilliseconds number -
corrections number Times the room corrected the player’s own character over the last second. Each is a move whose state the room ended past its tolerance from where the client had it end, such as the character’s position past the pose tolerance, defaultPoseTolerance.position unless the character’s control names one.
correctionsTotal number Times the room corrected the player’s own character since the page loaded its game, the last second’s among them: what a run over many seconds reads, where corrections starts over each second.
correctionWarning string | null What the page says while the room has corrected the character at a steady rate for seconds, as it does a page whose own systems fight the room’s: the traits of the character the page holds otherwise. Null on a healthy page, and always in a built game.
edits boolean Whether the room takes a devtools edit; false until the welcome says so, and once its socket closes.
full RoomFullReason | null How full the room was when it refused the player for being full, which a game shows as “This room is full (4 of 4)”; null otherwise.
interpolationMilliseconds number How far behind the room’s last snapshot the streamed entities are drawn, as the pings set it: one send interval before the first answer.
jitterMilliseconds number How much the round trip wanders: the mean change from one ping’s to the next’s over the last few; 0 before the second answer.
lastDrop RoomDrop | null Why the player’s last socket to the room closed where the room did not refuse the player, which a game’s line for RoomStatus.Reconnecting reads: the room gone, or a message of the player’s too large for it; null before any.
leadTicks number | null Ticks the page’s clock runs ahead of the room’s, as the room’s answers to the player’s pings estimate its tick, at the end of the last second: the lead the player’s input lands early by plus its trip. Null before the room’s first answer.
leave () => Promise<boolean> Tells the room the player leaves on purpose, which frees the player’s character and seat at once, and closes the connection for good. Resolves with whether the room released the player: false with no room, while the player reconnects, or when the room does not answer within leaveConfirmSeconds, and the room then keeps the player’s character for its hold. The app calls it as the player leaves the game.
move () => void Closes the player’s socket as moved: the seat went to the player’s session in another window or on another device, and the room stores the player’s save and frees the seat at once. The app calls it as it hears so.
notice RoomNotice | null What to tell the player about their connection now, in the game’s connectionText where it gives one, such as “Connection lost. Reconnecting…”; null while the player plays, and before the page tries a room. A game’s status line shows its text.
players number Players in the room: the streamed entities with a name.
predictionChecks PredictionFinding[] What the prediction checks found on the player’s page in development, one entry for each kind of mistake. Empty on a healthy page, and always in a built game.
readViewStep () => number | null The room’s step this page draws the streamed entities at now, the one a shot names, for a game’s own message to name the moment the player’s screen showed; null before the room has answered a ping.
refusal RoomRefusal | null The code and reason the room closed the player’s socket with when it refused the player, whatever the reason; null until it does. full and buildMismatch read the two reasons a game shows.
refusedShot ShotRefusedMessage | null The room’s last refusal of one of the player’s shots, by the number sendShot returned, as the frame after it landed publishes it; null before any. A new record for each.
refusedShotOrigins number The player’s shots the room refused for their origin since the player joined it, as its last answer to a ping counted them.
replayedSteps number Over the last second: the steps those corrections replayed, those that took their kept physics sweep rather than sweeping again. Also counts those that swept anyway because their kept sweep met a tie between two colliders, which a replay cannot prove it would break the same way. Also counts the milliseconds the page spent receiving the messages that corrected the character, the restores and replays among them.
rerunMilliseconds number The slowest re-run of the player’s predicted set over the last second, in milliseconds.
roomStepMilliseconds number | null Milliseconds one of the room’s steps takes on the server, on average over its last few seconds, as its last answer to a ping said; null before the first, or from a room that does not say.
roundTripMilliseconds number The time a ping takes to the room and back, the mean of the last few; 0 before the first answer.
sendEdit (edit) => void Sends the room a devtools edit: the loop’s socket, which drops it until open.
sendShot (shot) => number | null Sends the room a shot, naming the room’s step this page draws the streamed entities at, and numbered for a refusal to name: the loop’s socket, which drops it until open, and until the room has answered a ping since its welcome, since the clock names no step before then. Returns the shot’s number, from 0, or null for a shot dropped.
sendsPerSecond number The room’s sends a second, as its welcome named them: the game’s room setting, or the platform’s default.
sentBytesPerSecond number What the player’s page’s messages to the room weighed over the last second: the player’s input, a message a frame, the player’s presses, pings and the rest.
snapshotsPerSecond number The room’s snapshots and deltas applied over the last second.
status RoomStatus -
stepMilliseconds number Milliseconds one of the page’s own steps took, on average over the last second.
takenSweeps number -
tiedSweeps number -