Sunday, 29 August 2010

7cache - Geocaching App for Windows Phone 7

Microsoft is ramping up to the release of Windows Phone 7, and they've really been pushing the developer tools recently. The tools for WP7 development are now packaged alongside the XNA Game Studio 4.0 previews. I can see the reasoning behind it - WP7 development is either Silverlight or XNA and you'll use the same tools to develop XNA games for Windows, Xbox and Phone.

What makes less sense is that the Silverlight applications development side of the WP7 tools are also bundled in with the beta, creating an odd mishmash of tools for WP7 apps, WP7 games, as well as Xbox and Windows games development.

If Microsoft were hoping to tempt some of the XNA community over to Silverlight, they've succeeded! I briefly touched on Silverlight back in the 2 beta but I thought I'd have a dip into creating an application for Phone 7. I also intend to explore cross-platform games development for the phone and Xbox at a later date.

I've decided to create an application for Geocaching on the phone. In a nutshell, Geocaching makes use of GPS technology to create a worldwide outdoor treasure hunt. holds a database of "caches" placed by Geocachers around the globe, and provide the data for users to hook up their handheld GPS unit or GPS-enabled mobile phone and go hunting for caches.

The best mobile Geocaching application I've used is Trimble's Geocache Navigator on my Nokia N95. I'd like to get all the features of that particular application into my app, while providing a modern easy-to-use interface that makes the Geocaching-on-the-go experience a pleasant one.

And so I've begun prototyping my first Windows Phone 7 application, 7cache.

It's a good project as it not only exposes me to more Silverlight, but it also makes use of many features of the the phone, including GPS, mapping and (when made available in the API) the compass.

Unfortunately, while I can develop out the application to be as feature-rich as most Geocaching applications out there, I may never be able to release it as a real product. To be of any use, the application must be able to bring in XML data about the caches themselves. In other applications, this happens in one of two ways:

1. The user uploads .GPX waypoint files to the phone, and the application reads them in. Or:
2. The application connects to's API and retrieves cache data directly.

The first method is not possible on Phone 7, because Microsoft is not allowing direct access to the filesystem either by users or third party apps. I was hoping to make use of the rumoured Skydrive integration, but the API is currently limited to retrieving pictures from a user's Skydrive. I could leverage Azure services, but that would require users to go through a Windows application or hosted website to get their GPX files to their phone, which is an unwanted layer of abstraction.

The second method would be ideal, if made their APIs public. At the moment, only selected partners are able to query the Geocache database directly in their applications. They have said they are looking at opening up the APIs to a wider audience in the future. If they do, I'll be waiting with a near-complete solution for Phone 7 users.

Of course, there's other obstacles to overcome - I'll need a physical device to implement real geolocation properly. It's possible to fake it in the current API, but in order to build out the "cache radar" function, I'll need to test on real hardware. Having said that - so far the emulator is doing a great job!

On another note, I should really stop starting new projects!

Friday, 20 August 2010

Dysnomia: The Post-Mortem

Before I begin with this post, I should say that I am more than happy with the successes I have achieved with Dysnomia. I set out in May 2009 to create a game that I could be proud of, and that I would enjoy playing. I had no thoughts back then of making money from selling the game on the Xbox Live Indie Games (XBLIG) service, where my first release Gravsheep had failed miserably.

Dysnomia was born out of a love for '90s Amiga games, and those in the know immediately liken it to Team 17's Alien Breed. I did indeed set out to make an Alien Breed-alike, but there was another much less-known game that I borrowed ideas from. That game, Xenomorph, was a Dungeon Master-like crawler RPG set on a mining outpost. In fact, reading the game's Wiki article it's scary exactly how much I borrowed from it!

So the top-down, alien-shooting arcade action was borrowed from Alien Breed, whilst the parts-collecting and puzzle-like elements were borrowed from Xenomorph. The game's speed and sheer number of enemies on-screen was kind of a throwback to Gauntlet, but that came about naturally as I added in dual-stick shooter controls. Early in development, the right stick was unused and the player could only shoot in the direction of travel. That's one early change I'm glad I made.

I began in May with a design document that gave an initial outline for the game, and gave me something to show to potential artists that applied to my request for help on the Creator's Club forums. I believe that having that document showed artists that I was semi-serious about the game even though I was only offering a 50/50 profit split. I was pleasantly surprised at the number of replies, but at the end of the day one guy stood out from the crowd simply by getting the game idea and throwing out a few initial tilesets, some concept art and a character animation. That guy was Leon, and without him Dysnomia would be nothing more than a long-forgotten Visual Studio project folder.

And so the two of us ventured forth with development. One of the very early jobs for me was to enhance the level editor I had hacked together for Gravsheep so that it could be used to design the levels for Dysnomia. The editor was a simple Windows Forms affair, with drawing handled in GDI as opposed to using WPF or an XNA window. So, not the fastest of editors, but it worked well enough for both myself and Leon to get the levels done.

There are nine levels/floors/areas in Dysnomia, and each one was saved out of the editor as a simple plain text file using 2D arrays of three-digit integers to represent the tiles. Each map has a set number of layers overlaid in a set order. Some of the layers were full-colour tilesheets, others were effects layers. Later on I added in animation layers which were used sparingly, the biggest example being the animated water on the Maintenance level.

If I had to go back and do the editor again, I'd do it in Silverlight to start with. I'd allow for an unlimited number of layers each with a specific effect applied (shadow, reflection etc). I'd allow for multiple tiles to be selected in the tile palette and pasted into the map (large objects made up of several tiles had to be drawn tile-by-tile!). I'd make it a lot more generic too. Like I said though, it did the job and allowed me to focus on the game.

Developing the game itself was a veritable minefield for this amateur developer. Although I've been messing about with games development since the Acorn days, this is really the first serious game that I've attempted. Instead of playing it safe and skirting around issues I knew would be a challenge for me, I ploughed through. I implemented some features in Dysnomia that I never thought I'd be able to write. The one that immediately springs to mind is the pathfinding AI.

I hadn't even considered that the aliens might actually need to be able to find their way to the player. I guess I'd hoped that the Gauntlet-style logic of "move toward player location until you hit a wall" would suffice. Not really, no. It became apparent that some basic intelligence would be required. I knew nothing of the various pathfinding techniques that developers had used over the years, and I only just managed to understand A* after a few days of reading.

Luckily, Roy Triesscheijn has done a lot of work implementing A* in C# and XNA. I was able to leverage his examples as a good starting point. There was an awful lot of work to do to even with that initial code as it was quite allocation-hungry, and of course I had to make it work with my tilemaps. It all came together in the end though, and I could probably write a whole post on how.

There were a number of other challenges that I won't go into detail on here. Performance was a big one, and I learnt how to use the XNA remote perfmon tool and the .NET CLR profiler together to banish allocations and garbage collections. For those interested, I went down the path of allocating everything during load and nothing during the game and it worked wonders.

And so onto the game itself. The game received a number of awesome reviews, which I was so happy with. To see something that you poured so much love into be received so highly was reward enough. It went down fantastically with the Creator's Club members that playtested and reviewed the game. Receiving praise from peers is even better than getting good reviews!

Then the unthinkable happened - Dysnomia placed in the top 20 of Dream Build Play 2010! Leon and I decided to enter the game on a whim, and it just happened that we were mere weeks away from a complete and polished game when the deadline rolled around. That definitely worked in our favour. Although we didn't get a cash prize, Dysnomia became eligible for a place on the "Contest Finalists" section on the dashboard. More on that later.

One of the more common comments about the game is the respawning of enemies. In Dysnomia, the only enemies that are gone completely once killed are the bosses. All of the other enemies are spawned constantly, so there's always something to shoot. Many players didn't like that, and suggested that once the player clears a floor, the respawns shouldn't happen - or at least occur less frequently.

Looking back on it, I agree. If I was doing it all over again now, I could create a more tense and atmospheric game by using spawns more intelligently. Combine that with better use of the lighting system and it could have been an entirely different experience. The fact remains that Dysnomia definitely became more of a standard frantic dual-stick shooter than a story-driven adventure shooter. Maybe next time?

On a more personal level, I would have like to have used the motherboard/device mechanic a lot more. Motherboards in the game were inserted into and removed from devices such as doors, terminals, turrets and switches to power them up and down. The initial idea was to have more of those devices so the mechanic would become almost puzzle-like. If combined with less frequent enemy spawns, more motherboard/device puzzles would have been great. However, I think due to the overall speed of the game the frequency of the puzzles was just right. Any more and the player wouldn't have had time to solve them in between bouts of shooting!

And now to the boring business side of things. Dysnomia cost me around 800 hours of my time, and probably the same of Leon's. We couldn't possibly hope to make enough money to pay us a full wage for that much work. Good job this is just a hobby, right?

I spent around $100 total on assets for Dysnomia. Most of that went toward the sound effects I purchased from Soundrangers. That's right - I created a nine-level, three hour or so long indie game for $100. That's £70, give or take. So if you're looking purely at the bottom line financially, Dysnomia has made about ten times what was spent on it so far.

The music was mostly free-to-use public domain stuff composed by Matt MacFarland. The title track was made by one of the original members of Team Mango (as it existed back in high school), Adam Bartlett. The in-game ambient track was purchased from Shockwave Sound and composed by Bjorn Lynne (who wrote a lot of music for Team 17 and the theme music for Alien Breed 3D).

As I said, Leon agreed to do the artwork based on a 50/50 profit share, and I was lucky to find an artist that has the same passion for making games that I do. Any money we make is great, but it's not our focus at all.

And so, to some numbers. Here's a pretty chart:

Fairly self-explanatory. Firstly, not a great conversion ratio of around 6%. Secondly, you'll notice that huge trough between the end of March and the middle of June. End of march is when we dropped off the Indie Games new arrivals dashboard list after the first ten days or so. We then had very few sales and trials, most of them were driven by the reviews we were getting.

On the 15th June, the game was promoted to the Contest Finalists section of the dashboard, and that's where things pick up again. Sales aren't quite what they were in the first week, but the conversion ratio is similar. We currently average around 4.5 sales/day. I expect the sales to continue this way until we're pushed off the Contest Finalists section sometime next year.

Here's the totals for 19th March - 18th August:
  • Trials: 8002
  • Purchases: 487
  • Purchase/Trial Ratio: 6.09 %
So, we're nearing 500 sales fast. My personal target for Dysnomia was 1000 sales, and it looks like we'll reach it if things stay as they are now. What's more impressive is that 8000 people out there have played (or at least downloaded) my little game!

What makes me a little glum is thinking about where we'd be without the DBP placement. Sales and trials were dire in April and May when we weren't on the dashboard top lists. Even with some great word-of-mouth, we were nowhere. It goes without saying that if we were looking for financial success, XBLIG was not the place to find it with a game like Dysnomia.

I priced Dysnomia at 240msp. It's the price point of a quality XBLIG game that actually wants to sell some copies, which would not happen at 400msp. I think it's a fair price. When we drop off the Contest Finalists section, I'll drop it to 80msp. That's fairly selfish (and probably quite mad!), but it'll be a reasonable experiment to see if a quality game like Dysnomia can make some sales when not on the top lists. Should be interesting!

So there you have it. Dysnomia in a (rather lengthy) nutshell. The best game I've ever made and some of the most enjoyable coding I've ever done. I improved as a developer by an order of magnitude whilst writing it, and will always look back on the process fondly. Financial success maybe not, but a personal triumph indeed.

Thursday, 19 August 2010

Quarterly Report

Oh dear, looks like I reneged on my self-promise to blog at least once a month this year. No great surprise there. Usual excuses apply. So I've decided to make up for it with a series of three posts that will serve as a catch-up on the hectic four months since I released Dysnomia. Whether anyone still reads me, I have no idea. Drop me a comment or something!

Immediately after Dysnomia's release, I launched straight into my next XNA project that is now entitled "Run!". The next in this series of posts will be all about that particular game. In hindsight, I think it was way too soon to leap from finishing a 9-month development cycle into a new project. I had initially decided to take a couple of months and brush up on some XNA bits that I'm not strong at, such as shaders. But instead, I got right on with a new game - simply because the creative urge was still there.

In fact, one new game wasn't enough and I also started working on the engine for what will be the fourth Team Mango game. I'm not ready to talk about that one yet - but there are some cool ideas floating about. The idea was that I would have Run! finished by the end of June, and game four would be a six-month project to launch at the end of the year. That's not going to happen now.

You see, I've decided to grow up and get on the property ladder. Jenna and I started the hunt for a home at the beginning of the year, and in June we found a nice maisonette that's inside our rather humble price-range and put in an offer. That was the end of our six-month property search and we were sure we'd be all moved in by now.

However, after a six-week long wait full of stress, we were rejected by the first mortgage company that we applied to. The rejection was due to a change in circumstance that was bought up in the third week of our application, but for some reason we were strung out for a further three weeks before the rejection came through. Cue mad panic to secure a new mortgage before the vendor gave up on us.

As I write, we're two weeks into our second application, and things are looking way more positive. Keeping everything crossed for a swift resolution and hoping for a completion date sometime in September.

Having our own place will afford me the luxury of a spare bedroom office/studio which I struggled without during development of Dysnomia. Looking forward to having my own space to really crack on with the next two games. One we're fully settled, I'll have much more time not only for development, but also to be a more active XNA community member and maybe even fit in another couple of potential projects I have lined up, including something musical!

So, that's where I've been for the last four months - buying houses and nearly finishing a third XBLIG title. I'm tired, stressed, and in dire need of a holiday - but also extremely positive and excited about the coming months.