Game Development Reference
In-Depth Information
Table 18.2 Truth Table for OR
A
B
A OR B
0
0
0
0
1
1
1
0
1
1
1
1
In this case, the degree of truthfulness of the statement AORB is equal to the most
true member. Thus, we can define OR as follows:
R = max(A, B)
This same exercise can be continued to define results for NOT , XOR , and other logical
operator you want.
Let
'
s take a step back and reconsider the attack and run fuzzy sets. Let
'
s say the
player belongs to the close set by 0.6 and the far set by 0.4. Let
s also say that
the AI guard belongs to the healthy set by 0.3 and the hurt set by 0.7. In this case,
the attack set will be 0.3, and the run set will be 0.6. This could be translated into a
behavior by mixing the results:
'
attackPercentage = 0.3 / (0.3 + 0.6)
runPercentage = 0.6 / (0.3 + 0.6)
You could use these percentages to find the chance that the AI will run versus staying
and fighting, but a much cooler use of this would be to set up his behavior so that he
spends about 66.7% of the time running and the other 33.3% of the time shooting at
the player. In other words, he does both behaviors at the same time, just in different
degrees. The overall behavior you
'
d see is that as the player approached and wounded
the enemy, he would fall back and continue firing. Eventually, his health would drop
low enough that he wouldn
'
t belong to the healthy fuzzy set at all, and he would just
run without attacking.
Hopefully, this example shows you a little bit of the power of fuzzy logic. You can
take these techniques further by applying fuzzy action sets to all sorts of things to
create extremely complex behavior with just a handful of actions.
Utility Theory
Stuart Russell and Peter Norvig provide an excellent definition for utility theory in
their book Artificial Intelligence: A Modern Approach: Utility theory says that every
 
 
Search WWH ::




Custom Search