Hey, thanks for the help with cPickle, I haven’t tried importing the classes yet though but it sounds promising.
Your pathfinding does some weird stuff, I sent the bot up to the top of the map, then clicked the top again and started going to the bottom.
I’ll ask you some questions rather than trawl through your code
How do you determine if a point is inside a poly? For instance, how do you know which poly the player starts in?
Did you do any smoothing to the path? As in, when you first run the pathfinding, it will return the nodes as the centers of the faces/edges, did you then move those nodes to make the path even shorter?
Do you export the navmesh at runtime everytime?
The first question I already have a solution to, but it looks like it could get cpu heavy really quickly. To combat this I added a pathfinding controller, which you register all paths through, like this:
GameLogic.pfController = Pathfinding.createController(30)
path = GameLogic.pfController.newPath(start, end, navmesh=default, priority=False)
The controller will only process so many paths per frame, thats what the 30 means. It doesn’t mean 30 paths though, it means 30 points. Each navmesh has an attribute for how many points 1 unit is equal to (lets say 0.2), when each path is initialised it finds the distance from the start to the end and multiplies this by 0.2 and thats how many points get used when the path is calculated.
You can specify if the path is a priority (priority=True) which means it will be processed before non priority paths, even if they were added before the priority path.
You can also force the path to be processed for really important paths with:
You don’t need to use a controller, but if you have alot of paths (RTS comes to mind) then it would be helpful.
I’ll post mine up here when I finish it, maybe today, the cPickle thing was really getting annoying.