Game Development Reference
In-Depth Information
Figure 9.2
A sample graph.
This means that the first step to implement pathfinding in a game is to determine
how the world will be represented as a graph. There are a several possibilities. A
simple approach is to partition the world into a grid of squares (or hexes). The ad-
jacent nodes in this case are simply the adjacent squares in the grid. This method
is very popular for turn-based strategy games in the vein of
Civilization
or
XCOM
(see
Figure 9.3
).