Fuzzy State Machines (FuSMs)
Posted by Ogail on July 19, 2009
Fuzzy State Machines (FuSMs)
 FuSMs are based on fuzzy logic but don’t really represent fuzzty logic
 They are useful for systems that could be in more than one state at the same time

Similarities between FSM and FuSM:

FSM with prioritized transitions:
 Calculating activation level for each state and go to the highest activation state
 Adding fuzziness to the FSM
 Calculating activation level for each state and go to the highest activation state

Probabilistic FSMs:
 Probabilities are assigned to each transition state and then can be changed within game
 Probabilities are assigned to each transition state and then can be changed within game

Markov Models:
 Transition logic is completely probability based
 Transition logic is completely probability based

Actual Fuzzy Logic Systems:

When there are many fuzzy variables a problem arise called: combinatorial explosion
 This problem could be solved using Comb’s Method but the accuracy is decreased
 This problem could be solved using Comb’s Method but the accuracy is decreased


 Example of fuzzy problem in games: shooting while moving!
 Here there are some states that should be computed as digital not fuzzy (like attack state) so some of the states are calculated in fuzzy and others are calculated in digital approach

Structure of FuSM:
 FuSMState Class: Enter(), Exit(), Update(), CalculateActivation()
 FuSMMachine Class
 FuSMAIControl Class
 FuSMState Class: Enter(), Exit(), Update(), CalculateActivation()
 The states get perception variables from FuSMAIControl Class to calculate the activation level
 Activation Level: measure of how fully active the state need to respond to the perceptions
 It’s recommended to have separate perception system in the Control Class in bigger games
 Each Fuzzy State has no information about other states in it. Each state is only concerned with the perception checks that directly deal with itself only
 M_powerUpNear is not needed in FuSM but it’s necessary in FSM so it can fire GetPowerUp State

Pros of FuSM Systems:
 Used in parallel independent systems
 No transition events between states
 Adding new state is moiré easily , because each state is only concerned about itself!
 Allows more range of behavioral personality to be exhibited by the AISystem
 No existence of the oscillation problem
 Used in parallel independent systems

Cons of FuSM Systems:
 FuSMs are not as general a problem solver as FSMs

Bad FuSM lead to the problem of oscillation and this could be solved by having totally opposite states in your machine
 This states should be inconsistent in activation
 This states should be inconsistent in activation
 FuSMs are not as general a problem solver as FSMs

Extensions to this paradigm:

FuSMs with a limited numbers of current states
 Fuzzy states could be tagged with subtypes, and the highest propriety subtype would win for that particular subtype category
 Fuzzy states could be tagged with subtypes, and the highest propriety subtype would win for that particular subtype category

An FuSM used as a support system for a character:
 Used in facial expressions (333)
 Used in facial expressions (333)
 An FuSM used as a single state in large FSM

Hieratical FuSMs:
 Categorizing FuSMs in subtypes
 FSM where each state in a FuSM, this becomes in effect a fuzzy system that can switch out its entire fuzzy state system based on game events or perception changes
 Categorizing FuSMs in subtypes
 DataDriven FuSMs


Design Considerations:

Types of Solutions:
 Used is strategic and tactic types
 Could be used in RTS games: combine output of several fuzzy states such as resource gathering, diplomacy, combat, defense
 Used is strategic and tactic types
 Agent Reactivity: very reactive

System Realism:
 Seems realistic
 By adjusting current behavior not completely changing it this adds realism to the Game AI
 Seems realistic

Genre:
 FuSMs could be used as the perception system of a game
 FuSMs could be used as the perception system of a game
 Platform: there are no restrictions at all!

Development Limitations:
 Easy to understand and implement but there’s no support for dynamic product
 Easy to understand and implement but there’s no support for dynamic product

Entertainment Limitations: flexible and able to meet the entertainment requirements
Advertisements
Will Dwinnell said
“FuSMs are based on fuzzy logic but don’t really represent fuzzty logic”
Can you explain what this means?
abdelrahmanogail said
@Will Dwinnell
In traditional logic, there are only two possible end values: TRUE and FALSE. An extension on this is called “multivalued logic” where the possible values can be whatever is defined within the given system. In mathematics, “fuzzy logic” is a multivalued logic designed to deal with reasoning problems that include information of an approximate nature. In essence, it is a branch of set theory wherein the membership of any given set is stated as a number of functions, instead of the more “crisp” membership of traditional logic (meaning, you’re in the set or not).
The metaphor, then, for game AI state machines to call themselves fuzzy is that an AI agent can engage a particular behavior in a fuzzy manner; the behavior is not just ON or OFF. It is instead activated to some amount as necessary.
That make more sense?
This question was answered by the author of the book, find the answer here: http://www.gamedev.net/community/forums/topic.asp?topic_id=542114
Proud To Be Muslim said
actually i have read both Mr.Will question and the link that u posted that contains the answer
but the answer isnt related to the question he was identifying the fuzzy logic
the question was about that weird sentence saying that its based on
Fuzzy Logic but dosent represent it !!!!!
Proud To Be Muslim said
actually he identified the Fuzzy Logic but didnt gave an answer to the question
the question Mr.Will asked that wierd sentence how could u say they are based on Fuzzy Logic but dosent represent it !??
abdelrahmanogail said
OK let’s explain it more, in many games you are restricted in satisfying the definition of Fuzzy System where you have to configure the activation value for every Fuzzy State under the restriction you have in the game. In other words we implement FuSM under game rules NOT under fuzzy logic rules
Proud To Be Muslim said
defining the fuzzy system under the game rules is Fuzzy Logic
u gave each state a certain value defined in the game which is a fuzzy value
in ur system
that way u are applying the fuzzy logic
from wikipedia:
Fuzzy logic has been applied to diverse fields, from control theory to artificial intelligence.
as i can get fusm is based on idea of multivalued logic ??
abdelrahmanogail said
Yes, that’s right and in some games these rules (Fuzzy Rules) are broken so it’s not actually Fuzzy System
Proud To Be Muslim said
ok its clear now 🙂
hur abbas said
how nice discussion