Jump to content

Unable to diagnose framerate issues


Shantred
 Share

Recommended Posts

I'm nearly complete with a game that I've made using Phaser. I've been going in and trying to polish things and improve performance, but hit sort of a dead end. Since my very first draft of the game, before I even had multiple states, scorekeeping or additional sprites added into the mix, there have been random, brief bouts of framerate drops. Sometimes they'll last a half a second, sometimes 4. It doesn't seem to matter how many or how few sprites are currently on the screen, it just comes and goes as it pleases.

This has been especially frustrating as I've done things such as re-using objects in object pools, moving everything possible out of the update loop and packing sprites. I haven't packed ALL of them yet, especially since as I mentioned, this has been an issue since there were only 3 sprites involved. Any  chance that someone could look at my code and maybe point out what I'm doing wrong or whether this is just an engine issue?

Here is an up-to-date build: http://shantred.github.io/phaser-starfall-es6/builds/prod/index.html

And the repo: https://github.com/Shantred/phaser-starfall-es6

Link to comment
Share on other sites

Didn't notice any framerate drops.

Had a quick look at your code. I haven't used Phaser since version 1, so I maybe wrong, but I don't really see object pools.
I do see 'new Diamond(...)' and 'new Star(...)' inside the loop. Maybe you want to prespawn a 100 or so of each, and make sure 'new' is never used.

Link to comment
Share on other sites

Thanks for taking a look. Sometimes it is less noticable than others. It might be worth spawning them in like that. What I do instead right now is check if there is an object that can be re-used. If not, it creates a new one. I'll try pre-spawning them instead and see if that helps. It's not a tremendous amount of framerate lag, but it's there often enough when I'm testing that it gets to be a bit discouraging. 

Edit: Had my wife and a friend test it. My wife even tested it from my PC. To them, there was no perceived framerate drop. This makes me think that I'm experiencing is not a framerate drop. I was able to confirm by turning on advanced timing and displaying the FPS and playing. From what I can tell, what I'm experiencing might be a perceived difference in smoothness to how the star sprite positions are updated. This might also be enhanced by the gradient background.

I turned off the background and played for about 5 minutes and found that it doesn't seem to be nearly as much of an issue. So it could definitely be a perceived issue. To better describe the problem, I could say that sometimes it just appears that the falling stars sometimes move more smoothly across the screen than others. Sometimes it looks like they're smoothly falling down the screen, other times it looks like they're skipping positions. As if the rate at which the update or render loop is changing, but somehow also not affecting the fps counter.

Feel free to call me crazy.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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