Inifinity loop? >1024 node path

Hi,
I’ve been getting the following error when trying to send a unit from one side of the map the the other (Its quite a big map using a Gridgraph with nodes set to 651x681)

“Inifinity loop? >1024 node path. Remove this message if you really have that long paths (Path.cs, Trace function)”

I’ve had a look in the path.cs and increased the count to 2048 so that it doesnt break any more so units can actually move, however this seems to be leading to odd results of them following the path, stopping and running back to a previous point and then carrying on, kinda running around in circles. Also they seem to update their path a lot slower, especially when theres more then 4 of them.

I’m kinda guessing theres a reason you have made it break if the path exceeds 1024 nodes?
Is there a way of getting the pathfinding working on large maps with dense grids with lots of units? Not talking hundreds, maybe a few dozen? Or should I think about increasing the size of the nodes just reducing the number on the map?

Cheers
Rob

Also forgot to mention their repath rate is set to 1 second. And im using a rehashed version of the spider robot script as their controllers.

Hi

That is mainly as a protection for badly written graphs, badly written path types, negative penalties or other things which can in some cases cause infinite loops during that stage. You can safely remove the check if you have valid paths longer than 1024 nodes.

Also, for larger maps I would recommend a navmesh based graph type (such as NavmeshGraph or RecastGraph) since that will use less memory and be much faster.

Unfortunately due to the amount of changes to the graph going on in the game, the navmeshgraph isnt appropriate.

Still having difficulties with the units running around in circles. after upping the limit from 1024 to 2048.

From what I can tell, as they are running along the path, all is well with getting the next waypoint along the path but the moment the path is updated(which is done every second to make sure a wall/building hasn’t been built down in front of them) they seem to sometimes forget which was the next waypoint and return back to a previous one.
This only starts happening when ive got more then 4 units running across the map and seems to get better when they are all closer to their destination.

Hope you can help.

Cheers
Rob

Hi

Most likely this is because there is a slight delay between requesting the path and actually getting it back, so the start point of the path is not the same as the current position of the agent. The unit will think “oh, I should move back a few meters before starting to move forwards again” which is of course wrong. The AIPath script tries to solve this by, when getting a path back, simulating movement along where the unit moved during the path calculation time. It works quite well for that script.

Drat im already using the AIPath script, is there another I can use? I basically started with the one attached to the spider bot and have adjusted it.