Colyseus rooms
Multiplayer state is owned by a Colyseus room on the server. The template ships two
(packages/editor/template/server/rooms/), registered in server/rooms.ts.
The shipped rooms
Section titled “The shipped rooms”| Room | Purpose | Used by |
|---|---|---|
ArenaRoom | Tag game with phases (lobby → countdown → playing → scoreboard), NPC bots, server-authoritative tag logic | third-person-arena, third-person-arena-game |
GameRoom | A worked Schema-synced room (an orb-collecting arena) to start from | — |
Each is a Room<State> using @colyseus/schema for the synced state. The client connects via
the Callbacks API (onAdd / onChange / onRemove).
Adding a room
Section titled “Adding a room”- Create
packages/editor/template/server/rooms/{name}.tswith aRoom<State>class and a@colyseus/schemastate. - Register it in
server/rooms.ts. - On the client, connect with typed
joinOrCreate<T>and subscribe via the Callbacks API (Callbacks.get(room)—onAdd/onChange/onRemove, per-fieldlisten); read live schema fields inonChange— don’t destructure them into local copies. - Declare
"server": {"room": "{name}"}in the example’svgai.game.jsonmanifest.
See also
Section titled “See also”- Networking — the contract + Callbacks API.
- Examples gallery — which examples use which room.