What is Game Physics?
When we talk about physics in a game, we really mean classical mechanics, that is,
the laws that govern how large objects move under the influence of gravity and other
In games, classical mechanics is used to give game objects the feel of being solid
things, with mass, inertia, bounce, and buoyancy.
As processing power became available, we saw crates that could be moved around
or stacked, and walls that could be destroyed and crumble into their constituent
blocks. This is rigid-body physics, which rapidly expanded to include softer objects:
clothes, flags, and rope. Then came the rise of the ragdoll: a physical simulation
of the human skeleton that allows more realistic trips, falls, and death throes. And
recently we’ve seen a lot of effort focused on simulating fluid flow: water, fire, and
What is Physics Engine?
A physics engine is a common piece of code that knows about physics in general, but isn’t programmed with the specifics of each game.
The physics engine is basically a big calculator: it does the mathematics needed to simulate physics. But it doesn’t know what needs to be simulated. In addition to the engine we also need game-specific data that represents the objects in our level.
The advantages of using physics engine are well known. On the other hand, the main disadvantage is that a general-purpose physics engine is quite processor-intensive. Because it has to be general, it can make no assumptions about the kinds of objects it is simulating.
Approaches to Physics Engine
Types of Objects
The first distinction is between engines that simulate full rigid bodies or so-called “mass aggregate” engines. Rigid-body engines treat objects as a whole, and work out the way they move and rotate. A crate is a single object, and can be simulated as a whole. Mass aggregate engines treat objects as if they were made up of lots of little masses. A box might be simulated as if it were made up of eight masses, one at each corner, connected by rods.
Mass aggregate engines are easier to program because they don’t need to understand rotations.
Mass aggregate engines treat each mass as if it were located at a single point, and the equations of motion can be expressed purely in terms of linear motion. The whole object rotates naturally as a result of the connections between masses.
The second distinction involves the way in which touching objects are processed. a lot of the difficulty in writing a rigid-body physics engine is simulating contacts—locations where two objects touch or are connected.
There are different ways to resolve this problems:
1. Handle each contact one by one, making sure each works well on its own.
2. Use Jacobian-based approach: Calculate the exact interaction between different contacts and calculate an overall set of effects to apply to all objects at the same time.
3. Calculate a set of equations based on the contacts and constraints between objects.
Impulses and Forces
The third distinction is in how the engine actually resolves contacts.
Impulse is the integral of a force with respect to time. When a force is applied to a rigid body it changes the momentum of that body.