LimboAI - Behavior Trees and State Machines for Godot 4
LimboAI is an open-source C++ plugin for Godot Engine 4 providing a combination of Behavior Trees and State Machines, which can be used together to create complex AI behaviors. It comes with a behavior tree editor, built-in documentation, visual debugger, extensive demo project with a tutorial, and more! While it is implemented in C++, it fully supports GDScript for creating your own tasks and states.
🛈 Supported Godot Engine: 4.2
Behavior Trees are powerful hierarchical structures used to model and control the behavior of agents in a game (e.g., characters, enemies). They are designed to make it easier to create rich and highly modular behaviors for your games. To learn more about behavior trees, check out Introduction to Behavior Trees and our demo project, which includes a tutorial.
🛈 Demo project lives in the
demo
folder and is available separately in Releases. Rundemo/scenes/showcase.tscn
to get started. It also contains a tutorial that introduces behavior trees using examples.
Behavior Trees (BT):
BehaviorTree
resources in the editor.BehaviorTree
resources using the BTPlayer
node.BTAction
, BTCondition
, BTDecorator
, and BTComposite
.Blackboard
.
StringName
properties ending with "_var").BTSubtree
task to execute a tree from a different resource file, promoting organization and reusability.BehaviorTreeView
node (for custom in-game tools).Hierarchical State Machines (HSM):
LimboState
class to implement state logic.LimboHSM
node serves as a state machine that manages LimboState
instances and transitions.LimboHSM
is a state itself and can be nested within other LimboHSM
instances.BTState
for advanced reactive AI.LimboState
, delegate the implementation to your callback functions, making it perfect for rapid prototyping and game jams.Tested: Behavior tree tasks and HSM are covered by unit tests.
GDExtension: LimboAI can be used as extension. Custom engine builds are not necessary.
Demo + Tutorial: Check out our extensive demo project, which includes an introduction to behavior trees using examples.
LimboAI can be used as either a C++ module or as a GDExtension shared library. GDExtension version is more convenient to use but somewhat limited in features. Whichever you choose to use, your project will stay compatible with both and you can switch from one to the other any time. See Using GDExtension.
🛈 For GDExtension: Refer to comments in setup_gdextension.sh file.
modules/limboai
directory.tests=yes
and run it with --test --tc="*[LimboAI]*"
.Contributions are welcome! Please open issues for bug reports, feature requests, or code changes. Keep the minor versions backward-compatible when submitting pull requests.
If you have an idea for a behavior tree task or a feature that could be useful in a variety of projects, open an issue to discuss it.
Need help? We have a Discord server: https://discord.gg/N5MGC95GpP
I write about LimboAI development on Mastodon: https://mastodon.gamedev.place/@limbo.
Features and improvements that may be implemented in the future:
Use of this source code is governed by an MIT-style license that can be found in the LICENSE file or at https://opensource.org/licenses/MIT.