Multiplayer: shared-physics playground
site/media/lessons/tierc-mp-batch.lesson.ts (4 steps) Notblox’s signature is a shared physics world: every player moves a server-owned avatar and
pushes dynamic boxes, and every client renders the same synced positions. Object state lives on
the server, not peer-to-peer — so two clients never disagree about where a box is. This port keeps
that essence with a light 20 Hz server sim (NotbloxRoom) and the Colyseus Callbacks API on the
client.
-
Open the notblox scene. Load
examples/scenes/notblox.vscn.json.
The shared-physics arena, ready to run. -
Enter play mode — the client joins the notblox room. The example connects to
notblox_roomand registers Callbacks (onAdd/onChange/onRemove) for players and boxes.
The client connects to notblox_room. -
Server-authoritative players and boxes sync. The HUD reads room state live —
● online · 4 players · 5 boxes. The capsule avatars and crates are positioned from server state every frame; the server integrates input and box pushes, then broadcasts.
Avatars + boxes rendered from synced server state (4 players, 5 boxes). -
Stop play mode. Press Stop (or
Escape) — the room connection closes.
Recap
New functionality
- Ran a server-authoritative shared-physics game
- Saw players and boxes sync from the server (4 players, 5 boxes)
New concepts & skills
- Object state is server-owned, not P2P — one authority, no disagreement
- The server ticks at SIM_INTERVAL_MS; clients render synced positions
- Callbacks (onAdd/onChange/onRemove) drive client rendering from room state
Next lesson → Multiplayer: tank arena