Easel Physics Engine
Easel uses a custom-built physics engine that was made specifically for Easel. Easel is a multiplayer game engine based on rollback netcode, and the physics engine was designed with that in mind.
In most games, even if you have a large world with thousands of objects, the player is only interacting with a few of them at a time. Easel's physics engine only snapshots and rolls back the parts which change. This enables multiplayer Easel games to still perform well, even on large worlds.
Make sure your bodies are have zero Velocity and TurnRate when they are not being interacted with,
so they are able to sleep.
Under the Hood
Easel's new physics engine is custom-built for Easel. Here is a tour of some of the features that make it special.
Sleep
The fastest way to do something is to not do it at all. When a body is asleep, it does not require any snapshotting, rollback, or any physics calculations until it wakes up again. Unlike other engines which wait for a few seconds of inactivity, Easel puts bodies to sleep immediately when their velocity reaches zero (within a small epsilon threshold).
One tricky case here is gravity, which has the potential to keep your entire world awake with its constant nagging force. Easel tracks the forces and reaction forces on every object and can see whether they are balanced or unbalanced. Regardless of whether it is at zero velocity, as long as one body in a stack has unbalanced forces, the stack has not settled into equilibrium and so the whole stack stays awake.
Spatial Indexing
Like many other physics engines, Easel's broad phase uses a Bounding Volume Hierarchy (BVH) to quickly find potential collisions. Easel's BVH algorithms are optimized to minimize unnecessary snapshotting and rollback, only performing incremental rebalancing when the tree is already undergoing change.
One additional trick is Easel's BVH also tracks the Categories of each collider,
which speeds up common game queries dramatically.
It is very common, for example, for a bot to target the nearest player, and if the player is on the other side of the map,
it would have to traverse through every single collider in the world to find the nearest player.
Finding the nearest Category:Needle amongst a sea of Category:Haystack colliders is a lot faster with a metal detector!
Stepping Without Bounce Back
Making a character take a step is something so common but surprisingly complex in physics engines. A common method is to add velocity for the step, then subtract it after the physics simulation is complete, but a problem arises when the character collides with an obstacle mid-step.
Even if the physics engine does its job correctly and zeroes out the velocity, later on when the previously-added step velocity gets subtracted, it reintroduces the bounce back that the physics engine just zeroed out. It makes your character feel bouncy.
Non-bouncy stepping has been built directly into the solver of the Easel physics engine.
It is treated as position correction and so its velocity does not propagate into future ticks of the physics simulation.
Simply use ForcefulStep with the new restitution=0 parameter,
and Easel's physics engine will make sure the step does not bounce back.
Continuous Collision Detection
Continuous collision detection is Easel is performed by sweeping and then shape casting like other physics engines. Other physics engines sometimes do the sweeping first, which can lead to incorrect results in some cases. In Easel, collisions are resolved first, then the sweeping is done using the updated velocities. This ensures correct results.