Tag penalties not used


I’m currently doing a multiplayer tower defense game (the same one that I talked about in the Navmesh on a spherical planet post), and here’s how I want it to work:
The game is on a grid I created myself above the navmesh (with basically one tile by vertex on the mesh of Icopshere)
The opponent(s) and I each have one base placed on a few tiles, and each player can build towers on the grid (each tower taking up to several tiles).
What I want it my moving units to be able to go through my towers, but not my enemies tower (same thing for the opponents, their units can go through their towers but not mine)

What I did it set up graph update objects and RVO colliders on each tile, and activate them when a tile has a tower built on it.
It’s working just fine with the RVOs, but I’m having trouble with the path obstacle, or more precisely with the tags.

At first, I set the moving units to only be able to walk on “Basic ground” path or on the layer corresponding to the player sending these units, so that when I build a tower, I set the tiles tag to the player’s layer and his units can go through them but not the enemies.

But then I realized I might have some issues, because when my troops are sent, they target a specific enemy base and move towards it, and since the tiles under the enemy base are set to only let enemy units pass, my units tend to try to go as close to the enemy base as possible and sometimes try to go behind it or on it’s side instead of going to the front (which is totally understandable and normal).

So I thought I might rather use penalties instead of completely blocking the path, so that way, my units will go straight to the enemy base (that would mean that they would try to go through it but they won’t because they attack before walking into it (and also the RVO prevents to do that too)).

My problem is that the units completely ignore the tag penalties.
I tried to build some enemy towers on their way to the enemy base so that they try to go around them, but it doesn’t affect their path in any way.

Do you have any idea why it doesn’t work ? I looked into the code and it looks like the penalties are only used by the RichAI, is it correct ? If it is, that would be my problem because I’m using the AIPath.

Thanks so much for your time.

Good news !

I found why it didn’t work: I was setting the Seeker tag penalties at runtime, but the problem is that I was not setting it with an array of 32 elements, I noticed in the code that it was ignored when the value was null or didn’t have 32 elements.

1 Like