In this lesson, you will learn how the Chaos Physics solver leverages a multi-threaded architecture to decouple heavy physics calculations from your game’s main logic.
Decoupling the Game Thread
In older physics systems, the simulation often ran directly on the game thread. This meant that if a complex scene had too many collisions, your frame rate would drop because the CPU was busy solving physics equations instead of processing player input or rendering.
Chaos solves this by introducing a Physics Thread that operates independently of the Game Thread. Think of it like a restaurant: the Game Thread is the "front of house" taking orders (player input) and serving guests (rendering), while the Physics Thread is the "kitchen" working entirely on its own schedule to prepare the meals (calculating collisions and forces).
The Multi-Threaded Pipeline
The communication between these two threads happens through a specialized data structure called the Physics Proxy. Because the threads run asynchronously, the Game Thread cannot modify physics objects directly. Instead, it sends "commands" to the Physics Thread.
When you adjust a property like Mass or LinearDamping in your character blueprint, the engine doesn't change the value in real-time. Instead, it queues a command to the physics thread. This ensures that the physics state remains consistent and crash-proof, even if the frame rate fluctuates.
For example, when setting up a physics body in C++:
// We set properties that are pushed to the Physics Thread
GetMesh()->SetMassOverrideInKg(NAME_None, 100.0f);
GetMesh()->SetLinearDamping(0.5f);
Behind the scenes, the SetMassOverrideInKg call doesn't pause the game. It packages this request and dispatches it to the Chaos solver, allowing the Game Thread to continue executing your logic at a smooth 60 or 120 FPS. This separation is the reason why even highly destructive environments in Unreal Engine can remain performant; the "kitchen" is simply working in parallel with the "dining room."
Key Takeaway: Chaos architecture maximizes performance by isolating physics math on a dedicated thread, preventing simulation heavy-lifting from stalling your game's input and logic processing.