Sign in to follow this  
slicer4ever

A* and quick invalid path determination.

Recommended Posts

slicer4ever    6769
hello everyone, i'm working with a large tile map, and need to determine if a path is simply unreachable without exhausting alot of time.

i've come up with a few ideas on this, and would like some opinions:

A. for large area culling, i can do geometric id's for determining if the target tile is in the same area as the start tile, i expect i'll automate this process, but i suspect it'll give me a great boost when i select a target that is another land mass away.

B. for local area culling(i.e. several static objects are in a circle around my target(or even dynamic), making it unreachable), I was toying with the idea of taking the distance of the currently closest tile to the destination, after a certain point, i'll go in a circle around all the tiles at this radius, as such, if all tiles are in the closed list, then i can determine that the destination is unreachable, without having to do an exhaustive search.

my problem is implementing B quickly, my pathfinding system is already configured that it'll only take several tick's before breaking out, and allowing other things to be processed, but i'm simply not certain how and when i should trigger the radius search for unreachable determination.

any tips on the subject, or even better, better methods of pathing determination are very much welcome. Edited by slicer4ever

Share this post


Link to post
Share on other sites
jefferytitan    2523
Is your map static or dynamic? For a static map you could just segment the map using floodfills. You'd end up with x different areas. Then at runtime just check if the destination in the same area as the source. Another approach which may be more amenable for dynamic maps is recursive pathfinding. You could do it quickly (with crappy paths, just for connectivity checking). For a grid cell determine which of the 4 edges can be pathed between. Then treat each cell as a black box, and make bigger cells out of them, repeat. For connectivity checking then just path up to the next biggest level that doesn't overlap the destination, then back down levels until the destination is reached. For a dynamic map a limited subset of the pathing info could be recalculated as required.

Share this post


Link to post
Share on other sites
slicer4ever    6769
[quote name='jefferytitan' timestamp='1341657029' post='4956610']
Is your map static or dynamic?
[/quote]
both, their's alot of static objects, but also a number of dynamic objects, so i'd ideally want to make sure any pathing system that's developed can handle dynamic objects.

[quote name='jefferytitan' timestamp='1341657029' post='4956610']
For a static map you could just segment the map using floodfills.
You'd end up with x different areas. Then at runtime just check if the destination in the same area as the source.
[/quote]

this sounds like essentially what i was going to do with part A of path detection.

[quote name='jefferytitan' timestamp='1341657029' post='4956610']
Another approach which may be more amenable for dynamic maps is recursive pathfinding. You could do it quickly (with crappy paths, just for connectivity checking). For a grid cell determine which of the 4 edges can be pathed between. Then treat each cell as a black box, and make bigger cells out of them, repeat. For connectivity checking then just path up to the next biggest level that doesn't overlap the destination, then back down levels until the destination is reached. For a dynamic map a limited subset of the pathing info could be recalculated as required.
[/quote]

this kindof sounds like network programming and routing tables, but essentially it's be a routing table between a number of grouped nodes. It's an idea i had seldomly toyed with before, it's an interesting idea to approaching pathing, but the shear amount of memory required is way too much for my liking.

Share this post


Link to post
Share on other sites
ApochPiQ    23061
Hierarchical pathfinding is probably the best straight-out-of-the-tin solution, and done right isn't particularly memory intensive. Generally you would want to be a bit more granular than jeffereytitan described. Group perhaps 10x10 grid cells at a time, and make probably a total of 3 layers at most, and you should be good.

Share this post


Link to post
Share on other sites
slicer4ever    6769
[quote name='ApochPiQ' timestamp='1341754348' post='4956927']
Hierarchical pathfinding is probably the best straight-out-of-the-tin solution, and done right isn't particularly memory intensive. Generally you would want to be a bit more granular than jeffereytitan described. Group perhaps 10x10 grid cells at a time, and make probably a total of 3 layers at most, and you should be good.
[/quote]
hmm, a 3 layer map might be interesting, i think i'll try to implement it.

also, i've come up with potetionally another approach to quickly determine if a tile is not reachable, essentially, instead of marching in a circle at a certain point, i'll keep track of the closest tile, if i have tested, say another 100 tiles, and none of them get me closer, than i probably can't reach the destination tile, it's not full proof, but my maps shouldn't really require going around something 100 tiles in diameter. i might also be able to dynamically determine the number of tiles i need to test before i can break, by calculating the number of tiles which would be in a circle to the destination. Edited by slicer4ever

Share this post


Link to post
Share on other sites
slicer4ever    6769
[quote name='hdlopesrocha' timestamp='1342188520' post='4958798']
Try Bi-Directional, and find the intersection between paths, If the goal is unreachable one of the sides will stop.
[/quote]

their are key flaws in that design, in theory it can potentially be == to normal pathfinding, at best, it does correctly identify blocked paths quickly, however, the worse(and in my opinion most potentially possible), is that the two path's bening searched in both directions well take radically diffrent paths, for example if we have:
[code]
[_][_][_]
[_][X][_]
[_][_][_]
[/code]
where X is blocked, and we start/end in both corners like so:
[code]
[S][_][_]
[_][X][_]
[_][_][D]
[/code]
then what's to stop something like so from occuring:
[code]
[S][_][_]
[S][X][D]
[_][_][D]

[S][_][D]
[S][X][D]
[S][_][D]

[S][D][D]
[S][X][D]
[S][S][D]
[/code]

such that we've done twice the work.

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