What i have done so far?
I read through books and bachelor/master thesises till i felt comfortable with everything. I even implemented a 3D impulsed based Engine. The 3D engine is based on Game Physics Engine Development by Ian Millington. The engine has problems if you want to extend the engine with joints and resting contacts (you don’t have to understand that it will be explained in the next parts).
The engine i build is based on Farseer Physics…
I can’t find a developer friendly physic engine theory explanation. So i read through alot math thingys till i got a basic understanding. Now i read physic engine codes and reverse them to build “my own” engine. This process is documented here. Once in a week or even more frequently if a special topic needs distinct explanation.
We build the basics and extend the engine till we got a full rigid body engine.
In the game loop before the rendering we do a world simulation with the given elapsed time. The world simulation has the following structure (based on Farseer):
* Things will be added later, because it’s just performance boost or features which will prevent the basic understanding.
What shapes do we support?
I try to seperate the Collision and Physic Engine so you could add your shapes. The first shape i use are Boxes. I don’t want spheres because:
The first 3 points of the Physic Engine Loop: Cheap Rendering, Management of Body Adding and Removing, Integrating Gravity and Damping, Integrate new Position/Rotation and Collision Detection
We just draw boxes with orientation and position… Easy
Management of Body Adding and Removing
Short code to make it thread safer
Integrating Gravity and Damping
Very short code just basic formula
Integrate new Position/Rotation
Just basic formula
This will be the main topic. Since we are in 2D Space not that hard ^^