Mostly Code

A Cunning Plan

In this post I’ll try to lay out a shopping list for myself of things that need to be done on this project. I’ll try to order them in a rough priority, but obviously the different aspects are all interconnected, and so how I attack the list my be somewhat different.


Colliding with walls, game edge, and other players. Cocos2d supports both Chipmunk and Box2d physics engines, and although they may be overkill for basic collisions, it would be awesome later on to have some tasty physical interactions (I’m thinking dynamic limb removal, N styley ;) ).


Speaking of walls – we need real ones. Basically, I need to come up with a file format for describing the polygonal walls, and level size, so that it can be loaded easily (and perhaps in the future edited by and shared by players). This file format will need to also in some way contain animation info – lights that move are a key aspect of a level, and in the future there could also be animated walls.


…and speaking of lights, the dynamic shadows need to be implemented as well. A while back I managed to get a prototype working in Flash (flixel to be more specific), so I think I have a rough idea of the implementation, but it may be tougher than expected. Also, this is where performance may take a hit, so it may require some optimizing.


Initial steps have been made in figuring out what gesture the player has made, but without having a plan for what sort of gestures are needed, and how they are to be dealt with, I can’t work much more on them. They are closely tied to the combat and movement, and will probably be developed simultaneously.


This is a vital part of the gameplay, and something that needs to be implemented early on, in order to get playtesting sooner rather than later. As this is a 2(or more?) player game, and the iPhone is definitely not a 2 player device (see Networking below) I will initially have to fake the 2nd player’s interaction with some very basic AI. It will probably be an enemy who stands still, and, with random accuracy, attacks, blocks, and parries. It would be great in the future to involve a more in-depth AI, but for the initial scope of this game I think that may be rather tricky (though I’m not saying it is out of the question).


As mentioned above, networking is going to be key to this game. Without it the multiplayer aspect just isn’t going to work. The easiest solution would be to limit the multiplayer to nearby iPhones, using Bonjour or some other solution (I must admit I am far from an expert in this field). This would seriously limit the lifespan and enjoyability of the game. What would be great is to allow games across the net, based on a central server.

It would be cool to start up the game, see a list of all other players (friends highlighted), and choose battles in different arenas. This could give scope for leaderboards and karate kid style championships. Perhaps Apple’s GameCenter gives these kind of features? The logistics of syncing high-speed battles over a laggy network is going to be tricky, but one of the guys in the GameJam team had previously done some work on this. I will have to investigate.


It would be great to have some dynamic and cinematic camerawork integrated into the game. Initially this could be limited to zooming in/out when jumping, and some jarring effects when in combat.


Some of the visuals will be procedural (such as the walls/shadows), but the ninjas will have to be designed and hand drawn. I have some ideas, but will probably start from scratch when I get closer to need real designs.

I would like to investigate making the character’s animation procedural as well – so that all the ninja’s bodyparts are separate components, animated based on the speed/direction of the ninja. This may end up being a large task, but could add a slick, non-repetitive, dimension to the characters movement…. and it would allow for easier decapitation :)


There will need to be menus for getting into a game, and in-game pause and death menus. This can come a bit later in the process, as for now the gameplay itself is the most important part to get right.

Special Effects

These are all bonus effects that could add a great deal to the polished feel final package, but will probably come later in the process. For example:

  • Blood splats that fly in specific directions based on impact.
  • Sparks on sword impact
  • Full screen effects (like blur/distort) when hit or dying.

Sound Effects

Good sound effects are very important in making the gameplay feel solid and satisfying, but as this is on the iPhone it shouldn’t break the game to not hear the sounds. All key sounds (such as a warning when to parry) should be tied to a visual cue.

The music should be awesome, and dynamic if possible – ramping up the tension when the players are close, and going all out when in combat. My vision (if that’s the right word) for the music would be something in the style of these Kodo drummers:

This video was embedded using the YouTuber plugin by Roy Tanck. Adobe Flash Player is required to view the video.

Maybe an electronic edge could work well too:

This video was embedded using the YouTuber plugin by Roy Tanck. Adobe Flash Player is required to view the video.

This was mostly a brainstorming exercise, and the list is by no means complete, but it should help to keep me on track, and not let me get distracted by small details when there are large areas that still need work

The Shape of the Code

Onwards and upwards. I now want to talk about my progress in the code. First and foremost, I needed a 2d engine for the iPhone. After a bit of research, I decided to work with Cocos2d – it seems to be fully featured, has fairly deep documentation, and an active community.

So far (at this early stage at least) I haven’t been disappointed.

It is based on multiple Scenes (main menu/level 1/pause menu…), each containing nested Layers and Sprites (think of them as physical transparent sheets behind the screen, with other sheets attached to them). Getting the structure of these scenes, layers, and sprites, correct early on is vital.

I’m working on the in-game action first, and in this scene there needs to be 2 layers – the HUD and the World. These need to be separated at this point because the World layer needs to be scaled and moved to simulate camera movements around the map, while the HUD should remain static.

The World layer is filled with all entities specific to a level (such as Ninjas/walls/lights – who will all manage their own logic), while the HUD will show the score, the thumbstick, and receive the input (which will be passed to the world objects).

Functionality-wise, the point I am up to now is very basic. So far I have:

  • A Thumbstick implementation (I consider this finalized – a post about this will come).
  • A preliminary Gesture Capture layer (currently only handling single taps).
  • A player controlled Ninja, who moves around the world, based on input from the HUD (the movement-model hasn’t been tweaked yet, and the icon is from
  • A Level (populated with random, non-colliding squares – to be loaded from a file, and collide-able, in the future).
  • A very basic ‘Camera’, which follows the player ninja, and can zoom in and out (its target and zoom will be set dynamically in the future).

As I’m not yet a fully signed up iOS developer (I’m saving my $99/year till the last minute) I’m unable to test the code on a real iDevice, which is a real pain for testing multitouch input. As a solution I’ve been using iSimulate, and so far it does exactly what it says on the tin – and very well too. By adding a single library to your project it will send touch and accelerometer data wirelessly to the Xcode simulator, so you can multi-tap and gesture with the iPhone in you hands, giving a good feel for how it would be in real life.

Next time: a TODO list.

Touching your (ShadowNinja)Monkey

So, to follow up on the previous post, what progress have I made with ShadowNinjaMonkey (SNM) so far?

As there is a fair amount to go into, this will be split over several posts.

Control Design

To start with, I focussed on designing the combat in more detail. In the original Game Jam prototype this aspect really wasn’t thought about properly. Along with the shadow based hunting/hiding mechanic, this is the other core piece of gameplay, and ultimately the reason why you are hunting/hiding, so it should hold a certain amount of depth.

Although by no means a Soul Calibur-style fighter, I’m still imagining a back and forth attack/parry system within the combat, where timing is key, and where you have the ability to charge your attack (with a negative effect on movement speed).

The ninja’s movement is another aspect that needs to be polished. The ability to move with precision when hiding is needed, and also the ability to pounce at the enemy when attacking or when jumping between cover.

Basically, the design principle running through the control design is this: you should feel like a badass all the time. To get this feeling there will have to be a lot of tweaking, play-testing, and fine tuning.

Now, the iPhone/iPad touch interface poses some interesting design opportunities and issues. On the PC it is simple – WASD for movement, and a couple of buttons for pounce and attack. On iOS devices movement isn’t too hard – a classic thumbstick can be simulated easily (I’ll post about my implementation one of these days).

For jumping and attacking, however, there are a large number of options, including taps, double taps, two-finger taps, combinations of taps and holds, and gestures. From my experiments pretending to control a game on the iPhone, it seems clear that using 2 fingers on one hand is fairly awkward, and at most should only be used for advanced moves. My initial guess as to the controls is as follows:

  • 1 tap – Weak attack
  • Hold – Charge attack. Attack on release.
  • Line Gesture – Jump (not sure whether the direction will have an effect)
  • Line when hitting wall – Wall Jump (reverse direction, speed up)
  • Shapes (zig-zag/circle…) – Different attacks

(For now imagine the thumbstick on the left half of the screen, with the right half empty for gestures – this should be user-definable)

These moves can be combined, if you are dextrous enough, and there could even be some special-move combos. It goes without saying (but I’ll say it anyway), all these controls may/will change when there is something to play with.

Enough designing – next step… code.

ShadowNinjaMonkey Awakes

This is hopefully the start of a series of posts about my work developing a game for the iPhone. First, some history…

The origins of this game comes from the Global Game Jam 2010 (a great annual event where teams must design and make a game in a weekend – definitely worth getting involved in).

I had pitched the idea the previous year, but our team finally got around to making it this year. The title was ShadowNinjaMonkey, and the idea in a nutshell is this: black and white ninjas hunt/battle each other in a black/white world of dynamic shadows, where the white guy is hidden in the light, and the black guy is hidden in the shadow. Inspiration for the idea clearly came from here:

This video was embedded using the YouTuber plugin by Roy Tanck. Adobe Flash Player is required to view the video.

The result of the weekend was very satisfying, but the final game was FAR from finished.

You can try the original version here. It requires the Unity plugin, and another player on your local network (you have to enter their IP) – like I said: FAR from finished.

The player was just a dot, his sword only stuck out sideways, it was very hard to control, the combat wasn’t fully thought out, and it would crash if you finished the level. But hunting each other in the dynamic lights and shadows turned out to be a lot of fun, and we ended up winning several jury votes for the best game (resulting in having to make some very confused sleep-deprived speeches – I’m the mumbly longhaired guy at around minutes 7 & 11).

This video was embedded using the YouTuber plugin by Roy Tanck. Adobe Flash Player is required to view the video.

We agreed as a team to work on this further after the Jam, and although we’ve separately investigated aspects of it, we haven’t focussed together enough to produce anything of note (here is an experiment I made in Flash). I’m hoping this will change. I’ve been working on the control logic on and off (in a variety of languages, including flash and javascript), but have finally started to work on what (I hope) is the final iteration.

As mentioned above, the iPhone is the destination for this game. There are many reasons for this… I am working as a Cocoa developer during the daytime, I want to practice iPhone development, it has proven itself as a game platform that works, and there are more opportunities for making some money on the AppStore than in the browser, desktop or console.

So, what is the purpose of this blog? Well, mostly I’m hoping to motivate myself into seeing this through to the end. Also, if this does lead somewhere it will be an interesting log of my thought processes. I will try to regularly update these pages with my progress, game design ideas, artwork, anything really.

Coming Soon… An engine, some code, and some improved designs.

[june 09]

Design, artwork and coding for rock band The HotRats’ official homepage. It uses Twitter/Youtube/Flickr to provide and manage the site’s content.

[july 07]

A large-scale World of Warcraft database site, providing advanced searches of over 25,000 ingame items. This personal project received over 3500 unique visitors daily.

Sit Down, Stand Up – Radiohead

This video was embedded using the YouTuber plugin by Roy Tanck. Adobe Flash Player is required to view the video.

This music video for Radiohead’s ‘Sit Down, Stand Up’ (from their album Hail to the Thief) was produced as a final year individual project for my BA in Computer Animation & Film Special Effects at Bournemouth University. It took roughly 8 months to complete during 2004/2005.

  • Maya 6 / Photoshop 8 / Shake 3.5 / After Effects 5.5
  • Project Report – The project report, worth 20% of the overall grade
  • Mouth Rig test – A simple test of the main character’s facial blend shapes

Roadhouse Blues – The Doors

This video was embedded using the YouTuber plugin by Roy Tanck. Adobe Flash Player is required to view the video.

An animation completed for a 2nd year university project at the NCCA in 2004. As it was an open brief I decided to focus on music analysis, and so I limited myself to using only primitives. The ideas of design and form of Johannes Itten, and also the abstract animations of Norman McLaren were influential in this project.

  • Maya 5
  • Project Report (pdf) - A brief description of my thought processes

All Gates Open

This video was embedded using the YouTuber plugin by Roy Tanck. Adobe Flash Player is required to view the video.

This was a 2nd year group project (2003/2004) for the BA in Computer Animation and Film Special Effects at Bournemouth University, with 6 members in the group. The plot is based upon a Philip K. Dick short story called ‘The Electric Ant’.

My role in the project involved cinematography, lighting, editing, ambient sound, plot outline, and managing the renders. This was a very collaborative project, and we were all involved in most aspects of the production.

The other members of the team were:
Dave Hunt / Tim RidgardeDan Blacker / Alex Wilkie / James Whitworth

  • Music by Godspeed You! Black Emperor
  • Maya 5 / Shake 3 / Premiere 7
  • Project Report (pdf)A very brief summary of the work I put into this project