WEBVTT

00:06.910 --> 00:08.200
Welcome back.

00:08.230 --> 00:14.140
Now we've created our attribute system and we've created a couple of gameplay abilities.

00:14.170 --> 00:16.840
One, offensive ability, the Firebolt.

00:16.840 --> 00:19.600
And we have hit React for our enemies.

00:19.600 --> 00:24.100
But of course, our enemies are going to want to do much more than just hit react.

00:24.100 --> 00:30.130
And we still do want to create a lot more abilities, more offensive abilities, attacks.

00:30.130 --> 00:33.760
That aura can use, different types of spells and so on.

00:33.760 --> 00:39.520
But at this point in the course, it's time for our enemies to start having more functionality, more

00:39.520 --> 00:44.350
behavior as they need to be able to react to things they need to attack.

00:44.380 --> 00:48.460
Aura needs to be able to take damage from the enemies.

00:48.460 --> 00:54.250
And once we kill the enemies, we need to start gaining experience and think about how we're going to

00:54.250 --> 00:56.860
level up and reward the player.

00:56.860 --> 01:03.040
So amongst all that, the enemy needs some sort of way to be controlled by AI.

01:04.040 --> 01:06.050
So we have our aura enemy.

01:06.050 --> 01:10.900
And this class so far does nothing but just stand there.

01:10.910 --> 01:14.030
Yes, it can hit react, but that's it.

01:14.060 --> 01:21.170
Now it needs a way to make decisions, a way for it to process logic based on what's going on.

01:21.170 --> 01:26.750
It needs a way to chase aura so that it can decide when to attack.

01:26.750 --> 01:31.790
And we could place all of that logic in C plus plus code if we wanted to.

01:31.790 --> 01:35.060
But another way is to use behavior trees.

01:35.150 --> 01:44.600
A behavior tree is a nice way to encapsulate AI behavior into a nice tree blueprint where we can easily

01:44.600 --> 01:48.110
see the control flow of AI logic.

01:48.350 --> 01:57.620
We can also tie this in to the enemy via interface function calls or even to the ability system by sending

01:57.620 --> 02:01.790
gameplay events, activating abilities and so on.

02:02.030 --> 02:06.150
So a behavior tree is a pretty good way to control the enemy.

02:06.150 --> 02:12.930
And if we have a behavior tree asset tied to the enemy class itself, then different enemies could potentially

02:12.930 --> 02:14.280
use different behavior.

02:14.280 --> 02:14.640
Trees.

02:14.640 --> 02:17.100
They could all share the same behavior tree.

02:17.100 --> 02:22.740
Or we could make this flexible so they can swap that behavior tree asset out.

02:22.860 --> 02:29.490
Now, in addition to a behavior tree, AI enemies are going to need an AI controller, so this class

02:29.490 --> 02:32.370
will be closely tied to the enemy.

02:32.370 --> 02:39.060
And if we're going to be using a behavior tree, then something somewhere needs a behavior tree component

02:39.060 --> 02:41.700
and something called a blackboard.

02:41.730 --> 02:47.580
The behavior tree and the blackboard are classes that work closely together with each other.

02:47.580 --> 02:52.920
We'll see how and these components should be on some class.

02:52.950 --> 03:00.600
I'm going to choose to put them on the AI controller class so the AI controller will own these components.

03:00.600 --> 03:07.020
But the AI controller needs to be told what behavior tree its behavior tree component should use.

03:07.020 --> 03:11.640
So the behavior tree component is the component that contains the behavior tree.

03:11.670 --> 03:18.180
Our enemy specifically will have that and it's going to have to tell the controller to use its specific

03:18.180 --> 03:19.170
behavior tree.

03:19.170 --> 03:25.350
And once that behavior tree component knows which behavior tree it should use, it needs to run that

03:25.350 --> 03:26.430
behavior tree.

03:26.460 --> 03:29.580
So we need to start that behavior tree and get it going.

03:29.580 --> 03:34.560
And we can do that by calling run behavior tree on the AI controller.

03:34.770 --> 03:41.580
So the AI controller, as well as the behavior tree and blackboard are classes that don't exist in our

03:41.580 --> 03:42.630
project yet.

03:42.630 --> 03:44.730
So we have some things we need to make.

03:45.250 --> 03:48.100
So we have some next steps to perform.

03:48.250 --> 03:54.130
We need an AI controller class and we need to create a blackboard and a behavior tree.

03:54.160 --> 04:00.670
Now our AI controller is going to own the components for these, so we need to add a blackboard component

04:00.670 --> 04:04.090
and a behavior tree component to the AI controller.

04:04.120 --> 04:11.520
Once the AI controller has these components, then we need to add a behavior tree to our aura anime

04:11.530 --> 04:17.230
and we can set this in blueprint so we can potentially swap it out for different types of enemies if

04:17.230 --> 04:18.190
we need to.

04:18.190 --> 04:24.340
And once we've tied all this together, we need to actually run the behavior tree so that it's running

04:24.340 --> 04:27.130
and controlling our AI enemies.

04:27.130 --> 04:33.580
So once we get all of this foundational setup in place, then we can start deciding how our enemies

04:33.580 --> 04:37.570
are going to behave and start filling out our behavior tree.

04:37.720 --> 04:41.700
So we'll start tackling items on this list in the next video.

04:41.710 --> 04:42.880
I'll see you soon.
