How to save my game (global variable data) if my game is in nwjs format?

1 favourites
  • 4 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • Previously I used Local Storage function to save all my globalvar data and load them at the start of the game, for instance, If LevelKey exist > get LevelKey, Set GameLevel to ItemValue. But I understand saving my game this way makes them susceptible to being overwritten (cleared into oblivion) if user accidentally clear their browser cache. Since my game is exported to NWJS format, is there any way I can save it in a different folder, say a subfolder in My Documents?

    And how do I save and pull those global variable data at the start of the game using this method?

    I have multiple globalvar data to save and load. Also, does it render Local Storage functions unusable? I haven't seen much clear examples for this. Can I get anyone's assistance on this? Much appreciated.

  • Are you sure clearing cache in Chrome deletes NWJS local storage files?

    You can simply write any data you want to disk files using "NWJS Write text file" action, and read it back with NWJS.ReadFile() expression.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh, you mean the saved data from Local Storage are not stored in the browser cache? I must have read it wrongly somewhere. Where are the data stored then? Are they susceptible to browser data clearing?

    Based on the example you gave, "NWJS Write text file" action to save the data, how different is it from saving data using Local Storage? Can it replace the Local Storage function entirely? Sorry, I am a little bad at this stuff. All I wanted to do is to create a subfolder in the My Document folder where I can save and load my global variable data from my NWJS exported game without having to use Local Storage functions, if that's possible.

  • Are they susceptible to browser data clearing?

    That's what I asked you :) I didn't test it, but I believe clearing Chrome cache will not affect NWJS storage.

    stackoverflow.com/questions/25143532/node-webkit-clear-cache

    "NWJS Write text file" action to save the data, how different is it from saving data using Local Storage?

    It's like saving a text file with Notepad - you can save any data with any filename in any folder.

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