Author Topic: [Idea] A generic storage plugin.  (Read 250 times)  Share 

Calin Leafshade

  • AGS Project Admins
  • Long live King Cat!
    • I can help with AGS tutoring
    •  
    • I can help with voice acting
    •  
  • Calin Leafshade worked on a game that was nominated for an AGS Award!Calin Leafshade worked on a game that won an AGS Award!
[Idea] A generic storage plugin.
« on: 14 Sep 2012, 17:34 »
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
  1. <Items>
  2.     <Item>
  3.         <Name>Potion</Name>
  4.         <LongName>Potion Of AGS Mastery</LongName>
  5.     </Item>
  6.     <Item>
  7.         <Name>Poison</Name>
  8.         <LongName>Poison of Unfinished Games</LongName>
  9.     </Item>
  10. </Items>
  11.  

Code: Adventure Game Studio
  1. XmlFile *xml = XML.LoadFile("MyFile.XML");
  2. XmlNodeList *list = xml.SelectNodes("/Items/Item");
  3. int i = 0;
  4. while (i < list.Count)
  5. {    
  6.     XmlElement *ele = list.Item[i].GetElement("Name");
  7.     Display(ele.InnerText);
  8.     i++;
  9. }
  10.  


Thoughts? Useful? Not useful?

Leon: You need the sword first before you can get the monkey.

SSH

  • Flying round the world at the speed of haggis
    • I can help with scripting
    •  
  • SSH worked on a game that was nominated for an AGS Award!
Re: [Idea] A generic storage plugin.
« Reply #1 on: 14 Sep 2012, 17:55 »
Compile time? Is that do-able with the plugin system?

Presumably there is a standard XML parser somewhere you can reuse and adapt?

Calin Leafshade

  • AGS Project Admins
  • Long live King Cat!
    • I can help with AGS tutoring
    •  
    • I can help with voice acting
    •  
  • Calin Leafshade worked on a game that was nominated for an AGS Award!Calin Leafshade worked on a game that won an AGS Award!
Re: [Idea] A generic storage plugin.
« Reply #2 on: 14 Sep 2012, 18:01 »
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.

Leon: You need the sword first before you can get the monkey.