Game Development Reference
In-Depth Information
An x -value computed from Equation (15.3) can be converted to another
μ
and
σ
value using the
following equation:
=+
x
μσ
x
(15.5)
For example, let's say we want to compute the x value for a Gaussian distribution with a
mean value of 10 and a standard deviation of 2 when the probability value, p , is 0.4. The t value
can be found according to Equation (15.4).
1
t
=
ln
=
1.354
(15.6)
2
0.4
The x value for a Gaussian distribution with a mean value of 0 and a standard deviation of
1 can be computed from Equation (15.3).
2
2.515517
+
0.802853
t
+
0.010328
t
x
=− +
t
=−
0.253
(15.7)
2
3
1
+
1.432788
t
+
0.189269
t
+
0.001308
t
The value of x for a Gaussian distribution with a mean value of 10 and standard deviation
of 2 can be determined from Equation (15.5).
=+ = +
x
μσ
x
10
2 * (
0.253)
=
9.494
(15.8)
Other Probability Functions
There are many other possible probability functions besides the Gaussian distribution, and a
few of them will be briefly introduced in this section. The Gaussian distribution function is
symmetric, but there may be times when you will want to use an asymmetric distribution func-
tion. For example, in a horse racing game, you may want it to be more likely that a horse's speed will
be less than the mean value than the probability that it will be greater than the mean value.
Some of the other standard distribution functions that are used in science and physics
include the Poisson and exponential distribution functions. Details on these functions can be
found in the document “Distributions.” 2 As a game programmer you don't even have to be limited
by the “standard” distribution functions. Almost any function that is continuous between values
of 0 and 1 can serve as the inverse cumulative distribution function for your simulations.
Monte Carlo Simulations
So far in this chapter, you have learned about random number generators and probability
functions. These tools are the building blocks in creating probabilistic simulations known as
Monte Carlo simulations. The fundamental idea behind Monte Carlo simulations is that the
behavior of an overall system is equal to the behavior of the objects that comprise the system.
A Monte Carlo approach would simulate an anthill by modeling the behavior of the individual
ants inside the anthill. The behavior of the individual subcomponents of a system (for example,
the ants) in a Monte Carlo simulation is governed by a probability function. While the Monte
Carlo technique is numerical and statistical in nature, it can be used to model physical
phenomena. Some of the physical processes Monte Carlo simulations are used to model
 
Search WWH ::




Custom Search