parkm / oldbpm

A JavaScript game where you shoot at bubbles.
0 stars 1 forks source link

Bubbles going away? #18

Closed parkm closed 10 years ago

parkm commented 10 years ago

While playing in Field then going into another tab for like 20 seconds, I noticed when I returned that the bubble population had significantly decreased. If you wait long enough they will all disappear.

When disabling movement they will no longer disappear, so for some reason the edge restriction code doesn't apply.

parkm commented 10 years ago

Seems to be a problem with the delta time. http://stackoverflow.com/questions/20305320/canvas-requestanimationframe-bug-on-window-refocus

Setting the speed to this.speed * 17 causes no problems but obviously not a good fix.

dgpt commented 10 years ago

In Chrome only? When you switch tabs or minimize, it'll throttle the clock speed, which might explain this if it's related to delta time. On May 8, 2014 12:21 AM, "Parker Miller" notifications@github.com wrote:

Seems to be a problem with the delta time. http://stackoverflow.com/questions/20305320/canvas-requestanimationframe-bug-on-window-refocus

Setting the speed to this.speed * 17 causes no problems but obviously not a good fix.

— Reply to this email directly or view it on GitHubhttps://github.com/despondentdonkey/bpm/issues/18#issuecomment-42516950 .

parkm commented 10 years ago

It seems to do it a bit on Firefox as well but not as severely, it still gets stopped by the edge detection. It might be that it gets so slow that the delta is huge and that then makes the bubbles so fast that it will go past the edge detection and get stuck in a back and forth loop.

But I think we should pause the loop when the tab loses focus anyway.

dgpt commented 10 years ago

Ah, that'd make sense. Do the bubble objects persist or are they deleted?

We should definitely pause the loop when the game board loses focus. Can't rely on browsers to handle that well.

On Thu, May 8, 2014 at 12:32 PM, Parker Miller notifications@github.comwrote:

It seems to do it a bit on Firefox as well but not as severely, it still gets stopped by the edge detection. It might be that it gets so slow that the delta is huge and that then makes the bubbles so fast that it will go past the edge detection and get stuck in a back and forth loop.

But I think we should pause the loop when the tab loses focus anyway.

— Reply to this email directly or view it on GitHubhttps://github.com/despondentdonkey/bpm/issues/18#issuecomment-42587279 .

parkm commented 10 years ago

Yeah they persist.

Alright I'm gonna add that to #11. Actually just referencing the issue should make this show up in it, so never mind maybe.

dgpt commented 10 years ago

Closing to track on #11