Jump to content

Massive disc usage with phaser in webgl mode


ForgeableSum
 Share

Recommended Posts

I've been struggling to identify a very problematic bug over the past month and I think I may have found the source of the problem. The bug is a HUGE issue for me. It causes the game to be unplayable in certain software environments and this has prevented me from launching a demo of my game. 

 

Symptoms: 

* In certain software environments, my game and any phaser game in webgl mode is extremely slow. 

* if you open the built-in fps meter in Chrome, you will see random jumps at random intervals when nothing is happening in the game. you might load the game, do nothing (with nothing in update/render debugging, etc), and you will see random spikes in fps. in software environments where the performance isn't slowed down by that mysterious factor, you'll notice that the fps meter flatlines at 60 when nothing is happening in the game. this is how it should work. to assure this wasn't a fluke or some problem with my code, I stripped everything down to just Phaser and booting the game. I tried this going all the way back to phaser v. 1.6 and the problem is in every version. In some software environments, you'll see that random spiking. in others, you won't, but it definitely happens in every version of phaser in webgl mode. 

* In certain software environments, the location of other windows affect the fps of the game. For example, in yosemite on a 2009 imac, you can draw a new browser window over the game window and the fps will spike. it happens in windows as well but my windows machine is a scream machine so it's not as noticeable. at first i thought it was because phaser was processing input events, but no, it still happens when the mouse is entirely outside the window. i've made a video of this fucking weird-ass behavior so you can see for yourself:


The version of phaser running while this video was taken is completely stripped down. It's just phaser and an empty game world. This behavior alone would not concern me as one could easily write it off as a quirk. But because this behavior occurs only in the software environments with the performance problems, I believe it has significance. Yes, I've tried it in my good working software environment and moving other windows around on top of the phaser window has absolutely no effect on FPS. Here's another weird thing: even if the window is in active and behind the phaser window, it can affect fps. That's right, an inactive window or application behind your game, can causes spikes in fps. wtf?

 

* In software environments where the performance problem isn't present, it's common to see something like 1-15mb written to the hard drive (activity monitor, disk tab in mac) by the google chrome process. in software environments where the performance problem is present, you could see as much as 1GB of data being written to the hard drive in a single session.  Here you can download the open files and ports while phaser is running, when the problem is present:


And here you can download a sample of the chrome process when the problem is present:


And when the problem is not:


 

I'm not 100% sure, but I think this means the problem is not a cpu or memory problem, but a disk reading/writing problem. there's just too much disk activity while phaser/webgl is running and this is causing performance problems. it doesn't just happen in yosemite. it happens randomly in windows 7 as well. i've not seen the behavior in mac osx10 (yet).  

 

Link to comment
Share on other sites

Check in browser console if there are some errors logged every frame.

Do you mean the console tab? Of course I've looked there. I practically live in that tab. Unfortunately I don't think this problem is caused by how my js or phaser's js is being interpreted - otherwise, there would be errors. And again, it is working fine in some environments and poorly in others. 

 

I've created an issue on git hub and you can see Richard's comment here:

https://github.com/photonstorm/phaser/issues/1878

 

You can also download cpu profile/heap snapshots and heap timelines of the working and not working environment here.

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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