kaboom
kaboom copied to clipboard
update loop has jerky timing on Firefox on mac M1 pro
Version
v2000.2
What browsers are you seeing the problem on?
Firefox
What happened?
The onUpdate()
function is called multiple times per millisecond, with around 100ms interval on firefox on mac OS on my macbook pro M1, it appears to work just fine on Safari, I have not tested with other browsers.
See the reproducable code for more details.
This causes dt()
returns 0
for all frames, and for around 10 frames each second, it returns 0.1
.
It also causes the debug.fps()
to return either 0
, or Infinity
.
It also causes the movement of objects (with entity.move()
or the move()
component) to be jerky.
And it also causes fast entities to pass through each other.
What's the expected behavior?
The update function should be called are regular interval.
Minimum reproducable code
kaboom()
let t = Date.now()
onUpdate(() => {
let delta = Date.now() - t
t = Date.now()
// displays 10x "0 0.0" then 1x "100 0.1"
console.log(delta + " " + dt())
})
Live demo
No response
Very weird, can't reproduce on my end. Which FireFox version are you on?
Also can you try if using kaboom@next
(might might contain breaking changes tho) solves this issue
Thanks for your answer!
I just tried with kaboom@next
and I have the same issue, my firefox is the latest one (at the time of this comment) 97.0.1 (64-bit)