Salah Posted October 30, 2015 Share Posted October 30, 2015 Hi, I started developing a HTML5 game with Box2d (without using editors), after I have developed 16 levels of the game (from total of 40 levels), I found that the performance is slow on many mobile devices, I heard that Phaser physics engines are excellent on mobile, but I am a little confused, should I redo the whole game on phaser framework? or I can just use the P2.js physics engine from Phaser to take advantage of the code structure that I have built? or I can refine my box2d game performance without using any other framework, any advice? Thank You,Salah Jaber Link to comment Share on other sites More sharing options...
chongdashu Posted October 30, 2015 Share Posted October 30, 2015 Are you certain that the slow performance is due to the physics - and not something else (e.g., rendering?) The reason I'm saying that is -- Phaser also has a Box2D physics engine and I'm pretty sure it works well on mobile. Salah and in mono 2 Link to comment Share on other sites More sharing options...
tips4design Posted October 30, 2015 Share Posted October 30, 2015 P2.js is not the "physics engine from phaser". It's a separate Physics engine that happens to also be included in Phaser. Here is the link to the p2.js website: https://schteppe.github.io/p2.js/But I don't think it will be better on mobile. Depends on how many objects you have and what collision events/detection you want. Salah, WombatTurkey, chongdashu and 1 other 4 Link to comment Share on other sites More sharing options...
Salah Posted October 30, 2015 Author Share Posted October 30, 2015 Are you certain that the slow performance is due to the physics - and not something else (e.g., rendering?) The reason I'm saying that is -- Phaser also has a Box2D physics engine and I'm pretty sure it works well on mobile.I think the problem is due to physics, I have tested it without rendering, and it gives me the same FPS on Google Chrome mobile browser.. Link to comment Share on other sites More sharing options...
Salah Posted October 30, 2015 Author Share Posted October 30, 2015 P2.js is not the "physics engine from phaser". It's a separate Physics engine that happens to also be included in Phaser. Here is the link to the p2.js website: https://schteppe.github.io/p2.js/But I don't think it will be better on mobile. Depends on how many objects you have and what collision events/detection you want.Thank you for information, then, you think that the main problem is from the scene complexity, and not from the physics engine I have used, right? Link to comment Share on other sites More sharing options...
chongdashu Posted October 30, 2015 Share Posted October 30, 2015 I think the problem is due to physics, I have tested it without rendering, and it gives me the same FPS on Google Chrome mobile browser.. I think regardless of whether it's Google Chrome's mobile browser, or some other mobile browser, rendering could still be (and I suspect probably will be) the bottleneck. For example, if you are rendering lots of different sprites on the screen without a sprite batch, the draw calls itself will probably cause a massive slowdown. One thing you could do is try to do a stress test between your current implementation and Phaser. Maybe a few hundred objects of different images spinning around (or doing whatever computation you are using in your game) and compare and see if Phaser provides a performance boost. I suspect that the performance boost will not be from the physics engine (since it does use allow Box2D too). Salah 1 Link to comment Share on other sites More sharing options...
Recommended Posts