Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Calin Leafshade on Fri 14/09/2012 17:34:00

Title: [Idea] A generic storage plugin.
Post by: Calin Leafshade on Fri 14/09/2012 17:34:00
One thing that AGS does fairly poorly is user data storage. The Lua plugin alleviates this to some degree but I think a non-lua solution would be useful.

So how about a generic XML reader where users can add xml files to a project which get compiled and obfuscated at compile time and then AGS deserialises them at runtime. Something like this.

Code (xml) Select

<Items>
    <Item>
        <Name>Potion</Name>
        <LongName>Potion Of AGS Mastery</LongName>
    </Item>
    <Item>
        <Name>Poison</Name>
        <LongName>Poison of Unfinished Games</LongName>
    </Item>
</Items>


Code (ags) Select

XmlFile *xml = XML.LoadFile("MyFile.XML");
XmlNodeList *list = xml.SelectNodes("/Items/Item");
int i = 0;
while (i < list.Count)
{   
    XmlElement *ele = list.Item[i].GetElement("Name");
    Display(ele.InnerText);
    i++;
}


Thoughts? Useful? Not useful?
Title: Re: [Idea] A generic storage plugin.
Post by: SSH on Fri 14/09/2012 17:55:34
Compile time? Is that do-able with the plugin system?

Presumably there is a standard XML parser somewhere you can reuse and adapt?
Title: Re: [Idea] A generic storage plugin.
Post by: Calin Leafshade on Fri 14/09/2012 18:01:47
Well it would be similar in operation to the lua plugin whereby an editor plugin deals with the editor stuff (including compilation) and the runtime plugin reads that data back into the engine.

I assume there is an xml parser but there would be the serialisation and obfuscation and stuff to to handle as well. The actual parsing would be the easy part.