Jump to content

P2.js performance on iOS? FPS drops suddenly


tips4design
 Share

Recommended Posts

I have a problem with my Phaser game (tested through Cocoon Dev App) on iOS. The game is about stacking boxes and runs smoothly at 60FPS when there are 3 boxes stacked. As soon as I add the 4th box the FPS drops to 40FPS and stays there. I have noticed that if I set the boxes to kinematic (eg: disable p2 physics on them) the FPS goes back to 60FPS. Any idea what is wrong or how could I solve this issue? Why would the FPS drop that much by adding only an extra physics square body?

It sometimes doesn't drop the fps instantly after the 4th block is dropped, but it fps drops after a 4-5 seconds.

It might be an iOS bug as it doesn't happen on Android (eg: on my Nexus7 the FPS stays at 56FPS regardless the number of boxes present)

Link to comment
Share on other sites

@schteppe see it also happens on my old Nexus 7 2012. With 4 blocks and physics enabled, about 30-40FPS, when I make those 4 blocks static it goes back to 60FPS. I don't think that P2JS is that CPU intensive, my guess is that there is some CPU limit that the browser has and if it is reached then the update loop timeout is increased (from 16ms to 25ms or something). I mean, it makes no sense why adding a single new block suddenly drops the fps from 60 to 40 unless there is some kind of either CPU or memory limit that is reached. Again, this "limit" is not affected if the blocks body is set to kinematic.

@Mike018 I don't think p2 is bad for mobile. What else should I use? Box2D is the same I guess. The game runs at 60fps without problems for most devices (even for 3-4 years old devices). This honestly looks like a bug somewhere to me.

I tried reproducing the problem with a minimal code in jsfiddle, but it doesn't occur if I simply add 4 sprites with p2 enabled on them.

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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