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

//place the weapon in the bot's hand.
m_pCurrentWeapon = *curWeap;
}
}
}
}
The Combs Method
One major problem with fuzzy inference systems is that as the complexity
of the problem increases, the number of rules required escalates at an
alarming rate. For example, the simple module created to solve the weapon
selection problem only required nine rules — one for each possible combi
-
nation of the antecedent sets — but if we add just one more FLV, again
consisting of three member sets, then 27 rules are necessary. It gets much
worse if the number of member sets in each FLV has to be increased to
obtain more precision. For instance, 125 rules are required for a system
with three FLVs each containing five member sets. Add another FLV con-
sisting of five member sets and the number skyrockets to 625 rules! This
effect is known as combinatorial explosion and is a huge problem when
designing fuzzy systems for time-critical applications, which of course is
what computer games are.
Luckily for us, we have a knight in shining armor in the form of William
Combs, an engineer with Boeing. In 1997 Combs proposed a system that
enables the number of rules to grow linearly with the number of member
sets instead of exponentially. Table 10.4 shows the number of rules
required using the traditional method versus the Combs method (assume
each FLV contains five member sets).
Table 10.4
Number of FLVs Rules Rqd. (traditional) Rules Rqd. (Combs)
225 10
3 125 15
4 625 20
5 3,125 25
6 15,625 30
7 78,125 35
8 390, 625 40
A big difference, I’m sure you’ll agree!
The theory behind the Combs method works on the principle that a rule
such as:
IF Target_Far AND Ammo_Loads THEN Desirable
452 | Chapter 10
The Combs Method
is logically equivalent to:
IF Target_Far THEN Desirable
OR
IF Ammo_Loads THEN Desirable
Using this principle, a rule base can be defined that contains only one rule
per consequent member set. For example, the nine rules for the desirability
of the rocket launcher given previously:
Rule 1. IF Target_Far AND Ammo_Loads THEN Desirable
Rule 2. IF Target_Far AND Ammo_Okay THEN Undesirable
Rule 3. IF Target_Far AND Ammo_Low THEN Undesirable
Rule 4. IF Target_Medium AND Ammo_Loads THEN VeryDesirable
Rule 5. IF Target_Medium AND Ammo_Okay THEN VeryDesirable
Rule 6. IF Target_Medium AND Ammo_Low THEN Desirable
Rule 7. IF Target_Close AND Ammo_Loads THEN Undesirable
Rule 8. IF Target_Close AND Ammo_Okay THEN Undesirable
Rule 9. IF Target_Close AND Ammo_Low THEN Undesirable
can be reduced to six rules:
Rule 1. IF Target_Close THEN Undesirable
Rule 2. IF Target_Medium THEN VeryDesirable
Rule 3. IF Target_Far THEN Undesirable
Rule 4. IF Ammo_Low THEN Undesirable
Rule 5. IF Ammo_Okay THEN Desirable
Rule 6. IF Ammo_Loads THEN VeryDesirable
This is not a great reduction of course, but as you saw in Table 10.4, the
Combs method becomes an increasingly attractive alternative as the num
-
ber of member sets used by the linguistic variables rises.
One of the drawbacks with this method is that the changes to the rule
base required to accommodate the logic are not intuitive. Combs gives a
good example in his paper “The Combs Method for Rapid Inference”:
When I got my first drivers license, my insurance agent reminded me
that since I was sixteen AND male AND single, my insurance premium
would be high. Later, after college, he said that since I was in my
mid-twenties AND male AND married, my insurance premium would be
moderately low.
This latter statement seems to make more intuitive sense than our alter
-
native format: since I was in my mid-twenties, my insurance premium
would be moderately low, OR since I was a male, my insurance premium
would be moderately high, OR since I was married, my insurance pre
-
mium would be low.
Fuzzy Logic | 453
The Combs Method

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