Game Development Reference
In-Depth Information
12
Response Curves
One of the drawbacks of some of the functions we looked at in Chapter 10 is
that we are entirely at the mercy of the mathematics. Even if we could con-
struct a function that gives us close to the shape that we wanted, we are still
stuck with every bit of it. We have no way of tweaking a portion here or there to be
“just a bit higher� or “not quite as steep in this part.� More importantly, there are
plenty of situations where no mathematical function—no matter how convoluted
—is going to give us anything close to what we need.
Similarly, in Chapter 11, some of the probability distribution functions we ex-
amined allowed us to construct pretty curves but did not offer a way for us to extract
a random number from them. Being able to do so is important if we are to use those
probability distributions to construct decisions and behaviors. It doesn't matter if
we know that choice x should occur y % of the time if we can't cause x to occur at
all. For example, while we know that a coin should land on heads 50% of the time,
until we actually toss the coin, we won't know who wins the coin toss. We know that
rolling a 7 on 2d6 occurs 16.7% of the time—and yet the nice man running the
craps table will be very annoyed with us if we never actually throw the dice.
To address both of these problems, we need to introduce a new method of deal-
ing with functional data. To solve the problem of customizability, we need a way to
store the results of a function, tweaking those results at will, and extract what we
need out of it. To solve the problem of extracting a random number x , y % of the
time as determined by a continuous probability distribution function, we need to
do something very similar: store the results in a data structure that allows for re-
trieval in the appropriate proportion of occurrences. Response curves handle both
of these situations admirably.
285
 
 
 
Search WWH ::




Custom Search