Enemy collisions, alternative paths and Grid graph update


I am developing a 2D game.
The current scenario is 1 Player and 10 Enemies.
The enemies are following the player correctly, but i have a pair of issues

Now i need that when the enemies can’t reach the player (because other enemy are blocking the path) then try to get a alternative path

image > http://snag.gy/GRa1N.jpg
As you can see, the path is blocked, in this moment i need that the last enemies take an alternative path but they dont move

I have tried to add the enemies in my collision layer and update the graph, it works and they try to find alternative path but the result was unexpected when the enemies get a “shake” because they are adding a node below themself
image > http://snag.gy/iWbjk.jpg

there are a correct way to do this?

thanks :slight_smile:


You can try this.
Update the graph below the enemies to set the tag to something else (e.g tag 1), then specify on the Seeker component that the player may only traverse tag 0 (the default tag), but enemies may traverse both tag 0 and tag 1 (so they can traverse the tile they are currently on, which is very desirable).

But if the enemies can traverse both tiles how they find alternative path? in this case the enemies keep one behind the other (that is is not expected)

And the player needs a seeker component? (The player is moved with arrows not with the mouse)

I can add tags dynamically below each enemy? in this way the other enemies can traverse through others

is a good solution or this will affect the performance?

It will affect performance unfortunately.
I think you should only add the tag below the enemy when they are standing still, not when they are moving.