How do I Saves

Get help using Construct 2

Post » Mon Sep 07, 2015 5:41 am

I know there's discussion on this. I already understand the fundamentals of serialization, but what are people using to create save-games in construct 2? I've read Ashley's article on the topic. I know about web storage, local storage, and slots... I'm just not sure which way to go, though. With the current options I don't like the idea of classic serialization and writing out every single data member by hand, why do that when there's other options? NW.js seems difficult with writing to files, and really only seems to be well suited for text. There's no real formatting options..

The next best option would be local storage, which works like an ini, so at-least then you have keys to set and access. Slots seems easy and convenient. If slots were used in my case how much data is saved? Is it really everything other than what the docs mentioned wont be saved? So if the player saves in the middle of a level with badguys in certain positions, and all their data members set, will a load in that slot put everything in place? baddies where they were, and everything? Player will start right where they left off, as if on an emulator?

This sounds like a good method to use in conjunction with save spots/save crystals, or whatever.

The article also mentioned saving some meta data, not sure how to do this with NW.js, could the same be done with local storage, or would I have to use a set number of slots where it's key based.. That makes sense.

Could someone give me a crash course on saving meta data with NW.js. This sounds tedious with nothing but text. Wouldn't I have to overwrite the file each time, serializing the same data, and have my own parse methods set up? sounds like a lot for infinite save slots... No wonder most fledgling games use a simple 3 slot system... lol
B
7
S
2
Posts: 92
Reputation: 663

Post » Mon Sep 07, 2015 4:03 pm

You have to select a Construct object that best represents the type of data that you want to save, then export that object as either XML, JSON, or some other data format as a text string into the web storage.
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,415
Reputation: 4,824

Post » Mon Sep 07, 2015 5:03 pm

But if I use web storage, this NW.js right? Wouldn't I need to set up my own method of separating the json strings? There would be some kind of delimiter? Then how do I read in the string, and use the delimiter to break them back and put them in my objects? That's kind of what I'm wondering. I don't really understand how to do it through Construct. It's not really the same as using other languages, with knowledge of how the events flow..

Would it be easier to serialize by json strings into keys, and use local storage? What method works best for broad range of devices?

Thanks for your reply,
Jeremy.
B
7
S
2
Posts: 92
Reputation: 663

Post » Mon Sep 07, 2015 9:49 pm

You can use already existing parsing libraries (like rex_hash, Array, or possibly the dictionary object).

Look at rex's hash table thread for examples on how to use rex_hash to parse JSON.

Your local storage keys can be in any form (of string).

It is exactly like other languages. For example, in Java Google's Gson library is almost exactly like rex_hash is for Construct.
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,415
Reputation: 4,824

Post » Mon Sep 07, 2015 10:25 pm

Just a quick question. Why would I use this over local storage, which does the same thing in ini format?
B
7
S
2
Posts: 92
Reputation: 663


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, tarek2 and 13 guests