Local storage is very slow

0 favourites
From the Asset Store
Basic Plugins for Firebase Authentication, Realtime-Database, Firestore, Cloud Storage
  • on event complete- get item Pistol level

    get item Rifle level

    get item shotgun level

    get item machinegun level

    get item coins

    All of them are loading quickly except coins. Why?

    As i already said, its numbers of levels from 0 to 6 and number of coins. Numbers of levels are loading instantly, while coins are loading longer then 5 seconds on mobiles(including bluestacks),while on PC everything is instant(nws)

    Also if coins are loading instantly if you try to load them on start of the game, but once you change coins value during play and try to load them again-it will take a while

  • must be a bug

    No, ofcourse not

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • you saved the game in local storage?

    Local storage load might be slow then.

    As i already said, its numbers of levels from 0 to 6 and number of coins. Numbers of levels are loading instantly, while coins are loading longer then 5 seconds on mobiles(including bluestacks),while on PC everything is instant(nws)

  • Also if coins are loading instantly if you try to load them on start of the game, but once you change coins value during play and try to load them again-it will take a while

  • You can specify your problem more by giving the viewers more information so that someone visiting this post can help u better(but not me,i know nothing). Tell us more.

  • You can specify your problem more by giving the viewers more information so that someone visiting this post can help u better(but not me,i know nothing). Tell us more.

    I already said enough,sorry to say that,but you are making that worse,because less and less people will read all of that because its getting bigger and bigger

    Thread looks full like it was solved

  • Don't store the data separately, it just makes life awkward. Use a dictionary and save the JSON and load it back. Then there's only one load/safe.

  • Don't store the data separately, it just makes life awkward. Use a dictionary and save the JSON and load it back. Then there's only one load/safe.

    Sounds reasonable,but that will make me re-do all the code. Im searching for a kludge right here. The interesting part here is that even if ONLY coins are getting loaded - they are loading for too long in comparison, like Localstorage.Coins is cursed by an evil magician

  • You'd have to post your code, as that makes no sense. It shouldn't matter.

  • You have this issue at the first run?

    When you open your game for first time, coins are take too long to load?

  • You have this issue at the first run?

    When you open your game for first time, coins are take too long to load?

    No, when it was edited after game

  • I just notice you say there is not delay on start of layout.

    So this is the key, there is no need to load every time your score/level/coins change.

    Just do it once the player open your game and add a dictionary to hold your variables while the users play your game.

    So if a level end and you collect 100 coins, save the coins to your local storage but not load it back,just save it and to a dictionary and continue the game with the dictionary values.

    Now, as blackhornet say its better to use a dictionary to have only one save/load. And this is up to you if you want to have a game and run with no issues then you have to change your code and add the dictionary.

  • I just notice you say there is not delay on start of layout.

    So this is the key, there is no need to load every time your score/level/coins change.

    Just do it once the player open your game and add a dictionary to hold your variables while the users play your game.

    So if a level end and you collect 100 coins, save the coins to your local storage but not load it back,just save it and to a dictionary and continue the game with the dictionary values.

    Now, as blackhornet say its better to use a dictionary to have only one save/load. And this is up to you if you want to have a game and run with no issues then you have to change your code and add the dictionary.

    Thank you, I was thinking about this too while sleeping. I will try this today and leave a report

  • Local Storage is not slow. Even if you are saving/loading dozens of keys, it should only take a fraction of a second. If it takes 5 seconds, this is a clear indication that you are doing something wrong. As other people have said, you should post your code.

  • Local Storage is not slow. Even if you are saving/loading dozens of keys, it should only take a fraction of a second. If it takes 5 seconds, this is a clear indication that you are doing something wrong. As other people have said, you should post your code.

    It's slow only on mobile devices.There is no need to post the code,because its already mentioned in the post. Yes, its that simple.

    Now i've done that coins stores in dictionary. On start of the game, when localstorage.Coins is instant like "fraction of a second" it loads amount of coins and stores it in dictionary.get("Coins") and this works fine now. So, in short i removed action "get localstorage.Coins" from the game almost at all and now coins are working fine. Localstorage.coins are being written only couple of times and that makes it for coins in my game. Now finally player doesnt need to wait 5 seconds for coins to load. Now he needs to wait 5 seconds to load level of his shotgun... Why? It was instant before i removed action "get localstorage.coins". The other interesting part of this case is that all processes for each gun are absolutely identical and only shotgun is loading that long.

    If i switch to previous project save - it will load instant but "get localstorage.coins" would be slow.

    I will repeat, that shotgun events were untouched.

    It doesnt make any sense for me

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