Professional Documents
Culture Documents
What is pathfinding?
Pathfinding is the operation of calculating and creating a path for AI to follow. Whether it be
movement paths, story paths, or even behavior paths. All it entails is the calculation from one point to
another by an algorithm, usually A*, to create the most optimal path to your destination. This operation
is calculated before the execution of its results, making it a preprocessed operation, where obstacle
avoidance is real-time.
What is a path?
A path is any sequence of steps that once followed will lead an AI to its final destination.
Usually, very straight forward in the idea of the movement from one world point to another according
to the path found by the algorithm. However, more complicated AIs could use a path for interacting
with the player in dialogue or even the narrative in the story like the Mass Effect series.
What is a node?
A node is point along the path. Most literally a point in world space, but can be more abstract
like plot points or decision points. But in its most simplistic form, it's a point that a path can follow
towards its destination. There are many different characteristics that can be added to nodes like travel
weight, navigability, or even distance from the start and finish points of any particular path.
What is H?
H is the value that made Dijkstra's not as efficient as A*. Similar to G, it is a value that
is calculated by looking at the distance from the end to that particular node. But this is where A*
algorithms can differ. Because, there are many ways of calculating the H cost of any particular node.
My preferred method is to use the formula 14x + 10(y-x) = H or 14y + 10(x-y) = H. This allows the
algorithm to move diagonally
until it reaches the same cardinal
line as the end point. This
ensures that algorithm knows
the most efficient path towards
the end point and uses that to
calculate the H value of every
node when calculating a path.
This ensures that the F cost, the
combination of G and H, reflects
any particular nodes true value
when trying to calculate the
most efficient path from any two nodes.