Download

Many AI's on different patrol routes

I haven’t spent an excessive amount of time working on my AI set up yet, but I’ve been wondering how generally AI guards are set to patrol only their designated areas. It’s easy enough to program a single guard to walk between any number of points and wait or look around when it reaches those points, but it would be very unhelpful to create a separate AI blueprint for every single one of those routes. (Especially if you wanted to change some overall behaviour.)

So how do you give each guard different commands, while still being able to use the same blueprint to run all of their behaviour?

Would it make sense to put trigger boxes or waypoints in the world that tell guards what their next action should be?
Or make the guards get their directions for the patrol route based on which “patrol route blueprint” they spawn closest to?

Shouldn’t you just change the points? Or maybe have BP pick 2 random points from an array?

I made some patrolling guards (just to test some basic stealth gameplay), which walk from point to point that they get from a large array of locations. Which does make them very unpredictable and while that presents a challenge for the players to overcome in some ways, it leaves less room for meticulous planning to bypass them and forces players to act more on instinct. But I do want them to have set paths to follow, so that the one guarding the big safe isn’t going to walk away from it to investigate what’s going on behind the building near the cargo loading bay for example.

They don’t have to be different from each other in any other way than the locations between which they patrol.

So the options I’ve considered so far (some better than others):

  1. Make new AI blueprints for each “type” of patrol path. Using some kind of code to make each actor calculate their own patrol paths based on something like line trace information about their environment. (Some would just go back and forth, while others would move in a circle.)

  2. Spawn the AI with the level blueprint, in which I also set the location and patrol locations per-actor, based on a pre-determined level specific layout.

  3. Put in waypoints that tell guards next to them what their next action should be. (Sort of like a blueprint for each patrol route.)

  4. Make a new AI blueprint for each different guard, wiring up specific patrol locations and actions for each of them.

I don’t know man, I was just tossing out suggestions. LOL I’m a complete bonehead when it comes to this stuff trying to pack as much of it into my tiny brain as possible.

Hey, this is exactly what I’m trying to do at the moment, but for some reason it’s just not working for me. I didn’t count on the Event Begin Play thing only being able to attack one node and not another.

If anyone could help me get my many AIs moving, that’d be greatly appreciated (with helpful images)

On your patrol blueprint just setup an array for the points the guard should patrol and expose it as an editable variable. Then when you drop your guard into the level add as many patrol points as you want (use widgets or something) and they will navigate between the 1s you have selected. Then you can also just move around those patrol points and they will automatically get updated on whatever guards are using them.

This is the way you could do it … the other way is to use DataTables, put your Waypoint Names (from your maps in here) and then have your AI Blueprint read the correct DataTable and use the points to patrol through. This way you manage your array of sorts in a DataTable and not some over complicated array.

If I understood correctly, with that DataTable you can give a simple name to the differents locations in a map? I mean, “Point A” name is refering always to a certain x,y,z location?

Sorry for this novice question, I was just reading the thread to start learn things and I was very interested in this point ^^

Well you could do either … provide co-ordinates or a name for a waypoint that you have placed. The DataTable would work the same as ZoltanJr’s array of points, except that a DataTable is easier to maintain and modify. I would use it as a list of waypoints.

Thanks for the answer ^^