Jump to content

  • Log In with Google      Sign In   
  • Create Account


A* and quick invalid path determination.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 slicer4ever   Crossbones+   -  Reputation: 3192

Like
0Likes
Like

Posted 06 July 2012 - 09:07 PM

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, 06 July 2012 - 09:08 PM.

Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.

Sponsor:

#2 jefferytitan   Members   -  Reputation: 1650

Like
0Likes
Like

Posted 07 July 2012 - 04:30 AM

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.

#3 slicer4ever   Crossbones+   -  Reputation: 3192

Like
0Likes
Like

Posted 07 July 2012 - 05:53 PM

Is your map static or dynamic?

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.

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.


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

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.


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.
Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.

#4 ApochPiQ   Moderators   -  Reputation: 14264

Like
0Likes
Like

Posted 08 July 2012 - 07:32 AM

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.

#5 slicer4ever   Crossbones+   -  Reputation: 3192

Like
0Likes
Like

Posted 08 July 2012 - 11:35 PM

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.

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, 08 July 2012 - 11:46 PM.

Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.

#6 hdlopesrocha   Members   -  Reputation: 145

Like
0Likes
Like

Posted 13 July 2012 - 08:08 AM

Try Bi-Directional, and find the intersection between paths, If the goal is unreachable one of the sides will stop.

#7 slicer4ever   Crossbones+   -  Reputation: 3192

Like
0Likes
Like

Posted 14 July 2012 - 01:47 AM

Try Bi-Directional, and find the intersection between paths, If the goal is unreachable one of the sides will stop.


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:
[_][_][_]
[_][X][_]
[_][_][_]
where X is blocked, and we start/end in both corners like so:
[S][_][_]
[_][X][_]
[_][_][D]
then what's to stop something like so from occuring:
[S][_][_]
[S][X][D]
[_][_][D]

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

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

such that we've done twice the work.
Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS