Archive for February, 2009

More IPhone fun

Friday, February 6th, 2009

After getting things working on the IPhone I’ve been messing around with a series of further technologies on there.  I had to re-work my assert code as it only worked on a singe thread (oops).  In the end I discovered the way to do this is using Objective C’s selector messaging and then I can run a message on the main, event handling thread.  This reminds me of how in the Java/Eclipse SWT you can add blocks of code to be run later in the same messaging thread.  It’s very cool anyway and makes multi threading headaches appear to disappear somewhat.  I’m starting to really enjoy Objective C as there is a lot of expressive power.  How optimally some of these things compile I don’t know.

After fixing up assert for multi-threads I added in touch and tilt/accelerometer support.  At the moment my game engine simply polls for different input states so I’ve mapped these to the polling kind of architecture.  I’m wondering how best to do this for gesture control though.  I think it’s be nice to be able to define a gesture in some kind of ‘gesture description language’ and then just poll for that gesture having been completed as a single input.  This makes it easy to map inputs across platforms.

For example the Plane Game it would be nice on a PC to be able to drop a bomb by pressing b.  On IPhone though the same could be accomplished by a downward stroke on the touchscreen.  This would mean the underlying game code would be the same – the input library (and it’s configuration file) can handle all the mapping.

I should be producing another version of the Plane Game pretty soon with some advanced features. I’m working towards producing an IPhone version at some point. Also it’s been brought to my attention that the current windows version required the GNUWin32 dll’s for zlib, png and jpeg support. The new version will do away with those requirements.

With that in mind I’ve done some more COLLADA work, I can now import properly regardless of the up axis and once pulled in I’m indexing and then post transform vertex cache optimizing and vertex memory location optimizing my meshes. I soon hope to be able to save out a mesh imported from COLLADA and load it into the game to replace some of my sprites. It will be a nice stepping stone for the library!