Sign in to follow this  
presidenten

Optimize performance

Recommended Posts

is your game running generally slow or what seems to be the issue?

Generally slow now. Before I updated to 2.4.3 I had kind of good performance even on Ipad2. Now it only runs well on iphone 5s and mac google chrome. Im going to try some obvious stuff like decreasing size of sprites and such, but all tips are welcome.

Thanks for the tip clark! Ill have a look at game.forceSingleUpdate tomorrow.

Share this post


Link to post
Share on other sites

I am using a lot of Physics and AI in a p2 game. I improve perfomance by:

  • Recicling objects using pools, and before the game starts create (and kill) a number of objects you consider will be in screen at the same time, just to load them in memory.
  • If game requires AI, I only calculate things when are visible or near if possible, and don't calculate thinks in update(). I do it with game.time.events.loop, I put 200ms for example.
  • In general, avoid doing things when you can't see them.

 

game.forceSingleUpdate = true;

In the first state of your game.  It really depends on the game though, I do not use Physics and get better performance with forceSingleUpdate. 

 

 

I just tried it and in my case works strange, I will make some tests

Share this post


Link to post
Share on other sites
I am using a lot of Physics and AI in a p2 game. I improve perfomance by:

  • Recicling objects using pools, and before the game starts create (and kill) a number of objects you consider will be in screen at the same time, just to load them in memory.
  • If game requires AI, I only calculate things when are visible or near if possible, and don't calculate thinks in update(). I do it with game.time.events.loop, I put 200ms for example.
 

Ill try out the time.events.loop approach. There is some logic being done by each character right now. Thanks!

ForceSingleUpdate didnt really do much for me. Im also using P2 btw...

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

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.