FlashRevolution

Performance problems on switching tabs

Recommended Posts

Hello guys,

I have some big problems with the performance by switching tabs and the rendering progress. Maybe some of you can help me. (Sry for my english I give my best.)

The game about I'm talking is to find under: https://dsbmg.de/slotdemo/app.html

It's a slotmachine I build. The big problem is, that some users would like to play the game in more than one tab and some tabs are in background sometimes. Thats why I done the following.

The backend is a php file which is doing the whole math and connecting to the database to save player-data for each bet and other things.

Then there is a webworker as middleware which communicates with the backend and the frontend builded with phaser.

If a user switch the tab, a javascript code recognize the visibiltychange event and then send the new state to the middleware. The middleware itself take this event and switch internal from visible to none-visible and sending a break to the frontend that kills the tweens if there are some. After that point the middleware just "taking" to the backend with a delay, like the slot would be rendering, but without doing anything. (in autoplay mode) 

After switching the tab back to the front from the background, the visibiltychange event sending a message from the frontend to the middleware which switches the intern state to visible and the next game starting rendering again. 

But at that point the tweens and updates are not running well. They make a lot of problems which I can't figure out. 

Do anyone of you have an idea what I can do better? Have you any idea what I can do to get a better performance? 

If the slot is just running in one tab (background or front) there seems to be no such problems, just if you open another tab with the game. 

 

Hope you can help me to build a better engine for the slot. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.