Godot Finite State Machines Made Easy - A Simpler Method for Smarter Enemies

Поделиться
HTML-код
  • Опубликовано: 8 окт 2024
  • We're diving into the world of Finite State Machines! Take a sip of lemonade every time I say the word "state".
    Play my games on itch: breckheck.itch...
    Chapters:
    00:00: Intro
    00:30: What is State?
    02:20: State Class
    3:53: State Machine Class
    4:25: Stealth Game Example
    5:35: Flow Chart Setup
    6:18: Enemy FSM Setup and Code
    6:43: Add Shoot State
    7:48: More Complex FSM Setups and Substate
    8:35: When to not use FSMs
    9:36: When to use FSMs
    10:40: Conclusion

Комментарии • 2

  • @idinneken209
    @idinneken209 5 дней назад +1

    It was funny watching this because I slowly realised that you programmed this in the exact same way I did when I attempted a finite state machine system. A good sign that I’ve done something right I think!
    The differences that I can tell are that you’ve added separate ‘continuous’ steps for each type of update. Which is a good shout. Bespoke behaviour if transitioning to/from a specific state is also an interesting idea.
    One thing I haven’t added yet but I’m meaning to next time I work on this, is a Record variable on the State Machine node. It’d track all the Ticks at which a State is transitioned to. Probably using the Tick as a key and the State name as a Value in a dictionary. It’d be useful for answering questions of ‘were they in X state 5 secs ago’.
    Thank you for the video! It’ll be useful to me for refining the system I happen to be working on

  • @panagosu
    @panagosu 3 дня назад

    I like your approach to hierarchical state machines. If I understand it correctly, are we basically adding a substate machine as a child of a state, and simply calling the substate machine’s ready, input, process and physics_process methods inside the parent state’s enter, handle_input, update and physics_update methods respectively?