Flexible pathfinding
Hi, i need some advice on implementing advanced pathfinding in my game currently i have grid based A* and movement is based on catmull-rom interpolated splines.. Splines are placed to match found path node centers.
Now i have several problems:
* I should rebuild (resample) path so it does not produce jaggyness as splines are placed in node centers, where more smooth movement would be accomplished if i place in more smart places...
* Dynamic unit avoidance, i could mark tiles below units so that if one unit knows that his next move would be on tile that is not free from units, it would mark that tile as not passable, repath, unmark tile... But it does not work to well because if one unit does not take whole tile or is on edge of tile, other unit should be able to pass it..
Any suggestions or expierence sharing in this matter would be great help...
I am working/thinking about the same thing.
Doing a full repath to avoid units is of course a possibility.
But if you want units to pass each other on the same tile (as I do), I am thinking that it should be possible to keep the current path and just displace the spline points a bit to make units swerve to the side if 'obstacles' are detected ahead. If you don't require collision avoidance, then this should give a cosmetic effect at least. If the detection is done 3-4 tiles ahead, and only the spline points number 2-3 down the line are displaced, movement should appear fluid without jerky interruptions I would think.
About moving outside the center of tiles, I think you should look into collapsing the path nodes through post processing when the area around the path is of similar terrain and obstacle-free. Units will then move directly from A to B without visiting the intervening path nodes.
I haven't tested yet how it looks when a spline is applied to this situation where there are a lot fewer spline points though.
[Edited by - captain_crunch on December 17, 2008 4:59:32 AM]
Doing a full repath to avoid units is of course a possibility.
But if you want units to pass each other on the same tile (as I do), I am thinking that it should be possible to keep the current path and just displace the spline points a bit to make units swerve to the side if 'obstacles' are detected ahead. If you don't require collision avoidance, then this should give a cosmetic effect at least. If the detection is done 3-4 tiles ahead, and only the spline points number 2-3 down the line are displaced, movement should appear fluid without jerky interruptions I would think.
About moving outside the center of tiles, I think you should look into collapsing the path nodes through post processing when the area around the path is of similar terrain and obstacle-free. Units will then move directly from A to B without visiting the intervening path nodes.
I haven't tested yet how it looks when a spline is applied to this situation where there are a lot fewer spline points though.
[Edited by - captain_crunch on December 17, 2008 4:59:32 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement