Jump to content

How to improve performance in Evolb


OpherV
 Share

Recommended Posts

So I just posted the new game I've been working on, Evolb

 

I've been running into really bad performance issues - I'm not really sure what is their cause or how to tackle them.

 

To see what I'm talking about http://opherv.github.io/evolb/?loadLevel=random

This generates a random level with all possible game objects (creatures\enemies\power ups\rocks etc)

Try to move the creatures around with the mouse.

At first everything moves very smoothly, but soon you'll start to notice some game hiccups and slowdowns, even on a strong dev machine.

 

When running Chrome devtools profiler the only interesting bit of data is that I get 12.65% total runtime on SAPBroadphase.getCollisionPairs, which is part of P2 physics

Thing is - the game is not that intensive on physics. While there are around 200 objects in the level, most of those have only a circular body. Only the rocks and the environment areas have polygonal bodies.

Everything is ordered neatly into collision groups so that characters collide with characters\rocks\power ups\areas but for examples rocks don't collide with anything but the characters.

I saw that the P2 demos can handle much more complex simulations than this... so I'm really not sure what is the problem here.

 

Profiling the Heap Allocations doesn't reveal any noticeable memory leaks either.

In fact, if you try this level with very few objects you still get slowdowns.

 

I'm truly happy with my choice of Phaser as a platform so far, I really hope I can get this resolved

 

Please advise!

 

Source is available here:

https://github.com/OpherV/evolb

Link to comment
Share on other sites

SAPBroadphase checks wich bodies could theoretically collide based on their bounding boxes and nothing else, as far as I know... So it's got nothing to do with their actual shapes, which only come into play in the narrowphase.

Link to comment
Share on other sites

For me at least the biggest performance killer seems to simply be the screen size, so fill rate is likely the culprit. If I start the game maximised on my dev machine it's pretty slow. If I refresh with the screen size much reduced, the game runs smoothly. Maybe try reducing the number of layers you're using and try turning off filters to see if that helps.

Link to comment
Share on other sites

@wayfinder

Thanks for the insight... I thought as much but still 15% seems a bit high, no? Or is that normal for this amount of physics objects?

 

 

@lewster32
Thanks for the suggestion! It makes a lot of sense, but even running the game in a small viewport with no filters has no effect. I still see slowdowns at random intervals. Maybe the big background is the culprit... I'll try disabling those layers to see if that changes anything. 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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