Working on an iPhone Game: Days 1-3
Posted on 19. Sep, 2009 by Wes Comer in iPhone Dev
I’ve had a lot on my mind lately. Namely a tumor (rimshot, please!). One of the other things is an iPhone game that I hope to rapidly develop, submit to the AppStore and then get fabulously wealthy from. I’m going to document my efforts here so that:
- I’m held accountable (now that I’ve admitted to the great cosmos that is the internet that I’m working on this, the inevitable “when’s it going to be ready?” will be bandied about and I’ll feel the required pressure to actually finish it)
- So I can remember how I did all this for the next time, since I’m learning as I go, and
- So I can maybe help others that are out there hoping to develop games for the iPhone.
Here’s the progress I’ve made so far. If you’re not interested in this stuff, feel free to skip this whole post, ’cause it’s about to get geeky up in here.
DAY ONE
I’ve discovered that there’s an astonishing lack of cohesive information when it comes to iPhone programming. Specifically where it pertains to gaming. That said, it’s a bit like saying that there are no good recipes for food. If you Google “how to make food” the results won’t be nearly as specific as “how to make meatloaf”. Games and applications are so unique and varied, that it’s difficult to say “THIS is how you make a game” because “game” can mean a lot of different things. What kind of game? Is it 2D or 3D? Puzzle based or side scroller? The kind of physics involved? And the list goes on and on.
So when I say “day one”, I should probably admit that I’ve spent time over the past couple of months trying to figure out the best path forward, and started this day with a bit of an advantage. That said, it wasn’t much.
Alright, so day one consisted of some decisions and a little action. First, the decisions. I know that my game will be a 2D (flat artwork) based game that requires minimal or no physics. That means that I can exclude some of the WYSIWYG type editors that are available for iPhone such as Unity (used primarily for 3D). This stinks because I don’t know how to code outside of the web-based stuff that I do normally. There is a 2D game engine called iTorque or iTGB (depending on the day you check their website…the name seems to change) but it doesn’t seem quite ready for prime time (if you dig a little in their forums there are a number of posts that talk about the fact that games still require heavy hand coding after using the editor to get the game up and running and approved). For a price tag of $1,250, that won’t do.
So that basically leaves me with the task of learning C, Objective-C, and then the other graphics languages and coding practices for things like OpenGL, Cocoa, and Quartz. Or does it? Enter Cocos2D. I had downloaded this some time ago, but didn’t know how to use it properly and assumed it was junk since it was a little-known open source project. However, when you do any amount of research at all on iPhone game dev, you’ll see Cocos2D pop up over and over again. In a nutshell it’s a 2D gaming engine for iPhone games that takes some of the bend out of the learning curve. There’s no visual editor (yet), but it’s a pretty straightforward and semi-well-documented language.
The problem is that Cocos2d is easy if you know a flavor of C, but still a tough cookie to break if you don’t have a programming background. So there are two books that I’ve armed myself with as I begin this journey. First is “Learn C on the Mac” by Dave Mark, and second is “Learn Objective-C on the Mac” by Mark Dalrymple and Scott Knaster. These are not fun books, but they are great for their purposes. I haven’t finished these books, but plan to utilize them as I try to figure out how to program my game from the few tutorials and resources available out there on the web.
I decided to start out with what I know – the graphics. I created a menu screen, a test game screen, and a few little characters that I want to be the baddies. (This isn’t a small step, and if you don’t have experience in creating graphics, this will be a big hurdle to overcome with your game. I suggest you find someone that offers their graphic services and knows something about the iPhone platform.)
After finishing the graphics, I decided I needed a small victory on the programming front before I became overwhelmed with the whole prospect. (And it IS overwhelming when you start to do the research.) I stumbled onto this great tutorial from Monocle Studios that shows how to use and install Cocos2d with XCode (this is now outdated with the newest edition) and then add a menu, a game scene, and the ability to jump back and forth between them. This was just the right thing to do since I had my graphics, and I have to say that I was super pumped after I finished the tutorial. The program compiled and worked like a champ in the iPhone simulator. Time to call it a day.
Day one recap
Learned I’ll need the following tools to complete my game: a Mac, XCode , Cocos2D, great looking graphics, and a subscription to the Apple iPhone Developer Program (so I can test the app on my phone). I ended the day by paying my $99 fee to Apple and waiting for approval to join.
DAY TWO
I experienced what I’m sure will be my greatest frustration with the whole process – version control. I had just updated my laptop to Snow Leopard, so I had the newest version of XCode. Unfortunately, I only had the iPhone 3.0 SDK from Apple since I had been a non-paying member to this point, and needed 3.1 in order to test my app on my phone. Once I received my email of approval that morning, I went to download the newest SDK and then waited (for a loooong while) for the 2.2GB download to complete.
Once I did, however, it worked perfectly on the phone. There’s something special about going from knowing almost nothing 24 hours ago, to having screens and a menu you can touch on your phone. That said, I know I’m still a LONG way from having a game at this point.
As I was researching my next step on the Cocos2D website, I realized that I was using an older version of the engine. The Monocle Studios tutorial calls for version 0.7.2, and the newest version was 0.8.1. I downloaded the new version because it comes with a lot of great improvements. Namely, you don’t have to import Cocos2D into each project. You can run an installer script and then choose “Create New Cocos2D Project” from the XCode menu.
Here’s where it went south. After copying my game files over from the 0.7.2 version to the 0.8.1 version, the game wouldn’t load. It crashed on launch, and so the remainder of day two was spent trying to chase down the problem. End result? I never figured it out, and resigned myself to finishing the game with 0.7.2 so as not to slow myself down.
DAY THREE
After a good night’s sleep, I decided to just start from scratch and redo everything in the new 0.8.1 engine. After all, if I’m going to do this, I need to do it right. After a few hours of working I had it figured out and everything was running smoothly. I now had a main menu with a “start game” link, and the game scene that loads when you press the button.
The 0.81. version of Cocos2D added in a REALLY nice looking logo screen featuring the new Cocos2D logo from Michael Heald. The previous Cocos2D logo was horrible, and frankly one of the reasons that I thought the project originally was unprofessional. As a graphic designer, I fell in love with the new coconut character that Michael had designed.
The only problem that I had was that the logo screen was vertical, whereas my game screen is horizontal. To change the screen I had to use one of the provided horizontal logo screens and rotate it in Photoshop. I’ll explain this in a later post.
I finished out day three by figuring out how to layer the components of my game scene (so the bad guys could come from behind an object, but on top of the background) and add in a bad guy. He doesn’t do anything yet, but he’s on the screen and that’s good enough for me. Time to call it a day.
So there you have it. I’m on my way to making a ridiculous game that will hopefully help to offset any of the extra expenses associated with my upcoming surgery.
GAME PREMISE
Finally, I thought I’d share with you what I’m up to. The game is “Tumerz:Rise of Neuroma” (yes, I’m going for the stupidly overdramatic approach). With all the talk of brain tumors and surgery and options and blah blah blah, I came up with a simple game concept. There are tumors (or tumerz, if you will) of different sizes and color trying to reach the game’s brain. You have controls at the bottom of the screen that zap the tumor of the same color. So to destroy the blue tumor, you press the blue pill, green tumor, green pill, etc. The tumors will come from the top of the screen in “heats” of 15-20 per round, and your goal is to keep them from reaching the brain. Each round gains speed, and increases the number of tumors coming down. The game will (hopefully) feature local scoring so you can compete against your own best score, and global scoring where you can compare your score to others playing the game around the world.
It should be great fun, and I look forward to sharing my progress with you as I go. More soon…





Working on an iPhone Game: Days 1-3 | wescomer.com | IPhoneMate
29. Sep, 2009
[...] the original here: Working on an iPhone Game: Days 1-3 | wescomer.com Share and [...]