OnUpdate() not being called often if...

Monkey Targets Forums/HTML5/OnUpdate() not being called often if...

Salmakis(Posted 2016) [#1]
OnUpdate() not being called often if the canvas is not visible (i.e. if im in another tab in the browser (firefox in this case)), or if browser is minized etc.
i also found out that the javascript setInterval() function also is not working fine when the tab where the game is in is not visible, the time gets shifted compared to a tab that is all time open.
i think OnUpdate uses the setIntervall stuff? so this might be the reason then?

is there any trick to force it to keep it calling 30 updates per second even if the tab is not open/minimized/on other desktop?

Or is the workaround to count the updates and calculate them with the time, and let them all come after if the user returns to the tab with the game?


ImmutableOctet(SKNG)(Posted 2016) [#2]
The exact approach is up to you, but have you tried setting 'MOJO_AUTO_SUSPEND_ENABLED' to 'False'?




Salmakis(Posted 2016) [#3]
yes i have that setting on false


k.o.g.(Posted 2016) [#4]
Use a Webworker :D

It is not 100% tested! and not fully finished


Use in Main() the function UpdateThread.Initialize()