pathing messing up after the last node
I ran into another problem I'd like to share. I'm not 100% sure that the fix will work for all cases, but I think it is a good place to start.
At some point near the end of an NPC's path, the movement code will notice that there is LOS to the destination with no hazards. This is independent of the culling code. There are timers that periodically check for this situation, and abandon the calculated route when possible. This works great. However I've seen cases where the pathing code will travel direct for a bit, and then calculate a new route to a nearby path node. The NPC wanders off, and then comes back to the destination. Sometimes this route recalculation has occurred more than once. I'll advance the argument that once a safe direct path is found, that FindRoute should never be used again. Let the NPC head straight towards its destination. When this direct path is selected, the Route list is cleared. Code later notices an empty route and tries to calculate a new one. The following change has corrected this in my tests: Code:
@@ -1059,6 +1059,13 @@ VERTEX Mob::UpdatePath(float ToX, float ToY, float ToZ, float S a route has never been calculated. The PathingTraversedNodes check rules out the later case. The "return To" directs the NPC to head directly to its destination. |
All times are GMT -4. The time now is 12:46 PM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.