The physics engine is particle based, and updates 80 times per second.

Each particle has:

  • a mass

  • a location

  • a velocity

  • acceleration

During each time-step, the physics engine sums forces acting upon the particle and uses Verlet Integration in order to determine the velocity and position for the next time-step.

In order to simulate soft-body physics, four particles are interconnected with a system of dampened bidirectional ideal springs. The high refresh rate in the system is necessary to ensure the stability of the springs, as time-step methods tend to be unstable with springs.

Collision detection is achieved using the sphere radii, which are variable. When a collision is detected, either particle-particle or particle-wall, the physics engine resolves the collision. Initially this was done with a time back-stepping algorithm, which found the exact moment of the collision and then used Newtonian mechanics to resolve the collision. However, due to performance issues, this system was scrapped in favor of process simulating Newtonian mechanics by imparting velocity in the normal direction of the collision onto particles.

An octree was designed and implemented to improve performance, but streamlining the physics functions rendered it unnecessary, as physics test framerates routinely reached 110 fps with 82 bodies on screen (328 particles).

Rotation velocity is not explicitly calculated, but rather is a behavior designed to occur naturally due to the interaction between particles and springs. Due to the implicit nature of rotation in the physics engine, normalized basis vectors can be readily obtained for any given body, and a basis matrix can be formed. This basis matrix allows a rotation of any given polygon mesh to match the orientation of the body in one multmatrixf(float *) function call.

For videos of the game, please visit our YouTube page at: