Skip to main content
GameDev.net gamedev.net
๐Ÿ”’ Locked

Clearance-based pathfinding with dynamic obstacles

Started by pandaa Feb 3, 2013 at 2:52 PM 1 replies 3.2k views
Dan Violet Sagmiller
Dan Violet Sagmiller

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."
Dan Violet Sagmiller
Dan Violet Sagmiller

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."

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.