I’m trying to create an AI for an Action Tower Defense game, and I have some problems with that.
In my game there are different kind of towers, however, the ones that are related to the problem are the regular towers that shoot, and barricades; both can be destroyed by AI along their path. By default an AI just follows a path up to a crystal that it has to destroy, by on its path it may be distracted by a tower, for example, it may hit the AI making it follow the tower instead.
The problem, however, is that a barricade may alter the enemy behavior: if it’s in between the tower and AI, then the AI should try to destroy the barricade instead (i.e. switch the target from tower to barricade), but preferably it should check whether it can get around the barricade (in a close range) beforehand, and do so if it can (hence the final target will be the tower, but the path to it will change). Note: If there are two paths (for instance two distant roads) that lead to a tower an AI is trying to get to, it should take the closest one regardless the presence of the barricade.
Check my little painting for better explanation. The AI should take the Climb1 even if there’s another path that isn’t blocked through Climb2.
The player can also affect the AI path by distracting it, so, following the image, the AI can follow the player and get from the low ground to the high ground through Climb2 if the player didn’t go too far away from the AI in order to keep the agro.
The final questions are:
- Should my towers affect (in terms of just static/skeletal meshes) the navigation area itself (I mean make the place they’re standing on non-walkable for AI), or should they affect the final path instead?
- How can I make an AI check whether the barricade can be got around in a close range or not?
- How should I manage such path finding / agro system?
Thanks for reading.