Game Development Reference
In-Depth Information
minimal overhead and fast execution. Simplicity brings many other benefits.
Programmers writing this kind of code find it easy to write and debug. Indeed,
this is exactly the kind of coding method that is taught to beginners and perfected
by the time they become professionals. As long as the code keeps a reasonable
level of simplicity and straightforwardness, this kind of code represents the first
and best way of getting the job done.
Sophistication is not always a virtue. Imagine a nail-driving tool that is more
sophisticated than a hammer but less sophisticated than a power nail gun. Such a
tool would fail in the marketplace because it would fail to displace either
hammers or power nail guns. AI code is similar. Any methodology more
sophisticated than simple hard-coded AI must be sophisticated enough to bring
benefits that outweigh its costs. There is no place for methods that fall in between
''simple'' and ''sophisticated enough.''
To extend the nail-gun analogy, consider the fact that hardware stores still sell a
wide variety of hammers. Nail guns have not destroyed hammer sales. Carpenters
and even roofers still carry and employ hammers. In games, sophisticated AI
methods have not wiped out simple AI methods. Professional AI programmers
employ both. Beginning AI programmers start with simple methods and move
on as they learn more sophisticated ones. That being said, after learning to use
sophisticated methods to implement AI, beginning AI programmers should not
ignore the simple methods they first learned. It is a beginner's mistake to forget to
check if the simplest way to implement AI is also the best way. Many times it will
not be, but surprisingly often, the simple methods are the best.
The Bad
Perhaps the most critical issue for hard-coded AI is that it must determine when
its behaviors are appropriate. For tiny behaviors, the determination is so obvious
and easy to compute conclusively that the programmer can forget to deal
explicitly with the issue when the AI grows more complex. The code, no matter
how good, must fit the situation.
Consider the AI for a simulated opera singer—a tenor. We will name him
Horatio and refer to him in future chapters. The AI for Horatio evaluates his
current situation. He is dressed in a dark formal suit. He is standing before a
seated, mostly quiet group of formally dressed people. The lights over the
audience are low. Quiet, formally dressed ushers direct people to their seats.
Music begins to play. So of course his AI directs Horatio to break into the
Search Nedrilad ::

Custom Search