THE BASIC THINGS
This visual editor is a (FSM) finite state machine. If you don’t know what is a finite state machine
FINITE STATE MACHINE:
• A finite-state machine (FSM) or finite-state automaton (FSA, plural: automata), or simply a state machine, is a mathematical model of computation used to design both computer programs and sequential logic circuits. It is conceived as an abstract machine that can be in one of a finite number of states. The machine is in only one state at a time; the state it is in at any given time is called the current state. It can change from one state to another when initiated by a triggering event or condition; this is called a transition. A particular FSM is defined by a list of its states, its initial state, and the triggering condition for each transition.
To create an agent, go to Window/Easy AI Node Editor
A window was open, that is the editor where we are going to make AI behaviours easily.
Select the agent in the hierarchy and click “New Canvas”.
Now the start state has been created.
There’s a node in the window with the title “Start” that is the start node.
You can do zoom in and out with the mouse wheel but you if you do zoom out you only can view the nodes you cannot edit these.
Right click on an empty space of the window to create a new node, a list with nodes is displayed, this contain the name of all the nodes that you can create simply clicking on it.
Right click over a node to display the options: Delete, Duplicate. (The start node can not be deleted or duplicated).
You can create variables assign a value to it and use it in your nodes. In the panel type the name of your variable, in the drop down select the type (string, gameobject, int, etc). And finally click add.
In nodes like can see, can hear, pursue, etc, you can use it variable cliking in the “S” button, and selecting the variable.
You can call a function when a node starts, you only have to click over the node, go to the inspector, and there is the typic list with events, this works equal to the UI Events, so probably you know how call a function with it,.
If you don’t know:
• Click the + sign
• Drag and drop a gameobject (that contains the script with the function that you want to call) to the field in the left of the inspector
• In the drop down select the function that you want to call
There are different types of nodes:
ACTIONS: They are red.
CONDITIONALS: They are cyan, are the condition that needs to be completed to goes to the next state.
CAN SEE OBJECT
CAN HEAR OBJECT
They are some others nodes:
You can only connect knops of the same color.
Let’s see some examples to understand that better.
RESULT OF THIS: If you hit play, the agent will be wandering (state 1)up to it sees to the player, when the agent sees to the player (conditional 1 => to go to next state) it will flee from the player (state 2).
WHY WE ARE GETTING THESE RESULTS?:
The state 1 (identified in the last picture) is connected to the start state, so the state 1 is the first action that will be executed.
The state 1 is Wander, so the agent will wander by the world.
The condition 1 is the condition that needs to be completed to finish the state 1 and start the state 2.
The condition 1 is Can See Object.
The condition 1 is completed if the agent sees the player.
The state 2 is connected to the condition 1 so will be executed when the condition 1 is completed.
The state 2 is Flee, so the agent will flee from the player
The most important of this example is that you can have multiple conditionals and multiple ways.
RESULT OF THIS: If you hit play, the agent will be wandering (state 1) up to it sees to the player (conditional 1) or the timer get down to zero (conditional 2) the directional light will turn off (state 2).
There is another example of this Node Editor in Easy AI/Scenes/ called Visual AI Video
IF YOU NEED HELP LET ME KNOW: CONTACT US: firstname.lastname@example.org