Thursday, 10 June 2010

The Holy Triumvirate of Timesinks

We are passing through a short period of History that scientists and theologians alike will later agree to describe as, "Mentally Busy". This doesn't look set to change over the next six weeks due to Red Dead Redemption, the World Cup and a long overdue house move.

I haven't completed a game since GTA4, so it is fitting that RDR is the first game in two years that has managed to sustain my attention despite the numerous obligations and distractions. It's a very pretty title that manages to be supremely well crafted and horrendously buggy at the same time. Just riding around shooting at wildlife is extremely satisfying. That probably makes me a bad person.

Here's a free tip on how to upset your significant other: Tell her that most of your happiest memories revolve around the World Cup.

Finally, by early-July I should be in a position to shave a whopping 12-15 hours off my weekly commute which will give me, amongst other things, more time to spend working on that pesky game engine thingy.

Saturday, 29 May 2010

Super-Secret Game: Revealed

As tweeted earlier today by @thezombiecow, the super-secret AGS -> XAGE conversion project is Time Gentlemen, Please. Obviously this is massively exciting for a number of reasons:
More accurately, I'm actually working on the demo as a feasibility study and it's going pretty well. The ultimate aim is to get the full game onto Xbox Live. It's a huge amount off work but I'm confident it can be done.

Zombie Cow Studios are currently venturing into the third dimension, with some hand-holding from Channel4, in Privates (read the eye-opening press release here).

Oceanspirit Dennis:

I've actively been working on a few others things that have helped development across the board (finicky things like handling GUI transparency). One is Ben304's mock RPG, Oceanspirit Dennis: Scourge of the Underworld. It's essentially a satire on JRPGs (at least, that was my interpretation). It has since spawned a number of increasingly peculiar sequels, all of which are brain-achingly canon.

An interesting diversion and XAGE's second full conversion - play it online here: http://www.clarvalon.com/XAGE/games/ODennis/

To quote the author: 'Don't play if you're looking for a rewarding experience!'

Ben has also recently open-sourced '!', his well-received comic-panelled, robotic rap-athon. You should all follow @ben_304 and ask him when he finds time to sleep.

Other Stuff:
  • Expressions are supported, in that XAGE now copes with things like cChar.Walk(cChar.X + 10, cChar.Y - 20).
  • RenderTargets are no longer used when no scaling is required, improving performance in certain instances.
  • Silverlight now uses png textures instead of xnb, improving load times and further reducing the xap filesize.
  • Internal Dictionaries are generated in-game during initialisation. This means that, if a room has 300 objects, the engine no longer needs to loop through 299 to retrieve the last object when it is referenced via scripting. Certain methods that were previously using 4-5% of all processor time now use a tiny fraction.

Monday, 26 April 2010

Awakener: Reloaded

With the recent release of Silverlight v4, Awakener has received a small but much-needed update:
  • Right Mouse Button support - One long-running gripe with Flash is that any right click will open a context menu that usually can't be disposed of without selecting an item or, if you're determined not to let the pesky menu win, alt-tabbing your way out of it. It is a relief that Microsoft has opted to allow developers to override the existing right mouse button events to their own ends. No more awkward CTRL + LMB needed.
  • Full Screen Mode - Awakener can now be scaled up and down at runtime (previously just down due to a SilverSprite bug). This means we can now use Silverlight's Full Screen mode, as XAGE will scale the game up depending on the user's resolution.
  • Performance improvements - As mentioned recently, load times in particular are more brisk, although this perhaps isn't as noticeable given Awakener's small size.
These few changes make Awakener feel less like a clunky web app and more like the original AGS incarnation. I'd argue that it's even more intuitive as you don't have to worry about installations etc. Judge for yourself:
I've got a few more ideas for optimisations specifically for Silverlight but for now it's back to adding new functionality. Next up: Expressions.

Wednesday, 21 April 2010

More Optimisations

Talking about optimisations isn't especially exciting, though recent changes have been crucially important to making larger, more complex games viable on XAGE. The super-secret game, for instance, wasn't running at all well on the 360. After a productive weekend it now performs rather admirably, which is a major relief.

Engine - Load Times

Xml serialization is great, but - cripes - it's incredibly slow on the xbox. The main game content was taking in the region of 60 to 70 seconds to load, which might be passable for a Triple-A title but very undesireable for an Indie Game with a short time period in which to make a good impression.

The Automatic XNB serialisation built into Xna Game Studio wasn't really an option, and would have added a an extra layer of complexity to the publishing process. The only remaining solution was to write all data to a binary stream, which is blazing fast and supported on all platforms, but has obvious downsides:
  • You have to write load & save code for EACH class you want persist (at 70+ classes, this is a huge job).
  • Each time you change a class, you also have you to update and test the IO code (adding a painful maintenance overhead).
The eureka moment came from realizing that I could write a routine to generate the C# IO code automatically, and use this to extend my existing classes. I've written a summary of my solution on the Xna Forums.

The load time is now down to about 10 seconds, including all the initial graphics and audio - much better!

Engine - Garbage Collection

As mentioned previously, the X360 garbage collector is also horrifically slow. The super-secret game was causing XAGE to generate 1mb of garbage a second, causing a stuttering that was particularly noticeable when moving the cursor.

Using Collection Pools for the scripting routines and removing some sloppy CopyTo commands have reduced this to about 120k per second, meaning the GCs now occur once every 8 or 9 seconds and are less noticeable. I'll return to this in the future and should be able to reduce it further still.

Editor - AGS Conversions

The scripts are now processed in smaller chunks, speeding up some of the string manipulations dramatically. The HitchHiker's demo, quite frankly, used to take an absolute age to convert to XAGE and now the whole thing takes less than half a minute.

Friday, 9 April 2010

Hodge Podge

This post was started about three weeks ago, which may give some indication of how limited time is at the moment. It's a bit of a hodge-podge of news.

Optimisations

Work has begun on the next AGS game conversion - I'm not really in a position to reveal anything other than to say that it's a super-exciting project (as well as a massively complicated challenge).

Due to its size, some frailties within both XAGE Editor and the engine itself have been exposed. I've addressed some of these accordingly: items for scripts are now selected via dropdowns & lists rather than the previous big shiny buttons, the treeview refreshes a bit more efficiently and conversions have been speeded up after ...

Profiling

Converting small games is reasonably fast, though the process involves a lot of string manipulation and lookups and so takes exponentially longer the larger the game is. This was a problem for two games inparticular, taking anything between 5-10 minutes to convert - not a particularly productive length of time when testing small tweaks and changes.

I've managed to reduce this time by profiling the application. Using a profiler to identify a bottleneck is immensely satisfying. I'd gotten into the bad habit of using ToUpper() a lot when comparing strings, when there's much better performance to be had using String.Compare and ignoring case sensitivity. Other simple changes like using String Builders instead of concatenations have helped speed up the process.

Another useful outcome from profiling is identifying where garbage collection is occurring. One of the benefits of C# is not worrying too much about memory management. The xbox360 Garbage Collector isn't great however, and forces you to be mindful of what you're instatiating within each game loop. As it turns out, some rather innocuous code can be the difference between a game that runs at 2 fps and one that runs smoothly.

There are plenty of further optimisations to be made; XAGE's scripting creates more garbage than I'd like it to. When you have certain scripts with 10+ conditional statements that run 40 times per second, the garbage can quickly add up and cause stuttering. I'm also going to run a few tests using Automatic XNB serialization to improve load times on the 360 (assuming it's possible to do this using MSBuild).

New features

Support for AGS-style custom modules has been tentatively added, albeit in a slightly clunky way (slotted into standalone rooms for now). It's not ideal but it works, and will do until I get around to implementing a more elegant solution.

Other bits and bobs have been added, some of them purely to cater for some legacy AGS design oddities (like having room co-ordinates that operate at different resolutions). I've jotted out a few designs for designs for things like Expressions & Extension Methods so they should be getting rolled out over the coming months.

iPhone Support

Apple's T&C's for iPhone/iPod Touch firmware v4 (I do find it quite odious that they charge for firmware updates!) include the following:

Applications that link to Documented APIs through an intermediary translation or compatibility layer or tool are prohibited.

Sadly, this would appear to rule out developers ever using things like Flash-to-iPhone compilers, MonoXna and MonoTouch. Consequently, it is now looking very unlikely that XAGE will ever support the iPhone. Bah.

On a happier note, Silverlight v4 should be released in a few days so Awakener will shortly be getting an update.

Sunday, 7 March 2010

XNA on Windows Mobile 7

Windows Mobile has never had a good reputation. Microsoft are looking to change that with Windows Mobile 7, which looks very ZuneHD in nature.

The good news is that Windows Mobile 7 will support XNA natively, meaning for the first time XAGE should be directly supported on a smartphone. This is a very different to the proposed iPhone support, which remains purely hypothetical at this stage.

XAGE Awakener has been in the wild for a week and has been received pretty well. I've learnt a few things that will come in useful for future commercial releases. General consensus is that lack of RMB support is a pain, though this should be rectified once Silverlight v4 comes out of beta.

It is a relief to have something tangible to show after nearly two years of development. I feel like Silverlight has been proven to be a viable release platform for adventure games. The next two major milestones are to do the same for the Xbox360 and also release a stable version of XAGE Editor.

I've had a handful of approaches from individuals about working on some other projects, so it will be interested to see if any of those pan out. In the meantime, there's still plenty to be getting on with. Amongst those is, yes, revisiting Awakener. As alluded to in the conversion video, the on_mouse_click function isn't yet handled and all user input is still hardcoded in XAGE. Once this is sorted it should add a new level of usability to other converted AGS games. Other short terms goals include:
  • Cleaning up XAGE Editor.
  • Completing GUI editing.
  • Adding support for OpenQuest's GUIs.
  • Updating The Fourth Wall to the latest version (replacing deprecated actions).

Monday, 1 March 2010

XAGE Awakener - Live

Five months of my spare time condensed into a single blog entry: The XAGE version of Awakener is finished. Huzzah.

You can play it one of two ways (although they're essentially the same thing):
To the best of my knowledge, this represents several firsts:
  • First AGS game to be ported to XAGE (and therefore be playable online & on xbox 360).
  • First public XAGE game release.
  • First Xna-based game to become a facebook app(?).
As always, the XAGE project is hungry for feedback. Massive thanks to Ben Chandler and Bill Reiss, without whom the above would not have been possible. Ta also to all the last-minute beta testers.