https://github.com/darthdeus/behavior-tree
Behavior trees for Rust
https://github.com/darthdeus/behavior-tree
ai artificial-intelligence gamedev
Last synced: 6 months ago
JSON representation
Behavior trees for Rust
- Host: GitHub
- URL: https://github.com/darthdeus/behavior-tree
- Owner: darthdeus
- Created: 2021-09-15T15:59:30.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-06-17T19:40:11.000Z (about 2 years ago)
- Last Synced: 2024-12-16T07:17:32.868Z (7 months ago)
- Topics: ai, artificial-intelligence, gamedev
- Language: Rust
- Homepage:
- Size: 60.5 KB
- Stars: 31
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-rust-list - darthdeus/behavior-tree - tree?style=social"/> : Behavior trees for Rust! (Data Structure and Algorithm)
- awesome-rust-list - darthdeus/behavior-tree - tree?style=social"/> : Behavior trees for Rust! (Data Structure and Algorithm)
README
# `behavior-tree` for Rust!
[](https://crates.io/crates/behavior-tree)
[](https://crates.io/crates/behavior-tree)
[](https://crates.io/crates/behavior-tree)
[](https://docs.rs/behavior-tree)
[](https://github.com/darthdeus/behavior-tree/actions)
[](https://github.com/darthdeus/behavior-tree/commits/master)
[](https://github.com/darthdeus/behavior-tree/actions)**USE AT YOUR OWN RISK. This crate is under heavy development at the moment and a lot of the APIs will change often and without any notice. Performance is also terrible right now.**
Implemented nodes:
- Sequence - execute child nodes in a sequence until one of them fails.
- Select - execute child nodes in a sequence until one of them succeeds.
- While - execute a child node only when a condition is true.
- Wait - constant time delay.
- RandomWait - random time delay with a defined max.
- Action - generic user-defined action.
- StatefulAction - generic user-defined action which manages its own state in addition to the tree-wide Blackboard.
- Cond - checks a condition and executes either the `positive` or `negative` child.Almost all of the behaviors have test coverage including a few of the edge cases, but it is by no means exhaustive yet.
**There are a few quirks that need to be figured out, especially with respect to debugging/visualization, which will be stabilized before version `0.1`.**
## Other behavior tree crates
There are a few other crates that implement behavior trees (listed below).
This library is inspired by all of them, as well as the [Behavior Tree Starter
Kit from Game AI
Pro](https://www.gameaipro.com/GameAIPro/GameAIPro_Chapter06_The_Behavior_Tree_Starter_Kit.pdf).- https://crates.io/crates/piston-ai_behavior
- https://github.com/pistondevelopers/ai_behavior- https://crates.io/crates/aspen
- https://gitlab.com/neachdainn/aspen- https://crates.io/crates/stackbt_behavior_tree
- https://github.com/eaglgenes101/stackbt## Who uses this?
The code was originally extracted from [BITGUN](https://store.steampowered.com/app/1673940/BITGUN/), which continues to use it as it's being developed open source. If you're using this crate in your game [do open a PR](https://github.com/darthdeus/behavior-tree/pulls) so we can list your game here as well!