- Home /
Deterministic Pathfinding
Hello,
I currently am working on a multiplayer RTS (using lockstep), and now am stuck with local avoidance in pathfinding.
How is it managed to calculate the paths of dozens of units without bumping into each other? Pathfinding itself is working like a charm (with lockstep principles used), but my units have no collision to each other so far, so they can run through other units. Every solution I have seen so far is using physic-collision with rigidbodys. But I don't want to have this solved by a physics engine I don't trust to be deterministic, so I need some kind of algorithm. I checked out "A* Pathfinding Project" and "Simple Path", which are working well without avoidance, but I don't know how to add code/alter code to make the collision detection non-physical.
Am i missing something basically here?
Answer by tanoshimi · Dec 09, 2014 at 07:22 PM
Unity Answers is for specific technical questions; questions that require extended discussion are generally better suited to the Forums. Having said that, here's some suggestions off the top of my head:
When a collision with another unit is detected, pause for a short, random amount of time before attempting to resume the planned route. If after two successive attempts a unit can still not follow its planned path, get it to recalculate a different route.
Assuming your colliding units are all on the same team, and can therefore communicate and share their intended paths with one another, this is a nice description of a co-operative pathfinding approach: http://www0.cs.ucl.ac.uk/staff/D.Silver/web/Applications_files/coop-path-AIWisdom.pdf
If you're using A*, you can adjust the cost heuristic to assign more weight to routes that pass close to other units (and are therefore more likely to get blocked).
Or simply layer some avoidance steering behaviours on top of the movement resulting from the pathfinding.
Hey, where would be the right place in the forums to post a qustion like that? Because there are so many subforums, I decided to post here....
And thanks for the answers
Your answer
Follow this Question
Related Questions
How do i get the IsPathPossible() function to ignore some nodes using Astar Pathfinding Project 0 Answers
Navmesh Agent avoidance with as triggers 1 Answer
How do i get the IsPathPossible() function to ignore some nodes using Astar Pathfinding Project 0 Answers
How to combine NavMesh Agent with Character Controller 0 Answers