Jump to content

Run in background option?


Recommended Posts

I've finally gotten pretty deep into my server development and decided it was time to do some testing, at first I was very upset, because I couldn't find any reason as to why my multiplayer rendering was broken, however after some deep digging and about three hours of suffering I noticed that the client wasn't running when it wasn't focused. This caused the sprite to not be created, and the data that I sent over the Internet to ultimately not be read, so when the server requested an update for the player corresponding to a certain id, the client didn't have it and it broke. Obviously that's a design flaw on it's own that I will be fixing, but for now I need to figure out how to run the client in the background. 


I've been going through the phaser docs and I'm not seeing this functionality anywhere, but I'm only half way through it. 

Any pointers? 

Link to comment
Share on other sites

Take a look at the Game class, specifically the focusLoss function.

It is there that pauses the game when focus is lost, but there is also the means for you to achieve what you want: this.stage.disableVisibilityChange


Using the stage->disableVisibilityChange does not have any effect.




The code I'm using:


game.state.disableVisibilityChange = true;


I've tried it in both the preload/create functions.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...