Game Continue to Run Even When Not Visible?

  • Usually a Construct game pauses when the page has been switched out of or is not visible. I want my game to still run even when the Tab that it would be in is not visible, minimized etc. I was just wondering if someone could please tell me how I can set it in Construct that my game still runs even when it the player does not have page visibility.

  • There's no way to do this with exported projects AFAIK.

  • Oh, that's a shame. I was trying to make a clicker game similar to that of Cookie Clicker, Candy Box or Clicking Bad. Without this function the idea is worthless, and Construct was the only game engine that I could find that was easy to use and had all the functions I required for this sort of game. I even took ages figuring out if I could do everything I needed like upgrades etc. Everything was going to work, and I even made a prototype that worked with everything (just not fancy), which was when I discovered this problem. This is really upsetting <img src="smileys/smiley19.gif" border="0" align="middle" />

  • I think the only possible way around it that someone discussed was to use a plugin from rexrainbow that calculates how much system time has elapsed since you were last on the tab and then update your stats to reflect this. Not sure if that is ideal for your game though, maybe!

  • I use layers. so game still runs in background no problem. Each layer is a new tab. I use it for my settings, options, screens etc. When they switch to those tabs it sets game layer visibility to 15 - 30% depending and puts layers visibility to 90 - 100%.

    So you never change layouts unless you want to.

    Obviously, I don't understand what you mean by tabs. But you can cycle layers without stopping game flow. Game is built upon layers after all.

  • DUTOIT I think he's referring to switching between tabs in the web browser.

  • Lol, thanks plinkie for clearing that up. A game that continues to play without a player - Um????

    Edit: Will have to edit exported project.

    candies.aniwey.net/[url=http://candies.aniwey.net/]Press F12 and view source You going to need to insert code into the exported project. Have a look at main.php should have answer. Or possibly a js file.

    ----

    Its sunday morning -

    Or possibly pull in data (current time when browser not suspended - time when browser was suspened and added that to variable cookies) via ajax from users pc clock.

  • Just set "Pause on unfocus" to No in the project properties

    Edit: my bad, I forgot that's only for preview. Indeed, using the Browser plugin with the "on suspended" and "on resumed" triggers, you can compare how much time has elapsed between the two events.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think the only possible way around it that someone discussed was to use a plugin from rexrainbow that calculates how much system time has elapsed since you were last on the tab and then update your stats to reflect this. Not sure if that is ideal for your game though, maybe!

    I suppose that I could try out the plugin, if that's the last resort I have. Where can I get it and how do I install it for my game?

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