AI Blueprint Advice

Hi! I am fairly new with BP scripting so I’m looking for advice. Here’s my scenario:

→ Click a the mouse, build a little plot of farm land (It’s a square plot, let’s say 200 unreal units by 200 unreal units)
→ The 1 AI character in the scene runs to the farm land

I have both events working above. Now here’s my dilemma: I need to have this AI character start walking up and down the farm land to start farming (start an animation of him with a backhoe digging up earth). I can only really think of one way to do this right now:

I can manually script in more AI events where the AI char starts at one corner of the farm land, moves down to the end, moves over X-amount of units, then go to the other end. This way offers more flexibility in the case of my farm land potentially being larger than 200x200 units.

Although, I feel that if I have 300 AI characters doing the above action that it would really bog down the system. Maybe this IS the way to do it, I’m not really sure what would be the most efficient way to do this.

Again I’m not asking HOW to do this, I’m just looking for some advice on what would be the best approach to do it? Maybe there’s more options I’m just not aware of. Thanks so much for any advice!

Hi derm, well there are a few ways you could do it, depending upon your requirements.

If you just want the AI bots to to move between fixed locations [relative to the corners and scaled according to the size] in the farm plot, then what you could do is to create these locations in the construction script of the farm plot. Assuming that your farm plots are always going to be square/rectangular, you could use ‘Get local bounds’ of your mesh, or if you’re using box collision, ‘Get scaled box extent’ to get the length and breadth of the plot. Using this in conjunction with the actor location data [the center point], you can find the four corners of the plot and use it to create AI destinations relative to the corner points. The advantage of doing it this way is that the AI doesn’t have to calculate the points everytime it moves. It will just need to get these stored points from the farm plot actor and move in between them [along with delays and your animations].

If on the other hand, you want the AI to move between random locations within the plot, you could either store random locations using the previous method [say like 10 random locations within the plot] to save future calculations and have the farmer bot move between these points. If performance is not an issue, you could have the AI use the plot corner/center locations data and calculate these random points at runtime giving you more randomized movements.

Okay great, I’ll try that then. Thanks!