Seekers avoid them self and take long routes after scan

I am working on a 2D turn based game that doesent allow diagonal movement. This asset works great for this but I am struggling with a way to prevent seekers to not form “Conga lines”.

This is the map with the graph when I scan it (before running the game) I have 2 obstacles in the “Collision testing” (Wall and Enemy movement block) As you can see the walls are unavailable to walk on. (Image 1)

When I run the game there are enemies spawning andthey now show the path they want to take to get to the player. The enemies are layered “Enemy movement block”. But I havent rescanned the graph yet so everything works just fine now.
(Image 2)

And eventually they reach the player. Since the graph havent been scanned again they dont see each other as obstacles. I added some checks in the code witch prevents them to walk into each other. So instead they just get blocked and “skipps” their turn. But I thought I could scan the graph after each turn so the seekers know if a new obstacle have appeared on the map. It works great to spawn obstacles on the map and rescan, the seekers will start to move around it.
(image 3

But since the seekers are the obstacles to each other I wanted to add them to the scan. But I noticed if a seeker is added to a scan and is considered a obstacle they will start to move diagonal to avoid their position. Here we can see their new path after a scan. They always want to move diagonally to get out of their position.
(Image 4)

And after next turn (Image 5)


Am I missing something obvious that could prevent this or is this the wrong way for seekers to see each other as obstacles?

This is solved for me now. I Changed the code for the seekers and added some couroutines for them to scan the map before they move.

Each seeker scan the graph and before they do that I remove the obstacle layer on just that seeker, when the scan is completed I add the layer on that seeker again. This way they all detect each other but dont cause themself to avoid their own location.

After they scan the graph they also update their path.

This works perfect now. Thanks for a great asset.

1 Like

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