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
{{ message }}
Repository navigation
fix(core): app delta is unclamped, so a hidden tab makes huge physics steps #517
The game loop sets ctx.app.delta to the wall-clock time since the previous tick, with no upper bound: nanoforge-application.ts#L113, setDelta(step ? tickLengthMs : tickStart - previousTick). The loop is scheduled with timers, which browsers throttle to about one tick per second in a hidden tab.
So after the tab is hidden, or after any hitch, a system that moves by delta (components-systems move2D) makes one huge step. Fast bodies then pass through colliders that only test overlap: in the examples' local pong, a ball at 1000 px/s skips a 130 px wall-plus-ball span on any tick over 130 ms, leaves the field and was never served again (the game locked). The examples now cap the ball speed and serve a lost ball again, which hides the lock but not the tunnelling.
// a system that moves by delta, as move2D doesposition.x+=velocity.x*(ctx.app.delta/1000);// hide the tab for 5 s: the next tick's delta is about 1000 ms
Activity