WEBVTT

00:06.840 --> 00:07.930
Welcome back.

00:07.950 --> 00:10.890
So we'd like to use the environment query system.

00:11.010 --> 00:18.150
I'd like to be able to run some kind of X query to do all those nice, wonderful things we talked about

00:18.150 --> 00:19.800
in the previous video.

00:19.830 --> 00:23.460
In order to do that, I need to make an environment query.

00:23.760 --> 00:25.560
So here's what I'm going to do.

00:25.560 --> 00:29.700
I'm going to go into Blueprints I and we'll make one here.

00:29.730 --> 00:35.640
Now, at this point, I think it's time for some sub folders as we're getting kind of a lot of things

00:35.640 --> 00:37.840
and they're all getting jumbled up here.

00:37.860 --> 00:43.020
So I'm going to right click and make a new folder and put my behavior tree in Blackboard in that.

00:43.020 --> 00:45.270
So I'm just going to call this behavior.

00:47.430 --> 00:52.900
Tree and the behavior tree and the blackboard can both be lumped in together.

00:52.920 --> 00:54.630
So I'm going to move those there.

00:54.720 --> 00:57.390
Now, we also have a couple of tasks.

00:57.390 --> 01:00.140
We have BT Attack and BT.

01:00.510 --> 01:01.980
Go around Target.

01:01.980 --> 01:09.200
So I'd like to make a new folder for tasks so we can call that tasks and I'll put my BT.

01:09.210 --> 01:10.110
S in there.

01:10.890 --> 01:11.880
Move here.

01:12.300 --> 01:16.890
Now, here's my controller and my behavior tree service.

01:16.920 --> 01:23.550
I'll go ahead and put my service in a folder called Services like So.

01:23.850 --> 01:33.000
Move here and my aura controller can either stay right there or I could put it in a new folder called

01:33.030 --> 01:34.320
I Controller.

01:34.950 --> 01:35.940
Either way is fine.

01:35.940 --> 01:38.070
I'll go ahead and put it in a controller.

01:38.190 --> 01:40.710
Now we have more organization.

01:40.740 --> 01:45.080
Now, I'd like to do this because I'm going to add even more things to this.

01:45.090 --> 01:50.030
I'm going to make a new folder for the ECS System Environment Query System.

01:50.040 --> 01:52.260
So here's an ECS folder.

01:52.260 --> 01:56.010
I'm going to go in that and we're going to make our first environment query.

01:56.160 --> 02:02.690
So to do that, I right click, I go to artificial intelligence and here we see environment query.

02:02.700 --> 02:09.990
If I select that, I have a new environment query and I'm going to call this EC underscore EC stands

02:09.990 --> 02:17.530
for environment Query, and we'll call this find ranged attack position.

02:18.670 --> 02:25.120
So this will be for finding a good position for our Rangers to post up and start attacking.

02:25.210 --> 02:32.600
Now when it comes to ECS, a lot of things are going on sort of under the hood that can be hard to visualize.

02:32.620 --> 02:41.110
For that reason, there exists a special type of pawn that we can use to test out our environment queries.

02:41.110 --> 02:47.890
We can test what they're doing by drawing a bunch of debug shapes for all of the items that we generate.

02:47.890 --> 02:50.850
So I'd like to make one of those test pawns.

02:50.860 --> 02:56.350
I'm going to go to Blueprint class and search for ECS testing pawn.

02:56.380 --> 03:04.570
If we choose that ECS testing pawn and select it, we now have a pawn specifically designed to test

03:04.570 --> 03:05.950
environment queries.

03:06.040 --> 03:10.840
I'm going to call this BP underscore X testing.

03:11.870 --> 03:12.420
--.

03:12.980 --> 03:15.680
So how are we going to use this testing --?

03:15.710 --> 03:21.530
Well, I'd like to make a new level just for testing out environment queries, just so we don't have

03:21.530 --> 03:27.260
all this stuff in the way we have these enemies and they're going to be running up to us and distracting

03:27.260 --> 03:27.770
us.

03:27.800 --> 03:32.510
I'd like just a new map to test out the environment query system.

03:32.510 --> 03:40.850
So I'm going to go to file new level, choose basic, create and file, save as or save current level

03:40.850 --> 03:41.470
as.

03:41.480 --> 03:49.340
We'll go to maps and I'm going to call this X underscore testing map and we'll save that and we can

03:49.340 --> 03:51.500
test out our environment query system.

03:51.500 --> 04:00.440
So what I'm going to do is take my new EQs testing pawn and I X here it is, EQs testing pawn.

04:00.440 --> 04:01.760
We're going to bring that in.

04:02.030 --> 04:09.080
And with that pawn, we can choose to have this pawn test out one of our environment queries.

04:09.080 --> 04:13.770
We have one called EQ, Find ranged attack position.

04:13.770 --> 04:21.030
We can assign that to this X testing pawn as X testing pawns have this query template that it's going

04:21.030 --> 04:21.600
to test.

04:21.600 --> 04:27.540
So we're going to select EQ, find range, attack position, and now whatever we put in our environment

04:27.540 --> 04:32.750
query, we'll be able to draw some debug shapes here and see exactly what's going on.

04:32.760 --> 04:40.440
Now just to see this, I'm going to open up my EQ, find ranged attack position and notice it has a

04:40.440 --> 04:42.150
query graph with a route.

04:42.150 --> 04:44.580
So here is our environment query.

04:44.580 --> 04:51.210
And just like we discussed in the previous slide environment, queries make use of generators which

04:51.210 --> 04:59.100
generate a bunch of items either actors or locations, and that we can use those locations in our environment

04:59.100 --> 05:01.800
query based on whatever rules we set up.

05:01.800 --> 05:08.970
So we're going to add a generator by clicking on this bottom part of the root node dragging off.

05:08.970 --> 05:12.720
And notice that we have a number of generators that we can choose from.

05:12.720 --> 05:18.090
Now, once you learn how to use one of them, you pretty much know how to use all of them.

05:18.090 --> 05:20.700
You just have to be kind of shown the ropes.

05:20.700 --> 05:26.370
So we're going to choose one of them and the one we're going to choose is path and grid path in grid.

05:26.370 --> 05:34.320
If we select that is a special type of generator that generates a grid of points around a career.

05:34.320 --> 05:36.260
Now, what do we mean by career?

05:36.270 --> 05:42.990
Well, in the case of our testing pawn, our testing pawn itself is the career right here in the details

05:42.990 --> 05:50.010
panel we have generate around and we see environment, query context, underscore career by default.

05:50.010 --> 05:54.450
That is usually the pawn that's running this environment query.

05:54.450 --> 05:59.460
So let's take a look at some of the properties on this generator.

05:59.490 --> 06:04.950
The properties I'm concerned with right now are the grid half size and the space between grid.

06:04.980 --> 06:09.150
Half size is half of the squares extent, kind of like a radius.

06:09.180 --> 06:15.630
It's set to a thousand and space between is set to 100, which means we're going to get a grid of points

06:15.630 --> 06:17.310
with this specified size.

06:17.310 --> 06:22.230
Half of it is 1000, and the space between each point will be 100.

06:22.320 --> 06:26.040
Now, if we go back to the testing map, we can see what this looks like.

06:26.040 --> 06:35.130
Here we have a square with half of its width is 1000, so it's 2000 across 2000 across the other way.

06:35.130 --> 06:43.170
And we have this grid of points and each of these points is 100 units away from the next one.

06:43.170 --> 06:47.640
So we can see that we have quite a lot of points now.

06:47.640 --> 06:51.390
We saw that we have parameters in our generator.

06:51.420 --> 06:55.620
We can change our grid half size, we can change the space between.

06:55.620 --> 07:02.850
And what I'd like to do is undock this generator so I can see the test map as I'm playing with these

07:02.850 --> 07:04.050
parameters here.

07:04.050 --> 07:08.430
And I'm going to change the space between I'm going to change it to 200.

07:08.470 --> 07:14.550
Now we see that there are 200 units between each of these points, we can change the grid half size.

07:14.550 --> 07:19.080
I can change it to 500 and now we have quite a bit less, Right.

07:19.080 --> 07:24.510
And the number of points here is definitely going to affect how much work is done.

07:24.510 --> 07:30.240
If we do something for each one of these points, I'll set it back to 100 there.

07:30.240 --> 07:37.530
And here we have a grid of 500 with a space between of 100 setting grid half size to 800.

07:37.680 --> 07:39.060
Now we have this many points.

07:39.060 --> 07:46.650
So as you can see, we can play with this quite a bit and customize it to the grid that we think is

07:46.650 --> 07:47.760
appropriate for us.

07:47.790 --> 07:50.460
Now that's for a pathing grid.

07:50.460 --> 07:57.180
I'm going to hold alt and click right here to break this arrow and move that path in grid node away

07:57.180 --> 07:59.340
and drag off of the root.

07:59.340 --> 08:03.960
And instead of a pathing grid, I'm going to choose Points Circle.

08:04.260 --> 08:09.330
So as you can see, if you know how to use one of these generators, you pretty much know how to use

08:09.330 --> 08:10.950
them all, as you would expect.

08:11.250 --> 08:15.900
We have a bunch of points all around in a circular shape.

08:15.900 --> 08:17.940
We can change the circle radius.

08:17.970 --> 08:23.550
We can change the space between each of these, which will of course affect how many points there are.

08:23.550 --> 08:31.440
And we also have this arc angle, which if we drag down and give it a value less than 360, we can have

08:31.440 --> 08:35.370
a circular arc that's not a full circle, interestingly.

08:35.400 --> 08:37.650
So what do we do with points like this?

08:37.650 --> 08:43.830
Well, we run tests on them and tests are going to take these points.

08:43.830 --> 08:51.900
And based on whatever the test is that we run, it's going to score the points or filter them out or

08:51.900 --> 08:57.480
both filter out, meaning take some of the points and saying you points are no good, we're not going

08:57.480 --> 08:58.440
to use you.

08:58.440 --> 09:04.440
And scoring meaning run some kind of test on each of the points and see which one is better.

09:04.440 --> 09:07.680
So in the next video, we're going to run some tests on our points.

09:07.770 --> 09:09.420
I no longer need the circle.

09:09.420 --> 09:13.300
That was just to show you another example of a generator.

09:13.300 --> 09:20.440
We're going to hook up our pathing grid, which just gives us this grid with a bunch of points on it.

09:20.440 --> 09:25.090
And in the next video, we'll discover how to start running tests.

09:25.090 --> 09:27.280
So we'll do that next.

09:27.370 --> 09:29.260
Great job and I'll see you soon.
