Hi.
I’m only working with 4 agents but when using alternative path it sometimes takes more than an update (I’m fixing my game to 60 fps) to calculate the path and that makes it really rough to deal with (since I can’t let them run into eachother whatsoever).
I have already intended to buy the pro version anyway if only just to support Aron, but I don’t have the money atm. The question is, if I buy the pro version and use the local avoidance instead of using alternative path, will I be able to choose to make the moving agents avoid the stationary ones, or how does the avoidance work?
Atm I’m not using any threads in the pathfinding cause it messes with the alternative path, but I assume that If I were to use a few threads to calculate the paths that would free up some CPU power to use for other things, is that correct?
Thanks in advance.
Hi
I think what you really are looking for is http://arongranberg.com/2015/06/cooperative-pathfinding-experiments/
The local avoidance solution in this system works pretty well for “dense” scenarios, but the agent’s unfortunately do not look as smart as they could be when very few agents are used (for example when moving towards a head to head collision). You can make the agents stationary, that was implemented mostly because it was a common request, however the underlaying local avoidance algorithm implicitly relies on that other agents will also try to move out of the way to resolve collisions, so the avoidance around these static agents is not as good. It is better in that case to use a regular graph obstacle when the agent is stationary.
Regarding the Alternative Path modifier, what version are you using? In 3.6.7 a bug was fixed which could cause the pathfinding threads to crash if the alternative path modifier was used.
Hi Aron, and thanks for the reply.
I’ve checked your clip of the cooperative pathfinding and it looks great, but since it’s not implemented yet I have to find a temporary solution. I’m using version 3.7.4 of your free version atm.
For my prototype scene I’m using 50*50 nodes with a node size of 1 and there are no obstacles so maybe that’s one of the reasons calculations are slow. Since I’m making a fast paced game the path has to be recalculated pretty frequently , and I’m forcing a reset of the penalties using your suggestion in: Resetting penalties in the alternative path modifier
just so they don’t zigzag, and that is another reason the calculations are slow I think. I’m requesting a path from and to the currentnode to reset the penalties.
I also tried using your other suggestion but I didn’t really get it to work, I got it to run but it didn’t make any difference.
Is there an easy way to make a node in a calculated path unwalkable by just referencing a node from the path you get from the callback? I’m aware of the one using bounds but I’m afraid it might be slow so I don’t want to abuse it. Thanks for your time :).
Hi
You shouldn’t make any nodes completely unwalkable since that will interfere with the same unit when it recalculates its path. However you can change the tag of the node as long as you make sure that you have a single tag for each unit and that they ignore their own tag. See http://arongranberg.com/astar/docs/tags.php
var path = ...;
path.path[0].Tag = 1; // Set tag to 1
Normally I recommend wrapping all graph modifications in
AstarPath.RegisterSafeUpdate(() => {
// Update graphs here
}
But for tags it is usually fine to ignore that (which leads to increased pathfinding throughput).
That’s true, I forgot about that part. Tags is a great idea, I’ll try it out. Thanks for your help :).