Archive for December, 2009
Learning iPhone Game Programming
Posted by rad in Game Development, iPhone, Programming on December 29, 2009
Recently I decided to join the Get Rich By Selling an iPhone Game bandwagon. I had several things going against me. First, I’m starting from scratch when it comes to Objective-C and Cocoa. Second, this is completely unrelated to my current work, so I will not be able to port any know-how I gain from work into this new endeavor. Lastly, I still have to maintain my full-time job, and my family obligations, so this will at best get 5-10 hours a week of attention.
After several months of pursuing this inconsistently, my efforts have paid off and I finally am at point where my confidence in building an iPhone game is at about the same level as my confidence in building a web site on Ruby on Rails (my full-time job). I haven’t released a game yet, but I think I’m finally over the steep part of the learning curve.
If you’re planning to embark on a similar journey, here’s some advice:
1. Enroll on an iPhone programming course
I didn’t, but if one was available locally when I was learning, I would have seriously considered it. What I discovered during my learning process was that spending just one to two hours per session (the most I can spare in a day, given my full-time job and family obligations) for learning a completely new language and framework was very unproductive. I got stuck on most of those sessions, then I spent a considerable portion of the next session retracing my steps and figuring out where I stopped during the previous session. I made the most progress when I took a leave for several days from the my full-time job to concentrate on my studies.
Here are the bootcamps I recommend:
Alternatively, you can follow the Stanford CS193P iPhone Application Development class. Video transcripts of the lectures are freely available in iTunesU. The assignments are great, IMHO even better than the iPhone books. I’ve been looking for the Objective-C equivalent of the K&R book, and the lectures and the assignments come closest to it.
2. Go through these books, in order
- Introduction to Cocoa Application Tutorial
- Cocoa Fundamentals Guide
- Beginning iPhone 3 Development, 2nd Edition
- The Objective-C Programming Language
- Coding Guidelines for Cocoa
- iPhone Human Interface Guidelines
- iPhone Developer’s CookBook: Building Applications with the iPhone 3.0 SDK 2nd Edition
If you follow the Stanford CS193P class, you will find these books very useful. The Apple reference docs are your, well, references. The Beginning iPhone book and the Developer’s Cookbook will be helpful if you find some concepts aren’t adequately explained in the lectures or in the reference materials.
3. Get an actual iPhone or at least an iPod Touch
Theoretically it’s possible to build and release an app by just using the simulator, but it’s not recommended. Here’s why:
- You cannot test multi-touch and the accelerometer using the simulator
- You need to be an actual iPhone OS user to be able to understand the UI expectations of your users. You need to actually use an iPhone or an iPod to be able to appreciate much of what’s written in iPhone Human Interface Guidelines
- Apps, especially games, will be much slower on an actual device than on the simulator. You need to verify that your app won’t be sluggish on an actual device
4. Start with a framework
I recommend the cocos2d-iphone framework and the chipmunk physics engine. Both are free and are supported by a healthy community. They may not be the best, but they’re accessible and are enough to get you started.
5. Lastly, always remember to have fun!
That’s what this is all about, right?