playMaker

Author Topic: Datamaker reading xml  (Read 2235 times)

elusiven

  • Full Member
  • ***
  • Posts: 233
  • Debt we all must pay...
Datamaker reading xml
« on: June 07, 2016, 06:54:18 AM »
Hi there,

I'm storing my levels in a xml file, in total there should not be a lot of levels, It's all plain text, so it shouldn't take up much space. I am little bit worried about the efficiency of this though.

At the moment I'm loading the xml file with levels for each specific type of mini-game, when that game mode starts, so far i've only had 3 levels, so it's fairly quick. The question is, should I be reading those xml files in start() or on a main camera in fsm, at the beginning and then processing the data or is the file loaded with proxy rather than the function itself (select single node) ? Because if the file is loaded with proxy then I don't need to do anything, but if it's loaded every time I want to access it then I would need to move everything in the start() or something.

What's the most efficient way of doing this?

Thanks

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Datamaker reading xml
« Reply #1 on: June 08, 2016, 04:59:28 AM »
Hi,

 the key is to only read the xml file once at the beginning of your game, then you'll have no problem with perfs.

 I have worked a game where ALL levels where serialized with Xml, and even all user data where saved as xml,

so we where looking at a xml file that was 10K of lines. reads it on IOS in about half a second! so you do that at the very beginning and you are good, All xpath queries thereafter are totally ok to work on big xml, as long as you work with the proper xml representation and not everytime reading from the string version of xml.

Bye,

 Jean

elusiven

  • Full Member
  • ***
  • Posts: 233
  • Debt we all must pay...
Re: Datamaker reading xml
« Reply #2 on: June 08, 2016, 05:06:25 AM »
So what actually loads the file then, is it the proxy or a specific action? At the moment I'm using select single node and then I made one xpath query, so that action loads the xml file or would it be proxy?

And wow, thanks that sounds very promising!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Datamaker reading xml
« Reply #3 on: June 08, 2016, 05:48:03 AM »
Hi,
If you placed your xml in a proxy it will be loaded @ the start of you game by the proxy

If 'select single node' is set to use proxy it will search in the proxy,
If 'select single node' is set to use Variable it will search in the Variable,
If 'select single node' is set to use Plain Text it will search in the Text,

But i believe,

If 'select single node' is set to use Text asset it will load the xml and then search in the xml

elusiven

  • Full Member
  • ***
  • Posts: 233
  • Debt we all must pay...
Re: Datamaker reading xml
« Reply #4 on: June 08, 2016, 12:10:14 PM »
Okay thanks, so all my xml files are loaded by proxy then at the start of application. Sounds good.