Game Development Reference
In-Depth Information
commonly physics engines treat everything as a force: impulses are simply forces act-
ing over a very small period of time. This is a force-based engine, and it works in
the way the real world does. Unfortunately the mathematics of forces is more difficult
than the mathematics of impulses. Those engines that are force based tend to be those
with a Jacobian or reduced coordinate approach. Several of the leading middleware
physics offerings are force based.
Other engines use impulses for everything: the topic resting on the table is kept
there by lots of miniature collisions rather than a constant force. This is, not surpris-
ingly, called an “impulse-based” engine. In each frame of the game the topic receives
a little collision that keeps it on the surface of the table until the next frame. If the
frame-rate slows down dramatically, things lying on surfaces can appear to vibrate.
Under most circumstances, however, it is indistinguishable from a force-based ap-
proach. This is the approach we will use in this topic: it is easy to implement and has
the advantage of being very flexible and adaptable. It has been used in several middle-
ware packages, in the majority of the in-house physics systems I have seen developers
create, and it has proved itself in many commercial titles.
In this topic I will cover in depth the creation of a rigid-body, iterative, impulse-based
physics engine that I've called Cyclone. The engine has been written specifically for
the topic, although it is based on a commercial physics engine I was involved with
writing a few years ago. I am confident that the impulse-based approach is best for
developing a simple, robust, and understandable engine for a wide range of different
game styles and for using as a basis for adding more complex and exotic features
later on.
As we move through the topic, I will give pointers for different approaches, and
chapter 18 will give some background to techniques for extending the engine to take
advantage of more complex simulation algorithms. While we won't cover other ap-
proaches in the same depth, the engine is an excellent starting point for any kind of
game physics. You will need to understand the content of this topic to be able to create
Creating a physics engine involves a lot of mathematics. If you're the kind of person
who is nervous about math, then you may find some of this material hard going. I've
tried throughout the topic to step through the mathematical background slowly and
If you have difficulty following the mathematics, don't worry: you can still use the
accompanying source code for the corresponding bit. While it is better to understand
all of the engine in case you need to tweak or modify it you can still implement and
use it quite successfully without fully comprehending the math.
Search Nedrilad ::

Custom Search