Local Storage to keep track of time played lagging

Get help using Construct 2

Post » Fri May 19, 2017 10:05 pm

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.
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Fri May 19, 2017 11:36 pm

Saving to localstorage may not be asynchronous, but there should be no reason for the process to interfere with frame rate.
Image ImageImage
B
169
S
50
G
174
Posts: 8,331
Reputation: 110,806

Post » Sat May 20, 2017 12:32 am

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.
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Sat May 20, 2017 12:35 am

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.
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Sat May 20, 2017 3:11 am

There's no way to tell anything without a capx, and crashes are always bugs.
You know the drill for making bug reports.
Image ImageImage
B
169
S
50
G
174
Posts: 8,331
Reputation: 110,806


Return to How do I....?

Who is online

Users browsing this forum: ametueraspirant, dand, mickclarke and 35 guests