[go: up one dir, main page]

Skip to content

derkork/godot-statecharts

Repository files navigation

Godot State Charts

Quick Links

Install from the Godot Asset Libary | Read the manual | FAQ | Godot Engine Discord

If you prefer to learn in video form, there is also a video tutorial available on YouTube to get you started.

Godot State Charts Tutorial on YouTube

What is Godot State Charts?

Godot State Charts is an extension for Godot Engine 4 or later that allows you to use state charts in your game. State Charts are similar to finite state machines, but they are more powerful and avoid the state explosion problem of traditional FSMs.

Example of State Charts in action

Features

  • Built from scratch for the Godot Engine in an idiomatic way using Godot's nodes and signals. You need very little code to get started.
  • Supports both GDScript and C#.
  • Your code only interacts with a single class, StateChart which has two methods for triggering transitions and setting properties for expression guards. There is no need to create subclasses or implement interfaces. This makes it easy to integrate the library into your existing code base (or remove it if you find it unsuitable).
  • Declarative transitions with guards allow you to express complex logic in a simple way without writing any code.
  • Transitions can be time-delayed to easily build things like cooldowns.
  • Comprehensive in-editor error checking and warnings will help you avoid common mistakes.
  • Built-in debug view allows you to inspect your state charts in the game while they are running.
  • Inactive states will not update every frame for improved performance.
  • All states adhere to the pause mode, so state charts will pause when the game is paused.
  • Comprehensive documentation with a proper manual and annotated examples.

Attribution

The demo projects use the very nice Pixel Adventure assets by Pixel Frog. Thanks for making them available in the public domain!

The demo projects also use some icons made by J. W. Bjerk (eleazzaar), licensed under CC by DEED 3.0. Thanks for making them available!