Hello people.
I’ve been using A * Pathfinding Project for a fair while on my 2D commercial game. I’m developing a randomly generated dungeon and laying over a grid graph which is sculpted out using the floor tiles. I have a difficult problem that I’m thinking of fixing by modifying the graph node data.
The problem is that I have AI agents which are patrolling around the dungeon and the dungeon has narrow corridors that only one agent can fit down. If two agents walk down either end of the corridor and run into each other then are both blocked.
I was wondering if there is a way to stop any more paths being generated along the same nodes once one has been made? It would be even better to prevent any path being made along the nodes ONLY in the opposite direction?
I’m assuming that no-one can help me then?
Hi
Sorry for the late answer.
Doing that requires something called “cooperative pathfinding”. These algorithms are unfortunately not included in the system.
I have a branch of the project where I have implemented cooperative pathfinding. You might want to try it.
Note that the version I have implemented has some limitations. All units have to move at exactly the same speed and need to occupy exactly one node.
Thank you for the reply Aron, it is appreciated. That sounds great, but it might bit a little over complicated for my needs. I’m not 100% sure yet. I was going to try some easier solutions first, including one agent taking on the other agents target depending on priority.
Do you think you could point me towards the documentation that details with path priority? Perhaps I could hijack that system?
If I do try this build, how do I take it on?
Hi
What do you mean by path priority?
If you would try this build, I would simply send you a PM with the package.
I mean by the priority of the AI state. So, for instance, if one AI is just patrolling, they would take on the path of the AI who is searching for the player.
Anyway, I’d be up for trying a build, if you have one?
Hi
I just wrote a post about my cooperative pathfinding experiments. Take a look at it and see if you think it would be a good fit for your project.
http://arongranberg.com/2015/06/cooperative-pathfinding-experiments/
This looks incredible Aron, Exactly what I need. Could we give it a try? I can revert everything if things go wrong, so I’m not that worried about trying it out.
Sure. However there are some tweaks I have to do first to make the API more user friendly.
Ok, well, I look forward to it.