Jump to content

Phaser Box2D performance on mobile devices


kleepklep
 Share

Recommended Posts

I have to recreate a Box2D game I made in Flash in HTML5. Unless I can figure out a way to pull the Box2D info from the Flash game (I did not hand code the objects, I used Box2d Flash Alchemy Port + World Construction Kit), I was planning to use R.U.B.E. to recreate the world and use Phaser with the Box2D plug-in to load it in like so.

I've built 2 games using Phaser without using the built in physics systems and they work fine on my iPad, but I'm concerned about mobile performance using Box2D and want to set my client's expectations appropriately. So on to my questions...

 

Why does the Bridge demo run so much more slowly than the Conveyor Belt demo? Just wondering if there is something I should avoid.

Why does this run so much better on my iPad than the Phaser demos? I'm guessing it's because it's a simplistic library, but just wanted to point it out as an example of a Box2D demo that runs smoothly on my iPad.

 

None of the public Phaser Box2D examples have a background image. Would adding a background image and images to all of the objects further effect performance?

 

Is there a performance hit in using the Box2D plug-in vs. using Box2D externally like this Phaser game?

 

Would it be insane to try to build a Phaser Box2D game at 1024x768 or larger? I'm guessing that the larger the canvas size the worse the performance. Please correct me if I'm wrong.

 

The bottom line is, I really want use Phaser with the Box2D plug-in, but I want to make sure that it's the right tool for the job. I realize that mobile performance will never match that of a desktop, but I want the game to at least be playable.

Link to comment
Share on other sites

If you want to compare apples with apples then you need to modify the Box2D demos so they're not using any of the debug functions (which most of them do), or using any Phaser.Graphics calls at all. For pure speed you need plain batched images - no geometry, no debug, no Text objects, nothing. Just pure batched textures.

 

This alone will account for the vast majority of the speed differences you're seeing. This is really important on desktop, but on mobile it's the difference between a game that runs at all vs. one that doesn't.

 

The version of Box2D that Phaser uses is the same as most other JS libs.

Link to comment
Share on other sites

Thanks for the insight!

Should I be removing render: render from my new Phaser.Game object code when I'm done with a game? I had forgotten about it and was still calling a render function with everything commented out. Would that cause a performance hit?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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