Best way to save Local?

  • Hello, i want to know what is the best way to save your game local , right now im using Local Storage and im not very happy with it my game needs to save lots of variables and doesnt work everytime like it should.

  • Following, something similar here.

    I need to make a survey and count how many times each button is pressed. I am doing it the same way you did, using localstorage and records, but I have 25 questions, with 5 possible answers each, meaning 125 "counters" to be recorded...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Most problems with Local Storage happen because people don't understand that this is an asynchronous operation. Writing/reading data in Local Storage takes some time, especially if the amount of data is big. If you write something, you need to wait for "On item set" event before trying to access this data. A quite common mistake is to save some variables to Local Storage on the end of level, then switch to another layout and try to read these values back from Local Storage without any delay.

    Also, to minimize the number of keys and events, you can put all your variables into a dictionary and save/load the dictionary. Here is how I usually do this:

  • Thanks Dop, this will really help me.

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