Local storage - Loooong time memory management

Not favoritedFavorited Favorited 0 favourites
  • 5 posts
From the Asset Store
"Easy Local Notifications" enhances games with customizable local notifications.
  • I released an Android game in 2020 with the latest C3 version. In it, I use local storage to store high scores and other information.

    It's a puzzle game, and each round is intended to be played within an hour or so in one go, but some of my users play it differently. The longest session I know of is about 4 months. The game was always running in the background while the user used other apps on the phone.

    Just now, one user had the highest score ever when he died, and it wasn't recorded in the local storage. There is nothing in the code that explains why it wouldn't happen, but my ONLY explanation is the session's extreme duration.

    I have tried to recreate this error but creating these long sessions obviously takes a long time... :P

    My only solution to brute force fixing this is to systematically write the current status to local storage, or maybe there is a function for that when the app loses focus.

  • It's a very bad method to always keep the game running in the background. I would advise such developers to be punished.

    Is it so difficult to make everything time-dependent? And each time the game starts, recalculate the progress according to the time that has passed.

    I believe that in 4 months, some service or even an update could clear the local browser storage. You can duplicate the save to a file or some cloud service.

  • A normal user doesn't force close a mobile game after a session. As far as I know, the default state of C3 is to enter pause mode when it loses focus, so it shouldn't be running anything unless it's being played.

    Being punished for this, sure... I clearly need to catch when the game loses focus and save it in that state. Doesn't really explain why it went this way, though. As this is an offline game, I have no other way to save a persistent score.

    I always thought that the local storage is written into the games' "browser" memory, so updating the phone or system browser shouldn't affect that.

  • ...

    I always thought that the local storage is written into the games' "browser" memory, so updating the phone or system browser shouldn't affect that.

    That's how it should be.

    But I also notice that sometimes data in local storage is lost. It doesn't happen often, but it does happen. Maybe it's the browser's fault, or maybe it's the user's accidental actions.

    My advice is the same: add alternative options for saving progress.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm using Google Play as well, but players of this game are often offline, which is why I'm relying on local storage.

    I was just reading more about local storage and noticed it offers "Persistent storage" which I can't remember was an option when I published, could maybe help to "bake" the data further down.

    I actually got a report that one user had missed all the local storage data after swapping out a phone battery. The game went to the starting tutorial stage, which is weird. Looking into using the CGS to save all the data online :)

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