Decision
Description:
A decision tree framework for creating game AI structures.
Sel
Type: Function.
Description:
Creates a selector node with the specified child nodes. A selector node will go through the child nodes until one succeeds.
Signature:
Sel: function(nodes: {Leaf}): Leaf
Parameters:
Parameter | Type | Description |
---|---|---|
nodes | {Leaf} | An array of Leaf nodes. |
Returns:
Return Type | Description |
---|---|
Leaf | A Leaf node that represents a selector. |
Seq
Type: Function.
Description:
Creates a sequence node with the specified child nodes. A sequence node will go through the child nodes until all node succeeds.
Signature:
Seq: function(nodes: {Leaf}): Leaf
Parameters:
Parameter | Type | Description |
---|---|---|
nodes | {Leaf} | An array of Leaf nodes. |
Returns:
Return Type | Description |
---|---|
Leaf | A Leaf node that represents a sequence. |
Con
Type: Function.
Description:
Creates a condition node with the specified name and handler function.
Signature:
Con: function(name: string, check: function(self: Unit): boolean): Leaf
Parameters:
Parameter | Type | Description |
---|---|---|
name | string | The name of the condition. |
check | function | The check function that takes a Unit parameter and returns a boolean result. |
Returns:
Return Type | Description |
---|---|
Leaf | A Leaf node that represents a condition check. |
Act
Type: Function.
Description:
Creates an action node with the specified action name.
Signature:
Act: function(actionName: string): Leaf
Parameters:
Parameter | Type | Description |
---|---|---|
actionName | string | The name of the action to perform. |
Returns:
Return Type | Description |
---|---|
Leaf | A Leaf node that represents an action. |
Act
Type: Function.
Description:
Creates an action node with the specified handler function.
Signature:
Act: function(handler: function(self: Unit): string): Leaf
Parameters:
Parameter | Type | Description |
---|---|---|
handler | function | The handler function that takes a Unit parameter which is the running AI agent and returns an action. |
Returns:
Return Type | Description |
---|---|
Leaf | A Leaf node that represents an action. |
Accept
Type: Function.
Description:
Creates a leaf node that represents accepting the current behavior tree. Always get success result from this node.
Signature:
Accept: function(): Leaf
Returns:
Return Type | Description |
---|---|
Leaf | A Leaf node. |
Reject
Type: Function.
Description:
Creates a leaf node that represents rejecting the current behavior tree. Always get failure result from this node.
Signature:
Reject: function(): Leaf
Returns:
Return Type | Description |
---|---|
Leaf | A Leaf node. |
Behave
Type: Function.
Description:
Creates a leaf node with the specified behavior tree as its root. It is possible to include a Behavior Tree as a node in a Decision Tree by using the Behave() function. This allows the AI to use a combination of decision-making and behavior execution to achieve its goals.
Signature:
Behave: function(name: string, root: Behavior.Leaf): Leaf
Parameters:
Parameter | Type | Description |
---|---|---|
name | string | The name of the behavior tree. |
root | Behavior.Leaf | The root node of the behavior tree. |
Returns:
Return Type | Description |
---|---|
Leaf | A Leaf node. |
AI
Type: Field.
Description:
The singleton instance to retrieve information while executing the decision tree.
Signature:
AI: AI