Hello everyone, Patrick here, one of the developers on Plasma.
I've been meaning to do a focused post on the physics of Plasma for a while. As the old saying goes, there is no better time than the present, so here we are.
As one of two programmers on the project my main focus is on gameplay (building, attaching, detaching, scaling, rotating, etc.) and on physics/robotics.
As you might know, Plasma uses a fairly "new" physics solver based on Featherstone's algorithm, implemented by NVIDIA on their PhysX engine and then supported by the Unity team on the game engine that we use.
I'm not going to attempt to explain in detail how the solver works (mostly because I don't know - refer to https://en.wikipedia.org/wiki/Featherstone%27s_algorithm and the PhD thesis linked there), but instead let's look at what this means in the context of Plasma and in general for a physics sandbox game.
Main advantages
- No error/drift/elasticity in joint movement - a hinge that is designed to spin on an axis will never move or rotate in any other axis
- Support for large mass ratio differences - a light hinge won't implode under the weight of a large object it's trying to move
- High degree of accuracy when stacking joints - a robot hand with accurate finger movement can be simulated correctly
Main disadvantages
- As a restriction in the reduced coordinate model, it is not possible to have closed loops - everything is structured in a 'tree-like' hierarchy (a leaf cannot connect back to another leaf to close a loop)
- Computationally more expensive that traditional rigid body simulations
- More complex to implement some common gameplay scenarios
As a physics sandbox nerd, I get particularly excited about the possibilities enabled by the accuracy of joints, referred to as links or degrees of freedom (DoF).
If, like me, you have played other physics sandbox games and attempted to do any sort of robotics, you will have quickly found out that it's not really possible to do much beyond 2 or 3 link chains, often resulting in elastic/soft movement and positional error on unwanted axis, and attempting to do something like a functional robotic arm that can grab and lift things is pretty much out of the question.
With Plasma, however, allowing for advanced robotics has always been one of my main goals.
A quick example
The setup: a simple stack of 4 rotational hinges
Expected result: the hinges spin accurately on their intended axis
With a traditional
rigidbody system, the result is far from what we would like, almost immediately you see the second hinge starts collapsing and after that we have an unstable mess of stretchy joints rotating in every direction, totally unusable.
{STEAM_CLAN_IMAGE}/42952921/df0eafb12ac9c1c9ae9b46601f5665d2ee95c8a7.gif
With the new
articulation body system that Plasma uses, the outcome is exactly what we are hoping for, a stable, accurate simulation with no unwanted rotations or drift. A physics sandbox nerd's dream :)
{STEAM_CLAN_IMAGE}/42952921/8c185b2f8d2d5011e16eed8474dcac40f972f2d3.gif
In-game example
With a robust joint system, designing a six-legged creature that can walk, turn, and open/close into a ball becomes a delightful engineering process, not hindered by poor simulation or collapsing joints.
{STEAM_CLAN_IMAGE}/42952921/321b6e7e21a9674a55c749d6ef234b3c2692117f.gif
What's coming
While all the above is already a big achievement for our small team, there is still plenty we hope to achieve in the future, such as:
- Closed loops - while these are not possible in the reduced coordinate model, it is however possible to create a typical rigidbody constrain on them - the constrain will not be as rigid as the rest of the articulation but will be acceptable enough for most gameplay purposes
- Inverse Dynamics - somewhat similar in concept to Inverse Kinematics, Inverse Dynamics will allow us to calculate the torque/forces required to be applied to different links to achieve an end pose
- Path planning and collision avoidance - used in robotics to calculate the ideal path for a movement taking into account potential obstacles on the way
In conclusion
I hope this brief deep-dive was helpful in giving more information and context as to what we're doing in Plasma in regards to physics and robotics, please reach out if you have any questions or comments.
Thanks for reading!