# Node Reference

The _AI Brain Graph_ comes packed with four main type  of nodes:

* _AI Brain State Node_
* _AI Transition Node_
* _AI Action Node_
* _AI Decision Node_

Additionally, you'll get some helper nodes:

* _Comment Node_
* _AI Brain State Alias Node_
* _AI Brain Any State Node_

Finally, when you work with a Subgraph, you have access to:

* _AI Brain Subgraph Nodes_
* _AI State In Nodes_
* _AI Transition Out Nodes_

## Main Nodes

### AI Brain State Node

A **State** node represents a single state in the MMTools _AIBrain_.

{% hint style="warning" %}
Each state should be given a unique name by right-clicking the header and choosing _Rename._
{% endhint %}

The _Set as starting state_ button will set the state as the first one in the MMTools _AIBrain_ states list.

#### Attributes

* **Can Transition To Self**: if set to false, self referencing transitions will be removed (for instance _Idle > Idle_)

#### Inputs

* **States In** (multiple _State_ connections): a list of entry points from other states transitions
* **Actions** (multiple _Action_ connections): a list of actions that should be performed when entering the state itself

#### Outputs

* **Transitions** (multiple _Transition_ connections): a list of transitions that will let the system exit from this state&#x20;

![](https://1480578063-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LwY4qXRelZyML_CLwPb%2F-LxKVhHW-L0mUwbseTIK%2F-LxLwgem4Y4lBmkPEuQr%2Fnode_reference_001.png?alt=media\&token=d7f2a7ae-90a5-48d2-bcd3-4a559ad01154)

### AI Transition Node

A **Transition** node represents a single transition from a state in the MMTools _AI Brain_: a state can have more than one transition.

If you wish, you can rename the node by right-clicking the header and choosing _Rename_ but this won't affect the AI generation.

{% hint style="warning" %}
A Transition node should always have a connected _AIDecision_ node
{% endhint %}

#### Attributes

This node has no attributes.

#### Inputs

* **Decision** (single _Decision_ connection): a single _AI Decision Node_ that will let the AI Brain exit from the actual state
* **Input** (single _Transition_ connection): a single connection from the _AI Brain State_

#### Outputs

* **True State** (single _State_ connection): a connection to the state that should be activated when the decision is true
* **False State** (single _State_ connection): a connection to the state that should be activated when the decision is false

![](https://1480578063-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LwY4qXRelZyML_CLwPb%2F-LxKVhHW-L0mUwbseTIK%2F-LxLwXS13sQLRDzlZvQK%2Fnode_reference_002.png?alt=media\&token=e263ec1c-3ac8-425c-9fb4-acca76032281)

### AI Action Node

**Action** nodes are graph representations of _AIAction_ components. They come with a single output element that should be connected to the state. This will tell the state itself that this action should be executed.

A node may have some parameters, corresponding with the Corgi/TopDown engine _AIAction_ components.

If you wish, you can rename the node by right-clicking the header and choosing _Rename_ but this won't affect the AI generation.

#### Attributes

* **Label**: corresponds to the regular _AIAction_ label
* Depending on the corresponding _AIAction_, you'll have access to a list of paramenters

#### Inputs

This node has no input connections.

#### Outputs

* **Output** (multiple _Action_ connections): a single _AI Decision Node_ that will let the AI Brain exit from the actual state

![](https://1480578063-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LwY4qXRelZyML_CLwPb%2F-LxKVhHW-L0mUwbseTIK%2F-LxLx-L_NsTAiM0ktVij%2Fnode_reference_003.png?alt=media\&token=843536bc-135e-4bd9-8b5b-77810178de90)

### AI Decision Node

**Decision** nodes are a graph representation of _AIDecision_ components. They come with a single output element that should be connected to a state transition. This will define the condition to exit the state.

If you wish, you can rename the node by right-clicking the header and choosing _Rename_ but this won't affect the AI generation.

#### Attributes

* **Label**: corresponds to the regular _AIDecision_ label
* Depending on the corresponding _AIDecision_, you'll have access to a list of paramenters

#### Inputs

This node has no input connections.

#### Outputs

* **Output** (multiple _Decision_ connections): a single _AIDecision Node_ that will let the AI Brain exit from the actual state

![](https://1480578063-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LwY4qXRelZyML_CLwPb%2F-LxKVhHW-L0mUwbseTIK%2F-LxLxCF_Mi-7k1LL3qOc%2Fnode_reference_004.png?alt=media\&token=9562e2a3-23a3-4b82-aa73-ffaaf3b18948)

## Helper Nodes

### Comment Node

Comment nodes have the only purpose of letting you add notes in your graph. They won't generate anything in the character AI Brain System.

{% hint style="info" %}
Clicking on the header will let you enter edit note.
{% endhint %}

#### Attributes

This node has no input attributes.

#### Inputs

This node has no input connections.

#### Outputs

This node has no output connections.

![](https://1480578063-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LwY4qXRelZyML_CLwPb%2F-LxRespjHaJpvCGSRQXQ%2F-LxRgBkol0a9UULBUhsA%2Fnode_reference_008.png?alt=media\&token=7f098ca5-43fd-4dd1-bea7-cff397907584)

### AI Brain State Alias Node

The **AI Brain State Alias Node** will let you create alias elements for your states: this will avoid main spaghetti like brains when things get complicated.



#### Attributes

* **Available States**: the node will show a list of nodes:
  * In the main graph all nodes and subgraph-exposed nodes will be shown
  * In a subgraph, only inner nodes will be shown

#### Inputs

* **States In** (multiple _State_ connections): a list of entry points from other states transitions

#### Outputs

This node has no output connections.

![](https://1480578063-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LwY4qXRelZyML_CLwPb%2F-LxM1MYxZeMbfHdzt33B%2F-LxM4C9oxmU73sZR6MO9%2Fnode_reference_010.png?alt=media\&token=94625449-4a54-4231-be1b-045d2bac9d32)

### AI Brain Any State Node

The **AI Brain Any State** node will let you generate Decision/Transition logic for all nodes in your graph:

* If added in a main Graph, also subgraph States will be affected
* If added in a subgraph, only subgraph States will be affected

#### Attributes

This node has no input attributes.

#### Inputs

This node has no input connections.

#### Outputs

* **Transitions** (multiple _Transition_ connections): a list of transitions that will let the system exit all included states

![](https://1480578063-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LwY4qXRelZyML_CLwPb%2F-LxM1MYxZeMbfHdzt33B%2F-LxM2iTf1VGiFoKyQRgz%2Fnode_reference_009.png?alt=media\&token=5ae34968-479b-42dc-8af6-7f45dc1a18eb)

## Subgraph Nodes

### AI Brain Subgraph Node

A **Subgraph** node is a special state node, that lets you create a inner state/decision/action logic.&#x20;

It can be set as a starting node (in this case its inner starting node will be used).

![](https://1480578063-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LwY4qXRelZyML_CLwPb%2F-LxKVhHW-L0mUwbseTIK%2F-LxLxetBbhhTbIB498qS%2Fnode_reference_.png?alt=media\&token=1a583d4e-14c4-4cad-9c5f-0a787102396e)

You can create a subgraph asset and assign it to the _Subgraph_ field.

![](https://1480578063-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LwY4qXRelZyML_CLwPb%2F-LxKVhHW-L0mUwbseTIK%2F-LxLxsBWWmYoidbbA_IG%2Fnode_reference_005.png?alt=media\&token=4f3b521c-a3f3-4f6e-82f9-3d6553b86ac8)

{% hint style="warning" %}
You cannot create nested subgraphs (i.e.: you cannot add a subgraph inside a subgraph)
{% endhint %}

#### Attributes

* **Subgraph**: the subgraph data

#### Inputs

* **State In** (list of multiple _State_ connections): a dynamically generated list of state connections (see _AI State In Nodes_)

**Outputs**

* **Transition Out** (list of single _Transition_ connections): a dynamically generated list of transition connections (see _AI Transition Out Nodes_)

### AI State In Node

The **AI State In** node exposes an _AI Brain State_ node inside a subgraph to the parent brain graph.

![](https://1480578063-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LwY4qXRelZyML_CLwPb%2F-LxLybSuOAMDBruLb__o%2F-LxLzKIh_KfPQqO8H-15%2Fnode_reference_006.png?alt=media\&token=1e3c435c-5ba0-43c7-90a7-884dde5a5b4d)

{% hint style="warning" %}
_State In_ nodes are only available in a subgraph.
{% endhint %}

#### Attributes

This node has no attributes

#### Inputs

This node has no input connections.

#### Outputs

* **Input** (single _State_ connection): this node will generate a _State In_ connection in the subgraph node of the parent graph

### AI Transition Out Node

The **AI Transition Out** node exposes an _AI Transition_ node connection inside a subgraph to the parent brain graph.

![](https://1480578063-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LwY4qXRelZyML_CLwPb%2F-LxLybSuOAMDBruLb__o%2F-LxLzTmM9roZQpk8FZcA%2Fnode_reference_007.png?alt=media\&token=50ef821f-b2d8-4bbf-a4a9-d9068552c466)

{% hint style="warning" %}
_Transition Out_ nodes are only available in a subgraph.
{% endhint %}

#### Attributes

This node has no attributes

#### Inputs

* **Output** (single _Transition_ connection): this node will generate a _Transition Out_ connection in the subgraph node of the parent graph

#### Outputs

This node has no output connections.
