Game Development Reference
In-Depth Information
average interval was 5 minutes, it is very unlikely that we would encounter an
interval of more than 10 minutes. The reason for that is an almost necessarily math-
ematical symmetry that is necessary for generating an average. That is, with an
average of five minutes, every six-minute interval can be balanced by a four-minute
one, every seven-minute interval can be balanced by a three-minute one, and so
on. While an interval of 10 minutes or more is certainly possible , to maintain the
5-minute average it would require more than one corresponding interval of less
than 5 minutes.
The result of this balancing act is that as the average interval decreases, the
range of the distribution narrows. As the average interval increases, the range
widens. It is worth noting that because of this balancing problem, the distributions
are right-skewed—that is, the median and mean are to the right of the mode. The
tails are longer on the positive side than they are on the negative side.
Another artifact of this characteristic is that the likelihood of the average inter-
val occurring decreases because the distribution is spread over more intervals. This
is similar to the effect we saw with the normal distributions. The wider the bulk of
the curve (i.e., the standard deviation) is, the fewer occurrences of the result at the
mode.
This distribution is excellent for randomizing the times between events that
otherwise would occur at regular intervals. For example, if we want an agent's ac-
tion to occur every 15 seconds, we can generate a Poisson distribution with
λ
= 15
to determine in which second the event should occur.
Computational Drawbacks
One of the drawbacks of the Poisson distribution is the computational overhead in-
volved in calculating factorials. From a calculation time standpoint, factorials are
relatively inexpensive to compute. We can determine them from a simple loop. If
we did want to speed up this calculation, we could use a lookup table instead.
Of more concern is how quickly the size of factorial results increases. 10! =
3,628,800. 11! checks in at just under 40 million. Likewise, we face some signifi-
cantly large intermediate calculations with
λ
k
in the numerator of the equation.
With
= 15 and k = 15, that single calculation is 437,893,890,380,859,375… and we
haven't even multiplied it with e 15 yet! I know the graphics folks like to brag about
how many calculations and big numbers they push around, but we don't need to
try to out-gun them quite this much!
As percentages, the actual results of Poisson distributions are not terribly large.
Therefore, if we know the ranges of the potential
λ
and k values that we want to use
ahead of time, they can be calculated offline and stored in a lookup table. (As we
will see soon, storing probability values in an array-like structure will come in handy
anyway.)
λ
Search WWH ::




Custom Search