Skip to main content
Post Made Community Wiki by Jesse Dorsey
Source Link
bummzack
  • 22.7k
  • 5
  • 64
  • 87

There are several path finding algorithms out there.

One of the most popular ones is probably A* (A-Star). It's a very useful algorithm if you have a heuristic function that can give you estimated costs to reach a goal (example would be the line-of-sight distance to the target). A* is very useful to find the shortest path from a start to an end point.

Other than that there's also Dijkstra's algorithm which is very useful to find the nearest item out of several items. Eg. if you want to find out which power-up (or similar) is closest to your gaming character.

There are several other algorithms out there, but I guess A* is by far the most popular one. Mat Buckland has an excellent chapter about Path-Finding in his Book Programming Game AI by Example. I strongly encourage you to get a copy of it. Otherwise you'll find loads of information online by searching for "A Star search".