Game Development Reference
In-Depth Information
when it rains, and it may open the windows when it is cold outside if the room is
comfortably warm. Piggybacking the window AI onto the furnace AI results in a
poor window AI. The AI response does not fit the conditions.
Making sure that the AI response fits the conditions makes or breaks hard-coded
AI. It is rather easy to forget to guard against all the situations where the AI acts
inappropriately; indeed, it can be impossible to be completely effective in all
cases. Beginning AI programmers must learn to always do the analysis. Hard-
coded AI is simply too fast and effective to be discarded out of hand, but knowing
when not to use it takes practice.
Complexity is the enemy of hard-coded AI. As the number of decisions that
govern a particular behavior rises, complexity explodes. Complexity also
increases as the number of actions needed to implement a behavior increases and
with the number of inputs and the amount of state data that must be examined to
make the decisions. At a certain point, the complexity overwhelms the ability of
the programmer to write, debug, or modify the code. Usually, the ability to
modify the code is the first to succumb, followed by the ability to debug the code.
The thermostat we just coded has one decision to make: whether to call for heat.
It can implement that decision with a single action. It has one item of state data:
the desired temperature. It has one input from the outside world: the current
temperature in the room. So the answer to each of the ''how many'' questions is
1, the lowest possible number that can still expect an intelligent decision to be
made. Is it too low for it to meet our definition of AI?
To react intelligently to changing conditions, the AI must be able to act. This
thermostat has one output action. For it to detect changing conditions, it must be
influenced by at least one outside piece of data: the current temperature. For it to
act intelligently, it needs guidance on the decisions—and that guidance is the set
point of the thermostat. This AI is almost the simplest possible AI; it is no
surprise that hard-coded design is more than adequate to the task. A more
complex design would be overkill. It would be harder to write and debug. The
overhead of a more complex method would certainly make it slower to run. It is
hard to beat simple methods!
Consider, though, a very simple set-back thermostat with a day setting and a
night setting. It still has only one decision to make: whether to call for heat. The
internal state data has gone up, however, because there are two set points to track.
And the set points themselves have become more complex: Instead of a simple
 
Search Nedrilad ::




Custom Search