Welcome back.
So we'd like to use the environment query system.
I'd like to be able to run some kind of X query to do all those nice, wonderful things we talked about
in the previous video.
In order to do that, I need to make an environment query.
So here's what I'm going to do.
I'm going to go into Blueprints I and we'll make one here.
Now, at this point, I think it's time for some sub folders as we're getting kind of a lot of things
and they're all getting jumbled up here.
So I'm going to right click and make a new folder and put my behavior tree in Blackboard in that.
So I'm just going to call this behavior.
Tree and the behavior tree and the blackboard can both be lumped in together.
So I'm going to move those there.
Now, we also have a couple of tasks.
We have BT Attack and BT.
Go around Target.
So I'd like to make a new folder for tasks so we can call that tasks and I'll put my BT.
S in there.
Move here.
Now, here's my controller and my behavior tree service.
I'll go ahead and put my service in a folder called Services like So.
Move here and my aura controller can either stay right there or I could put it in a new folder called
I Controller.
Either way is fine.
I'll go ahead and put it in a controller.
Now we have more organization.
Now, I'd like to do this because I'm going to add even more things to this.
I'm going to make a new folder for the ECS System Environment Query System.
So here's an ECS folder.
I'm going to go in that and we're going to make our first environment query.
So to do that, I right click, I go to artificial intelligence and here we see environment query.
If I select that, I have a new environment query and I'm going to call this EC underscore EC stands
for environment Query, and we'll call this find ranged attack position.
So this will be for finding a good position for our Rangers to post up and start attacking.
Now when it comes to ECS, a lot of things are going on sort of under the hood that can be hard to visualize.
For that reason, there exists a special type of pawn that we can use to test out our environment queries.
We can test what they're doing by drawing a bunch of debug shapes for all of the items that we generate.
So I'd like to make one of those test pawns.
I'm going to go to Blueprint class and search for ECS testing pawn.
If we choose that ECS testing pawn and select it, we now have a pawn specifically designed to test
environment queries.
I'm going to call this BP underscore X testing.
--.
So how are we going to use this testing --?
Well, I'd like to make a new level just for testing out environment queries, just so we don't have
all this stuff in the way we have these enemies and they're going to be running up to us and distracting
us.
I'd like just a new map to test out the environment query system.
So I'm going to go to file new level, choose basic, create and file, save as or save current level
as.
We'll go to maps and I'm going to call this X underscore testing map and we'll save that and we can
test out our environment query system.
So what I'm going to do is take my new EQs testing pawn and I X here it is, EQs testing pawn.
We're going to bring that in.
And with that pawn, we can choose to have this pawn test out one of our environment queries.
We have one called EQ, Find ranged attack position.
We can assign that to this X testing pawn as X testing pawns have this query template that it's going
to test.
So we're going to select EQ, find range, attack position, and now whatever we put in our environment
query, we'll be able to draw some debug shapes here and see exactly what's going on.
Now just to see this, I'm going to open up my EQ, find ranged attack position and notice it has a
query graph with a route.
So here is our environment query.
And just like we discussed in the previous slide environment, queries make use of generators which
generate a bunch of items either actors or locations, and that we can use those locations in our environment
query based on whatever rules we set up.
So we're going to add a generator by clicking on this bottom part of the root node dragging off.
And notice that we have a number of generators that we can choose from.
Now, once you learn how to use one of them, you pretty much know how to use all of them.
You just have to be kind of shown the ropes.
So we're going to choose one of them and the one we're going to choose is path and grid path in grid.
If we select that is a special type of generator that generates a grid of points around a career.
Now, what do we mean by career?
Well, in the case of our testing pawn, our testing pawn itself is the career right here in the details
panel we have generate around and we see environment, query context, underscore career by default.
That is usually the pawn that's running this environment query.
So let's take a look at some of the properties on this generator.
The properties I'm concerned with right now are the grid half size and the space between grid.
Half size is half of the squares extent, kind of like a radius.
It's set to a thousand and space between is set to 100, which means we're going to get a grid of points
with this specified size.
Half of it is 1000, and the space between each point will be 100.
Now, if we go back to the testing map, we can see what this looks like.
Here we have a square with half of its width is 1000, so it's 2000 across 2000 across the other way.
And we have this grid of points and each of these points is 100 units away from the next one.
So we can see that we have quite a lot of points now.
We saw that we have parameters in our generator.
We can change our grid half size, we can change the space between.
And what I'd like to do is undock this generator so I can see the test map as I'm playing with these
parameters here.
And I'm going to change the space between I'm going to change it to 200.
Now we see that there are 200 units between each of these points, we can change the grid half size.
I can change it to 500 and now we have quite a bit less, Right.
And the number of points here is definitely going to affect how much work is done.
If we do something for each one of these points, I'll set it back to 100 there.
And here we have a grid of 500 with a space between of 100 setting grid half size to 800.
Now we have this many points.
So as you can see, we can play with this quite a bit and customize it to the grid that we think is
appropriate for us.
Now that's for a pathing grid.
I'm going to hold alt and click right here to break this arrow and move that path in grid node away
and drag off of the root.
And instead of a pathing grid, I'm going to choose Points Circle.
So as you can see, if you know how to use one of these generators, you pretty much know how to use
them all, as you would expect.
We have a bunch of points all around in a circular shape.
We can change the circle radius.
We can change the space between each of these, which will of course affect how many points there are.
And we also have this arc angle, which if we drag down and give it a value less than 360, we can have
a circular arc that's not a full circle, interestingly.
So what do we do with points like this?
Well, we run tests on them and tests are going to take these points.
And based on whatever the test is that we run, it's going to score the points or filter them out or
both filter out, meaning take some of the points and saying you points are no good, we're not going
to use you.
And scoring meaning run some kind of test on each of the points and see which one is better.
So in the next video, we're going to run some tests on our points.
I no longer need the circle.
That was just to show you another example of a generator.
We're going to hook up our pathing grid, which just gives us this grid with a bunch of points on it.
And in the next video, we'll discover how to start running tests.
So we'll do that next.
Great job and I'll see you soon.