Saving Data

Discussion and feedback on Construct 2

Post » Sun May 31, 2015 9:24 pm

I have read up on Local Storage and feel comfortable moving forward with it, but I am not 100% comfortable with comments regarding the data saved off and whether it is protected. If a player clears their cache, can it be wiped out?

If you have a game where players need to play through a lot of levels and you need to save off their progress in addition to coin counts, is the only sure way to do this with a web-based DB? Is there any way to do it locally if the user gives permission?

My apologies if this answer is out there on the forums somewhere. I just cannot seem to find a definitive answer. Thank you in advance for any help.
B
42
S
16
G
3
Posts: 169
Reputation: 4,383

Post » Tue Jun 02, 2015 6:09 pm

CDogs1964 wrote:I have read up on Local Storage and feel comfortable moving forward with it, but I am not 100% comfortable with comments regarding the data saved off and whether it is protected. If a player clears their cache, can it be wiped out?

If you have a game where players need to play through a lot of levels and you need to save off their progress in addition to coin counts, is the only sure way to do this with a web-based DB? Is there any way to do it locally if the user gives permission?

My apologies if this answer is out there on the forums somewhere. I just cannot seem to find a definitive answer. Thank you in advance for any help.

You can use File Chooser, Browser, AJAX and default save/load actions if you need to store user's files on user's disk.

On save complete - start to download SaveStateJSON string (with browser or any other plugin that can download as string), then if user want to load the game, he need to choose the downloaded file with File Chooser, then your game need to read the contents of this file as string, you can use AJAX object for that, Request URL - FileChooser.FileURLAt(index) and when AJAX triggers On Completed you need to use system's action Load from JSON and set AJAX.LastData as a JSON string to load from. You can download any JSON with savegames data, not only system's SaveStateJSON.
B
22
S
9
G
7
Posts: 421
Reputation: 6,543

Post » Wed Jun 17, 2015 9:13 pm

Good and quick explanation @Sisyphus. I found the solution by reading your response to this topic. Thanks for that.
ImageImage
B
111
S
51
G
24
Posts: 786
Reputation: 23,392

Post » Sun Jun 21, 2015 5:44 am

@Sisyphus Would I also need NW.js to write the file?
B
42
S
16
G
3
Posts: 169
Reputation: 4,383

Post » Sun Jun 21, 2015 2:00 pm

CDogs1964 wrote:@Sisyphus Would I also need NW.js to write the file?

Nope, you can use any export option with support of ajax and file chooser.
B
22
S
9
G
7
Posts: 421
Reputation: 6,543


Return to Construct 2 General

Who is online

Users browsing this forum: wertt22 and 14 guests