iPhone Game Development…
Flushed with getting my apps on the Apple App Store I decided to try my hand at writing a game on the iPhone. Â I’ve done game development in Java as the Sudoku game I posted in an early post shows. Â So given games seem to be very popular on the iPhone I’ve decided to give it a try.
Its a steep learning curve as I’m still new to Obj-C and now I’ve got to include OpenGL ES. Â All my Java games were built on top of LWJGL which is an OpenGL wrapper for Java, but I also used a framework on top of that called Slick which removes you even further from the OpenGL side of things.
Nothing really exists like that for the iPhone which I have found, so I’m having to get to grips with OpenGL ES. Â There are a lot of resources our there for OpenGL and I’ve found some for ES as well. Â ES contains a reduced feature set so whilst a lot of standard OpenGL will work ok, there is a lot that wont. Â OpenGL ES does not support glBegin, glEnd or GL_QUADS for example….still learning what they do anyway ;o)
So where have I got to…well I started by checking out the CrashLanding example app which Apple provide. Â This is a simple game but provides a HUGE amount of clues as to how to put things on the screen and generally get an OpenGL app up and running. Â I spent some time taking this example apart to see how it works and then trying some of my own code within it. Â This took some time but I ended up having a reasonable idea of how it worked.
I then created my own project using the OpenGL ES App template in Xcode. Â I then copied over the classes from the Crash Landing app which I needed. Â These include the sound engine for playing your game sounds (which I had already used in iServant Bell) and also a convenience class called MyEAGLView. Â This takes a UIView and places OpenGL specific functions within it for switching buffers etc so plenty of the deeper elements I don’t need to worry about at the moment.
I also took a copy of their Texture2D class. Â This allows you to take a UIImage or some text and turn it into an OpenGL texture and then render it to the screen. Â This is a great little class and works well. Â I’ve added to this myself which I’ll go through in a later post.
Having done all of this I now have a framework in which I can start to develop my first game. Â Currently I have got my own ship moving around the screen using the accelerometers and also have it firing when you tap the screen. Â This has been much easier than I thought and I’m now starting to create more framework type functions so I can add animation etc.
I’m thinking that I will share my code and create some tutorials to follow what I am doing. Â If anyone thinks this would be useful just drop in a comment. Below is a small video of what I’ve got so far. I’m working on getting the basics needed to make a game and then I’ll work more on the game concept and graphics etc.
Mike
7 Comments
mike on February 18th, 2009
Hi matt
I’ve been working on getting the basics working for what would be needed for a game such as spritesheets and animation. I’m them going to get the tutorial done on the basics of setting up a project which will let us build the other items we need.
I don’t have a date in mind at the moment as the day job is hectic, but I want it to be sooner rather than later and will be working on it this week.
Mike
mike on March 1st, 2009
The first Tutorial is finished and will be posted in the next couple of days.
Mike
Ant1 on March 28th, 2009
Just wanted to say excellent tutorials and cool app!
Thx for all the help
Looking forward to your next tutorial!
blindsidew on July 15th, 2009
I couldn’t found the CrashLanding example… I tought it was at the dev center..
mike on July 15th, 2009
Hi blindsidew, Apple did pull the Crash Landing source a while ago. The sound engine was not longer supported and recommended for use. I have a copy of the source though if you would like it.
http://www.71squared.co.uk/iPhone/CrashLanding.zip
Mike
yotes on July 21st, 2009
Men, i loved your first tutorial, and the good think is that there are a 9 more, i supose that ill spend all night.. you are great, keep doing this :D
(sorry my english :P)




matt on February 17th, 2009
cool man, nice work. when do u plan to release the tutorial?