Physics Engines
Theory
-
Parallelizing the Physics Solver of Teardown .
-
TLDR :
-
He uses a graph-based technique to separate constraints that can be processed in parallel (the Box2D 3 technique).
-
Then, idle time between threads is optimized to gain performance: Spin Lockless > Lockless > Sync Primitives.
-
He mentioned he would implement Work Stealing in the future, said it was a good idea.
-
Makes total sense, tbh, strange he hasn’t tested it yet, but he said he would.
-
-
-
It uses the technique developed for Box2D 3.
-
He strongly recommends the Box2D author’s blog and says the new Box2D is incredibly fast.
-
-
The video is nice, but it only covers those two concepts. The presentation is a bit stiff.
-
His profiler is homemade, but he recommended Tracy.
-
"It has to be a lockless profiler".
-
-
His lifetime work has been on physics engines.
-
About the Physics Engine :
-
"Putting the solver on the GPU ends up forcing the entire game onto the GPU since physics interacts a lot with gameplay; not a good idea."
-
Which solver?
-
All solvers are relatively similar, as long as they follow Projected Gauss-Seidel / Sequential Impulse .
-
-
How many iterations?
-
I found 6 for Teardown. It’s based on experimentation. Many games use 4 or 8.
-
"It's a performance / quality tradeoff".
-
-
-
{34:30}
-
Comparison chart.
-
-
-
-
The video isn’t focused on programming or performance, but on the theory of realistic car simulation; it’s about cars only.
-
The guy is a tire nerd; ultra hyper-focused on cars.
-
There’s quite a bit of theory behind it.
-
.
-
-
He explains Gear Shifting, sound generation, etc, etc, lots of stuff.
-
-
{43:30}
-
The clip is wild, very cool.
-
-
Options
Manually
-
Playlist about building a physics engine .
-
Resolution is done via ~
move(in the direction of a normal vector, by a depth), for both colliding objects.
-
-
-
AABB: Axis Aligned Bounding Boxes.
-
Performs a check on all axes and looks for "intersection", where this is defined via a check of the 'min' and 'max' of both areas.
-
-
SAT: Separating Axis Theorem
-
Rotates the object at different angles, projecting what is "seen" on an axis where it is analyzed whether there is intersection or not. If there is any intersection in any of the projections, then the objects are touching.
-
-
Box2D
-
Box2D .
-
Open-source, MIT.
-
Written in C (C17).
-
The newest version of Box2D is written in C; version +3.x. It used to be in C++, but they preferred switching to C.
-
Odin :
-
[dev-2025-06]
vendor:box2dUpdate to 3.1.0
-
-
Pros :
-
Mature & Stable: The gold standard for 2D physics, used in countless games (e.g., Angry Birds, Cocos2d-x games).
-
Lightweight: Optimized specifically for 2D, making it very efficient.
-
Good Documentation: Large community, tutorials, and integrations (Unity, Unreal, custom engines).
-
Deterministic: Helpful for replays and networked games.
-
-
Cons :
-
No 3D Support: Purely 2D—you’d need to switch engines later for 3D.
-
Limited Parallelism: Single-threaded by design, though some forks add minor optimizations.
-
No Built-in Bone Support: You’d need to manually implement ragdolls or procedural animation.
-
LiquidFun
-
Fluid/soft body physics, extends Box2D
Planck.js
-
JavaScript port of Box2D
Dyn4j
-
Java.
-
Inspiration: Box2D’s design, but for Java/Kotlin games.
-
Why Use It?
-
Good for Android/LibGDX projects.
-
Chipmunk2D
-
Simpler alternative to Box2D (used in iPhone games).
Nape
-
Haxe.
-
Discontinued but influential.
-
Box2D, but with a stronger focus on game physics.
-
Legacy: Inspired later engines like Heaps.io’s physics.
Jolt Physics
Rapier
-
Rapier .
-
Rapier .
-
Open-source, Apache 2.0.
-
Rust.
-
Pros:
-
Fast & Deterministic: Great for 2D/3D networked games.
-
Simple API: Easier to use than Jolt for basic needs.
-
-
Cons:
-
Less Feature-Complete: No advanced destruction/ragdolls.
-
Smaller Community.
-
-
Verdict: A good Jolt/Box2D alternative for Rust or WASM games.
PhysX 5
-
Open-source Apache 2.0.
-
PhysX 5 is open-source, but it’s a stripped-down version of NVIDIA’s proprietary PhysX (used in Unity/Unreal).
-
Jolt is fully open-source (MIT) and often outperforms PhysX in CPU-based simulations.
-
PhysX 5 .
-
Type: C++
-
Inspiration: Jolt’s focus on parallelism, but GPU-accelerated.
-
Why Use It?
-
Open-source version of NVIDIA’s engine (used in Unity/Unreal).
-
NVIDIA PhysX 4.x (Unity & Unreal’s Default Physics)
-
Closed-source.
-
Pros:
-
Highly Optimized: GPU-accelerated for large-scale simulations (rigid bodies, cloth, particles).
-
Good 3D Support: Industry standard for many games (Unity & Unreal default).
-
Deterministic Options: Useful for networking/replays (with some tuning).
-
Supports 2D (Box2D in Unity): But 2D mode is simplified compared to Box2D.
-
-
Cons:
-
Closed-Source (mostly): Limited customization (Unity/Unreal expose only high-level APIs).
-
Not the Best for Parallelism: PhysX 4.x improved multithreading, but Jolt’s job system is more flexible.
-
No Bone/Ragdoll Authoring: You need higher-level tools (like Unreal’s Chaos or animation systems).
-
-
Verdict:
-
Good for general use, but less control than Jolt.
-
Chaos Physics (Replacing PhysX in UE5)
-
Closed-source.
-
Pros:
-
Built for Destruction & Large Worlds: Handles fractures, deformations, and massive scenes well.
-
Multi-threaded: Better parallelism than PhysX.
-
Integrated with UE5’s Nanite & Niagara: Great for next-gen visuals.
-
-
Cons:
-
UE5-Exclusive: Not usable outside Unreal.
-
Overkill for Simple Games: Focused on AAA-scale physics.
-
No Standalone 2D Mode: You’d need to lock axes manually.
-
-
Verdict:
-
Best for high-end 3D in Unreal, but not for 2D or cross-engine use.
-
Havok
-
Microsoft bought it.
-
"Contact Microsoft and they’ll get back to you to decide if you’re 'worthy'."
-
P2.js
-
Type: JavaScript
-
Inspiration: Box2D, but for web games (used in early Phaser games).
Bullet Physics (Older Unreal & Older Godot Versions)
-
Pros:
-
Open-Source & Cross-Platform.
-
Supports Soft Bodies & Ragdolls.
-
-
Cons:
-
Outdated: Lacks modern optimizations (Jolt/Chaos are faster).
-
Poor Multithreading.
Verdict: Only consider for legacy projects.
-
Open Dynamics Engine (ODE)
-
Key Features:
-
Stable, supports vehicles & articulated bodies.
-
-
Best For:
-
Robotics simulations or older game projects.
-