limboai/README.md

126 lines
9.3 KiB
Markdown
Raw Normal View History

<p align="center">
<img src="doc/images/logo.svg" width="400" alt="LimboAI logo">
</p>
2024-03-03 19:53:27 +00:00
# LimboAI - Behavior Trees & State Machines for Godot 4
2024-01-14 21:37:24 +00:00
[![🔗 All builds](https://github.com/limbonaut/limboai/actions/workflows/all_builds.yml/badge.svg)](https://github.com/limbonaut/limboai/actions/workflows/all_builds.yml)
[![🔎 Unit Tests](https://github.com/limbonaut/limboai/actions/workflows/test_builds.yml/badge.svg)](https://github.com/limbonaut/limboai/actions/workflows/test_builds.yml)
[![Documentation Status](https://readthedocs.org/projects/limboai/badge/?version=latest)](https://limboai.readthedocs.io/en/latest/?badge=latest)
2024-03-03 20:00:32 +00:00
[![GitHub License](https://img.shields.io/github/license/limbonaut/limboai)](https://github.com/limbonaut/limboai/blob/master/LICENSE.md)
2024-03-03 19:53:27 +00:00
2024-03-03 20:00:32 +00:00
[![Discord](https://img.shields.io/discord/1185664967379267774?logo=discord&link=https%3A%2F%2Fdiscord.gg%2FN5MGC95GpP)](https://discord.gg/N5MGC95GpP)
[![Support this project](https://img.shields.io/badge/Support%20this%20project-red?logo=kofi&logoColor=white&link=https%3A%2F%2Fko-fi.com%2Flimbonaut)](https://ko-fi.com/limbonaut)
[![Mastodon Follow](https://img.shields.io/mastodon/follow/109346796150895359?domain=https%3A%2F%2Fmastodon.gamedev.place)](https://mastodon.gamedev.place/@limbo)
2024-03-03 19:53:27 +00:00
2024-02-14 19:32:32 +00:00
**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.
2024-03-03 19:53:27 +00:00
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](https://limboai.readthedocs.io/en/latest/getting-started/custom-tasks.html) and [states](https://limboai.readthedocs.io/en/latest/getting-started/hsm.html).
2023-07-23 16:02:26 +00:00
>**🛈 Supported Godot Engine: 4.2**
2024-03-03 19:53:27 +00:00
![Textured screenshot](doc/images/behavior-tree-editor-debugger.png)
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](https://limboai.readthedocs.io/en/latest/getting-started/introduction.html) and our demo project, which includes a tutorial.
2023-07-23 16:02:26 +00:00
2024-03-03 19:53:27 +00:00
## Demonstration
2023-07-26 13:54:19 +00:00
![Charger from Demo](doc/images/demo_charger.gif)
2024-03-03 19:53:27 +00:00
>**🛈 Demo project** lives in the `demo` folder and is available separately in [**Releases**](https://github.com/limbonaut/limboai/releases).
2024-05-01 17:01:44 +00:00
> Run `demo/scenes/showcase.tscn` to get started.
2024-06-24 19:34:35 +00:00
> It also includes a tutorial that introduces behavior trees through illustrative examples.
### Videos
<a href="https://www.youtube.com/watch?v=NWaMArUg7mY"><img src="https://img.youtube.com/vi/NWaMArUg7mY/0.jpg" width=410></a>
<a href="https://www.youtube.com/watch?v=aP0Aacdxmno"><img src="https://img.youtube.com/vi/aP0Aacdxmno/0.jpg" width=410></a>
2023-07-23 16:02:26 +00:00
## Features
2023-09-13 09:44:56 +00:00
- **Behavior Trees (BT):**
2023-11-02 13:23:34 +00:00
- Easily create, edit, and save `BehaviorTree` resources in the editor.
- Execute `BehaviorTree` resources using the `BTPlayer` node.
- Create complex behaviors by combining and nesting tasks in a hierarchy.
- Control execution flow using composite, decorator, and condition tasks.
- [Create custom tasks](https://limboai.readthedocs.io/en/latest/getting-started/custom-tasks.html) by extending core classes: `BTAction`, `BTCondition`, `BTDecorator`, and `BTComposite`.
2024-03-03 19:53:27 +00:00
- Built-in class documentation.
2024-03-21 20:04:22 +00:00
- Blackboard system: Share data seamlessly between tasks using the `Blackboard`.
2024-02-15 15:23:15 +00:00
- Blackboard plans: Define variables in the BehaviorTree resource and override their values in the BTPlayer node.
2024-03-21 20:04:22 +00:00
- Plan editor: Manage variables, their data types and property hints.
2024-03-03 19:53:27 +00:00
- Blackboard scopes: Prevent name conflicts and enable advanced techniques like [sharing data between several agents](https://limboai.readthedocs.io/en/latest/getting-started/using-blackboard.html#sharing-data-between-several-agents).
- Blackboard parameters: [Export a BB parameter](https://limboai.readthedocs.io/en/latest/getting-started/using-blackboard.html#task-parameters), for which user can provide a value or bind it to a blackboard variable (can be used in custom tasks).
2024-03-21 20:04:22 +00:00
- Inspector support for specifying blackboard variables (custom editor for exported `StringName` properties ending with "_var").
2023-07-23 16:02:26 +00:00
- Use the `BTSubtree` task to execute a tree from a different resource file, promoting organization and reusability.
- Visual Debugger: Inspect the execution of any BT in a running scene to identify and troubleshoot issues.
2024-02-15 15:23:15 +00:00
- Visualize BT in-game using `BehaviorTreeView` node (for custom in-game tools).
2023-11-02 13:23:34 +00:00
- Monitor tree performance with custom performance monitors.
2023-09-13 09:44:56 +00:00
- **Hierarchical State Machines (HSM):**
2023-09-13 09:44:56 +00:00
- Extend the `LimboState` class to implement state logic.
2024-03-21 20:04:22 +00:00
- `LimboHSM` node serves as a state machine that manages `LimboState` instances and transitions.
2023-07-23 16:02:26 +00:00
- `LimboHSM` is a state itself and can be nested within other `LimboHSM` instances.
2024-03-03 19:53:27 +00:00
- [Event-based](https://limboai.readthedocs.io/en/latest/getting-started/hsm.html#events-and-transitions): Transitions are associated with events and are triggered by the state machine when the relevant event is dispatched, allowing for better decoupling of transitions from state logic.
2023-07-23 16:02:26 +00:00
- Combine state machines with behavior trees using `BTState` for advanced reactive AI.
2024-03-03 19:53:27 +00:00
- Delegation Option: Using the vanilla `LimboState`, [delegate the implementation](https://limboai.readthedocs.io/en/latest/getting-started/hsm.html#single-file-state-machine-setup) to your callback functions, making it perfect for rapid prototyping and game jams.
2023-11-02 13:23:34 +00:00
- 🛈 Note: State machine setup and initialization require code; there is no GUI editor.
2023-07-23 16:02:26 +00:00
2023-11-02 13:23:34 +00:00
- **Tested:** Behavior tree tasks and HSM are covered by unit tests.
2023-09-13 09:44:56 +00:00
- **GDExtension:** LimboAI can be [used as extension](https://limboai.readthedocs.io/en/latest/getting-started/gdextension.html). Custom engine builds are not necessary.
2024-03-21 20:04:22 +00:00
- **Demo + Tutorial:** Check out our extensive demo project, which includes an introduction to behavior trees using examples.
2024-02-14 19:32:32 +00:00
## First steps
Follow the [First steps](https://limboai.readthedocs.io/en/latest/index.html#first-steps) guide to learn how to get started with LimboAI and the demo project.
## Getting LimboAI
2023-07-23 16:02:26 +00:00
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](https://limboai.readthedocs.io/en/latest/getting-started/gdextension.html).
### Precompiled builds
2023-07-23 16:02:26 +00:00
2023-10-31 17:59:35 +00:00
- For the most recent builds, navigate to **Actions** → [**All Builds**](https://github.com/limbonaut/limboai/actions/workflows/all_builds.yml), select a build from the list, and scroll down until you find the **Artifacts** section.
- For release builds, check [**Releases**](https://github.com/limbonaut/limboai/releases).
2023-07-23 16:02:26 +00:00
### Compiling from source
2023-07-23 16:02:26 +00:00
>**🛈 For GDExtension:** Refer to comments in [setup_gdextension.sh](./gdextension/setup_gdextension.sh) file.
2023-07-23 16:02:26 +00:00
- Download the Godot Engine source code and put this module source into the `modules/limboai` directory.
- Consult the Godot Engine documentation for instructions on [how to build from source code](https://docs.godotengine.org/en/stable/contributing/development/compiling/index.html).
- If you plan to export a game utilizing the LimboAI module, you'll also need to build export templates.
- To execute unit tests, compile the engine with `tests=yes` and run it with `--test --tc="*[LimboAI]*"`.
2023-07-23 16:02:26 +00:00
## Using the plugin
2023-10-31 17:59:35 +00:00
- [Online Documentation](https://limboai.readthedocs.io/en/latest/index.html)
2024-05-26 09:22:03 +00:00
- [First steps](https://limboai.readthedocs.io/en/latest/index.html#first-steps)
- [Introduction to Behavior Trees](https://limboai.readthedocs.io/en/latest/getting-started/introduction.html)
- [Creating custom tasks in GDScript](https://limboai.readthedocs.io/en/latest/getting-started/custom-tasks.html)
2024-03-03 19:53:27 +00:00
- [Sharing data using Blackboard](https://limboai.readthedocs.io/en/latest/getting-started/using-blackboard.html)
- [Accessing nodes in the scene tree](https://limboai.readthedocs.io/en/latest/getting-started/accessing-nodes.html)
- [State machines](https://limboai.readthedocs.io/en/latest/getting-started/hsm.html)
- [Using GDExtension](https://limboai.readthedocs.io/en/latest/getting-started/gdextension.html)
2024-03-03 19:53:27 +00:00
- [Using LimboAI with C#](https://limboai.readthedocs.io/en/latest/getting-started/c-sharp.html)
- [Class reference](https://limboai.readthedocs.io/en/latest/getting-started/featured-classes.html)
2023-10-31 17:59:35 +00:00
2023-07-23 16:02:26 +00:00
## Contributing
2024-03-21 20:04:22 +00:00
Contributions are welcome! Please open issues for bug reports, feature requests, or code changes. Keep the minor versions backward-compatible when submitting pull requests.
2023-07-23 16:02:26 +00:00
2024-03-21 20:04:22 +00:00
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.
2023-12-16 21:30:17 +00:00
## Social
2024-03-21 20:04:22 +00:00
Need help? We have a Discord server: https://discord.gg/N5MGC95GpP
2023-12-16 21:30:17 +00:00
2024-03-21 20:04:22 +00:00
I write about LimboAI development on Mastodon: https://mastodon.gamedev.place/@limbo.
2023-12-16 21:30:17 +00:00
2024-03-03 19:53:27 +00:00
## License
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.