Game Development Reference
In-Depth Information
Nebraska with no other traffic in sight? Would you need to ever think of changing
lanes? (For my gentle readers who have not been to western Nebraska, think of a
highway on the moon instead.)
It could be just as awkward to think about changing lanes over a longer period
such as five minutes, however. What if a situation arose where a lane change was not
only available, but desirable? Or even necessary? We would look a little silly sitting
there waiting patiently for our “lane-change timer� to expire. (On second thought,
I know people like this, too.) The problem is that there is no “natural� interval at
which we should consider changing lanes.
While the correct approach to any given problem may be a little obscure at
times, we can generally narrow it down to one of four approaches:
Every frame (continuous recalculation)
Defined time periods
Polling for changes
In response to an external event
Let's examine the strengths and weakness of each approach.
Continuous Recalculation
The term continuous recalculation doesn't evoke a lot of mystery about how often
we are reprocessing the world. In a nutshell, this method recalculates a decision
every frame. The only variation is how many frames per second we are running.
Suffice to say, for all intents and purposes, this method is equivalent to “as fast as
we possibly can.�
There are uses for this approach throughout much of artificial intelligence (AI).
Simulation of flight, racing, aiming, and other continuous forms of movement, for
example, depends heavily on continuously updating speed and directional control
to match the information of the exact moment. Animation AI needs to know the
position of body, the states various limbs are in, what objects are in the way, and
what forces are present. One could make the case, however, that these items are
reactions and not decisions or behaviors . While reactions certainly do need to be up-
dated quickly, continuous updates aren't as appropriate for behavioral AI.
Above, we suggested that our decision on what to do for dinner should be cal-
culated once per evening. Barring certain contingencies (such as receiving a phone
call from friends inviting us over), imagine our dinner decision being constantly
monitored with the question, “Are we still having microwave burritos? Are we still
having microwave burritos? Are we still having…� (I'll quit there. You probably get
 
Search WWH ::




Custom Search