Adaptive AI Engine for RTS Games

Discussing the theory and practice

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
    • Probabilistic FSMs:
      • Probabilities are assigned to each transition state and then can be changed within game
    • Markov Models:
      • 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
  • 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
  • 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 AI-System
    • No existence of the oscillation problem
  • 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
  • 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
    • An FuSM used as a support system for a character:
      • 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
    • Data-Driven 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
    • Agent Reactivity: very reactive
    • System Realism:
      • Seems realistic
      • By adjusting current behavior not completely changing it this adds realism to the Game AI
    • Genre:
      • 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

Entertainment Limitations: flexible and able to meet the entertainment requirements

Advertisements

9 Responses to “Fuzzy State Machines (FuSMs)”

  1. “FuSMs are based on fuzzy logic but don’t really represent fuzzty logic”

    Can you explain what this means?

  2. abdelrahmanogail said

    @Will Dwinnell
    In traditional logic, there are only two possible end values: TRUE and FALSE. An extension on this is called “multi-valued logic” where the possible values can be whatever is defined within the given system. In mathematics, “fuzzy logic” is a multi-valued 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

  3. 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 !!!!!

  4. 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 !??

  5. 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

  6. 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 ??

  7. abdelrahmanogail said

    Yes, that’s right and in some games these rules (Fuzzy Rules) are broken so it’s not actually Fuzzy System

  8. Proud To Be Muslim said

    ok its clear now 🙂

  9. hur abbas said

    how nice discussion

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: