CS/INFO 4152: Advanced Topics in Computer Game Development

iOS Development

The iPhone is becoming a very popular game development platform, and is being adopted by most major game developers. Even though the Android has more marketshare, game developers prefer the iPhone platform because the hardware is uniform (instead of fragmented across several devices), and because iPhone owners are more likely to pay for applications. Honestly, if you make an Android-only game, you might as well give it away for free.

The iPad is another exciting reason to develop for iOS. The increased screen size allows you to take advantage of the touch screen in ways that you cannot on the phone. If you design your application correctly, anything made for the iPhone should also work on the iPad as well. With that said, you may make an iPad-only application if you wish; games often work best when you can make assumptions about the screen resolution and input modes.

Before you get started on working for iOS, however, you must have the hardware. We are not providing you with complementary iPhones or iPads. You will need at least one, but it can be shared among the group. You can buy an iPod Touch from the campus store for $200, which is enough.

More importantly, all of the programmers on your team must use OS X. Generally, that means that you should all own Macintoshes. In the past, we have had some developers succeed using Hackintosh, but we provide no support here.

[Developer Program] [Objective C] [iOS SDK] [Cocos2D] [3D Resources]

Developer Program

Even if you have an iPhone, iPad, or iPod Touch, there are other hurdles in developing for this platform. In particular, the free iOS SDK allows anyone to write an iOS program, but you are limited to using the simulator inside of OS X. The simulator is pretty speed, and fine for development, but it is not so great if you actually want someone to play your game.

To load a game on a physical device you must have membership in the iPhone Developer Program (which costs $100 a year). Once you have this membership, you register your device numbers with Apple, and are free to load whatever programms you want (you do not need App Store approval to load on to your own device; that is only for devices other than your own). This is not a huge expense, but seeing as we just told you we could not provide you with free hardware, the costs are starting to mount up.

Fortunately, we can help with this particular problem. We have a membership with the iPhone University Developer Program. This allows you to to load your game on your iPhone, iPad, or iPod Touch without having to have a developer program membership. It also provides us with a "sandbox" that allows everyone in the class to play everyone else's games, though we cannot distribute them outside the class. If you want to be included in this program, please send us your Apple ID.

Warning: Because of how Apple has designed their licenses, you cannot use GameCenter with the University Developer Program; this service is only available to people with the standard (paid) program. That is unfortunate, because GameCenter is the preferred way of supporting game networking. It supports player matchmaking and other nice features. If you want to support game networking without GameCenter, you will need to implement your own server.

Objective C

The primary challenge with iPhone development is programming in Objective C. This is a competitor to C++ that uses message passing and other techniques taken from SmallTalk. It is a bit overwhelming at first, but it is easy once you get started.

Historically, the main challenge for newcomers appears was memory management. However, since iOS 5 (and OS X Lion), Objective C has supported Automated Reference Counting, thus eliminating that sticky issue. While some issues remain, these are general memory management issues common across many platforms; we will talk about these in class.

It is also possible to mix Objective C and C++, though that is a bit advanced (see below). Furthermore, any UI elements in iOS must be written in Objective C, and cannot use C++. This generally means that C++ can only be used in the Model and Controller portions of the MVC software pattern. However, many game developers get away with a single Objective C class and then, using OpenGL ES, write everything else in C++.

With that said, unless you have an OpenGL expert on your team (preferably with CS 5625 experience), you are going to be using the Cocos2D Game Engine. And that means you have to learn Objective C.


The resources below are not specific to iOS. Objective C is useful for general Macintosh development, and it is often easiest to learn the language on that platform first. In particular, it is often best to start with a simple "Hello World" style program before complicating matters with the iOS simulator.

Start Developing Mac Apps Today

This is an extended tutorial that takes you through all of the steps of developing an application for the Macintosh. While the iOS development is a but different, this is an easier way to get started. And in fact, much of the documentation is common between the two platforms. You can safely stop at Human Interface Design, as all of the topics after this point are Mac specific.

Objective C Beginners Guide

This is a very terse tutorial. It is also written completely in bullet-point style which, as many of you know (from my comments on your design documents), is a style that I absolutely hate. But it does have everything in one place, which makes it quite useful

Cocoa with C++

This is a deprecated document about how to mix Objective C and C++. While this was a popular option at one time, Apple is now trying to pretend that it does not exist, and is no longer updating documentation for it. With that said, it is not going away (because the Clang compiler team will not let it), and it is often the only way to do high performance OpenGL ES programming for iOS.

If you go this route, the key thing to understand is that there is no Objective-C++ language, despite what you may have heard. You can call C++ classes inside of an Objective C class, and vice versa. So a common design pattern is to have a single Objective C class that starts the program, which then relinquishes control to all of the other classes, written in C++.

Strategies for Using C++ in Objective-C Projects

This is a more modern document on mixing C++ with Objective C. It assumes that you have read the document above, but it is updated for the newer versions of XCode and iOS.

Memory Management

As we said, iOS now supports Automated Reference Counting, so memory management is less of an issue. With that said, if you are having memory problems, this is an important document to read. This PDF provides a comprehensive overview of how iOS handles garbage collection and other related issues.


Once you know the basics of Objective C, it is time to start working on iOS development. The first things that you need is the iPhone SDK, which is built into XCode 4.5. You can download this for free.

Start Developing iOS Apps Today

This is an extended tutorial that is almost exactly like the Map App tutorial mentioned above. The only differences are the sections Jump Right In (which now has an iOS tutorial) and everything after Human Interface Design (which we told you to skip anyway).

Stanford's iPhone Development Course

Stanford's course on iPhone development is very famous. It is fairly exhaustive for anything that you would want to do in CS/INFO 4152. Stanford has released the lecture notes and examples for this course to the world, free for you to use.

iPhone Game Programming Tutorial (Part 2)

This set of tutorials is a nice example of how to make a simple Pong game on the iPhone. It covers the basic elements of game programming, such as the game loop and various subsystems, and shows how they fit into an iPhone application. This tutorial is a must if you plan to make an iPhone game without using an engine.

With that said, this tutorial is a bit old, and iOS has come quite a ways since that tutorial.

Cocos2D Game Engine

If you want to make a 2D game, we highly, highly recommend that you use the Cocos2D engine as your game engine. This is the simplest game engine available for the iPhone, and has a lot of community support. An uncountable number of indie games have been made with Cocos2D.

In the past Cocos2D suffered from problems due to poor technology choices. It used the horrible Chipmunk Physics engine for physics and some very heavyweight code for rendering. However, the latest version is very robust. It uses OpenGL ES for performant graphics, and the familiar Box2D for physics.

There are a lot of tutorials out there on how to use Cocos2D, as well as an active users forum. Here are just a few to get you started.

How to Make a Simple iPhone Game with Cocos2D

This is an excellent tutorial that tells you everything that you need to get started. The Scene Director in Cocos2D can be a bit confusing, so this tutorial is a better place to start than the official documentation.

Cocos2D and Box2D

While Box2D is not the only physics engine supported by Cocos2D (Chipmunk Physics is still supported), it is an available template. This tutorial shows you how to use this template to use Box2D physics (which you already know how to use) in your game.

However, be warned. Box2D physics is entirely in C++. Therefore, you need to understand how to mix Objective C and C++ (see above) in order to use it properly.

Cocos2D and Storyboards

Storyboards are a really cool way to program for iOS or OS X, as they allow you to drag-and-drop a lot of GUI design elements, and control the transition between player modes. This tutorial shows you how to combine these with Cocos2D, turning the game window into a widget within a much larger interface.

Cocos2D API

Once you understand everything else, you should use this page as a reference.

3D iOS Development

If you want to go 3D in this class, mobile is also an easy way to do this, provided that you know OpenGL. All of the modern mobile devices support OpenGL-ES, which is a stripped-down subset of the OpenGL API. With that said, the requirements for a 3D mobile game are the same as for a PC 3D game; you must have a team member from CS 5625.

Developing a 3D mobile game can have a fairly steep learning curve. While we provide several resources below, you should leverage existing libraries and technology as much as you can.


Even if you use a 3D game engine (like the ones listed below), you will still need to know the basic libraries for 3D development. That means OpenGL ES for graphics and Bullet for physics.

OpenGL ES from the Ground Up

This is lengthy tutorial about using OpenGL ES and how it differs from typical OpenGL. This is an excellent starting point, as it gives a refresher course in OpenGL and how to use it.

NeHE iOS Tutorial (Part 2)

The famous NeHe tutorials are available for iOS as well. These first two tutorials give a very advanced introduction to using OpenGL ES on the iPhone. Be prepared for some hardcode mixing of C++ and Objective C (which is common when programming in OpenGL ES).

Bullet Physics Documentation

Never implement your own 3D physics engine for this course. If you are thinking about it, stop right now. If you implemented one for a previous course (and it works perfectly), that is okay. Otherwise you should use Bullet, which is the best non-commercial 3D physics engine.

With that said, the documentation here is a little sketchy. There are no breezy "My First Application" like you might find with Box2D. And there are far to many TODOs on the documentation page for it to be considered professional. But it is still better than making your own physics engine.

3D Game Engines

There are a few 3D game engines out there, though they are not as popular as Cocos2D. However, they each come with some caveats.


The Oolong engine is a open-source engine out of MIT. It is much more bare bones than Cocos2D. But it uses Bullet for physics and it has direct integration with Blender for 3D models. Unless you plan to do everything (except physics) on your own, we recommend that you check out this engine.

Unity 3D

In the past we have allowed students to use Unity. This engine is no longer allowed in this course. There are several reasons for this decision. First of all, the tool has a lot of ideosyncracies, and development teams often find themselves spending the entire semester trying to beat the engine into submission, when it would have been much easier for them to implement the functionality themselves. More importantly, this is not a middleware-focused design course. If you are going to be programming for a mobile device, we want you writing actual code and not high-level engine scripts.

With that said, this engine is an excellent tool for rapid prototyping. If you wish to use this tool for early prototypes you may. However, anything after the technical prototype should use your final game engine, and not Unity.

Sio2 Engine

This newcomer is an engine that we do not know a lot about, though it has been getting a lot of good press. Its primary advantage is that it is cross platform for both iOS and Android. It also uses the Bullet Physics Engine.

Sio2 has a trial version which is free. However, it says that it works only for a limited number of games and a limited number of builds. We have no idea what that means. In addition, the engine does not appear to have a education version, so the cheapest mobile license is $400.