Expand description
Entity AI — Finite State Machine, Behavior Tree, and Utility AI.
Three complementary AI models:
StateMachine<S>: enum-driven FSM with transition guardsBehaviorTree: composable node tree (Sequence, Selector, Decorator)UtilityAI: scores candidate actions and picks the highest
Modules§
- keys
- Standard blackboard keys used by built-in behaviors.
Structs§
- Always
Failure - Always-failure leaf.
- Always
Success - Always-success leaf.
- Behavior
Tree - A complete behavior tree with its own blackboard.
- Blackboard
- Shared working memory for AI nodes.
- Check
Flag - Condition: reads a bool from the blackboard.
- Check
Float - Condition: checks if a float exceeds a threshold.
- Consideration
- Consideration: maps a blackboard value through a curve to a partial score.
- Cooldown
- Cooldown: child can only run once every
cooldownseconds. - Inverter
- Inverter: flips Success/Failure.
- Parallel
- Parallel: runs all children every tick. Succeeds when
nsucceed. - Random
Selector - RandomSelector: like Selector but shuffles children on each activation.
- Repeater
- Repeater: runs child
ntimes (0 = infinite). - Selector
- Selector: runs children left-to-right; succeeds on first child success.
- Sequence
- Sequence: runs children left-to-right; fails on first child failure.
- SetFlag
- Action: set a blackboard flag.
- State
Machine - A generic Finite State Machine.
- Succeeder
- Succeeder: always returns Success.
- UtilityAI
- Selects the highest-scoring available action and runs it.
- Utility
Action Def - An action defined by its considerations and execution function.
- Wait
- Action: wait for
durationseconds.
Enums§
- BtStatus
- Status returned by a BT node each tick.
- Consideration
Combine - State
Result - Outcome of a state’s update tick.
- Utility
Curve - Scoring curve applied to a raw utility value.
Traits§
- BtNode
- A node in a behavior tree.
- FsmState
- A single FSM state.
- Utility
Action - An action that utility AI can evaluate and execute.