____ A concise description of your problem here ____
The code running the HOST of a MULTIPLAYER GAME is supposed to keep running in the background, even if it's not in the active tab. This is how C2 games worked for at least the last 3 years (from my experience).
Recently, something changed. Now, if the HOST is not running in the ACTIVE WINDOW, the multiplayer game ceases to communicate position information to synchronize objects. Basically - the multiplayer aspects of the game, halt. This is bad.
Attach a Capx
____ Upload a Capx to this post ____
I tested this using your standard "MULTIPLAYER GAME" example where you control the little dude who shoots, just to confirm it was not my code. It's not my code. You should test with your standard example.
Description of Capx
____ Concise description of what this CapX does ____
It's your code. You know what it does.
Steps to Reproduce Bug
____ What happens? ____
Multiplayer stops sychonizing objects, when host tab is not active.
____ What do you expect to happen? ____
Multiplayer has always synchronized objects when host tab is not active - years and years it worked like that.
Operating System and Service Pack
____ Your operating system and service pack ____
Windows 8 and Windows 10 and OS... basically, any OS where Multiplayer currently works.
Construct 2 Version ID
____ Exact version ID of Construct 2 you're using ____
239 (64 bit) ---- basically, the current stable release.
Any update on this bug?
Develop games in your browser. Powerful, performant & highly capable.
The BUG is still happening.
This makes CONSTRUCT 2 a fairly BROKEN PLATFORM for doing multiplayer games.
The reason is simple - if you make a multiplayer game, and if the user who is running the host instance of the game switches tabs or minimizes their browser, even just for a minute, the game halts during that time.
Basically, until this is fixed, Multiplayer using C2 is not viable for creating working games in the real world. Or you need to give some major warnings to the person running the host instance. But that's a hack.
This could make C2 a non viable platform for multiplayer. Hopefully they get it fixed.
The problem is Chrome changed, not Construct 2.
Chrome tries to suspend background tabs to save battery/CPU. For a couple of years we used a hack to force background tabs to wake up if they're a host. It looks like Chrome have clamped down on this and made it more aggressively suspend background tabs, which is causing multiplayer hosts to get suspended.
There's not much we can do about this - it's the browser that is suspending the game, not C2. I reported the issue to Google here: https://bugs.chromium.org/p/chromium/issues/detail?id=676036 - it may be worth starring the issue/adding some comments to show it affects you.
Thank you for this clarification, I believe all of us have tried as much as possible, and hopefully one day there is a best clue from scirra forum's friend.
BTW until this is fixed, I've heard there's a workaround - if a tab is playing audio, it's not suspended. This is a reasonable thing for a game to do, so if you play a quiet music track or something, and set the Audio plugin to play in the background, then it should also keep hosting the game. The multiplayer demos in C2 don't do this, but perhaps your own games can. Hopefully Google will fix this with a better solution soon.
Sorry if it is improper to revive an old thread, but I came across this information and felt this was relevant here.
https://arstechnica.co.uk/information-t ... -download/
https://developers.google.com/web/updat ... round_tabs
https://docs.google.com/document/d/18_s ... x4OlE4/pub
TLDR; Basically in the event you are running multiple hosts in multiple tabs with the intent of using a client to server style design, you can set a flag to disable background throttling.
[quote:1nauq8zt]Chrome provides the --disable-background-timer-throttling flag for use cases like running test suites and other user-sanctioned heavy computations.
We can't normally expect a end user to have this flag on if you are utilizing a peer to peer design though, so the workaround would be to play audio, as previously mentioned.
Also note that the opt-out option is planned to change via FeaturePolicy in 2017 and be depreciated by 2020 (with suitable replacement), so stay on your toes to update your solutions as needed if you are serving a significant user base.