Skip to content

Multiplayer and Networking

Dominik Burger edited this page Jun 7, 2026 · 5 revisions

Multiplayer and Networking [CURRENT]

Multiplayer Model

Online multiplayer is live at tamersquest.com — one combined Node service serves the client and runs the authoritative WebSocket game on the same origin.

  • Up to 16 players share one round on one map instance; multiple rounds run concurrently.
  • Authoritative server owns all state (positions, monsters, combat, zone). Clients send inputs & render snapshots — never trusted (see Anti-cheat).
  • Map by seed: the server picks a seed and sends only that; clients regenerate the identical map deterministically (seeded RNG).
  • Sessions: guest play with a nickname (the profile carries an isGuest flag); the server issues an opaque token the client stores to resume the same profile on reconnect (Google/Discord auth later — see Onboarding and Title).
  • Visibility: the server filters each snapshot to an area of interest — some monsters spawn hidden and only reveal at close range (ambush).

The client never owns truth — it sends intent and renders what the server reports:

sequenceDiagram
    participant C as Client
    participant S as Authoritative Server
    C->>S: input (move direction, action)
    Note over S: integrate at 15 Hz<br/>collision, combat, zone
    S-->>C: filtered snapshot (~7.5 Hz)
    Note over C: interpolate & render<br/>(no prediction yet)
Loading

Networking & Anti-cheat

Aspect Value / rule
Tick rate 15 Hz authoritative simulation
Snapshot rate ~7.5 Hz (every other tick), per-player
Area of interest visible monsters within 900px; hidden monsters only within 220px
Hidden monster split ~35% of a round's monsters start hidden (deterministic from id)
Client rendering interpolates self + others toward the latest snapshot (no prediction yet)
Movement authority client sends a direction only; server integrates at BASE_SPEED (200px/s), clamps the axis to [-1,1] (NaN/∞-safe), normalizes diagonals
Tile collision server per-axis: a move applies only if the destination tile is walkable → slide along walls
Map bounds positions clamped to the map; no walking off into the void
Combat actions server honors only the active monster's own attacks (off-roster names → a skipped turn); a player can only act on their own combat

A dropped connection mid-round shows a "Connection lost" overlay → return to menu. True reconnection (resume the round) is pending a design decision (Q12).

Clone this wiki locally