Basic AI FSM - Handling state transition
        Posted  
        
            by 
                Galvanize
            
        on Game Development
        
        See other posts from Game Development
        
            or by Galvanize
        
        
        
        Published on 2012-06-19T14:30:27Z
        Indexed on 
            2012/06/19
            15:26 UTC
        
        
        Read the original article
        Hit count: 369
        
I'm starting to study on how to implement game AI, and it seems to me that a very simple FSM for my Pong demo would be a nice way to start.
My vision on implementing this would be to have a basic state interface and a class for each state, then the NPC would have an instance of the current state. The class should have an update method and directions on wich state to go next, depending on the event received.
The question is: How do I handle this event? Should I have a regular addEventListener and a costum event system? Or should I check on update for the things that could change the current state?
I'm feeling a bit lost, I feel I have a good grasp on the FSM concept but a good implementation seems tricky, thanks in advance.
© Game Development or respective owner