Posts Tagged ‘game’

Solar Balls game for iOS

Tuesday, May 8th, 2012

solar balls iphone
Today I released my first game for iOS. It is called Solar Balls, and is a simple arcade game where you have to flick coloured balls into the correctly coloured target. The game has:

* 16 mission levels
* 3 bonus levels which become unlocked when your score is high enough
* An arcade mode where you just have to get the highest score possible

The aim of the game is to save the Earth from the Solar Balls. They are heading towards our planet, and the only way to prevent them from destroying our planet is to fire them into the matching targets.

Game background and technical information

I wrote this game for fun, and to learn some iOS programming. It is built on top of the Cocos2D game framework. I tried first coding it using UIKit, but it was far too slow once I had more than 5 balls on screen at once.

solar balls ios 1

Cocos2D is built on top of OpenGL and was easily fast enough to run at 60FPS on my 2G iPod Touch even with 20+ balls on screen.

I did mix in a bit of UIKit for the menu buttons, and also to construct the sprites. Cocos2D has no easy way of drawing simple anti-aliased shapes such is circles, or dotted lines. I therefore drew these offscreen with UIKit and then imported the image data into a Cocos2D sprite.

solar balls 2

The physics is coded using Box2D. Originally I wrote the ball bouncing and collision code myself, but once I started adding angles and obstacles into the level it became obvious that I really should just use a physics engine to save me a lot of pain. As Box2D is written in C++ this has the knock on consequence that any parts of the game that interface with it also have to be written in C++ instead of Objective C.

I used the Particle Designer tool to make some of the explosion particle effects.

The game sounds use the OpenAL framework for low latency, and the background sounds use the simple AVAudioPlayer. I used the Finch wrapper to simplify using OpenAL, but had to customise it to handle automatically pausing/restarting the audio when necessary (e.g. if an incoming call occurs, or the game is backgrounded).

I found that the audio was the biggest user of memory. I had to re-convert many of the samples to lower bitrates to reduce the app size. Also I found that it was best to completely unload all audio and the audio framework if the game was backgrounded. I then reloaded all the audio again if the game was brought back to the front.

I’m not an audio or sound person so I made use of free images and sound effects. For the background I was able to make use of NASA great collection of copyright free images. As an extra touch I added information about each of the images to the start screen of each level (click on the level location at the bottom to see it).

It can be time consuming to produce multiple sets of images (original iOS screen resolution / retina display / menu buttons), so I wrote a script using ImageMagick to automatically convert each source image into the correct resolutions and to give them the correct names.

The sounds all come from This is a great resource for free game audio, but make sure you understand the licence terms for each sample. They have several different licences in use on the site.

XCode was really easy to use, as was debugging on hardware. In fact debugging on hardware is just as easy as debugging on the simulator which certainly encourages you to continually test on the real hardware.

Update: Solar Balls is not currently available on the App Store.

Atomic MIDlet game

Friday, July 4th, 2008


Atomic is board (but not boring) game where the idea is to take over the game board. You can do this by placing atoms into empty squares or onto square that you already control. If a square reaches its atomic capacity then it will explode causing the atoms to fly into the neighbouring squares. If any of your opponents atoms are in the neighbouring then they will become your atoms.

Any time a square reaches its atomic capacity it will explode. This can cause long chain reactions that can have a dramatic effect on the state of play.


Atomic Download (43kb)

The Atomic game is available to download from the above link.


Use Up, Down, Left & Right to move the current square position. Fire places an atom.


This game is best played against human oponents. Up to four people can play. However you can play against the computer as well. From the options screen just choose how many humans and computers you want in the game. If you are playing against the computer then you can set the computer's intelligence level.

Technical Guff

Atomic is a MIDlet (similar to a Java Applet but for mobile phones). It can be played on MIDP compatable devices or emulators. This has been tested on Sun's Reference Implementation (available with the Sun Wireless Toolkit) and with the MIDP add-on for the Nokia 9210. This is a colour game with lots of images so you ideally need a fairly powerful colour phone.


1.0.1 13/04/02
Thread logic is hopefully slighly better. There should be less chance of deadlocking the game.
A 'Shaky Balls' option has been added
Clearer indication of whose turn it is
Larger board

1.0.0 04/03/02
Base version of the game.


Atomic is based on an Amiga game called Atoms by Tom Kuhn. This version is very similar to the original but with the addition of computer players.