Game Development Reference
In-Depth Information
an equal chance that any of the six sides will be face up. In this case, the probability function is
a straight line.
fx
( )
=
0.166667
(15.1)
What Equation (15.1) says is that there is an equal probability,
f(x)
, of any of the six possible
die rolls and that the probability of any particular value being rolled is equal to 1/6. There are a
lot of times when you will not want to assign an equal likelihood to all possible outcomes. If you
were designing a poker simulation, for example, and the computer player started with a pair of
jacks, you might want to have the computer raise 60% of the time, check 30% of the time, and
fold 10% of the time. If a flight of arrows from a group of bowmen were being simulated, it might be
desirable to give the arrows different initial velocities and flight angles. In these situations, a
nonlinear probability function is used.
Figure 15-1 shows a typical nonlinear probability function. The vertical axis displays the
probability that a given value of
x
will occur. For the purposes of this discussion, what
x
repre-
sents is irrelevant. The probability function in Figure 15-1 is symmetric, but symmetry is not
required and some probability functions are asymmetric. The peak of the probability function
is called the
mean
. It is the most likely value of the quantity
x
. In Figure 15-1, there is a 40%
chance that
x
will have the mean value of 10.
Figure 15-1.
A typical probability function
In looking at Figure 15-1, it is clear that some values of
x
are more likely than others. It is
much more likely, for example, that
x
will have a value between 9 and 11 than it is for
x
to have
a value greater than 12. The width of the profile is defined by a quantity called the
standard
deviation
, which we will discuss in more detail a little later in the chapter.