It is a simple process to perform box collisions in Cocoa Touch using the CGRectIntersectsRect function, and while this is easy and provides decent performance it does not make for the most accurate collisions.
A couple of new tutorials have been created featuring techniques for creating more accurate collisions methods.
The first tutorial is from 71 Squared on Collision Detection Methods which has a some nice straightforward functions written in C that you can drop into your code for Circle to Rectangle, and Circle to Circle collisions.
The second tutorial is from Ray Wenderlich, the creator of the Space Game Starter Kit and co-author of the Learning Cocos2D book, and goes through the process of how to use sprites in Cocos2D and how to get extremely accurate vertex based collisions using box2D in How To Use Box2D For Just Collision Detection In Cocos2D iPhone.
Drawing a 2D Hud on a 3D OpenGL ES scene is a common task when developing games.
To do this without any distortion in OpenGL ES you need to draw your HUD through a matrix different from the projection matrix used for 3D objects.
In the tutorial Jeff takes you through the process of adding a simple HUD to a 3D Scene.
Be sure to check out the iPhone OpenGL ES resources list for more OpenGL ES resources.
source Jeff LaMarche’s Blog
After making my open source iphone game engine comparison post,, I’ve noticed quite a few searches for a comparison of commercial iPhone game engines, so I’ve decided to create this comparison.
Please note that this is only a feature comparison, as while I have tested out the editors of these engines (where available for free) I have tried all of these engines and have been maintaining this site for the last two years so I can provide a lot of information on the topics. I’ve listed them separately in 3D and 2D placing the free ones first.
Engines With 3D Game Support
Unreal Development Kit For iOS – I don’t think I need to say much about this one. The Unreal Engine is legendary in the gaming industry, and their Infinity Blade game has been tremendously successful in the app store. Starting at $99 for indies the 3D engine is highly accessible to anyone. The only caveat for development on iOS is that the tools require Windows so if you’re a Mac OS X purist you’re going to have to look elsewhere. If you want cutting edge features, want to use the same brilliant tools used in creating hits like Unreal Tournament, and Gears of War then this is it.
Unity 3D – Unity 3D is the most popular commercial 3D iPhone game engine, and has been used in many games. Initially the iPhone version had some performance complaints, but it appears as though those issues were alleviated. Unity allows you to use an extensive 3D editor with many scripts available and there is considerable community support available. Another nice feature recently added to unity is that it allows you to use your Objective-C code, and it is the only one of these engines that appears to do so (so you can utilize libraries of your choosing within the iPhone SDK). Unity 3d for iPhone costs a minimum of $399 if you already own a copy of Unity Basic otherwise you will need to spend $199+$399 for Unity Basic + the iPhone license.
Marmalade – Formerly known as the Airplay SDK Marmalade is a high quality 2D and 3D game framework including tools that run on both Windows and Mac OS X. Airplay can compile to many different platforms. Airplay utilizes C++ and integrates with Visual Studio on Windows and Xcode on the Mac. The feature list is extensive and Airplay updates frequently to cover new features when Apple updates their SDK. I really can’t say anything bad about Airplay other than that the learning curve can be higher than some of the other options listed.
Stonetrip S3D – This is another full featured 3D game engine that has been used in high quality iPhone games. There is a full featured 3D editor, and many scripts available along with large community support. What’s cool about Stonetrip is that it now works with the Airplay SDK so you can develop using the visual tools of Stonetrip and then port to all the different Airplay platforms if desired. The base cost is 169 Euro, and this includes compilation options for the Mac, Windows, and iPhone platforms — without using Airplay.
SIO2Engine – This is a once open source C++ solution that has now gone fully commercial, although the have kept the text from the old site on an area of their site, and appear to sell code samples for the old version they have ended support for version one of the engine. The new commercial version has added many features such as a windows simulator, and the ability to create scenes in Maya, and still supports features that made the original version popular such as Lua scripting. SIO2 now starts at $365.
GLBasic – This is a suprisingly cool development tool that I found in relative obscurity. It has been used in a number of 2D games already, and I have seen some fairly impressive 3D work being done on this but it does not appear as though any 3D games have been released using GLBasic. GLBasic is very easy to use, and I was rather surprised by the quality of the tool since I didn’t see it being talked about much. The price is 80 euros for the premium version. The only problems I had were that you had to dig through the forums to figure certain things out, I think it would be great if they had much better instructions for those looking to develop on iOS. Clearly there are some people who really know what they’re doing, but it can be hard to find the right documentation.
Bork 3D – This engine is touted by the developer as an engine for programmers. It does not include a wysiwig content editor or scripting langue with pre-built scripts like the Stonetrip, and Unity engines, but does support 3DSMax, Maya and Collada. The excellent Anytime Golf was created with Bork 3D which has terrific graphics. The price is the lowest of all engines available at a base cost of $49.
2D iOS Game Engines
Now onto the 2D Engines. I’m a little hesitant to show these engines since the excellent Cocos2D is an excellent, and proven open source engine, but if you are a programmer and want to avoid programming as much as possible a wysiwyg editor is available with the following 2 engines.
Game Salad – This is probably the easiest game creator available on iOS if you are new to programming. This is potentially a purely drag and drop solution, and Game Salad users are out there cranking out games like crazy which is proof of it’s ease of use. When Game Salad first came out there were performance issues, but with updates to Game Salad itself, and power increases of iOS devices this really isn’t an issue anymore. Publishing to iOS devices is now free at the base level.
Corona SDK – The Corona SDK is a development platform using LUA that has been used in many different iPhone and iPad games and apps. It features high performance, and has really come a long way, and now has a very strong community. There are numerous examples and tutorials available from Corona and other developers. Ease of use and strong 2D performance have made Corona very popular. Corona starts at $199/yr.
Torque 2D for iPhone: iTorque – This is from the makers of the famous Torque engine, and is essentially the Torque Game Builder ported to the iPhone platform. This means that you can use the same tools as the Torque Game Builder in creating your game. With the recent turmoil of Garage Games the cost for iTorque has dropped dramatically now at $99 and you no longer need to purchase Torque2D for desktop in addition to this. What makes iTorque unique is that you get full source code so you have the potential to extend and update at will.
Game Editor – This is an option that I haven’t done too much with. There are some games being made with this, and this is a drag and drop solution. There is an open source option, but you have to pay for iOS publishing.
Adobe Flash CS5 – Flash CS5 has a lot of potential, especially if you’re already a Flash developer. There do seem to be some performance issues, but if you’re a flash developer looking to create a simple game this could be for you. There’s so many options available, but the lowest non-upgrade price I could find that wasn’t for students was $578.
In summary, I’d have to say Unity would be my choice for 3D engines, the community is unparalleled, and upgrades are frequent. If you’re looking for a pure 2D game engine and must have a wysiwyg editor it appears as though Torque 2D is currently the only viable choice.
For those that don’t know Cocos2D is an open source LGPL licensed 2D game engine for the iPhone that has already been used in many games. Mitch Allen has posted a nice list of resources for the open source Cocos 2D iPhone game engine.
My favorites from the list are:
1. iPhone Dev – Which contains a collection of Cocos 2D tutorials for beginners.
2. iPhone App Shared Libraries http://www.clintharris.net/2009/iphone-app-shared-libraries/ – A good tutorial for using static libraries
3. Coloring Sprites With Cocos2D iPhone – an article on how to color sprites.
Check out the full article and the rest of the resources here at: Cocos2D Game Engine
I saw an interesting question being asked by an aspiring iPhone game developer, "Should I use CoreAnimation or OpenGL ES?".
Core Animation is fine for games where performance is not critical, and for new programmers will likely be easy to use, OpenGL is needed for anything else.
Core Animation utilizes OpenGL ES, it is high level, and in my testing works fine in situations where performance is critical.
OpenGL ES is an open standard that is used on a growing number of devices created by a wide variety of companies, and because CoreAnimation is a higher level framework built atop OpenGL ES it cannot provide nearly the same performance.
My opinion is that Core Animation is likely the appropriate choice for games where performance is not critical such as simon says type games, card games, and trivia games. Some might argue that OpenGL ES is easier to use, and it likely is if you’ve studied say.. DirectX.. but Core Animation (and Quartz 2D for that matter) is much easier to do simple effects in, and can be used with existing UIViews.
OpenGL ES is your choice for performance critical games. Which is essentially anything but simple mostly static games like the ones mentioned I above such as first person shooters, flight simulators and the like. You also get the added benefit of potentially being able to port your games to a device other than the iPhone, and there is alot of existing game code in OpenGL that can be converted the other way. That being said for simple, static games for a newcomer to graphics programming my choice would be Core Animation although if you can wrap your head around the tutorials and frameworks on my OpenGL ES resources page OpenGL ES may be for you.
I hope this provides answer for anyone trying to decide whether they should program in OpenGL ES, any opinions from those who have done more with Core Animation than I have would be greatly appreciated.