O'Reilly logo

Programming Game AI by Example by Mat Buckland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Designing the Ammo Status FLV
Finally, we’ll tackle Ammo Status, which will utilize the fuzzy sets
Ammo_Low, Ammo_Okay, and Ammo_Loads. Because linguistic terms are
defined within a context (since what you might consider an okay amount of
ammo for, say, a grenade launcher, is unlikely to be an okay amount for a
machine gun), this FLV varies from weapon to weapon.
A rocket launcher is able to shoot two rockets per second, so I’d say that
an okay amount of ammo is about 10 rockets. If carrying 30 or so rockets,
I’d consider myself to have loads of ammo and anything less than 10 is
low. With this in mind I’ve designed Ammo Status as shown in Figure
10.14.
As you can see, designing FLVs is mainly common sense: You simply
examine and translate your own or, even better, an expert’s knowledge
about the domain.
Designing the Rule Set for Weapon Selection
Now that we have some fuzzy terms to play with, let’s work on the rules.
To cover all the possibilities, a rule must be created for each possible com
-
bination of antecedent sets. The FLVs Ammo Status and Distance to
Target each contain three member sets, so to cover every combination nine
rules must be defined.
Once again I’m going to play the role of expert. In my “expert” opinion,
a rocket launcher is a great medium distance weapon but it’s dangerous to
use close up because you’re likely to get damaged by the blast of the explo
-
sion. Also, because rockets move slowly, it’s a poor choice of weapon
when the target is far away since the rockets can be easily dodged. With
these facts in mind, here are the nine rules I’ve created for determining the
desirability of using a rocket launcher:
428 | Chapter 10
Fuzzy Rules
Figure 10.14. Ammo Status for the rocket launcher

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required