brett19 / rosebrowser

ROSEBrowser is a free and open-source implementation of the ROSE Online 3D MMORPG for web browsers written from scratch using the latest web standards (WebGL, HTML5, Javascript, Threads, ...).
Other
20 stars 15 forks source link

Falling through the map when browser tab not focused. #28

Open exjam opened 10 years ago

exjam commented 10 years ago

Go run for a long distance and change browser tab, wait a bit, return to rosebrowser tab and discover that the whole screen is grey!! (So probably fallen through the floor).

brett19 commented 10 years ago

Unfortunately, the browser stops rendering (and thus stops updating) stuff while the browser is not focused. Might need to add some code that when tab is in background we switch to setInterval to keep ticks running at a slower but effective rate (without rendering).

exjam commented 10 years ago

Probably because we use requestAnimationFrame for loop?

brett19 commented 10 years ago

This is indeed the case. In fact, we should probably be doing some form of CCD when frame-times are long. Note that the code is written to be able to handle long frame-times which pass through transitions between states and such, but the code doesn't use it particularly well.