Using PlayCanvas outside of PlayCanvas

How can I allow the players of a game to leave their browser (i.e. they are in another tab) but the game is continuously running? I am STILL making my multiplayer game (its going very well) but this is one of the three key points I need to fix. After these issues are fixed the game will be more than halfway done!

Chhes :cheese:

1 Like

If the game logic is running on a server, it can continue independent of whether the player switches tabs or closes the browser.


A JavaScript Worker still fires setInterval even tho you left the tab or minimized the browser (at least I just tested that with Chrome), which you probably need to send/receive updates from every client to calculate e.g. their ping on the server.

Two simple files to test it out:

File: test.html:

  worker = new Worker('worker.js');

File: worker.js:

var start =;

console.log("Worker start", start);

  var end =;
  var diff = end - start;
  if (diff > 120) {
    console.log('diff', diff);
  start =;
}, 100);

The worker barely not reaches the setInterval timeout, but sometimes it goes over some milliseconds:


And here I just pasted the JavaScript code into DevTools, to run it into a normal environment:


The times go crazy and way over 100ms e.g.

What part of your game requires this, gameloop and networking?


What’s the name of the game

I will showcase when I am done

pretty much the entire gameplay