Saturday, 3 March 2012

Making an iPhone game, tools used

I'm nearly done making Balls Abound, and it's been more work than I really ever could have imagined. I made a lot of work for myself though, starting the game from a prototype with no game aspect being my biggest mistake. But, I digress.


The first tool I jumped on when prototyping Balls Abound, was Blender, a terrific free 3D modeling tool. I had the idea of putting somewhat realistic rolling balls on the screen, so I needed to create some 3D balls. Blender made this possible, though it has a steep learning curve, and every time I go back to it, after even the briefest absence, I am back to the web trying to figure out what I'm doing.

To create the rolling ball effect, I generated 64 images from 64 angles around the circumference of the ball. Blender makes this pretty easy (ignoring the barrier to entry in learning Blenders keyboard shortcuts). Just build a model of a sphere, add some texture, then set the camera to change angle to rotate around the ball.  I chose 64 frames, meaning 64 / 360 is the angle between frames, so the ball roll can run at 60fps if needed. Some balls repeat after half a rotation, for these you can drop to 32 display frames.  I then wrote a bunch of code, in a CCSprite subclass, that keeps track of how far the ball has moved (via setPosition) and updates its displayed frame and rotation angle.  I think the illusion works well.


I used Gimp to create a number of images and effects in Balls Abound. Most notably the signs were created in Gimp, and the waves in ocean and island reflections were made in Gimp. The water effects were created by using the waves and ripples distort filters and varying the parameters based on the number of images being altered. You end up with a series of images that can be played in a loop, with the wave making one full cycle across your animation sequence.


I used Inkscape to put together a number of images, specifically those that make up the crab and pelican animations. Using Inkscape I drew and laid out a number of keyframes for each of the pelican and crab. I then used Interpolate extension (under Generate from path in the extensions menu). You can specify how many steps and an exponent (to simulate easing in or out). Inkscape will then generate a number of objects that transform between your selected key frames. This is labour intensive and I spent a good deal of time generating the pelican and crab animations, but I believe they were worth the effort.

Texture Packer

With all the images generated with the tools listed above I needed something to create texture maps that I could use in cocos2d. I stumbled on Texture Packer and bought it. Point it at all of your images and it gives you a sprite sheet with plist file that can be read directly into cocos2d.


I use PVRTexTool for generating mipmaps and changing encoding of the texture maps I generate with Texture Packer. Very handy.

Audacity & Garage Band

I really like Audacity. Generating sound effects for the game has been a fun challenge. I once watched a short documentary on foley artists in the movies, I tried to copy the what I learned from that brief exposure. I took many balls (ping pong, tennis, basket, etc.) and recorded them bouncing with my iPod. I took blocks of wood and clicked them and slid them. I found rarely did I record anything that didn't require a fair bit of post in order to make it work. Using Audacity you can alter speed, tempo, pitch and all sorts of other properties of your recorded samples. You can make clips that are loopable and isolate the exact bit of sound you require. Garage Band is a great source for samples, and if you are musically inclined you can do that too.


I am using cocos2d to provide me easy access to their sprite model and action framework, among other things. cocos2d has been just a great library to work with, though I have made some modifications and some uglier hacks to accomplish what I wanted with Balls Abound.


I quite like XCode for the most part.  It's autocomplete drives me nuts, and the inability to refactor anything because Box2D is in use (and in C++) is annoying. But otherwise I think XCode is pretty damn good. I really like objective c now that I've wrapped my head around the whole messaging vs method invocation thing, it's a pretty nice language to develop in (if not a little verbose in areas, which could be helped out with a more useful autocomplete function in XCode). All the code I've written in XCode and all my builds are done there too. Sources are checked in locally to a git repository, and backed up offsite. Enough said.

iTunes Connect & Provisioning Portal

Not much to say about these, you have to get online and manage a whole whack of stuff. Advertising setup, in app purchases, and game center leaderboards and achievements are all setup here. And then you have to write a bunch of code to work with it. This is also where you submit your app eventually, hopefully soon...

No comments:

Post a Comment