0

I am in planning of developing HTML5-Canvas based cross platform game targeting Android and iPhone platforms using Box2D js framework. My game contains some of good physics moves, thus I chose Box2D JS(http://box2d-js.sourceforge.net/).

So, I recently ran some of Box2D HTML examples (http://box2d-javascript-fun.appspot.com/) in my android phone/android tablet. I really felt low performance of these pages while running basic physics moves.

Can anyone suggest how to resolve it?

Can anyone suggest other engines that can provide good performance which must have applied physics moves like Box2D?

P.S.: My Android tablet is having 1 GHz of processor and 512 MB of RAM. While i was running above pages, almost 240 MB was free.

Kaushal O
  • 47
  • 2
  • 7

1 Answers1

1

Yes, canvas really does have poorer performance on mobile devices -- so box2d will also be slower.

Within box2dJS, you can adjust the timing-interval and resolution-iterations to adapt to the slower mobile devices. Adjusting the timing-interval will cause the game to animate faster or slower. Adjusting the resolution iterations will cause the game to be more/less accurate with it's physics. Perhaps you can "fine-tune" box2d and still use it.

I recommend tuning rather than abandoning box2d. Games like Angry Birds use the box2d physics engine and run well on mobile devices. So efficient programming makes box2d perform well (and poor programming can make box2d perform poorly).

More to your question, though: Matt Greer did some testing of physics engines last month and his results are here: http://buildnewgames.com/game-engine-comparison/

And finally, if you don't need the more advanced physics like restitution and friction, you might just "roll your own"! You can pull the matrix transform and collision code out of one of the many open-source physics engines and the hard part is done for you. In addition to learning how they optimized performance, you will end up with a small & fast physics engine that is tuned to your exact needs.

markE
  • 102,905
  • 11
  • 164
  • 176
  • I guess you are suggesting about frame rate increment. As well I'll check about "time interval" and "resolution adjustments" that how i can apply. I'll also check about other engines with Matt's link here. One question still aries here: If i got for other engines like, LIME, Crafty or Impact, then did i get all box2d kind physics effects there?.. Thanks for this help, appreciated :-) – Kaushal O Feb 26 '13 at 05:52
  • Game engines let you establish Scenes, add/remove Nodes, work with Actions and respond to Collisions. They don’t have the advanced physics of Box2d. If you don’t need all the advanced physics, they are good frameworks to start building your games. – markE Feb 26 '13 at 06:29