Friday 7 August 2009

AGS Conversion Progress

Yesterday was a welcome break from T4W (how long does it take for an acronym to be established?). I spent some time rewriting how XAGE converts AGS scripts. Previously it was a bit flaky in how it dealt with carriage returns and didn't always provide the most reliable results.

Each AGS script is now tokenised, splitting everything up into functions, statements, if, brackets etc. The tokenised script is then converted into XAGE scripts. This two stage process is a lot cleaner and easier to extend. Using OpenQuest as my AGS source, here's a cherrypicked example of where the conversion is currently at. Consider the following AGS code:

function character2_a() {
// script for Character 2 (Lifeform): Interact character

if (sInteractionVerb == sTalkTo)
{
hideGUI();
// have we already met the cleaner? If so, use a different greeting
if (GetGlobalInt(8) == 1)
{
player.Say("Greetings Carol");
cCleaner.Say("You again?");
}
else
{
player.Say("Speak lifeform!");
Wait(40);
player.Say("Is this translation matrix working?");
cCleaner.Say("You're that guy from accounts right?");
}
dCleaner.Start();
}
else if (sInteractionVerb == sSmell)
{
player.Say("This creature has an overwhelming pungent smell");
}
else if (sInteractionVerb == sMove)
{
player.Say("The lifeform is surprisingly sturdy, I don't believe I can use force");
}
else
{
triggerUnhandledEvent();
}
}

The above function now converts automatically to an XAGE script as follows:

Photobucket

The two provide the equivalent 1-1 functionality save for two things:
  1. XAGE doesn't know what 'sInteractionVerb' is (#defined in OpenQuest as Game.GlobalStrings[11]. Whereas XAGE would link each event with its own script, AGS (or AGS developers?) tend to bunch certain events to the same function, which seems unnecessarily complicated - perhaps a throwback to earlier AGS versions).
  2. The conversion process doesn't yet handle AGS functions calling each other (requires an XAGE object running a new XAGE script).
In the future I see a juggling act; trying to keep XAGE's design as clean as possible and yet trying to map as much AGS functionality as possible, some of it outdated and deprecated. It's gratifying nonetheless to watch the OpenQuest opening cutscene running in XAGE, albeit in a slightly clunky, stunted way.

2 comments:

Keith Weatherby II said...

Keep up the good work. I haven't had any time to look at your last versions. I'm making a platformer and it's taking my time, but I'm considering learning AGS to make my adventure game or at least prequels to my big adventure game. My big one I want to do with the full res of the xbox... like 720p, although I still want to make a pc version. So whenever you get it done maybe i'll make my little prequels, and convert it to xage... and then sort of do it vice versa for my big one... (it means doing two versions because you don't have a back conversion but it won't be so hard when I learn your system)... I'm still interested in Xage, so keep it up :-)

Clarvalon said...

The AGS community is active and friendly, so there's plenty of help at hand. It's certainly worth looking at as AGS uses conventions found in most Adventure Game creators.

XAGE to AGS conversion should never really by required, as XAGE also targets Windows PC.

Good luck with your platformer.