[Source] PPather pathfinder in your own programs -
10-30-2008
How to use the PPather pathfinder in your own programs
by barthen
First of all, this is a partial rip of the PPather source code (it's released under the lesser GPL license, so it's fine to do it).
So 99.99% of the credits go to the PPather team.
This post is useful for those people tryng to code a bot and looking for a pathfinder.
When creating your own bot you have to deal with the problem of "How do I get from point A to point B?". This sample code shows you how you can achive that goal without reinventing the wheel.
You can use the pathfinder included in PPather and watch it load geometry data from the mpqs and calculate the path for you.
Downloads
Screenshot of the path calculated in the sample program (from orc noob village to Razor Hill):
[Only registered and activated users can see links. ]
Updated for PPather1.0.4dBETA3.3
Download the example source code from: [Only registered and activated users can see links. ]
Limitations & flaws
The pather only calculates paths within the same maps (ie. no paths from Kalimdor to Eastern Kingdoms)
It's slow
If you get a "too long search, aborting" error, you may have to tweak the timeout in the PathGraph.cs file:
Code:
System.TimeSpan ts = System.DateTime.Now.Subtract(pre);
if (ts.Seconds > 60)
{
Log("too long search, aborting");
break;
}
it originally was 15 seconds in the PPather source, I changed it to 60 seconds (feel free to modify it to suit your needs).