flatland-pathfinding
Shared grid A* pathfinding used by Flatland3 clients (auto-nav) and the region sim (NPC / worker movement).
Depends on flatland-protocol for world coordinates and view types.
Path modes
| Mode | Behavior |
|---|---|
| Fastest (default) | Cell cost ∝ 1 / move_speed_mult from content (terrain-kinds.yaml) |
| Direct | Uniform cost on all walkable cells — shortest geometry |
NavWorld.kind_nav carries per-kind speed / impassable flags from the terrain kind catalog (no hardcoded speeds in production). Impassable kinds (e.g. rock, deep water) are authored with impassable: true in World → Terrain kinds.
Player auto-nav mode is set in ClientConfig.auto_nav_mode (F2 → Auto-nav). Server agents always use Fastest.
Building footprints use the same pad as runtime collision (PLAYER_RADIUS_M only). Extra clearance used to seal road cells beside buildings while the player could still walk them.
Debug
FLATLAND_NAV_DEBUG=1
On each auto-nav plan, stderr prints start/goal kinds, straight-line blocked cells (and which building/circle sealed them), and path deviation from the chord.