Fixes the increasing network delay issue when the client page is an inactive tab for a while.
Previously, game/network updates were triggered by the rendering only. This generally worked fine, except that the rendering loop slows significantly when the tab isn't active, causing the network to still receive data while the update functions weren't called. This pull request adds a simple updateManager module to create a more centralized way of adding update functions to a list and allows any other module to trigger an update (instead of completely leaving it the renderer's responsibility).
Because the network packets stop right after the end of a race (as there's no new data to send at that time), there is a tiny bit of network buffer left at the end of a race that doesn't get processed immediately if the tab stays inactive. This would still cause a "delay", unless the client switches back to the tab again at some point or once the game state changes from finished to waiting. I'd consider this only a small issue, and given how the solution to that would involve creating a worker thread to periodically force updates I don't it's worth addressing.
Fixes the increasing network delay issue when the client page is an inactive tab for a while.
Previously, game/network updates were triggered by the rendering only. This generally worked fine, except that the rendering loop slows significantly when the tab isn't active, causing the network to still receive data while the update functions weren't called. This pull request adds a simple
updateManager
module to create a more centralized way of adding update functions to a list and allows any other module to trigger an update (instead of completely leaving it the renderer's responsibility).Because the network packets stop right after the end of a race (as there's no new data to send at that time), there is a tiny bit of network buffer left at the end of a race that doesn't get processed immediately if the tab stays inactive. This would still cause a "delay", unless the client switches back to the tab again at some point or once the game state changes from
finished
towaiting
. I'd consider this only a small issue, and given how the solution to that would involve creating a worker thread to periodically force updates I don't it's worth addressing.Referencing issues Closes #232