playMaker

Author Topic: Data storing question - please help  (Read 1948 times)

elusiven

  • Full Member
  • ***
  • Posts: 233
  • Debt we all must pay...
Data storing question - please help
« on: November 17, 2016, 09:46:19 AM »
Hi all

I am storing data for my game in a XML file at the moment... I do have a feeling though like it's going in a wrong direction, mainly because the XML file will look like a massive mess when it has more than +100 lines.

http://pastebin.com/6tK105gQ   - heres my xml file

It's an educational app... Something like Duolingo.

So the structure is fairly simple.. The app will have 3 difficulties, within those each 3 difficulties there will be 12 categories, and then in each category there will be from 2 to 5 lessons and within lessons there will be about 7-15 challenges.

Categories will have an id, to know which one it is, and then image to display and whether its unlocked or locked (for iap, is that a good idea??).

When user clicks on a category, it will bring them to lesson menu, and then clicking on a lesson it will make player go through a various set of challenges, something like mini-games.

I am open to suggestions, mainly looking at XML, CSV, JSON. I will update the app reguraly with new content, so it's important to change and add data swiftly. Is XML good enough for that, and is there anything I can do to not make it look too messy, maybe split those in different files or something?? Also this asset package caught my eye:

https://www.assetstore.unity3d.com/en/#!/content/18480     - would this be any good to what I want to do?

At the moment I'm using XML, and it works, it's just that the scaling sort of terrifies me, let's say that I place the file online, and then I can edit it, and each time the app opens it downloads the new version of the file.. but what if some content writer makes a mistake in the xml file or something.. It just seems very uncontrollable..

Also, does my XML file look correct, or did I mess it up completely?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Data storing question - please help
« Reply #1 on: November 18, 2016, 02:01:05 AM »
Hi,

 100 lines :)

 BottleNeck has an xml that goes easily over the 10 000 lines!!!

http://www.tumblehead.com/60/games/bottleneck

all levels are defines using xml, the xml file is loaded when the game starts, in a split of seconds and then the loaded xml is used throughout the game to load levels.

 another xml is used to store player progress, saving scores for each level, the number of stars, the progress, etc and the gros over time, loaded and saved at runtime, without any problem or performance hit ( you have to be careful to do that at key moment, but basically loading is  as fast as any other AAA game like cut the rope and all).

so 100 line it really nothing, trust me!

I would definitly give a go at the game data editor asset, you may find it a lot easier all around, then brute xml, which gives you total raw power, at the cost of having to plug everything yourself :)

the huge advantage of xml is that it's a plain readable format, which means debugging is a lot easier troughout the life time of your game and during dev, you can pull the data anytime and analyze it without any fancy tool, where as embedded data editor will be harder to debug when the game is out.



Bye,

 Jean



elusiven

  • Full Member
  • ***
  • Posts: 233
  • Debt we all must pay...
Re: Data storing question - please help
« Reply #2 on: November 25, 2016, 08:09:21 AM »
Hi Jean,

Thanks for that re-assurance about the size of XML - it is a relief for me.

I did encounter a problem though, or it's just probably something that I don't quite understand yet...

I have everything in one scene, and I have a categories menu, where I pull all the categories, from their difficulties and then when you press on a category, it pulls from xml all the lessons for that specific category. (categories and lessons, are created from prefabs and placed in a layout group.)

But then if I change screens, I make it deactive, so all the categories, levels are disabled.

Am I doing something wrong here, should I keep reference to all of them somehow?

The way I want it to work is that the player clicks on a category he wants to play, then tap on the lesson (lesson is made up of up to 10 different mini-games), and then load the mini-game with id 1 and it's data, and then once the user completes mini-game id 1, it will move on to id 2 and so on until player has finished all mini-games within that lesson, then it will marked the lesson as completed and the player will be able to move on to lesson 2. To do that do I need to "query" xml file in run-time to find out those things, like which mini-game is next and which lesson is next and so on?

For example I want to find out how many there are lessons in each category.. Do I need to query XML for all lesson nodes, in category id 1? for example xpath: /Difficulty/Category[_0_]/Lesson[_1_]

and then within that category, loop through lesson IDs of each node?

How can I keep track of all of this though, like what is next mini-game, what was last, what is completed and what is not? Is that what I do in another XML file? I'm just confused about the structure of that second file...

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Data storing question - please help
« Reply #3 on: November 28, 2016, 03:15:10 AM »
Hi,

 yeah, you should likely have an xml proxy that you keep alive as you load and unload levels.

 or else, you simply need to save a pointer reference to your xml, that reference will survive level loading. you know about references in xmlMaker right?

 Bye,

 Jean