← Server architecture · all tasks
Stage 4 — interest management, creatures, flow-field pathfinding at scale
server-architecture/008 · created 2026-08-02 · updated 2026-08-18 · blocked by server-architecture/007
What to do
The scale stage — everything before this proves the mechanism works with a handful of entities; this stage proves it holds up at the load overview.md’s “Pathfinding and sensing” section actually targets: hundreds of creatures, from multiple spawn points, converging on a handful of targets, within tick budget.
- Interest management: each client receives state only for entities within a radius, via the spatial partition
overview.md’s “Netcode” section calls for (day-one requirement, being implemented properly at the first stage where it actually matters at scale). - Creatures: NPC entities that move autonomously toward targets (a home castle, a player) rather than only being driven by client intent.
- Flow-field/Dijkstra-map pathfinding: one outward sweep per distinct target producing a direction grid; creatures do a single array lookup per tick rather than individual A* searches — per
overview.md’s explicit “cost scales with number of targets, not number of agents” mechanism. Recompute a target’s field only when it changes cell; cap total pathfinding work per tick via a work queue. - The actual scale proof: hundreds of simulated creature agents, load-tested within this stage’s tick budget (20 Hz simulation, per
overview.md’s “Netcode” section) — measure and report actual numbers, not just “it didn’t crash.” - Automated tests (flow-field correctness on a known map, recompute-on-cell-change behaviour) plus a headless load-test script that spins up the target creature count and reports tick timing — the scale claim has to be a number in a script’s output, not an impression from watching it run.
- Handoff note:
land-of-lor/pocs/multiplayer-poc/handoff/stage-4.md, including the actual measured numbers (how many creatures, at what tick cost) and an honest note on where the ceiling was found, if one was.
Definition of done
Automated tests and the load-test script both pass and report concrete numbers; the handoff note exists with those numbers in it. Set state: review, not done.
Where the work lands
land-of-lor/pocs/multiplayer-poc/.
Docs to read first
server-architecture/overview.md’s “Pathfinding and sensing” and “Netcode” sections (tick rates, interest management) in full — this stage is where nearly every decision in those two sections gets exercised together. Stage 3’s handoff note for the client/server contract this stage’s creatures and interest management build on.
View source in repository · also available as raw markdown.