Game Development Reference
In-Depth Information
Chapter 17
Collision and Simple Physics
Even the simplest 2D game needs collision. After all, if the objects in a game can
t
interact, how fun could the game possibly be? Breakout is a great example of a sim-
ple game. A ball bounces off walls, bricks, and the paddle. If you look at it this way,
the core of the game experience is created by the 2D collision algorithm. It
'
'
s almost
impossible to design a game without at least some rudimentary collision. Perhaps a
text adventure like Zork is one example, but hey, it hasn
'
t exactly been flying off the
shelves lately. If you are familiar with Zork, that
'
s great because you know your
game history. If you
'
ve actually played Zork, well, then you are probably as
mature
as I am.
Collision is a purely mathematical calculation to determine the spatial relationship
between objects such as points, lines, planes, or polygonal models. I
ll point you to
some great resources outside of this topic that provide good solutions. I ' m not
going to pretend I can offer something better.
Physics, on the other hand, is a much more complicated beast altogether. A physics
simulation in your game will make it possible to stack objects on top of each other,
fall down slopes and stairs accurately, and interact with other dynamic objects in a
visually realistic fashion. It can also create motion under force such as you
'
d see
with motors and springs. It can constrain the movements of objects similar to a
door on hinges or a pendulum swinging in a grandfather clock.
In the spring of 2004, I worked on Thief: Deadly Shadows. This game used the Havok
physics engine on every movable object, including rag dolls for characters. Thief
'
567
 
 
 
Search WWH ::




Custom Search