Game Development Reference
In-Depth Information
If someone read a review like this, they might think “Hey, this game sounds cheesy. I don't
think I'll buy it.”
The point is that physics matters. It is one of the first things reviewers and potential users
will look at when they are evaluating your game. Keep in mind when creating games (just like
in writing topics) that you can't fake it. If you use bogus physics in your games, somebody will
notice, and that somebody will write in to the game forums and tell the world how crappy your
game is. While if you take the time and effort to get the physics right, your games will get the
reputation for being the coolest and most realistic games around.
Adding Physics-Based Realism Is Easier Than
You Might Think
Physics has an unfortunate reputation for being really hard. People think of Albert Einstein
locked away in his office generating horribly complicated mathematical equations for years
and years. In reality, most of the physics models you need as a game programmer, and most of
the physics models discussed in this topic, are reasonably simple. Ninety-five percent of the
mathematical equations you will see in this topic will be algebraic equations or simple trigo-
nometry (sines and cosines).
Let's look at a couple of quick examples of the types of mathematical equations you will
encounter in this topic. A common task for game programmers is to model the trajectory of a
projectile—a bullet, cannonball, basketball, and so on. One of the things typically required is to
determine the altitude of the projectile at a given time. If the only force acting on the projectile
is gravity pulling it towards the earth, the altitude of the projectile is a function of the elapsed
time, t , the initial velocity, v 0 , the initial altitude, z 0 , and the acceleration due to gravity, g .
1
2
2
zz vt
=+ +
t
(1.1)
0
0
Equation (1.1) is a simple algebraic equation, and yet there is real physics in it. In some
situations, computing the trajectory of a basketball for instance, Equation (1.1) is the expression
you will use in your game programs. An example of when trigonometry is used is the problem
of modeling a car resting on a sloped ramp as shown in Figure 1-1.
Figure 1-1. The force acting on the car is a function of the sine of the slope angle.
Search WWH ::




Custom Search