• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

HTML5 game pauses?

Solvius

Member
When I run my HTML5 game in a tab and I go to an other tab, then the game pauses.
Can I make it so that the game will keep on running when I am in a other tab?
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
This is a thing enforced by browser - if the tab is inactive, the game is only allowed one "frame" per several seconds. This is best workarounded by measuring the time since last frame (via current_time, for example) and applying the changes in bulk when user switches back to the game.
 

Solvius

Member
This is a thing enforced by browser - if the tab is inactive, the game is only allowed one "frame" per several seconds. This is best workarounded by measuring the time since last frame (via current_time, for example) and applying the changes in bulk when user switches back to the game.
Thank you. Thats not a option for my game. I have enemy's running around and such so I have no changes in bulk. The game actually needs to run along.
 
Top