Hi. In this video I will introduce NCAlt, which stands for NodeCanvas Alternatives.
NCAlt is an extension to NodeCanvas - a node-based system to create behavior trees for game AI.
NCAlt supports multiple behavior tree alternatives for a game character and allows live differencing of multiple behaviors in both: the game scene and the tree visualization.
I'm going to go over a couple of examples of how NCAlt can be used.
The first of which is Pac-Man.
Here is the interface of NCAlt.
This is a menu widget to select the alternatives.
I have already created two behavior tree alternatives. They are Blinky and Clyde.
Blinky almost always follows the tile that Pac-Man currently occupies.
Clyde's movements are based on how far away he currently is from Pac-Man.
However, as soon as Clyde comes within six tiles from Pac-Man,
he flees to his scatter position.
This GUI text field is used to rename the alternative.
This Boolean toggle button is used to label the game object in the game scene.
The GUI button is used to create a new alternative.
This will duplicate the currently active behavior tree alternative into a new alternative which the user can interact with independently.
The user is then able to add a new node, delete nodes, rewire the connection, or overwrite the entire behavior tree alternative.
However, this does not affect the behaivor tree alternatives because they are completely independent of one another.
NCAlt's difference visualization marks the differences between multiple behavior tree alternatives against a chosen alternative in two ways.
They are: Difference visualizations in the game scene view and difference visualizations of behavior trees.
I'll be using the Pac-Man game to visualise the differences in the game scene.
To get into this mode, the user must click on a GUI button named "Diff Game Scene".
To show the differences between multiple behavior tree alternatives in the game scene view,
A clone game object is created with the compared behavior tree alternative and colored uniquely using the diff game scene toggle button color.
Here, Blinky is the red ghost which is chasing Pac-Man.
and Clyde is the yellow ghost which is running away from Pac-Man because he is currently in the scatter mode.
So, using NCAlt, users see multiple AI behaivors concurrently in the game scene along with their behavior trees opened in separate canvases.
Now I'll be using the RPG game to visualize the differences in the behavior tree.
I already created two behavior tree alternatives for the RPG game.
First, let's have a look at these behavior tree alternatives in the game scene.
Here, the skeleton is the enemy character and the human is the player character.
In Alternative 1, the enemy will follow the player when he is 10 tiles from the player and he goes to position 1 when he loses the sight of the player.
In Alternative 2, the enemy will follow the player when he is 10 tiles from the player and he is within 45 degrees in the field of view of the player.
The priority of "IF (ALL TRUE)" node has been changed as well in Alternative 2. That's why number "1" is appearing on top of this node.
Besides, the enemy goes to his initial position when he loses the sight of the player.
To get into the difference visualization in the behavior tree mode, the user must click on a GUI button named "Diff BT"
Now when the user clicks on the added node, four nodes have been newly added in Alternative 2.
The "Seek $position1" node has been deleted in Alternative 2. That's why it is shown as a ghost node in Alternative 2.
The "IF (ALL TRUE)" node is modified in Alternative 2. That's why there is a "not equals" sign appearing on top of this node.
Now, I will be using the Pac-Man game to demonstate the workflow of selective merging.
First, let's have a look at Blinky's and Clyde's behaviors in the game scene.
As we can see, Blinky stays in the scatter mode for 10 seconds and changes his mode to chase.
However, Clyde changes his mode from scatter to chase after arriving in the scatter position.
Now, suppose the user wants to make Blinky's scatter mode similar to Clyde's scatter mode.
However, the user does not want to get rid of Blinky's current behavior tree.
So, the user creates another alternative for Blinky's behavior tree and renames it as "Blinky 2".
After that, the use opens the Blinky 2's behavior tree in a new canvas.
Now, to merge from Clyde's scatter mode and Blinky 2's scatter mode
The user selects three nodes from Clyde's behavior tree, which is the source alternative.
and opens the selective merge menu to select the Blinky 2's behavior tree alternative, which is the target alternative.
Now, the selective merge is compeleted.
Let's have a look at Blink 2 in the game scene after the selective merge is completed.
Now, as you can see Blinky 2 changes his mode from scatter to chase after arriving in the scatter position.