Welcome back.
Now we've created our attribute system and we've created a couple of gameplay abilities.
One, offensive ability, the Firebolt.
And we have hit React for our enemies.
But of course, our enemies are going to want to do much more than just hit react.
And we still do want to create a lot more abilities, more offensive abilities, attacks.
That aura can use, different types of spells and so on.
But at this point in the course, it's time for our enemies to start having more functionality, more
behavior as they need to be able to react to things they need to attack.
Aura needs to be able to take damage from the enemies.
And once we kill the enemies, we need to start gaining experience and think about how we're going to
level up and reward the player.
So amongst all that, the enemy needs some sort of way to be controlled by AI.
So we have our aura enemy.
And this class so far does nothing but just stand there.
Yes, it can hit react, but that's it.
Now it needs a way to make decisions, a way for it to process logic based on what's going on.
It needs a way to chase aura so that it can decide when to attack.
And we could place all of that logic in C plus plus code if we wanted to.
But another way is to use behavior trees.
A behavior tree is a nice way to encapsulate AI behavior into a nice tree blueprint where we can easily
see the control flow of AI logic.
We can also tie this in to the enemy via interface function calls or even to the ability system by sending
gameplay events, activating abilities and so on.
So a behavior tree is a pretty good way to control the enemy.
And if we have a behavior tree asset tied to the enemy class itself, then different enemies could potentially
use different behavior.
Trees.
They could all share the same behavior tree.
Or we could make this flexible so they can swap that behavior tree asset out.
Now, in addition to a behavior tree, AI enemies are going to need an AI controller, so this class
will be closely tied to the enemy.
And if we're going to be using a behavior tree, then something somewhere needs a behavior tree component
and something called a blackboard.
The behavior tree and the blackboard are classes that work closely together with each other.
We'll see how and these components should be on some class.
I'm going to choose to put them on the AI controller class so the AI controller will own these components.
But the AI controller needs to be told what behavior tree its behavior tree component should use.
So the behavior tree component is the component that contains the behavior tree.
Our enemy specifically will have that and it's going to have to tell the controller to use its specific
behavior tree.
And once that behavior tree component knows which behavior tree it should use, it needs to run that
behavior tree.
So we need to start that behavior tree and get it going.
And we can do that by calling run behavior tree on the AI controller.
So the AI controller, as well as the behavior tree and blackboard are classes that don't exist in our
project yet.
So we have some things we need to make.
So we have some next steps to perform.
We need an AI controller class and we need to create a blackboard and a behavior tree.
Now our AI controller is going to own the components for these, so we need to add a blackboard component
and a behavior tree component to the AI controller.
Once the AI controller has these components, then we need to add a behavior tree to our aura anime
and we can set this in blueprint so we can potentially swap it out for different types of enemies if
we need to.
And once we've tied all this together, we need to actually run the behavior tree so that it's running
and controlling our AI enemies.
So once we get all of this foundational setup in place, then we can start deciding how our enemies
are going to behave and start filling out our behavior tree.
So we'll start tackling items on this list in the next video.
I'll see you soon.