How do I run game continuity at browser minimize?

  • The game is paused when browse minimize or switch to other web page. How do I run the game continuity in these cases?

  • You can't - browsers deliberately stop running hidden web pages to reduce CPU usage and save battery life on mobile devices. I don't think it's possible to work around, sorry.

  • I think a trick you can use is to store the time 5 seconds (so you don't need to know when the browser is stopped), then when the game resumes and the time saved is greater than 5 seconds, you can speed things up to how they would be if the game kept running.

    Although, this would only be good for sim and RTS games probably.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • On the other hand, it's irritating as a player to switch the tab away, and come back and you've died because the game carried on while you weren't looking. IMO, it's actually a useful feature it pauses while you're not looking.

    The player can always create a new window with a single tab - that might work to keep it running.

  • On the other hand, it's irritating as a player to switch the tab away, and come back and you've died because the game carried on while you weren't looking. IMO, it's actually a useful feature it pauses while you're not looking.

    The player can always create a new window with a single tab - that might work to keep it running.

    Yeah, dying while away is lame. I was thinking of sim games like Smurfs where it says "Building complete in 2 hours".

  • In that case, I guess you could compare the actual time when the building start to be built and set the finishing time to that starting time + building time.

    That way doesn't matter if the game pauses or not.

    But keep in mind that players could cheat changing their own pc clock.

    If you could compare to a web clock somewhere, this would be avoided.

    Anyway, it's just an idea.

  • +System:Every tick
    [ul]
    	[li]Text: Set text to time

    I test this problem again in r65.

    Chrome: paused when browser minimize.

    Firefox: still running.

  • I think Chrome pauses, and Firefox starts running one tick every second (1 fps) to give the app a chance to stay up to date. For games it's not very useful though - in the latest releases of C2, if it spots it's going at 1 FPS it sets dt to 0, effectively pausing the game (so long as your game is framerate independent).

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)