You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using latest Phaser build.
This issue only happens in chrome as far as I can tell, and isn't deterministic.
Stripped down example:
var before = performance.now();
requestAnimationFrame(function frame(now) {
console.log(now - before);
});
This will log negative value for me with chrome 61.0.3163.100 (64-bit).
Given that Phaser uses performance.now() in TimeStep.resetDelta, and then uses value from RAF, the result is negative delta time being passed down to update. Given how smoothing works it will stay negative for up to 10 frames.
One solution would be to check for negative rawDelta in TimeStep.step. Another, would be to have TimeStep.resetDelta not perform the actual reset, rather rebind RAF callback to reset method (which would then bind it back to normal step).
Or consider it a chrome bug and not fix it at all, leaving developers to handle this. Admittedly, in usual usage, the first 10 frames of the game aren't critical.
Using latest Phaser build.
This issue only happens in chrome as far as I can tell, and isn't deterministic.
Stripped down example:
This will log negative value for me with chrome 61.0.3163.100 (64-bit).
Given that Phaser uses
performance.now()
inTimeStep.resetDelta
, and then uses value from RAF, the result is negative delta time being passed down toupdate
. Given how smoothing works it will stay negative for up to 10 frames.One solution would be to check for negative
rawDelta
inTimeStep.step
. Another, would be to haveTimeStep.resetDelta
not perform the actual reset, rather rebind RAF callback to reset method (which would then bind it back to normalstep
).Or consider it a chrome bug and not fix it at all, leaving developers to handle this. Admittedly, in usual usage, the first 10 frames of the game aren't critical.
Seems like I'm not the only one with this issue: https://stackoverflow.com/a/46121920
The text was updated successfully, but these errors were encountered: