Construct 2 has three kinds of physics engines it uses to run physics operations:
box2dweb
version of the physics engine. The box2dweb
version is based on the box2d
physics engine; a physics engine is commonly used for native games. The box2dweb
version is the JavaScript version of it that's intended to be used for web games.box2dweb
. It uses emscripten
(a technology from Mozilla) that takes C and C++ code and produces JavaScript, creating high-performance JavaScript code as a result. This is what's called asm.js
, and the browsers that are optimized for asm.js
can translate this code to enable fast performance that you'd get from native C and C++ codes. However, all this happens in your browser.By now, maybe, some of you have a good question in mind: if the asm.js
version of box2dweb
is faster than normal box2dweb
physics engine, then why not make box2dweb asm.js
the default physics engine? It turns out that there are two drawbacks of this asm.js
physics engine. They are as follows:
disable collisions
action. Some old games that are created before the physics engine feature is added might use an action to disable collisions, and setting the asm.js
as the new physics engine will break these games. To enable backward compatibility as much as possible, asm.js
is not the default physics engine.asm.js
version of the same code, so if you want to deploy games for iOS, it is advised that you do not to use the box2dweb asm.js
physics engine.Okay, so now you know the three types of physics engine Construct 2 uses. Which one should you use? If you're deploying to mobile using CocoonJS, use the CocoonJS physics engine; if you're targeting iOS platforms, use box2dweb; and if you use the disable collisions' action in your game, use box2dweb. If you encounter anything other than these, use the box2dweb asm.js
physics engine.
If you want to learn more about the Physics behavior, there's an online manual on Scirra's website (https://www.scirra.com/manual/98/physics).