Recently encountered this path finding problem while doing a RPG game. I am using Godot engine and pathing with A* and small cells. I also searched some other algorithm or technique like flowfield or navmesh, but seems A* with small cells is a easier approach. In order avoid obstacle like teammates or enemy while going for specific target in a fight or else, I update A* point weight like every 0.5 seconds where a unit is standing or not, using raycast to detect obstacle and re-path, and still having problem below:
- narrow pass. if two units standing close and there is a narrow pass between, the A* would return the path going through the narrow place which is unpassable due to the collision.
- path finding with different agent size. but this may require changing the A* code. If can path finding by size the first problem could be solved. the workaround to 1st problem I am thinking could be detect those narrow pass at runtime and update the weight. don't know if that is a good practice.
- world Vector3 position to grid, sometimes if two unit's position is convert to same grid the path return by A* would get block especially in crowd situation, thinking smaller grid may solve this
Overall I feel my implementation is bugy and not good practice, checked some games pathing AI, seem they have some rules like when units is forming a formation turn off the collision, or push other unit to engage enemy, dont know if or how they deal with volume, and feel like if changing these rule like turn off collision, would need to change other code like how to avoid overlap. I am quite confusing now how to achieve a solid pathing AI, and not for a large group of people, that maybe overkill for an RPG game.