While the base of the natural logarithm, e, is conspicuous in the
denominator of the fraction, it is really optional. We can certainly use the
approximation of 2.718 in that space, or any other number for that matter. In
fact, by changing the value for e, we can achieve a variety of different slopes
to the center portion of the resulting curve. As stated though, the formula
graphs out as shown in Figure 7.
Notice that, unfortunately, the graph’s natural range is not 0– 1 as
with our other examples. In fact, the range of the graph is infinite in
that it asymptotically approaches both y = 0 and y = 1. We can apply
some shifting to get it to fit the 0– 1 range though, so that we can
use it with normalized values of x. We can also change the area of the
graph where the threshold occurs by changing what we are adding to
Comparing and Contrasting
» The end result of all of this is that we can create very sophisticated
response curves that translate our raw values into meaningful utility
values. Also, because these end products are normalized, we can now
easily compare and contrast them with other results. Going back to the
examples I cited early on, we can decide how hungry we are in relation to
other feelings such as fatigue (or too busy finishing a last-minute column
for a magazine). In fact, we can line up dozens—or even hundreds—of
utilities for various feelings or potential actions and select from among
them using techniques as simple as “pick the highest” to seeding weight-based randoms.
Compare this to what we would have to do were we not to use the
normalized utility values. In our hungry/tired/busy example, we normally
would have to construct a multi-part condition to define each portion of our
decision. For example:
If ( (Hungry > 5) && (Tired < 3) && (Busy < 7) ) then
If ( (Hungry < 4) && (Tired > 6) && (Busy < 3) )then
If ( ...
Ya know what? Never mind ...
Even if the above values were normalized (i.e. between 0 and
1), the complexity explosion involved with comparing the different
possible ranges and mapping them to the appropriate outcome would
get out of hand quickly. And that’s just with 3 inputs and 3 outputs!
By converting from value to utility, we massage what the data “means
to us” inside each response curve. We now can feel comfortable that a
direct comparison of the utilities will yield which item is truly the most
important to us.
The system is extensible to grand lengths as well. If we want to
include a new piece of information or a new action to take into account,
we simply need to add it to a list. Because all the potential actions
are scored and sorted by their relative benefit, we will automatically
take newcomers into stride without much (if any) adjustment to the
If calculating and measuring all of these feelings and desires is starting
to sound a lot like The SimS, it is not a coincidence. The SimS is an excellent
(but not the only) example of how complex utility-based functions can be
used to simulate fairly reasonable, context-dependent decision processes
in agents. Richard Evans has spoken numerous times at GDC on this very
subject. I wholeheartedly recommend reading his papers and viewing his
slides on the subject.
The uses of these methods aren’t limited to that genre, of course.
Strategy games, in particular, lend themselves to more nuanced
calculation. Even in modern shooters and RPGs, agents are expected to
make increasingly more believable decisions in environments that contain
significantly more information. Our AI no longer has the luxury of simply
leaning on “if I see the player, shoot him!” as its sole guideline, and building
static rulesets that address all the possible permutations of world state gets
brittle at an exponential pace.
As I’ve illustrated (ever so briefly), the inclusion of some very simple
techniques lets us step away from these complicated, often contrived, and
sometimes even contradictory rulesets. It also allows us, as AI designers,
to think in familiar terms of “how much”—the same terms that we often use
when we think of our own (human) states. The numbers we need are there
already. The magic is in how we use them.
dave mark is the president and lead designer of Intrinsic Algorithm, an independent game
studio and AI consulting company. He is also the author of Behavioral Mathematics for Game
AI and a summit advisor of the annual GDC AI Summit. He continues to attend the University
of Life. He has no plans to graduate anytime soon.