Array Local Disk Saving/Loading

0 favourites
  • 10 posts
From the Asset Store
Ludo Local Multiplayer board game can be played by 2 to 4 players
  • Hello.

    I would love to be able to save and load array files into the C2 array, You see.. the thing is! in my game I have "world generation", And I want to make it possible to save and load worlds. By saving them to the user disk drive.

    I would be very very very great-full if this we're added!

    Thank-you, dcrew!

  • Webstorage

    Example of level editor (basic, WIP, with saving system) - LINK

    Save variables/example of use of webstorage - LINK

    Other example of use of webstorage - LINK

    This is not exactly one action "Save my whole array" type of thing, but you have to consider HTML5 limitations (like no support of the mousewheel or no system file access (no writing to the harddrive, apart from webstorage)).

  • As far as I know though, webstorage can't be transferred, so it won't work for things like level editors. The only way I've determined to get it to work is using the CSV plugin, which turns a 2D array into a string, copying the string and pasting it into a 'load table from JSON string' action.

    If it doesn't work, all " need to be doubled to "".

  • For level editor, you may try sprite bank. It could be more useful if you want to record the instances of sprite.

  • Although CSV can transfer into JSON string, it's inconvenience to save a general array/hash table, so I make a hash table plugin. You can try this.

  • I see how it works. I thought the webstorage wouldn't work because there was like no save function.

  • But what if I want to save multiple different worlds.

  • Save your world as a serialized string.

    Each string is then a different key in the webstorage.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Save your world as a serialized string.

    Each string is then a different key in the webstorage.

    Okay, also is the webstorage temporary? Does it ever get deleted? / Does the saved data ever get deleted?

  • In the manual article:

    he WebStorage object allows data to be stored in two places: Local storage and Session storage.

    Local storage is permanent (until the user clears their cache). If the user comes back the next day, local storage still has the saved data.

    Session storage only lasts with the current browser session. If the user comes back the next day, session storage is empty again.

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