Pathfinder2d: Where is the shortest path saved? - Forums
You may post here on any subjects related to this site or the software therein.
(Most everything on this site is tied into the forums so that you may leave or post comments about it.)
Date: November 08 2003 02:05 AM
Just a quick question. I'm using some of the Pathfinder2d code in a web-based, real-time strategy game. I've basically pulled the AStarHeapInteger code out and ported it to C#. That doesn't take too much brainpower. Just neuter the pointer references and a couple other miner tweaks here and there and it`s ready to go.
However, I`ve tried my hardest to understand just what I had to to port it over. I have other things to code and I didn't want to have to sit down and understand the whole process of pathfinding.
What I'm trying to find is the path after it has been calculated (FindPath). Where is it stored? (nodes, routes, ??) Is it stored in yx where I will << and & the data to get the coords?
Any help would be appreciated. If I have to, I'm sure come Monday, I'll piece it all together myself.
|
From: Lewis A. Sellers
Date: November 10 2003 03:10 PM
A good question. (Tries to remember.) As I recall, what I did was that since I had to reference the map data anyway, I stored final movement for that method in routes. The heap/nodes are only used when computing the path.
(Thinking back.)
The routes are stored (I believe for that method) in reverse order, ie from end to start (a by product how how the routes are generated). So to use them you have to compute the beginning point then flip directions around 180.
There actually is go in there that already does that as a final operation before the pathfinding ends. Don't have access to the code at the moment, but it should be about the last function in the AStarHeapInteger class (I think).
Help at all?
(Note: I've been gearing up to take the Java certificate exams so I was seriously thinking about ripping that same alg out and porting a simple, clear version to Java for the experience.)
--min
|
|