🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Clearance-based pathfinding with dynamic obstacles

Started by
1 comment, last by Dan Violet Sagmiller 11 years, 4 months ago

http://aigamedev.com/open/article/clearance-based-pathfinding/

Is it possible to handle dynamic obstacle in clearance-based pathfinding? how about the performance?

Advertisement

Yes.

As an example, the obstacle would need to alter the map tiles when being set or released. Typically, I would recommend generating an function that processes all the blocks in a given region. Vector A to Vector B. When the map loads, that gets processed as the entire map. Vector(0,0) to Vector(?100,?100).

Next, when an obstacle is placed, wreckage, downed bridge, whatever, it marks the tiles it needs to as Blocked. Then calls the function to recheck the tiles allowable unit size for all the tiles surrounding the ones that were changed. I.e. I put an obstacle at (5,5) and (5,6) I would then run the sizing function for all the tiles from (3,3) to (7, 8)

This presumes that each tile holds an integer for unit size allowed. One that is editable.

Maps can be saved with this information already stored, to reduce processing on load time. And otherwise the performance will be minimally affected by short range size updates. A* is going to be a huge hog compared with this.

Moltar - "Do you even know how to use that?"

Space Ghost - “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer."

Dan - "Best Description of AI ever."

Additional Note, I hadn't seen or considered, Clearance Based Path Finding before. I like it, and will definitely use it. I do apply similar tactics though, for instance AI for Non-Military units takes into account enemy positions and reduces the value of tile positions the closer to enemies the path is, making it far less likely to use an enemy riddled path. It is somewhat similar, but this is most useful.

Moltar - "Do you even know how to use that?"

Space Ghost - “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer."

Dan - "Best Description of AI ever."

This topic is closed to new replies.

Advertisement