Why You Should Be Using the PGS Solver

December

19, 2017

by timobius


Creators Tech

A few years ago, the Roblox physics team developed and released a new state-of-the-art physics solver. The motivation behind this effort was to offer simulation capabilities not possible with the original solver, including building and running complex machines and articulated mechanisms – from full suspension vehicles and realistic construction equipment to robots and mechanical bugs. We also wanted to provide better behavior with more common models like doors, rotors, and rolling wheels. And so, the team embarked on a mission to completely redesign the physics solver from the ground up. Using a high-fidelity dynamics solving algorithm tuned for speed and a new architecture for joints, the reimagined physics solver (PGS solver) brought new levels of precision and smoothness to all types of motion simulation. And it also gave the Roblox engineering team a solid foundation to extend its capabilities into the future.

In this post, I would like to do a review of the advantages of using the PGS solver and showcase some examples of the amazing models that can now be simulated. Even though the new solver is the default setting for new games, there are still places out there that use the legacy solver. Our hope is to inform and motivate these builders to make the switch and take advantage of the superior PGS characteristics available today, as well as the ongoing improvements planned for the coming weeks and months.

A next-generation physics solver

Years ago, when working on one of my first Roblox games, I built an oversized vehicle and immediately noticed that this was happening:

The wheels were tilting due to bending at the hinge joint, an expected artifact of the spring-based legacy solver. I noticed similar flexing, or joint sponginess, when I tried to build heavy doors, unbalanced rotors, and cars driving aggressively over obstacles. I simply could not get the precision I needed from the spring solver for the types of models I wanted to build. Experiences like this, both from within Roblox and across our entire developer community, fueled our desire to develop the next-generation solver with much better joint precision, performance, and extensibility.

In 2015 we moved forward on new solver research and development, and later that year released the PGS solver, which employs an innovative formulation specifically designed to accurately simulate models with joints and collisions. In other words, joints no longer separate or bend during simulation, even under very high force and torque conditions.

Updates since the launch of the PGS solver

Since the original release, there has been an ongoing effort to improve PGS performance and stability, reduce memory footprint, and extend its capabilities. These activities include the introduction of new tools for creating mechanical joints, or Constraints, based on Attachments. With the Constraint/Attachment objects, builders can more easily create, edit, and analyze complex models. It also provides the foundation for new joint types such as prismatic, cylindrical, ball, rod, spring, and rope joints to allow builders to further explore whatever dynamic creation they might imagine.

Following the initial release of Constraints, we utilized the same Constraint/Attachment classes to offer a new suite of body movers that are more powerful and easier to use (see new body mover documentation on AlignPosition, AlignOrientation, VectorForce, LineForce, Torque). More recently was the release of the Cylindrical Constraint, as well as more joint limit capabilities for the BallInSocket Constraint. Finally, the Inverse Kinematics dragger, which can only be used with Constraints and the PGS, is the latest exciting feature to reach production.

Examples

Given the rich feature set associated with the PGS solver, there is no shortage of awesome models and games appearing that utilize it. Here are just a few of them:

We’ve talked about some of the benefits and cool features that you get with the PGS solver today, but the Physics team is just getting started. The new solver, as well as the accompanying tools and architecture, will be the primary focus of nearly all future physics work. In fact, in the coming months, you will see PGS improvements with distributed physics, humanoid behavior, model stability, memory, and speed.  We will also continue to introduce new Constraint types. Conversely, almost no development time will be allocated to bug fixes or improvements with the legacy solver.

Today, nearly 75% of Roblox game play time is using the new solver. With nearly full-time focus on extending and optimizing the new solver technology, now is the time to work together to get all games using the PGS solver!

For more information on the PGS solver and how to enable it, please visit this wiki page.