DoodleBod and Danger Tank! Updates Complete

Well, DoodleBod has received a major update which now means it’s pretty much where I had imagined it would be in terms of functionality. Disappointingly, none of the ~15 iPhone game review sites selected it for review, and in fact only one of them responded at all. The crushing realisation that I may actually have to spend money to get my games noticed is starting to dawn on me… That said, Danger Tank! still gets about 4x as many downloads as DoodleBod, and is the only one that really sells at all (~3 a month at the moment). I’m considering going back to Danger Tank! for another update to add Internet play, which I think my 130 paying customers may appreciate. Also it would be another fine display of my talents for any potential employers :-) In the meantime I’m starting a new project with some new tech (Cocos2d-HTML5) which is cool, I’ll post about that soon. Turrah!

Physics and Stuff

Hello everyone! Been a long time since the last update, I’ve been beavering away on an update for both DoodleBod and Danger Tank! For DoodleBod, I’ve added some new features and tidied up the multiplayer (Game Center) code. It will be submitted to Apple this week. For Danger Tank! I’ve added a new physics engine, so that the in-game objects react (somewhat) realistically to explosions etc. I used the awesome Chipmunk physics library for this:

I’m just finishing up with the Danger Tank update and it should be submitted at the end of the week. A small update in terms of sales – DoodleBod isn’t really selling at all in it’s current state, but Danger Tank! continues to shift 3-4 units a month. I’m hoping these updates will stir some purchase activity as they’re great improvements to both games. We’ll see.

On a final technical note, it’s worth mentioning that I had some trouble using chipmunk to get my tanks to move uphill properly. Their wheels kept slipping back down any surface that was more than about a 30 degree incline. Thanks to the very responsive admin “slembcke” from the Cocos2d forums, this was solved quite quickly by increasing the wheel friction to 4. E.g.

wheel.shape->u = 4.0f;

I didn’t realise it could be increased past 1.0!

DoodleBod nears completion

Greetings all! That time has arrived, when the fun of creating a new app gives way to the pain of bug fixing and tidying up the UI :-( However, KingChimp’s second release – DoodleBod – is now in final testing and looks like being released almost exactly on KingChimp’s first birthday! Yay!

To follow will be some more iPhone tech tips I’ve picked up on this project (still learning all the time), including:

  • Game Center integration (turn-based matches)
  • Compression (deflate and byte-packing)
  • Cocos2d RenderTextures
  • Facebook integration
  • In-app purchase
  • Ad integration (Mobclix and Admob)

So expect an epic post once DoodleBod is released to the world.

Danger Tank! v1.2 causes small sales spike

Version 1.2 has been out for a couple of weeks, and its initial release caused a small sales spike :-) I’m guessing this is because the free version now gives a few single-player missions to get stuck into. Total sales have now cleared 70 (woooooooooo!) and I’m looking forward to the 100 sales party where I will be spending part of the profits on a celebratory can of Tennent’s Super. KingChimp now has 3 projects in development (count ‘em!) and I’m hoping the first to be released will be available by the end of May. It’s got a social slant to it, so I’m getting to grips with Facebook integration and all that fun stuff. Laters!

The Cat Sat On An Orange And Had Histerics

Writing games generally involves a fair bit of trigonometry. I never really liked it at school but it turns out I did remember one thing: a little phrase to aid one’s memory of equations for a right-angled triangle. In my current project I need to work out a coordinate position based on an angle and a distance – which relate to the angle and hypotenuse of said triangle. Now I realise this isn’t rocket science, but because I’m so generous I’m gonna share my function for returning the coordinates (from 0,0 origin) to a point at an angle and distance:

CGPoint translateAngleDistance(float angle, float distance)
CGPoint returnVal;
returnVal.x = cos(angle) * distance;
returnVal.y = sin(angle) * distance;
return returnVal;

Translating touch coordinates from screen to world using Cocos2d

EDIT: Danger Tank!’s camera feature no longer overrides visit(). Instead, it uses the main layer’s camera object and changes its coordinates to pan around the screen. Zoom is handled by scaling the main layer rather than changing the camera’s zEye value.

After hours of fiddling around and searching forums for a solution to this problem, I’ve worked it out and it’s fairly simple. What needs to be done is to calculate the touch’s screen coordinates as a proportion of the screen’s width and height, then apply that to the visible section of the world (between the horizontal and vertical clipping planes). My game at present does camera plane calculations manually by overriding the visit() function of the main layer and doing some magic with glOrthof(). The camera I use is actually just a dummy layer, using its position for the camera position and the scale property for zoom. Clip planes are then calculated as follows:

glOrthof(cameraLayer.position.x – SCREEN_WIDTH / (2 * cameraLayer.scale),                    cameraLayer.position.x + SCREEN_WIDTH / (2 * cameraLayer.scale),             cameraLayer.position.y – SCREEN_HEIGHT / (2 * cameraLayer.scale),             cameraLayer.position.y + SCREEN_HEIGHT / (2 * cameraLayer.scale),

The following code will translate a touch to world coordinates using the method described above:

CGPoint touchRatios;
touchRatios.x = currentTouch.x / SCREEN_WIDTH;
touchRatios.y = currentTouch.y / SCREEN_HEIGHT;
currentTouch.x = (clipPlaneLeft + SCREEN_WIDTH / 2) + (clipPlaneRight – clipPlaneLeft) * touchRatios.x;
currentTouch.y = (clipPlaneTop + SCREEN_HEIGHT / 2) + (clipPlaneBottom – clipPlaneTop) * touchRatios.y;

The clipPlaneX values are calculated as shown in the glOrthof() call above, where they are shown in left, right, top then bottom order. -1000 and 1000 are the near and far planes, these seem to work fine for my needs.

Mmmmm, Clouds

Hi everyone, the terrain generation algorithms and parallax scrolling for the main game arenas are now pretty much done. Here’s an exciting screengrab from the simulator. For those who don’t know, parallax scrolling is a 2D technique to give the illusion of some depth by moving the background at a different rate to the foreground. My elegant solution is that whenever the camera moves, the background (sky and clouds) move at half the speed in the same direction. Adding further layers that move at different fractions of the front layer gives an even greater illusion of depth!

An early finished version of the main arena