Pathfinding can be one of the more complex problems in iPhone game development.
It can become even more difficult with multiple game objects moving around, and there is a need for those game objects to avoid each other or find the shortest path to another moving object.
It doesn’t help that most of the more advanced pathfinding information on the internet is usually written in the form of theoretical papers featuring obscure math formulas that can appear like a bunch of random wingdings to us mere mortal iPhone and iPad programmers.
Fortunately All-Seeing Active the company that released the fantastic asihttprequest library has released a co-operative pathfinding library. Here’s why this is so good:
- It’s written in Objective-C so if you’re unfamiliar with C/C++ you can still look through the code and figure things out.
- It was actually written for iOS devices so there’s no conversion needed as with most of the readily available pathfinding libraries. It can just be dragged right in.
- It’s co-operative so one object can easily avoid another, and you can cut other moving objects off
- It’s pretty fast as it was written to perform well on the original iPhone
- It was already used in a popular game in the app store: Space Harvest (which btw is really cool if you like space trading type games.)
- A fantastic example application is included, and the code is very well written and commented. I was able to figure out the basics very quickly just by looking at the sample.
You can find the Github project page here:
Thanks for reading, please share this if you find it interesting!