Qualia
0.2
|
Executes behaviors randomly, based on a given set of weights. More...
#include <ProbabilityNode.h>
Public Member Functions | |
ProbabilityNode () | |
virtual | ~ProbabilityNode () |
virtual BehaviorTreeNode * | setChildren (BehaviorTreeNode *node,...) |
Sets children, giving them all the same weight. More... | |
virtual BehaviorTreeNode * | setWeightedChildren (WeightedBehaviorTreeNode weightedNode,...) |
void | init (void *object) |
BEHAVIOR_STATUS | execute (void *object) |
This method is invoked by the node's parent when the node should be run. More... | |
![]() | |
BehaviorTreeInternalNode () | |
virtual | ~BehaviorTreeInternalNode () |
virtual BehaviorTreeNode * | _setChildren (BehaviorTreeNode *node, va_list nodeList) |
Helper method for setChildren(). More... | |
![]() | |
virtual | ~BehaviorTreeNode () |
Private Attributes | |
MTRand_closed | random |
float | totalSum |
BehaviorTreeNode * | currentNode |
float * | weighting |
Additional Inherited Members | |
![]() | |
BehaviorTreeNode ** | children |
This node's children nodes. More... | |
uint8_t | nChildren |
The number of children of this node. More... | |
Executes behaviors randomly, based on a given set of weights.
The weights are not percentages, but rather simple ratios.
For example, if there were two children with a weight of one, each would have a 50% chance of being executed. If another child with a weight of eight were added, the previous children would have a 10% chance of being executed, and the new child would have an 80% chance of being executed. This weight system is intended to facilitate the fine-tuning of behaviors.
ProbabilityNode::ProbabilityNode | ( | ) |
|
virtual |
|
virtual |
This method is invoked by the node's parent when the node should be run.
Implements BehaviorTree::BehaviorTreeInternalNode.
|
virtual |
Adds a child to the node with specific weight. Deprecated: use setWeightedChildren() method instead.
Implements BehaviorTree::BehaviorTreeInternalNode.
|
virtual |
Sets children, giving them all the same weight.
Reimplemented from BehaviorTree::BehaviorTreeInternalNode.
|
virtual |
Sets children with different weights. Accepts WeightedBehaviorTreeNode instead of BehaviorTreeNode. List of arguments should be terminated by WeightedBehaviorTreeNode::NULL_WEIGHTED_NODE.
|
private |
|
private |
|
private |
|
private |