How do I Saves

0 favourites
  • 5 posts
  • 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

  • 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.

  • 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.

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Just a quick question. Why would I use this over local storage, which does the same thing in ini format?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)