Thursday, March 24, 2011

New Things, Old Things, and Old Things Made New

In late September, I started writing an iPhone/iPad game called Creatures & Castles using Monotouch. I decided not to use Objective C for two reasons. One of these was that I wasn't a fan of the syntax and design; it felt archaic and semi-obsolete. The second reason was that by using C#, I had the potential to port it to more platforms with fewer changes, should I feel the need.

My wife recommended that I put it forward for the 2010 Best App Ever awards, and so I did, resulting in a satisfactory second place in the iPad category to Mobigame's excellent Edge. Up until that point, sales had been a fairly flat five sales per day. Following the award, sales peaked for a few days at over one hundred copies per day. Not super, but fairly pleasing.

Anyway, an HTML5/Javascript conversion was suggested to me. I thought that it might be fun to give it a try. The ImpactJS javascript library was recommended as a potential framework for an HTML5/Javascript conversion of the game so I took a look. My Javascript is a little rusty these days, so it took me a while to get my head round it, but so far it's been a dream to use. As long as one stays within the boundaries of what it supports, development is a dream. For some aspects of Creatures & Castles, I'm going to have to step outside those boundaries. I'm not sure how easy that will be, but I suspect any difficulties will be due to be rustiness rather than any defects in ImpactJS.

Anyway, after only three days, I've already got levels with baddies moving around in the correct formations showing up in a browser. No user interactivity as of yet, but that's coming. I made a fortunate choice to store all my level information in xml, so conversion to the ImpactJS Weltmeister level format was as simple as adapting my C# level loading classes to spit out correctly formed JSON level files that load right into Weltmeister. I did have to add some code to my javascript entities to handle features such as waypoints (that define the entities paths), but that was a fairly trivial process.

More tricky will be the tinting. In order to create graphical variety in the original C# version, I used OpenGL to tint levels with different shades. There's no clean and simple way to do that in the ImpactJS library, so over the next day or so I'll be implemented a custom image loader that will tint images as they are loaded. Once this is done, I'll submit it as a ImpactJS plugin for others to use (assuming it's not a total hack).

Creatures & Castles in HTML5 glory.

No comments: