---
name: server_authoritative_movement_plan
description: Architecture decision for server-authoritative movement - waypoint extrapolation model, road graph, 5-phase migration plan.
type: project
---

Server-authoritative movement uses waypoint + speed extrapolation (option C). Server computes route as waypoint list along roads between towns, sends to client with speed. Client interpolates locally. Server interrupts with combat_start or town_arrived.

Key decisions:
- Roads are a linear chain between 7 towns (Willowdale->Starfall), stored in `roads` + `road_waypoints` tables
- Hero model gains: current_town_id, destination_town_id, road_id, waypoint_index, waypoint_fraction
- Movement ticks inside game.Engine.processTick for online heroes
- Offline heroes do NOT simulate movement (just instant fights as before)
- Encounters are server-decided based on position + cooldown, NO client request_encounter
- Base move speed 2.0 units/sec, ~78s per road segment, ~4-5 encounters per segment
- position_sync every 10s for client drift correction

5-phase implementation: WS protocol fix -> server combat -> movement system -> frontend gut -> hardening.

**Why:** Frontend was simulating everything locally (walking, combat, rewards), making the game fully cheatable.
**How to apply:** All implementation agents should follow the 5-phase order. Phase 1-2 can ship without movement. Phase 3-4 are the big changes.
