BEST WAY TO SAVE GAME DATA (player, lives..) HTML5- ANDROID

Hi!
I am doing an educational game in Gdevelop (html5), for ANDROID, and I´m lost. :frowning:

I would like to know what is the best way to save the game data: player data (name, age), points, lives, average response time, summary of correct answers (good, lost, failed).

I have seen several options but I do not know which one may be the most suitable for what I want.

  • Variables …
  • Json file, javascript
  • XML (only for native?)
  • DataBase

Thanks a lot. :slight_smile:

It depends on what do you want to do with the data.
If you want to keep the data locally, then you can use a variables/json system. This is the easiest one, just use the storage actions to read/write values in the browser storage, json conversion is a simplified way to store large structure variables, you can convert an entire structure into a single string and save it in the local file :slight_smile:
The database way is harder but lets you save data online, to keep the data synced in different devices or avoid hacking I guess :confused:

Thanks Lizard-13 for responding so soon. :wink:
I need to have the data to be able to treat and analyze them: what failures and successes are the most frequent, how long they take to complete each scene, …
I do not need the data online.
I have a question, :confused: if I use the json conversion and children access from different android devices, where will the data be stored so that I can access and analyze that data? Do you know any example that can help me?
Thank you again! :slight_smile:

Mmmh for security reasons you can’t save in a file itself, but in the browser storage, and it differs from browser to browser, in Firefox it will save the data in some sql blocks.
I show here how to debug a file, but you have to do it from the browser itself: [url]https://forum.gdevelop.io/t/how-to-save-progress/11344/5] :slight_smile:
What you can do to retrieve the data is, in the browser debugger as I did in the link, select the file with the data you want to analyze, and copy it into a file. A bit cumbersome but web security makes every task a bit more cumbersome :imp:

Also, take into account that the local storage can be edited by the user through extensions :smiling_imp:

If your goal is to gather data from a number of players that play in different devices, the database solution is probably the best… The catch is that the player will have to be online when he plays the game…

In the end you will have a database that you can choose who will be able to see it…

The example in the tutorial section is actually spot on, I tried it recently…

Don’t forget in case you want to collect data, from 25.05.18 in EU and 25.06.18 in the US you do need to make every single user agree to what data you are collecting and to what you plan to do with it. In case you don’t do this you can get raped by your government.
My understanding is that, it is enough if you display on the store page before download or at the beginning of your game that you do collect data (explain what data) and you going to use it for statistics and you won’t share it with 3rd party if that’s the case. But you may want to double check this.

Otherwise, in case it is a single player game, it should be not a requirement to be online. Just make it so if the player is online then send the data but don’t push it because players can push back :stuck_out_tongue:

Also how much time you’ll store it. But it depends if the data collected has personal information, I guess :neutral_face:

@Lore, anyway, you have said you don’t need the data online, do you have access to the devices?, if so you can just copy the data from the browser manually (if you have to do it only once then it’s easy). Otherwise you’ll have to go for the database dark path (continuous refresh, no collection time limit, needs internet) :smiley:

Depends on what is the definition of “personal” :laughing:
What I click, what decisions I make, how fast, how often, is personal to me especially if they can track me down and push ads in to my face based on that info :smiling_imp:

Yeah, that’s my point, if the data points to you then it’s personal, I mean anonymous data. If the OP wants some statistics but from anonymous users (not pointing the device) then the law isn’t so hard, no? :confused:

Well, the official website about the law reference it only as “personal data” and they describe personal data as

I guess you are right, in case the collected data is not pointing back to an individual in any ways or form then it is not subject of this law. At least this is what I understand from this single line I was able to find on their website. But for example they mention CCTV cameras are subject to the low because they are making footage of people. The footage they are recording is not pointing back directly to any person just because you made a footage of me you don’t know who I am but CCTV still fall under this law.

I guess it doesn’t hurt anyway to be honest and say “I collect information about your reaction times and such to improve the product and this information won’t be shared with 3rd party” just to play on the safe side because by end of the day I believe your government going to make the decision and governments are corrupt and love to use lack of shared information against you :imp:

Hi !
I appreciate your answers very much.

I need the data for an educational experiment. I have all the necessary permissions to request and save the children´s data.

The children have to register in the game an I have to save all the game data and analize them. There are 200 children more or less. It doesn´t need to be playing online. Children are geographically in different places.

In addition, I have been informed that finally I will not be able to have the tablets for children so I am evaluating the possibility of developing the game for web (html5) to play from computers.

In this case, on the web (HTML5) to play from computers, how can I do in Gdevelop to save game data? what would be in your opinion the best option?

Thank you very much for your patience and help. :slight_smile:

The way Gdevelop works it would be a html5 (web) game anyway before it got converted for android…

If you don’t have access to the computers that the children will be playing then the only way is to use global variables and the online database approach…

In this example in the tutorial section of the wiki the user uses a number of (global) variables to send data as a high score system that you can later view…

wiki.compilgames.net/doku.php/gd … highscores

This practically creates a table for every user that the administrator (you) can view and use… You can have variables for each scene (Total time taken, Number of failures etc.) and when they progress these variables will be sent to the database on their user name.

I found it a bit complicated when I decided to implement it but it was rather easy. Hope I helped a bit…

The most simple way is to store the info in a file somewhere on the computer but HTML5 don’t have read and write permission by design so you are going to need some javascript and 3rd party API or framework to write the info in to a file and export the file that you can save on the computer.
The most simple solution would be to use GD4 and the native Windows export. It can read and write the local file system out of the box.

In case you don’t have access to the computers I imagine you do have permission from parent or someone looking after the children (You must have) in that case you can also ask the adult person to get the files and upload it to your google drive for example. You can create a folder on google drive and give write permission to the people going to submit the data. Alternatively, they can also email the file to you.

In case the above methods doesn’t suit you, I think the only option left is to send the data to a database on a server. It is relatively easy but the games do need to connect to the internet and you need to have a server and database somewhere.

Thank you for your answers MeX1Co and ddabrahim.

I will not have access to computers. Children should connect to the web and play. Therefore, and as you say, I think that the most appropriate thing will be to use global variables and Database.

I have seen the example you have recommended me from PHP and mySQL. I will try to follow the example to be able to collect all the game data I need. Do you know any similar example to help me?

I think I have clarified several things with your help. Thank you for everything. :slight_smile: