In tactics games like Fire Emblem, XCOM, or Into the Breach, when you click a tile and watch your unit navigate around walls and enemies, you’re watching A* (pronounced “A-star”) at work.
The problem: Finding the shortest path from point A to point B while avoiding obstacles. A brute-force search checks every possible path—which explodes exponentially as the map grows. A* is smarter.
How it works: A* maintains a “frontier” of tiles to explore, ranked by a score: f(n) = g(n) + h(n).
- g(n) — the actual cost from start to the current tile (distance traveled so far)
- h(n) — the heuristic: an estimate of the cost from here to the goal (usually straight-line distance)
A* picks the tile with the lowest f score next. This heuristic guides it toward the goal without checking every dead end. It’s like having a GPS that knows the beeline distance—you prioritize roads that point in the right direction.
Why tactics games love A:*
- Deterministic — same path every time, which matters for turn-based strategy
- Adjustable heuristics — want more cautious AI? Increase terrain costs. Want aggressive AI? Lower them.
- Interruptible — you can cap computation time and return the best path found so far
- Grid-friendly — tiles naturally form the graph nodes A* needs
Variations:
- Jump point search — skips empty spaces, speeds up large open maps
- Theta* — allows diagonal movement through corners (no corner-cutting)
- Flow fields — compute paths from goal to all reachable tiles once, then reuse for multiple units (great for swarm AI)
The next time your unit snakes around a building to reach an enemy, that’s A*—the quiet workhorse behind every tactics game.
