Game Development Reference
In-Depth Information
Figure 11.5
A grid of vertices.
of your own units; if you tell a tank to go from one location to another, it should
take the shortest route and avoid running over civilians. This type of problem is
generally known as path finding, and the easiest solution is to research the A-Star
algorithm and implement a suitable variant of it. Not all games use A-Star for
path finding, but it is a very popular method that is quite easy to understand.
The second type of AI in real-time strategy games is the AI that controls the
computer component. This AI must provide a challenge to the player, but it
shouldn't appear to cheat, and it should be beatable. There are all sorts of novel
solutions to this problem using exotic sounding things like neural networks, but
the usual solution is the slightly more mundane state machine and a few rules.
A strategy game AI might have a number of states such as build-up-units ,
attack , and defend . Each state has some associated rules; for instance, the
build-up-units state might have a rule ''if the numbers of units are greater
than ten, then move to the attack state.'' The attack state might have rules
such as ''if the offensive unit isn't near enemy base, then move to enemy base.'' It
may also have rules about what should be attacked first and what priorities cer-
tain targets should be given. These rules can usually be defined in a data file, and
then they are refined with a lot of tweaking and play testing.
 
Search WWH ::




Custom Search