Local Storage to keep track of time played lagging

0 favourites
  • 5 posts
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • I have Local storage keeping track of total time played. I have it so every 15 seconds it takes a variable and saves it to to local storage. The idea is that it persists over more than one game, so i figured Local Storage would work.

    But the more the game goes on the worse the lag gets. Even though it only saves to local Storage every 15 seconds.

    Is there any other way to keep track of total time played, even across more than one game? Even though it's only saving once per 15 seconds it's still lagging the game.

  • Saving to localstorage may not be asynchronous, but there should be no reason for the process to interfere with frame rate.

  • Yea, it's not that.

    I have a Variable that increases by 1 one each second. I have so when it equals one, set it to two, random (1-5) wait 4 seconds, random one through five.

    Then variable equals 4 set to 5, random (1-5) wait 4 seconds, random one through five. Then 7, 10, 13 and then set the variable back to 0.

    I don't know why it's lagging. Could it be because of the Variable how its working with the Random number generators? It's weird because the game will be playing okay, i'll pause it for awhile (global timescale at 0) and i'll resume it (timescale to 1.0) and the framerate stuttering will be worse. Eventually the sprites for moving will get messed up and not respond very well.

    Im going to try wait x seconds.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This is the crash summary I got:

    ANR Input dispatching timed out (Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago. Wait queue length: 18. Wait queue head age: 5580.8ms.)

    It is crashing because of how I set it up for the Sprites to be generated?

    Basically it's a Variable that goes from 1 to 13. At 1, 4, 7, 10, and 13. At one, set to 2, random (1-5) wait 4 seconds random (1-5) and the same thing for 4, 7, 10, and 13. except for 4, set to 5, 7 to 8, 10 to 11, and 13 to 0. Otherwise a bunch of sprites will spawn.

    I did a Variable instead of Every x seconds because Every x seconds starts when the loader is completely loaded. The idea is that the sprites start spawning anew each time the person plays.

    I tried putting Every x seconds as a sub-event of When BG is visible, but it doesn't restart whenever the BG becomes visible.

  • There's no way to tell anything without a capx, and crashes are always bugs.

    You know the drill for making bug reports.

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