# Difference between Arcade, P2 and Ninja physics in Phaser

I am a beginner and trying to learn game development using Phaser. Currently Phaser is providing three physics systems namely Arcade, P2 and Ninja. But I don't know the differences between them and I would also like to know in which scenario we should use a particular physics system?

Please give me some insight for these physics systems.

• Phaser ships with our Arcade Physics system, Ninja Physics and P2.JS - a full body physics system. Arcade Physics is for high-speed AABB collision only. Ninja Physics allows for complex tiles and slopes, perfect for level scenery, and P2.JS is a full-body physics system, with constraints, springs, polygon support and more. Commented Apr 4, 2014 at 6:07
• And now there is also the paid Box2D backend, which should be similar to P2.JS but better. Commented Jan 23, 2018 at 16:55

As mentioned in the comments, their site already explains what the three systems are and what they can be used for.

Arcade Physics is for high-speed AABB collision only.

AABB means axis-aligned bounded rectangles; it means you have objects without rotation, and you're only checking if the image (which is a rectangle) overlaps with another image (so there's a potential collision). This is cheap to compute, and fast, which is probably why they recommend it for high-speed collisions.

One issue with AABB is that it doesn't guarantee that there really is a collision; you may have a completely transparent area overlapping.

Ninja Physics allows for complex tiles and slopes, perfect for level scenery, [...]

Remember how AABB is non-rotated? Ninja Physics will handle rotations (so it can do slopes and complex tiles). This is a more flexible (and probably more accurate) physics model; it's probably slower.

[...] P2.JS is a full-body physics system, with constraints, springs, polygon support and more.

If you need to model springs (eg. something swinging like a pendulum), constraints on forces, and arbitrary polygon shapes (eg. tetrahedron), this sounds like what you want. If you want a frame of reference, think of something like Angry Birds.

Based on your game, you can pick which is the best-fit to your needs. It sounds like a spectrum of speed versus accuracy/complexity (Arcade Physics being the fastest but simplest).

• does one incidence of the more precise model decrease performance? Commented May 18, 2014 at 8:55
• @expiredninja yes, of course. AABB is fast and cheap; the other two are more complex and feature-rich (eg. slopes, rotations) so they come at a performance cost. Commented May 18, 2014 at 9:38
• i guess I was wondering about what the thresholds generally are in terms of number and/or complexity of objects. Commented May 21, 2014 at 19:09
• @expiredninja that will depend largely on your hardware and game logic. I suggest you open another question, or better yet, just try them and see what works best for your needs. Commented May 21, 2014 at 20:35