Recast with Behavior Tree – Working Web Player

So in this quick video we review that Web Player exports and imports do work, they just need to be unique or Unity3d decides which file you really intended to use. Read the rest…

In this video we work through exporting our navmesh and setting up our dwarf to become hungry. After that it looks for nearby food and eats. Initially I state that the web player version is broken, but as it turns out in Video 2a it is simply failing because I have multiple files named “NavMesh” in the resources folder. Read the rest…

In this first episode we create a new Unity3d project and bring in the Behavior Tree Library we have built. We also import in the RecastUnity project from the asset store and begin to combine the two in order to make a basic AI that will look for, go to, and eat food when it gets hungry.
Read the rest…

Behavior Trees – Priority Selector

In this video we build up a priority selector. Its purpose is to rerun every node from the beginning each time in case we need to override its last behavior by prioritizing another behavior. This is useful for the top-level of the AI so we can build a list of behaviors that have a priority, such as dropping everything and going to defend. Read the rest…

In this video we take the Condition class and modify it. Combining conditions with the composite class we create a class that holds one child and returns a specified value rather than failed when the condition doesn’t return true. This is useful for situations where we want a sequence to continue even though the condition doesn’t hold true. An example would be in the middle of an auto attack script where we don’t want an attack to return failure when we are on cool-down. Read the rest…

Now that we have covered our primary classes it is time to take a look at the Condition class. This class is designed to be used in a sequence as a way to continue or stop a certain path. Again taking our example of an AI for a First Person Shooter, the Condition class is the portion that says “Is my health less than 50″ as part of the sequence “Do we need to go find a health power-up?” The idea is that if my health isn’t less than 50, we will move on to the next priority, something like making sure I have ammo. Read the rest…

Now that we have completed our testing of the Sequence and Selector classes individually we are focused on writing our first integration test. We build a selector with 2 sequence children to make sure that if one sequence fails, the selector moves to the second child and when both sequences fail that the selector fails. Likewise we also build a sequence with 2 selector children to make sure that when on selector fails, the sequence fails, but when both selectors succeed the entire sequence succeeds. This test is more of a comprehensive test to ensure our theories on Selectors and Sequences are correct. Read the rest…

Behavior Trees – Coding the Sequence class

Continuing from the last video we now take a look at the Sequence class. A Sequence is an object that has one or more children and will go through each child only if the previous child succeeded. The Sequence object will fail if any of its children fail. The idea behind this class is to make a list of behaviors that must be done in order. Like the Selector, a prime example would be part of the AI in a First Person Shooter. The Selector in the AI would first check if it is wounded and needs to heal. This would be composed of a condition, such as Health < 50. If that Succeeds then it would do a check for nearby health. If that also succeeds, the AI would then place a priority on getting to the health powerup to heal itself by telling its path finding algorithm where it needs to move. Read the rest…

Behavior Trees – Coding our Selector class

Continuing from the last video we now take a look at the Selector class. A Selector is an object that has one or more children and will go through each child if the previous child failed. The Selector object will only fail if all of its children fail. The idea behind this class is to keep track of the last thing it did but give priority to certain behaviors. A prime example would be part of the AI in a First Person Shooter. The AI would first check if it is wounded and needs to heal. If it isn’t, it moves to the next node. The next node might see if the AI is out of ammo. If it isn’t out of ammo, the next node might look for the nearest enemy to engage.  Read the rest…

We are beginning a new series covering Artificial Intelligence. It permeates almost every game and in some cases can make or break how well your game does. Numerous books and sites are dedicated to AI and path finding. This series is going to explore Behavior Trees, Pathfinding with Recast, and ultimately how to make the two work together to build NPCs that can be used in numerous games. Read the rest…