Game Development Reference
In-Depth Information
Consider camera AI. Some aspects of camera AI are readily handled by simple,
short, hard-coded scripts. A small chunk of AI allows game designers to create a
compelling dramatic experience by taking temporary control of the camera.
Imagine a first-person-perspective game. The camera shows what the player's
character in the game sees. The character deals with the last enemy in a stairwell,
opens the door to the roof, and steps out, hoping that the promised helicopter will
come and pick him up. At this point, the game freezes and the camera pulls back,
showing the character standing there, up high and alone. It then pans a full circle,
allowing the player to see the burning city below. Then the camera moves forward
and jumps back to the character's perspective. The player walks that character
around the roof and gets a bad feeling about the helicopter before giving up and
heading back down the stairwell. Halfway down, however, he decides that one last
look for the helicopter is in order. The player's character opens the door to the
roof and steps out—but this time the AI does not take control of the camera.
The hard-coded script for that bit of camera AI is an if-then statement with two
conditions. If the character is walking out the door and is doing so for the first
time, then the camera AI should take control and run the pan script. The core
decision-making logic is well within the capabilities of a beginning programmer.
It is not a great teaching example, however, because it demands that a complex
game program—complete with compelling art assets and good interfaces for the
AI programmer—already exist.
Thermostat AI places low demands on the programmer in terms of the amount
of effort needed to handle the software that is not the decision-making part of the
thermostat. While few games use thermostat code, many games use code of
similar complexity, as seen in the camera example. For example, level designs
often involve traps and triggers, and they use AI comparable to our thermostat
examples.
A Simple Thermostat
Consider the AI of a very simple thermostat. A mechanical switch in the ther-
mostat decides whether the heating system should run or not run. We will create
this type of a thermostat AI as part of a new project.
1. Using Visual Studio, create a new Windows Forms Application and call it
Thermostat.
2. Double-click My Project in the Solution Explorer.
 
 
Search Nedrilad ::




Custom Search