Expand description
Everything related to AI behavior and behavior trees.
Behavior trees are simple but very powerful mechanism to implement artificial intelligence for
games. The main concept is in its name. Tree is a set of connected nodes, where each node could
have single parent and zero or more children nodes. Execution path of the tree is defined by the
actions of the nodes. Behavior tree has a set of hard coded nodes as well as leaf nodes with
user-defined logic. Hard coded nodes are: Sequence, Selector, Leaf. Leaf is special - it has
custom method tick
that can contain any logic you want.
For more info see:
Modules§
- composite
- Composite node is a container for children nodes. Composite node could be either
Sequence
orSelector
.Sequence
node will execute children nodes consecutively untilStatus::Failure
is returned from any descendant node. In other wordsSequence
implement AND logical function.Selector
node will execute children untilStatus::Success
is returned from any descendant node. In other worldsSelector
implement OR logical function. - inverter
- A node, that inverts its child state (
super::Status::Failure
becomessuper::Status::Success
and vice versa,super::Status::Running
remains unchanged) - leaf
- Leaf is a “final” node of a behavior tree. It contains user-defined action which is able to mutate given context.
Structs§
- Behavior
Tree - See module docs.
- Root
Node - Root node of the tree.
Enums§
- Behavior
Node - Possible variations of behavior nodes.
- Status
- Status of execution of behavior tree node.
Traits§
- Behavior
- A trait for user-defined actions for behavior tree.