---
title: "Pathfinding for games, and a planner of blocks, areas and doors"
authors:
  - "quanglee"
year: 2026
venue: "quanglee field notes (quanglee.dev), 18 Nov 2026"
arxiv: null
doi: null
source: "https://quanglee.dev/blog/pathfinding-for-games/"
version_reviewed: "web 2026-11-18 (build d4975b7)"
topics:
  - "pathfinding"
  - "hierarchical-pathfinding"
  - "hpa-star"
  - "flow-fields"
  - "rts"
  - "deterministic-lockstep"
  - "weighted-grids"
seed_rank: 2770
seed_batch: "craft-2026-12-01"
reviewed: "2026-12-01"
pool: "game-ai"
relevance_score: 8
lineage: pathfinding
cites:
  - title: "Pathfinding for games, and a planner of blocks, areas and doors"
    url: "https://quanglee.dev/blog/pathfinding-for-games/"
    year: 2026
    arxiv: null
    doi: null
  - title: "Near Optimal Hierarchical Path-Finding"
    url: null
    year: 2004
    arxiv: null
    doi: null
  - title: "A Formal Basis for the Heuristic Determination of Minimum Cost Paths"
    url: "https://doi.org/10.1109/TSSC.1968.300136"
    year: 1968
    arxiv: null
    doi: "10.1109/TSSC.1968.300136"
  - title: "1500 Archers on a 28.8: Network Programming in Age of Empires and Beyond"
    url: "https://www.gamedeveloper.com/programming/1500-archers-on-a-28-8-network-programming-in-age-of-empires-and-beyond"
    year: 2001
    arxiv: null
    doi: null
  - title: "Crowd Pathfinding and Steering Using Flow Field Tiles"
    url: "https://www.gameaipro.com/GameAIPro/GameAIPro_Chapter23_Crowd_Pathfinding_and_Steering_Using_Flow_Field_Tiles.pdf"
    year: 2013
    arxiv: null
    doi: null
  - title: "Online Graph Pruning for Pathfinding on Grid Maps"
    url: "https://doi.org/10.1609/aaai.v25i1.7994"
    year: 2011
    arxiv: null
    doi: "10.1609/aaai.v25i1.7994"
  - title: "JPS+: An Extreme A* Speed Optimization for Static Uniform Cost Grids"
    url: "https://www.gameaipro.com/GameAIPro2/GameAIPro2_Chapter14_JPS_Plus_An_Extreme_A_Star_Speed_Optimization_for_Static_Uniform_Cost_Grids.pdf"
    year: 2015
    arxiv: null
    doi: null
  - title: "Efficient Triangulation-Based Pathfinding"
    url: "https://cdn.aaai.org/AAAI/2006/AAAI06-148.pdf"
    year: 2006
    arxiv: null
    doi: null
  - title: "Optimal Pathfinding on Weighted Grid Maps"
    url: "https://doi.org/10.1609/aaai.v37i10.26458"
    year: 2023
    arxiv: null
    doi: "10.1609/aaai.v37i10.26458"
see:
  - "205-a-formal-basis-for-the-heuristic-determination-of-minimum-co"
  - "027-1500-archers-on-a-28-8-network-programming-in-age-of-empires"
  - "1433-crowd-pathfinding-and-steering-using-flow-field-tiles"
  - "196-online-graph-pruning-for-pathfinding-on-grid-maps"
  - "454-jps-plus-extreme-a-star-speed-optimization-static-grids"
  - "2424-efficient-triangulation-based-pathfinding"
---

# Pathfinding for games, and a planner of blocks, areas and doors

## One-sentence takeaway

A long, measured field note on RTS pathfinding. It surveys how shipped games do it (AoE II tiles, StarCraft walk tiles, SupCom 2 and AoE IV sector-portal flow fields, 0 A.D. areas plus JPS, Factorio and OpenRA area guesses, Recoil quadtrees, Recast navmeshes) and then builds an HPA*-style planner for weighted 1 m grids with one-cell-thin walls at any angle. The planner cuts blocks into flood-filled areas, puts doors on block edges and at every ground-cost change, and links doors with per-block Dijkstra. On a 3.2 km × 3.2 km map (10.24 M cells) it plans in 8.0 ms median against 345 ms for exact A*, with paths 1.2% cheaper at the median after straightening and 3.5% dearer at worst.

## Why it matters here

GRID COMMAND needs exactly this: large maps, ground costs (roads vs marsh), thin walls and many orders per second, all deterministic across lockstep peers. The post bakes that in from the start: step costs are integers ((a+b)×100 straight, ×141 diagonal), so "the same order gives the same path on every machine". It also builds door links on worker threads and merges them in block order, so the graph is identical whatever the thread count. Two ideas transfer directly. A per-region flood-fill id answers "unreachable" in one lookup (13–24 µs) instead of a failed search. Doors split at cost changes keep units on roads without special cases. The comparison table of shipped engines is a ready-made design-space map for ano-side movement rules.

## Key ideas

- **Areas, not blocks.** Flood-fill free cells inside each block (block edges treated as walls), so a wall through a block yields separate areas with their own doors. That gives "no route through a wall" by construction, with no per-wall-shape rules.
- **Door rule.** Place one door per opening, plus a split wherever ground cost changes along the edge. Without the cost split, paths ran 5.4% longer at the median (19% at worst). HPA*'s two doors on wide openings cost time and did not help once the cost split was in. 32 m blocks beat 16 m (too many doors) and 64 m (too many cells per step search).
- **Per-order pipeline.** Region check, Dijkstra from start and target inside their own blocks, A* over doors with the octile heuristic, exact A* per link one block at a time (6 ms, against 30 ms when all route blocks were searched at once), then straightening that accepts a shortcut only if it costs at most 5% more.
- **Prepare cost.** 37k doors and 540k links take 6.4 s at load for the big map, and lazy per-block preparation was worse (one order took 1.9 s). Parallel, deterministically merged link building, or saving the graph with the map, are the proposed fixes.
- **Why A* struggles on weighted ground.** An admissible heuristic must assume road everywhere, so A* explores an oval whose work grows roughly with distance squared. Doubling the map side made exact A* 4.6× slower and the planner 2.2× slower.

## Caveats

This is a personal engineering blog, not a peer-reviewed paper. The author's full name isn't given (byline "quanglee"). The benchmark is a standalone JavaScript program on a heavily loaded 10-core machine, with 40 trips on one synthetic map. Maps are static: no dynamic obstacles, no unit-unit avoidance, and per-size cell sets are described but not benchmarked. Descriptions of commercial engines come from postmortems, slides and open-source code, as cited. I read the full post. The GRID COMMAND mapping is mine.

## Links

- Post (HTML, interactive figures): https://quanglee.dev/blog/pathfinding-for-games/
- AoE IV pathing slides (GDC 2022, cited): https://media.gdcvault.com/GDC+2022/Speaker+Slides/Pathing+In+Age_Cheng_Frank+2022-03-29+00.16.38.pdf
- JPSW (AAAI 2023, cited): https://ojs.aaai.org/index.php/AAAI/article/view/26458
