We want Easel to be powerful enough to make the kinds of games you would play for hours. Popular multiplayer games like Among Us let you walk around an entire spaceship, completing tasks and evading impostors. Unfortunately, up to this point, games of that scale were out of reach for Easel, because the off-the-shelf physics engine would have to snapshot and roll back the entire world to support Easel's predictive multiplayer architecture. It's too much to do every frame.
Until this point, you were required to keep your world small. But not anymore!
Easel's new custom-built physics engine only snapshots and rolls back the parts of the world that change. That big spaceship might have thousands of objects forming the walls, the control panels, the vents, and so on. However, each frame, a surprisingly few number of objects actually change - perhaps less than 30 per frame as the players walk around and interact with the world. A smart implementation keeps objects sleeping while they are offscreen.
With only 30 objects out of thousands needing to be snapshotted each frame, a factor of 30-50x fewer than before, multiplayer Easel games with large worlds suddenly becomes feasible. Release the feral hogs!
Easel's new physics engine is custom-built for Easel, which is why it supports everything Easel supports, but better! Here is a tour of some of the features that make it special.
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, of course, we're not slow).
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.
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. Do you only do the vacuuming just before your friends come over? Easel's BVH is lazy efficient just like you.
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!
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.
... continue reading