Right now, for both rollback and lockstep netcode, if one user backgrounds their tab, the game will totally freeze. Currently it’s not that big of an issue since we only support two-player games anyway, but as we move on to >2 players this problem must be solved.
Right now the main loops of both netcode implementations look something like this.
The problem is that the browser will stop calling setInterval (and other callbacks like requestAnimationFrame) when the tab is backgrounded meaning that the game wont tick anymore.
The good news is that this is solvable. Even when backgrounded, the pages are responding to messages on the RTCDataChannel, meaning that event listeners are being run. We should be able to tick during these event listeners, though this will require some changes to the main loops to make this possible.
Right now, for both rollback and lockstep netcode, if one user backgrounds their tab, the game will totally freeze. Currently it’s not that big of an issue since we only support two-player games anyway, but as we move on to >2 players this problem must be solved.
Right now the main loops of both netcode implementations look something like this.
The problem is that the browser will stop calling
setInterval
(and other callbacks likerequestAnimationFrame
) when the tab is backgrounded meaning that the game wont tick anymore.The good news is that this is solvable. Even when backgrounded, the pages are responding to messages on the RTCDataChannel, meaning that event listeners are being run. We should be able to tick during these event listeners, though this will require some changes to the main loops to make this possible.