You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1.3 KiB

name description type
Server-authoritative architecture Phase 1 WSEnvelope protocol, server-owned movement system, combat push via WS, RoadGraph, hero lifecycle on connect/disconnect project

Phase 1 of server-authoritative architecture implemented 2026-03-27.

Why: Frontend becomes a pure renderer; all game logic (movement, combat, encounters) is owned by the backend to prevent cheating and enable consistent simulation.

How to apply:

  • All WS messages use model.WSEnvelope (type + json.RawMessage payload). Both server->client and client->server.
  • game.MessageSender interface decouples engine from handler (avoids import cycle game<->handler).
  • Engine now has 3 tickers: combat (100ms), movement (500ms/2Hz), position sync (10s).
  • game.HeroMovement tracks per-hero walking state; created on WS connect, destroyed on disconnect.
  • game.RoadGraph loaded from DB at startup; towns connected in linear chain with waypoints.
  • Client commands (activate_buff, use_potion, revive) routed from hub.Incoming -> engine.IncomingCh.
  • Hub has OnConnect/OnDisconnect callbacks wired in main.go.
  • Migration 000013: hero movement columns + roads + road_waypoints tables.
  • Offline simulator does NOT touch position/movement fields (per spec risk section 6).