Recommended Posts

Hi Guys,

I have multiple game states and one of them is kind of slow on mobile, while it works just fine on desktop. I ran a js profile to find out what could be the potential cause of this and attached it as a reference here. I know this image does probably not give away enough in order to make any clear predictions on what the issue for my fps drop is, but maybe the pattern of the times spent for the functions to execute yields something I could make use of.

I commented out most of my update functions of that state to see whether the issue is hiding in there, but no success. The imagery and text I am rendering is also smaller and less than on my working states. I also tried to destroy and null all objects of the previous state. There might be still a couple I haven't captured.

This is what I null:

    this.game = null;
    this.add = null;
    this.make = null;
    this.input = null;
    this.state = null;
    this.stage = null;
    this.time = null;
    this.world = null;

 

Any suggestion what could go wrong? 

tmp.PNG

Share this post


Link to post
Share on other sites

Some performance optimization i have found for my game are:

  • do not use webgl - this one can make a large difference in fps
  • do not use webaudio if you dont need it - this one helps on ram consumption you may turn it of before starting phaser with this:
window.PhaserGlobal = {
    disableWebAudio: true
}
  • if you use large map toggle sprite visibility of when they are out of camera view
sprite.visible = false
  • if you have full background you can set clearBeforeRender = false - didnt see much difference but may help in some cases
game.clearBeforeRender = false
  • if you don`t need running in background disableVisibilityChange = false (by default but you may have changed it)
game.stage.disableVisibilityChange = false
  • if you are using pixelart set antialias = false
game.antialias = false

 

Probably there will be more to come but at this time it enough for me to keep 30fps even on slowest device i have.

 

Share this post


Link to post
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...

  • Recently Browsing   0 members

    No registered users viewing this page.