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!
I found this great explanation of the Doom for iPhone source code. For those that don’t know, Doom was ported last year to the iPhone and the source was released by ID Software to help enable game development on the iPhone.
I found this great article covering the design, graphics rendering engine, networking system, and sound system of the Doom iPhone source code. It’s a very good read with several of diagrams that really give you insight into the thought process used to develop the game.
You can view the article here: Doom iPhone Code Review
You’ll want to make sure you get the Doom iPhone source code.
If you’re interested in checking out some other open source iPhone apps, I made a listing some time ago showing several high quality open source iPhone apps.
Please post any thoughts below, thanks.
You’ve probably heard by now that Flash CS5 is coming with iPhone support. I know several artists that are extremely excited, and I’ve been doing some fiddling around with Flash game development, and I’m getting excited too. I came across this interesting story from some developers who have already created a game using Adobe Flash CS5 that has been able to reach a top 10 download position in several countries.
The developers state that even though they have never developed a mobile game, that they were able to make a high quality app that is almost indistinguishable from a native app in actual use. That being said there were a few negatives:
- Performance is not as good as a native app so they don’t suggest using frame heavy engines, and Papervision 3D (a popular 3D graphics engine for the Flash platform) was unusable.
- The game will need some optimization to run on the iPhone, don’t expect a web game to run straight out.
- No way to integrate social gaming support used in native apps.
- No support for in app purchases.
Despite these negatives the developers felt like the whole experience was “a breeze from start to finish”, and will allow anyone with Photoshop, and basic Flash knowledge to build a high quality app.
I look forward to playing with this thing.. I have to admit Flash game development is pretty fun, it’s nice to see results so quickly… need to get my Photoshop abilities up to snuff though 🙂
OpenGL ES is the graphics API used for programming the iPhone. If want to create your own game engine, design a game from scratch, or create some other graphically intensive app that requires you to go beyond Core Animation and Quartz, then you will need to have a good understanding of OpenGL ES. I updated this list previously upon the release of the OpenGL ES 2.0 capable iPhone 3GS, and since then I’ve received a few messages about some of the resources being updated, and found a couple new resources that i have listed below. If you want to have an understanding, or just want to see if learning OpenGL ES is your cup of tea then you will want to check out these resources.
If you don’t have a basic understanding of 2D and 3D math for computer graphics your head will probably explode once you try learning OpenGL. To prevent that from happening you should at least understand the terminology, and the reasons why this math is needed. No need to grind through math problems like in college.. that’s what computers are for.
1. The Black Art of 3D Game Programming Chapter 10 This is a great introduction to graphics math, and really tells you what you need to know about 3D math without getting into what doesn’t really matter. What I really love about this book is that unlike most similar books this is not a textbook, but rather designed for personal learning which makes a huge difference.The whole book can be found here for free. It is an old book, but the math still holds true.
2. Vector & Matrix Math Tutorial If you feel that everything in the resource above is flying above your head then you probably will want to take a look at this. I normally wouldn’t reccomend a resource that brags about being “book sized”, but it is very good.
iPhone Specific OpenGL ES 2.0 Resources
3. The OpenGL ES Shading Language This is a free pdf book from Khronos, and actually a really good read, and will teach you what you need to know, again don’t try this until you at least have some OpenGL understanding or your head may explode. Thanks to Bill Dudney one of the authors of iPhone SDK Development for pointing this out.
4. Hello Triangle: An OpenGL ES 2.0 Example – This is a sample chapter from the OpenGL ES 2.0 Programming Guide. If you’re thinking of getting this book you will probably want to check this out to see if the book is for you as it is, how should I say this… rather academic.
5. The OpenGL ES Programming Book This code from this book has been updated to run on the iPhone and can be found here, and you’ll probably want it if you go through the chapter listed above. Make sure you have a solid understanding of OpenGL (or OpenGL ES 1.x) before starting this book. Now it might seem odd to put a paper book here, but you can learn alot from the sample code, and what’s given from the book.
6. The Oolong Engine An Open source 3D OpenGL ES Game Engine for Iphone, MIT licensed. Written by Wolfgang Engel former Rockstar Games programmer, and author of some intense DirectX books. Great to see the libraries in here for handling memory, loading 3d models, performing math, and now code is rapidly being added for support of OpenGL ES 2.0 features.
7. Getting Started with OpenGL ES 2.0 on iPhone 3GS A getting started with OpenGL ES 2.0 tutorial that explains some of the most basic differences between OpenGL ES 1.1 and 2.0.
iPhone Specific OpenGL ES 1.1 Resources
8. iPhone OpenGL ES Tutorial Series (link currently dead – hopefully a new repository for these tutorials will crop up soon.) I don’t know if Maurice Simon is the smartest person alive, but this is the smartest set of OpenGL ES tutorials I’ve seen. A terrific resource.
10. SIO2 Engine this is an excellent Open Source 3D OpenGL ES engine, look at the code, understand, and maybe even use the engine rather than write your own from the ground up (nothing wrong with that).
11. Cocos2D Iphone This is an excellent Open Source 2D OpenGL ES Game Framework for iPhone you can learn alot from going in and looking around the code. As far as Open Source frameworks go this extremely easy to use, well documented, and has an active community.
12. SDL for iPhone (SDL Version 1.3) The SDL library has been a popular open source library for probably over a decade, and has been used in many games. This is the iPhone port, and a great resource.
Non-iPhone OpenGL ES 1.x Resources
If you use these resources you’ll need to put in some time to get things running on the iPhone, but they are still excellent.
13. Nehe Tutorials Converted To OpenGL ES Michael Gorchak creator of the GluES library has put together this collection of tutorials converted from their original Nehe form. In case you haven’t heard of them the Nehe tutorials were the definitive free tutorials for learning OpenGL. Michael has done an excellent job of writing comments for these tutorials. These tutorials have been updated as of late, and more has been added so be sure to check it out.
14. Khronos OpenGL ES Page This is the OpenGL ES “homepage” on which you will find the reference manual, and lots of examples. Not specifically IPhone, but there are some great examples here and even a complete racing game BSD licensed.
15. Khronos OpenGL ES 1.x Step-By-Step Tutorials This page is from Imagination Technologies makers of the Iphone GPU, and it contains the Khronos tutorials converted to OpenGL ES and created for the PowerVR technology. Good to lean from especially as to how they load Pod files.
16. Zeus CMD OpenGL ES Tutorials This site contains 25 Great OpenGL ES Tutorials and they are extremely well paced, this was a site I learned alot from.
17. Typhoon Labs OpenGL ES Tutorials Another excellent set of OpenGL ES tutorials if you’re addicted to tutorials you might want to check these out too.
Interesting OpenGL ES Related Sites
18. GLBenchmark This is a just an interesting site that compares the different mobile devices available that utilize OpenGL ES. At this point it’s only showing OpenGL 1.1, but you can see how much faster a 3GS is than a 3G even at this stage.
This is just a quick video on an approach to getting started with iPhone OpenGL ES, emphasizing that it’s helpful to start with learning 3D math:
That’s the latest version of the list, be sure to post below if you find out about any other useful OpenGL ES resources.
I’ve mentioned the excellent Cocos2D open source 2d iphone game engine many times. The engine itself comes with many examples of the different features available, but something that comes up frequently is that people want some example games to look at it. Here are 5 terrific examples.
1) Gorillas – I’ve mentioned this game before, it’s a great example of a "Worms" type game, and has been around on many different platforms.
2) ABC 123 – A sequence memorization game. This game is really cool, letters appear, and you have to memorize the correct sequence by destroying bubbles that pop up.
3) TweeJump – This is a very nice platform jumping game. You jump from one platform to the next, if you remember the game Icy Toweres, this is similar.
4) Thrown – A Physics puzzler, not the best graphics, but an excellent coding example for Cocos2D that also utilizes the Chipmunk physics engine.
5) Grabbed – A dragging game example from the same author that created Thrown, and also utilizes Chipmunk.
Sapus Media, who started the Cocos2D iPhone project has an extensive source code example which is of their app "Sapus Tongue" you can check it out here, it’s not free, but these guys have put in so much into Cocos2D that I mention it here.
The book iPhone Cool Projects contains an example of a minigolf game that was created in Cocos2D.
And of course you can find the Cocos2D iPhone google code project itself here.