Using Civs Pathfinder?

cephalo

Deity
Joined
Jul 26, 2007
Messages
2,058
Location
Missouri, USA
I'm in the planning stages for a new mod that will need to know paths and path distances. I can impliment my own Astar pathfinder but I'd rather use the one that civ uses. The problem is that when I have tried to use it in the past, I have gotten unpredictable results. For example, I might get a path distance from A to B of 5, but then if I try a path from B to A I might get a -1 for no path found. I can't think of a situation in Civ where going from A to B wouldn't allow a return from B to A.

Has anyone had luck using Civ's pathfinder for custom applications?
 
If you have used the CyMap().calculatePathDistance -> you need to do CyMap().resetPathDistance() after each call. 1 day of headaches because of that.

Hope this help , Tcho !
 
If you have used the CyMap().calculatePathDistance -> you need to do CyMap().resetPathDistance() after each call. 1 day of headaches because of that.

Hope this help , Tcho !

When I was making PerfectWorld, my start plot finder was to fill a table with path distances to help with starting plot placement. Even with calling resetPathDistance for every call, I was getting plenty of 'one way' -1 results on a continent, and also results were the two legs of a round trip had vastly different path lengths. About 80% of the time I got the correct values, but the failure rate was unacceptably high. My distance table always had some garbage values. The code is still there but commented out.

I eventually just used straight line distance because I couldn't figure it out.
 
When I was making PerfectWorld, my start plot finder was to fill a table with path distances to help with starting plot placement. Even with calling resetPathDistance for every call, I was getting plenty of 'one way' -1 results on a continent, and also results were the two legs of a round trip had vastly different path lengths. About 80% of the time I got the correct values, but the failure rate was unacceptably high. My distance table always had some garbage values. The code is still there but commented out.

I eventually just used straight line distance because I couldn't figure it out.

Strange, I've made lots of tests with it and got no problems after using resetPathDistance (almost 150 map generation without any problems, a -1 would have benn noticed with my function). Perhaps do you get a line of mountains that make returns -1 for the path. I've tried to generate as a test all plots A->B and B->A and always get the same result.

:confused:

Edit : perhaps you have done some path starting or ending with a mountain ?
 
Edit : perhaps you have done some path starting or ending with a mountain ?

You know, someone recently complained about a starting plot on top of a mountain. I haven't seen that myself, but I wonder... Good thinking Sto!
 
Back
Top Bottom