path finding

Started by
15 comments, last by chengseesin 20 years, 6 months ago
quote:Original post by weasalmongler
What if you preprocess the level and group all nodes that can reach each other, any nodes that are unreachable are placed in another node list, or are simply tagged as part of a different group. Before performing the A* search, you check whether the target and start nodes are in the same group, if they are, voila, they will reach each other so you can begin the search, if not, exit immediately and you don''t even have to start the A* search.

- James


Sure this would solve one problem, but introduce a new overhead to all pathfinding calculations (which may or may not be significant depending on the specifics of the world and the implementation). There are some pre-culling operations you could use before using such a solution, such as, for any given grouping of nodes, have a centre point and a radius which envelopes all the nodes within the group. Then check if the target node falls within this circle (or sphere if you''re working in 3D). If it does then it still might not be connected, but if it doesn''t then it certainly is not connected and you can early-out with a failure.

I would also suggest that any grouping you used for the nodes be contained in such a manner as to allow fast retreival. Instead of using a list or a vector, for instance, you could a set, where the container simply stores a set of unique keys, the key could be the address of a node. This is a fast method (perhaps not the fastest, but orders of magnitude faster than a list retrieval) for finding out if a node is in a grouping.

Mike
Advertisement
use 2-way a*! if you won''t say more info about your problem we can''t help you any more!!!!
excuse me for my russian english :)
quote:Sure this would solve one problem, but introduce a new overhead to all pathfinding calculations (which may or may not be significant depending on the specifics of the world and the implementation). There are some pre-culling operations you could use before using such a solution, such as, for any given grouping of nodes, have a centre point and a radius which envelopes all the nodes within the group. Then check if the target node falls within this circle (or sphere if you''re working in 3D). If it does then it still might not be connected, but if it doesn''t then it certainly is not connected and you can early-out with a failure.

I would also suggest that any grouping you used for the nodes be contained in such a manner as to allow fast retreival. Instead of using a list or a vector, for instance, you could a set, where the container simply stores a set of unique keys, the key could be the address of a node. This is a fast method (perhaps not the fastest, but orders of magnitude faster than a list retrieval) for finding out if a node is in a grouping.

Mike


be simpler! the grouping algorithm has linear complexity and i don''t think that it may be optimized in anyway.
excuse me for my russian english :)
quote:Original post by wormball
be simpler! the grouping algorithm has linear complexity and i don''t think that it may be optimized in anyway.


Which grouping algorithm has linear complexity? What has complexity got to do with it? What may not be optimized? I''m confused

Mike

you go around the connected nodes and paint they in the same color (with linear complexity!), then you take another node disconnected from already painted group, and paint the nodes connected with this node, also with linear complexity, etc.

ps. how can you speak this language? russian is much more cool
excuse me for my russian english :)
One of the best ways to improve the speed (specially when you have more than one unit) is limiting your number of iterations.
If you can´t find the path in something like 80 iterations, just break, and set your goal to the nearest point found.

This is what starcraft do, and in the worst case, when you reach this sub-goal, you can recalculate.

---------------------------------------------
If God with me, Who against me?
Sitio de desarrollo de videojuegos en español
Digital Moon Studio...

There is no spoon

[edited by - NeonGE on October 22, 2003 10:15:51 AM]
--------------------------------------------- If God with me, Who against me?Personal Web Samuel Prince Blog...
no! it is a bad way! it won't find path if it is long, so it is not good

[edited by - wormball on October 22, 2003 11:09:43 AM]
excuse me for my russian english :)

This topic is closed to new replies.

Advertisement