2Apr/100

How to allow user background music with OpenAL by Mr Jack

Version 1.0 of Alien Swing has no music included, but also won't let you listen to your own music while you play. Since the iPod Touch and iPhone developed out of Apple's successful MP3 playing empire this seems rather suboptimal, so one of the things I've added in the 1.1 update is the ability to listen to your own music. This is actually a very straight forward thing to do, but I spent quite some time time tracking down how to do it, so here, reproduced for anyone else who wants to do it is how it's done: During your setup process, and before you call the OpenAL initialisation code, you need to add the following lines of code:

// Allow their music to play in the background
AudioSessionInitialize(NULL, NULL, NULL,NULL);
 
UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback;
AudioSessionSetProperty( kAudioSessionProperty_AudioCategory, sizeof( sessionCategory ), &sessionCategory );
 
UInt32 allowMixing = true;
AudioSessionSetProperty( kAudioSessionProperty_OverrideCategoryMixWithOthers, sizeof( allowMixing ), &allowMixing );

These functions are included in AudioToolbox/AudioToolbox.h so make sure you're using the AudioToolbox framework and including that header in the appropriate file. The update to version 1.1 of Alien Swing was submitted to Apple on Monday but it's still in the 'waiting for review' state - I'm guessing this is because they're concentrating on getting all the iPad apps reviewed ready for release so it may be a while longer.

5Feb/100

Promo trailer by Mr Jack

3Feb/109

Video (almost) direct from the iPhone by Mr Jack

Video of your game is kinda of a must have promotional tool but unfortunately there is no simple, sensible way to capture video from the iPhone. The earlier videos I posted where taken on a digital camera - but the quality just isn't there, even with a tripod and I don't fancy forking out for a flashy camera just to do that. Another alternative is to run it in the simulator and use software which will capture video from the Mac screen, trouble is with a game like Alien Swing that uses a lot of accelerometer control that doesn't quite work either. Still, making video can't be that hard, can it?

So I saddled up with OpenCV, and started capturing the screen with glReadPixels. Hmm... there's two problems here. The first is that the iPhone port of OpenCV doesn't include the video codecs needed. Bah, problematic, but not that critical - I can capture the screen, write it to the iPhone's flash memory and then knock up a command line tool on the mac to convert from this raw data into a sensible video format. Which leaves problem number 2: it's slow. Really, painfully slow. glReadPixels will capture the screen just fine but it knocks the frame rate down to an unplayably slow speed.

The solution: delta compression. We're fortunate in that most of the time most of the screen is unchanging in Alien Swing, this means I only need to capture and store the changes from the last recorded frame and save them off - a process known in the trade as delta compression. So, after a fair bit of effort I have video recorded from the iPhone device with the game running at 60fps (except during screen transitions and when it saves the captured data off). As you can see from the video below, it's not quite there yet - I've a few glitches to iron out - but the video should give you a decent impression of how the game plays.

26Jan/100

And we’re there… almost by Mr Jack

222 check-ins and a lot of days later Alien Swing is now ready to submit.

Except Apple's site is down for improvements so I can't...

23Nov/092

Games are for fun by Mr Jack

Well I've been working away for a couple of weeks now, and it occurs to me I've not actually explained anything about the game we're making yet. It's a simple 2D physics puzzler, in which you attempt to get across the screen by swinging off objects. There will be two game modes, one consisting of a series of independent puzzles of roughly increasing difficulty, and the other a ongoing challenge in which you attempt to travel as far as possible across linked screens containing a variety of objects and challenges. So far I've been working on the latter of those two modes, but 95% of the code is common to both anyway.

The game has very simple controls, you just touch the object you want to swing off, hold to keep swinging and release to let go. This was initially the only controls I added, and it was enough to make the game both fun and challenging. But on it's first public outing I showed it to a friend who made the obvious observation I'd completely missed: why couldn't you swing higher by tilting the iPod? Doh! Why didn't I think of that? A few minutes of coding later and "tilt swing" was born. Rocking the iPod back and forth makes your character swing higher in a way that feels instantly natural and opens up new areas of game play to be explored.

If you look at the videos we've posted so far, you'll doubtless notice the lack of polish and graphics in the game. This is a feature, not a bug. The more design goes into a game, and the more time spent on level designs and art, the more fixed it becomes because changes mean throwing more and more stuff away. At the moment, it's easy to put new game mechanics - like tilt swing - in, and easy to explore new game designs and modes (today I've been experimenting with levels in portrait rather than landscape orientation). This kind of tweaking and exploration is vital to producing games that are really good fun to play. Whilst the ability to envision how a game will play while its only a doodle on a bit of paper is one of the skills that distinguishes the best game designers; there's no substitute for actually trying stuff out.

Many years ago, when I was still at my first games programming job we were working on a racing game (no, I'm not saying which one it was) in which the tracks were all modelled in Maya (for those of you that don't know, Maya is a 3D art package popular in the games industry). Whole worlds were built around these tracks that had never been anything more than sketchs, polygons were placed, tweaked and textured; whilst over on the other side of the room one of my fellow programmers was busy putting together the car physics, complete with a modelled clutch and drive train. Then, many months later, the tracks were nearing ready and the cars could, for the first time, be dropped onto track.

They couldn't get up the hills with their 70 degree inclines.

But by this point, the tracks had literally hundreds of man-hours invested in them and making changes would have meant weeks of artist time; time we didn't have. So, instead, the car physics got bent and botched until they could get up the hills and, eventually, after a fashion you could race round the tracks. But because they hadn't been - and couldn't be - tweaked and tuned to the way the AI and the physics worked the tracks were too wide, it was too easy to pass and the corners weren't much fun.

That's not a mistake we plan on making, so much of this week will be spent tweaking, trying and exploring designs while the game's still fresh and maleable and before the art has been locked down. By the end of the week we should have the game - sans graphics and polish - playing much how it will when it's finished.

19Nov/090

Using the real kit by Mr Jack

Yes, that's it running on a real iPod Touch. You can see a couple of other bits of progress too, although they won't look like much until I get some real art done. The background is using a test texture loaded from PNG using an .xml described texture page, and you can see the transition between two distinct screens going on - again these screens are described in .xml. That's the basic building blocks of a game, and now it's running on the real kit I can start tweaking it to feel right with the finger control and figure out some sensible level designs.

13Nov/090

Can you tell what it is yet? by Mr Jack

Okay, so it's not really a game yet, but no matter how many games you've written or worked on there's always a little touch of excitement when you first make something that actually behaves like it might someday be a game. The video you can see here is of it running in the simulator, and so it's mouse controlled but it should transfer straight over to touch control when we can start using the real hardware.