What should I do if Local Storage fails?

0 favourites
  • 5 posts
From the Asset Store
Basic Plugins for Firebase Authentication, Realtime-Database, Firestore, Cloud Storage
  • I'm developing a game for mobile (hopefully both Android and iOS) with 200+ levels and I'm planning to store the progress in Local Storage. Total size of data should not exceed a few Kbytes.

    What is the likelihood that there will be some kind of problem with Local Storage and what should I do in this situation?

    Say, if "On item Get" is not triggered soon, how long should I wait? Should I execute "Get Item" action again?

    What if I never get the item even after several attempts? Should I just reset level progress?

    I imagine players who have completed many levels will be really disappointed..

    Or is this situation so rare that I shouldn't bother about it at all?

    What do you do in your games?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Good practice with asynchronous data retrieval is always to build in a timeout and error handling, with the option of (or automatic) retrying. The logic process of what happens in the event of an error is entirely up to you.

    I've never had problems with local storage, but my sample size is small. I wouldn't normally worry about it besides setting up an error/debug notification in case it fails, so that end users at least have some sort of idea what happened and can report back. If it becomes a common problem, then I would look into it more closely.

    Generally speaking, if you are unable to load your saved data, the game should probably treat it as if there was no saved data, and in that case progress would indeed be reset.

    Ideally you would have their progress saved on the cloud (Google play services can facilitate this) but that adds another layer of complexity.

  • Thanks oosyrag !

    I wonder if it's possible to somehow corrupt the local storage to see what kind of error message I'll get in C2.

  • It probably just won't load, and your oncomplete will never trigger.

  • In theory, the "On error" event should be triggered.

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