Sign in to follow this  
pandaa

Clearance-based pathfinding with dynamic obstacles

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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.  

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this