# Improving heuristics for A* search — retained record

> Retained reddit record from reddit:gamedev.

Canonical: https://highsignal.app/data/records/e318e2380df492fb

[← sources](https://highsignal.app/data)


source: [reddit](https://highsignal.app/data/reddit) (reddit:gamedev)  published 2026-10-12 04:00 ingested 2026-10-13 02:38

[original source ↗](https://www.reddit.com/r/gamedev/comments/1x3ryts/improving_heuristics_for_a_search/)

## retained text



```
Distance heuristics ignore map structure, so A* wastes effort when they point the wrong way. The fix precomputes shortest-path costs to a few "landmark" nodes using Dijkstra's or BFS, then applies the triangle inequality, cost(B,X) ≥ cost(B,L) − cost(X,L), taking the max across all landmarks and the usual Manhattan estimate. Landmarks help most when they sit "past" the goal, often at map edges. Placement depends on the game, though random-path analysis can pick spots automatically. Only the heuristic changes, often in about 20 lines, and memory grows with landmarks × nodes. Demos on Dragon Age, Cogmind and maze maps show A* searching far less of the map.
```



document fetched 2026-10-13 00:27 · canonical https://reddit.com/r/gamedev/comments/1x3ryts/improving_heuristics_for_a_search
