Game Development Reference
In-Depth Information
might not use physics as its core game experience, but it certainly creates a convinc-
ing illusion of a complete world in which the player can interact with objects in a
meaningful way and affect the events of the game. Here
s an example: You could
knock a barrel down a flight of stairs, and each impact reported by the collision sys-
tem would trigger a sound effect that you heard through the speakers. The actions
would also trigger sound events in the AI subsystem. This would bring curious
guards around to investigate the noise.
You might think for a moment that you could have a similar game experience
without a complicated physics simulation, and you are right. The aforementioned
barrel could have simply shattered into bits when you knocked into it, and the
same guard could have investigated it. The fundamental difference is one of realism
and how far the player has to go to imagine what happens versus seeing it in front
of his eyes.
Many games don
'
'
t have super-accurate physics simulations, something you
'
ve prob-
ably suspected, but perhaps you
ve wondered why the designers and programmers
stopped short of doing. A truly accurate physics simulation for every game object
is an expensive proposition, CPU-wise. Every game will make reasonable optimiza-
tions to make things faster. For example, most physics simulations assume that
buildings and other architecture are essentially infinite weight and impossible to
break. Load any racing game, like Project Gotham 4, and try running into a barri-
cade with a Ferrari at over 200 mph and tell me that a real barricade would survive
that impact without being horribly mangled. It won
'
'
t, and therefore that simulation
'
isn
t completely accurate.
But it is quite a bit of fun to rebound off barricades in games like Project Gotham at
high speed to get around corners faster, isn
m trying to make is that
you have to understand your game before you decide that a physics simulation will
actually add to the fun. A game like Thief benefited from accurate physics, but Project
Gotham would have been remiss to create something perfectly accurate in every way,
even if it could have afforded the CPU budget.
Think about this for a moment: Is it better to have the pendulum in a grandfather
clock act under a completely realistic physics simulation or a simple scripted anima-
tion? The answer is completely dependent on your game, and by the end of this
chapter, hopefully you
'
t it? The point I
'
ll be able to answer that question for yourself.
Since I only have one chapter to talk about collision and physics, I only have time to
show you how to use an existing system (specifically the open source library, Bullet)
in your game. We
'
ll cover the basics and get right into how you can best use these
complicated pieces of technology.
'
 
Search WWH ::




Custom Search