Connecting
How to connect to a game server, manually or through the lobby.
The menu (the normal way)
- Open the dev server (
npm --prefix src/games/fps run dev). - The first time a browser reaches the lobby it is asked who you are. The name you pick is your account's; leaving it empty keeps the
Player_<number>the lobby gave you. You already have a key at that point — it is what opens the same account in another browser, and the Profile key at the foot of the menu is where you copy or save it. - Pick a mode on the Play stage — Duel, Amphi, FFA or S&D — and take the one big action under it to find a room. Private beside it makes a room that appears in no list; the only way in is the invite link it gives you.
- In the room you vote for a map, pick a side, add bots, chat with the people in it, and mark yourself ready.
- When everyone is ready, the lobby spawns a dedicated game server for that match alone and hands your client its address and a ticket for your seat.
- The connecting screen takes over and becomes the loading screen where it stands: its third step, MAP LOAD, lights up, the stage names the map over its levelshot, and a bar fills as the map loads. The game then compiles the shaders your weapons and effects draw with, shown as COMPILING SHADERS and a percentage, so nothing stalls the first fight. When it is done, the screen fades and you spawn. The match's sounds stay muted until then.
- When the match ends, Back to the lobby brings you back to the same room, ready for a rematch.
The loading screen also prepares your held weapons and projectile models. If required weapon preparation fails, the client reports the failure and disconnects rather than joining with missing models. Returning from a hidden tab rechecks rendering readiness; those checks have bounded waits and can be cancelled when the match connection ends. GPU preparation pauses while the tab is hidden rather than spending its timeout budget in the background. Player bodies and combat models are prepared before entering; failed required collision or model preparation reports an error. Audio prepares alongside the world and can fall back if the browser cannot finish decoding it promptly.
Rooms you can join are listed down the left rail. The Leaderboard shows your rank in every mode in its rail, and Profile shows your ranked record beside your key.
Joining a match under way
A match that has started still takes players while it has room. Its key in the rail reads join, and pressing it puts you straight into the match, on the smaller side in a team mode. A full match reads watch: you spectate, and pressing J (or Join in the match menu) asks for a place. When one has freed up you are in at once, on the connection you are watching from. When the match is still full, the chat says so. In a Duel whose two sides are taken — including a side held for a player who dropped — you are put in the challengers queue and brought in when it frees. In a round mode you join dead and play from the next round.
In the Ready Room
| Action | How it resolves |
|---|---|
| Vote map | Six maps are drawn from the gametype's pool (three from a smaller pool); most votes wins |
| Switch side | Immediate, no vote — it affects only you and it is reversible |
| Vote shuffle | Randomises the teams; needs a majority (ceil(players / 2)) |
| Add AI player | In any waiting room; the room stays public or private as it was. Fills a seat with a Hard bot, or Insane when your rating is strong. The arrow beside it picks Easy, Medium, Hard or Insane instead |
| Ready | Toggles your ready state |
A public room nobody else joins plays against AI players. It looks for people for 90 seconds, counting down the last 30 under the waiting clock ("Inviting AI opponent in 0:30"), then invites a bot matched to your rating; in FFA and S&D another follows every 5 seconds while seats are open, so a person can still take one. A private room waits for the people you invite. A match with a bot in it is rated in the private pool, wherever it was played.
On a team gametype you are auto-assigned to the smaller side on join. Switching sides needs no vote because it affects one player and is reversible — and without it there would be no way to choose a side at all, which makes testing the attacking half of a round mode impossible.
Bots count as automatic yes votes on a shuffle, but only once a human has voted. A bot has no opinion about team balance, and without this a lobby of one human plus any number of bots could never reach the majority and so could never shuffle at all.
The side you end up on is carried through to the game server, so what you chose in the ready room is what you play.
Console (the developer way)
connect ws://localhost:7777 # Connect to a running dedicated server
disconnect # Leave the match and return to the lobby
cl_netgraph 2 # Show live connection diagnosticsThe connect command lives in src/games/fps/console/commands/ConnectCommand.ts (registered at boot by registerFpsCommands).
If a map <name> [gametype] command was used to dev-spawn a server, the lobby spawn + the network connect happen automatically. You don't need connect after map.
A server reached with connect shows the join screen once the map is in: join the match, or spectate first.
What Happens on Connect
- Browser WebSocket handshake with the game server.
- The client presents the ticket the lobby gave it. The server admits the seat that ticket belongs to — the name a client sends identifies nobody. A seat survives a dropped socket, so a reload before the match starts reclaims the same one.
- Server replies with
serverInfocontaining the active map name + gametype + tick rate. - Client renders the BSP via the engine's
loadClientMap()helper (no local simulation — the server is authoritative). - Client subscribes to snapshot stream and starts sending input commands.
- Server adds the player to the simulation; first authoritative snapshot arrives with the spawn position.
Disconnect Behaviour
disconnect does what Leave match in the match menu does: it closes the connection and returns you to the lobby. On the way out it tears down:
- The active
NetworkGameHost - The input loop
- The snapshot buffer
- The client-side projectile / weapon-view state
In Duel and Amphi, dropping out of a live match pauses it for up to two minutes, and your seat is held for as long as the pause lasts; see Timeouts. Otherwise, if you drop mid-match, your seat is held for 60 seconds and the server hands your client a resume token, so coming back inside that window puts you back in the same seat rather than a new one. If the game reloaded or you went back to the lobby, use Rejoin match in the match room: it takes the same seat back, as often as you need. Miss the 60 seconds and the seat is released and your name leaves the scoreboard; in Duel and Amphi your opponent wins by forfeit. In the other modes Rejoin match still brings you back with your score, but the match is no longer rated.
Reading the NetGraph
cl_netgraph 1 shows ping, snapshot rate, estimated snapshot gaps, interpolation delay, command rate, prediction corrections and extra upload and download delay as text; cl_netgraph 2 adds a rolling graph of ping and gaps. See HUD → NetGraph.
- Ping is measured from the server's acknowledgement of your commands, and is the number the scoreboard shows.
- corr / max count the times the server corrected your predicted position by more than half a unit, per second, and the largest in the last second. Normally both stay at zero.
- up / down show how much longer than your best of the last 30 seconds your commands take to reach the server (
up) and its updates take to reach you (down). A high ping with a highupmeans your upload is queueing behind something else — a file upload, a cloud sync, a weak Wi-Fi uplink. The game keeps you where you are while it waits and catches up afterwards, but nothing can make your shots arrive sooner. - Hit registration is lag-compensated. When you shoot, the server rewinds other players to the tick your client was showing you, so what you saw under your crosshair is what is tested for weapons that use it.
Ticketed and ticketless connections
A match started through the lobby is ticketed, as above. A connect typed at the console carries no ticket: the server lets it watch, but a playing seat belongs to a ticket, so it cannot take one. Watching from the lobby's rail is different: there, Join asks the lobby for a seat.
Further reading
The engine's Networking Guide covers the underlying mechanics, and its Lobby Server guide covers accounts, rooms and results. This manual's Lobby, Rooms and Accounts page covers them from the player's side.
