Game Development Reference

In-Depth Information

The thing is, basic (forward) Euler integration has a hard time dealing with stiff

springs. This is the major drawback of forward Euler integration, and often a

showstopper. The problem is that particle positions and velocities come out of

sync when time steps are too large. This in turn leads to instabilities, which lead

to pain and suffering.

11.2.2 Backward Euler Integration

A way to make up for this is to use implicit integration. The method of back-

ward Euler integration belongs to the family of implicit-integration methods. The

members of this family all provide more stability in situations with stiff equations

and generally let us use larger time steps without the risk of the system blowing

up.

With backward Euler integration, we update the current position, not with

the current velocity and acceleration vectors (as was the case with basic Euler

integration) but with the resulting velocity vector
v
(
t
+Δ
t
) and the resulting ac-

celeration vector
a
(
t
+Δ
t
). The problem with this approach, however, is that the

acceleration and velocity at time
t
+Δ
t
are unknown, and therein lies the prob-

lem with backward Euler integration: as we cannot directly evaluate the update

velocity and acceleration, we need to solve for the unknowns. The resulting set

of equations can be rather large if there are many particles. This calls for (usually

slow) numerical methods for solving equations. This means that in their basic

forms, neither backward nor forward Euler integration is immediately useful for

our purpose.

11.2.3 Other Approaches

Experimentingwith other approaches, such as adaptive integration or higher-order

integration methods such as Runge-Kutta, may bring you closer to the desired

result, but these methods, too, are not ideal choices for real-time, interactive use

for the same reasons: they are basically either slow or unstable. So what does an

intelligent game physics programmer do? It seems we cannot escape either having

to deal with instability or too much elasticity in the case of explicit integration

methods or being forced to solve unwieldy systems of equations in the case of

implicit integration methods—or, alternatively, waiting an eternity for adaptive

methods to finish.

Luckily, as it turns out, we can have the best of two worlds. The so-called

semi-implicit methods (also known as semi-explicit methods) are both simple
and

stable. And while we may lose some accuracy in some cases, it doesn't really

matter in the case of game simulation. Who cares if the dead body flies ten percent

too far or too short? We're not sending a (real) rocket to the moon. On the other