The first Quest-powered smartphone app will be released soon. It is an updated version of Tim Hamilton’s The Things That Go Bump In The Night, currently one of the top-rated games on textadventures.co.uk, and will be available for both iPhone/iPod Touch and Android devices.
That’s the theory, but it has taken a bit longer than I initially expected to get this first app ready for release, for reasons which I’ll go into below. The good news is that subsequent conversions should now be much quicker and easier.
The first step was actually a pre-conversion – the app converter works with games written for Quest 5, but Tim’s game was written for Quest 4, which is effectively a completely different system (although sharing some of the same design). So the first thing to do was convert a Quest 4 game into a Quest 5 game.
I wrote a converter application which converts most of a game correctly, although there were still a few manual tweaks to do – even some Quest 4 bugs to emulate! What really helped was to have a complete walkthrough for the game – Quest 4 has a “transcript” feature which is similar to Quest 5′s walkthrough feature. This meant I could have Quest 4 and 5 automatically play the game through to completion, and compare the output, fixing things as I went along.
I then sent Tim the converted Quest 5 game, and he made a few more tweaks and corrections. He also adapted the game to make better use of hyperlinks – something which is really important for the smartphone version of the game. Tim’s enhancements mean it is possible to play the game through in its entirety, without having to type anything.
By the way, now that I have an internal Quest 4 to Quest 5 conversion tool, please get in touch if you have an old game you’d like to convert. The conversion isn’t perfect (which is why this won’t become part of Quest itself), but it can get you most of the way.
Being unable to block the thread to display a menu meant that I had to rewrite the parser, as this often needs to display menus to resolve the typed-in object names. I drew myself the diagram below and almost descended into insanity in the process:
So, that was annoying, but it’s actually a better design for the future (especially when playing a game via the web, as the server will no longer need to keep a thread hanging around if it’s waiting for the user to respond to a menu).
Eventually I had a pure HTML/JS version of the game which could be played in any web browser. I implemented the walkthrough feature to verify the game was working correctly, and again I sent it to Tim so he could check for any “off-walkthrough” problems.
Now the game was working in HTML/JS, it was straightforward to wrap it in Phonegap and create a functioning app. Even here there were unexpected problems – although the app ran at a respectable speed on my iPhone 4, when I ran it on my old iPhone 3G I was horrified to find that it would sometimes take 10 seconds to respond to a command. The fix was again some re-engineering of Quest 5 and the Core Library, this time adding the ability to cache regular expressions, and improving the performance of the scope functions.
The desktop/web version of Quest 5 saves games by writing out the entire game state. The JS app version takes a different approach, saving a delta instead – only changed attributes are saved to local storage. This is quicker, requires much less local storage, and also means that the app can be safely updated without breaking existing games. The delta is automatically saved after each turn. Again I found some performance issues here, so it took a bit of time to get this right. With a Phonegap app on the iPhone, you get no warning if your app is going to be terminated, so I had to make saving robust enough that it wouldn’t break things horribly if the game started saving but never finished (instead, there are effectively two save slots that are used alternately, so the worst that can happen is you lose one turn).
By now I had the game working pretty well on iOS, and sent it to a few beta testers using TestFlight, which I highly recommend as it takes much of the pain out of ad-hoc distribution on the iPhone. I thought it would be a good idea to get it working on Android too, and I was pretty pleased when only two days after I took delivery of the cheap but surprisingly capable Samsung Galaxy Ace, I had a version that worked on that too.
I was pleased with the overall Android development experience – it seems so much more developer-friendly than iOS. The documentation is laid out in a way that a mortal can understand, and it’s so much easier to send a build to beta testers – just email an APK file. Much more pleasant than dealing with certificates and distribution profiles on iOS.
So it is now ready – the first Quest-powered iOS and Android app, which is also my own first app for these platforms. The iOS version has been submitted to Apple, and I’ll submit the Android version as soon as it’s approved, so both versions will be available on the same day – watch this space!