Add Artificial Intelligence to your project using this simple State Machine visual editor. It also supports nested state machines to enable modern AI implementations.

Last Updategithub|imjp94|gd-YAFSM|master
Authorimjp94 and more
Supported Versions3.2

Features

  • Design StateMachine in a flowchart-like editor
  • Visualize the flow of StateMachine & inspect parameters in realtime
  • Visualize game/UI state from the flowchart
  • Similar workflow as using AnimationTree, and not required to inherit any custom class, just plug and play
  • Nested Finite State Machine workflow supported to create complex state machine with ease
  • As a Resource, StateMachine can be used repeatedly in different scenarios(StateMachinePlayer) and provide different outcomes based on the input
  • Compact data structure for StateMachine resource file

Installation

  1. Get gd-YAFSM either from the Github Repo or the Godot Asset Library
  2. Copy/paste it in the project’s addons folder
  3. Enable it from the plugins tab

Usage

Scene

  1. Add a StateMachinePlayer node
  2. Select the newly created node and find the new window for editing the state machine
  3. Click “Create StateMachine”
  4. Right-click on the graph and add a new entry state
  5. You can add your own states after the entry
  6. Use Shift-Drag to create connections

Code

After setting up the StateMachine node, you can connect with it via code.

There are 2 signals that the StateMachinePlayer triggers:

  • transited(from, to)
  • updated(state, delta)

You can set the state machine’s properties using set_param or set_trigger commands.

License

MIT

Extra

Quick’n Simple Tank AI in Godot

Do you want to learn how to create a State Machine Tank in Godot?

Get this free course and find out how to use gd-YAFSM to implement a patrolling tank that also attacks targets.

Get the free course from here.