Action Tower Defense game AI / Path Finding

Hey @Tonetfal,

As stated above the query filters will not be your end-all-be-all solution for your entire multi issue problem, but will answer the first part of your post where your AI will not stray from the path you want once the closest tower/climb is determined even if the path is blocked. Let’s say take a (poorly) drawn example I have, if the closest tower/climb is determined as green, it will use the green zones and not move to the red zones to move to the high ground and vice versa if the red tower is determined closer.

Here is a non-Epic video that explains more about query filters, how they work, and how you can set them dynamically:

The rest is going to require a lot more nuance, referring to the latter half of the post, that entirely depends on your project and how you have set up your barricade system. That can easily be addressed using a behavior tree. Behavior trees can be used to easily switch between different actions that you want your AI to take (Move To/Detect and break Towers/ Detect and break barriers/ etc.). Breaking it down even further:

  • You are vague in how you explain the way in which your barriers work. Is this a grid based system? If so, the easiest approach would be to do a check of the surrounding grid spaces and determine if any are clear or to use AI Sight (AI Perception) with a desired radius to determine if a grid space is clear otherwise attack the nearest barricade.

Here is more info on AI perception:

And finally, all of these behaviors (move to, attack baricade/tower/player, distracted temporary move to, etc.) can be switched between using behavior trees that can be used for every pawn regardless of the path they take and can be switched upon entering a trigger volume, using AI sight, etc.

Check out these non-Epic affiliated videos on behavior trees and AI perception:

Unfortunately there is no singular answer, especially if you do not already have a system in place that just needs fixing. But, I hope this more clearly explains an option you have and helps guide you toward the solution you are looking for.

2 Likes