Support Forum

Using AILerp for 2D Grid Based Game - working, but need local avoidance for other enemies

Hi,

So as the title says, I’m working on a 2D tile based game. The players, AI, everything is completely locked to the grid; so the AI don’t cut corners, only move in 4 directions, etc. Got the AI movement down great using AILerp. Now I’m working on some sort of local avoidance for the AI not running/going through each other. In the documentation, it says local avoidance cannot be used with AILerp because this class is meant to follow the grid exactly, which is what I want. So I tried using dynamic grid obstacles to just update that portion of the graph as the AI move; however, since the AI are also pathfinding, they will either “jump” over the current spot in the graph that was just cut out, teleport with some settings, or if I calculate a new path before they get to the newly cut out waypoint slots, they will double back.

I could see this approach working if agents could ignore their own dynamic obstacles somehow. Any recommendations for how to go about this? Attached a picture of the game at the moment for reference.localAvoidance

Also wrote a custom movement script and used that to attempt to just cut the graph using the collider and the UpdateGraph snippets in the documentation, but that created some wonky behavior as well.

I haven’t tried tagging tiles as the AI pass them with high penalty costs, because I’m assuming that’ll cause the same issues as the dynamic obstacle component.

Hi

You might be interested in https://arongranberg.com/astar/docs/turnbased.html