Re: Feature #2229: Improve pathfinding AI
Posted: 06 Jun 2015, 07:22
How about improving the AI?
Thanks for that. I've found it and updated the PR so that AiFollow will use this sync logic as well.mrcheko wrote: True, applies to any other package apart aiCombat. I fixed that rather long time ago (only in aicombat): PathFinder::syncStart, look for usage in AiCombat::buildNewPath
Thanks, but it doesn't seem to have any effect. I think it's because AiFollow won't start moving the NPC until you're within 500 units and have Line of Sight. This is due to code you added to AiFollow.execute() in December.scrawl wrote: Open the console, click on the NPC, close the console, walk out of their line of sight, open the console, then type AiFollow player 0 0 0 0.
Can you be more specific?wareya wrote:How about improving the AI?
True. Well, then you could tell the NPC to AiFollow while you're near them, then disable AI (enter toggleAI in the console), move out of their line of sight, then toggleAI again.Thanks, but it doesn't seem to have any effect. I think it's because AiFollow won't start moving the NPC until you're within 500 units and have Line of Sight. This is due to code you added to AiFollow.execute() in December.
That value seems excessively large. The change would fix one bug but create others in the process.my suggestion is change the tolerance on checkPathCompleted to 80.0f.
Checking every frame is not a good idea as it would give different results for different computers, making testing hard. However, testing every 0.1 sec should be fine.That value seems excessively large. The change would fix one bug but create others in the process.
I think the root cause of the problem you are seeing would be AiCombat calls checkPathCompleted only every 0.25 seconds (tReaction). If we check it every frame instead, wouldn't that fix the issue?
I think I've got a better idea. Based on what I originally tried in AiCombat to fix. Which was to check if NPC is getting further away from waypoint, if I move this logic into PathFinding.checkPathCompleted() it will be available for all AiPackages.gus wrote:Checking every frame is not a good idea as it would give different results for different computers, making testing hard. However, testing every 0.1 sec should be fine.That value seems excessively large. The change would fix one bug but create others in the process.
I think the root cause of the problem you are seeing would be AiCombat calls checkPathCompleted only every 0.25 seconds (tReaction). If we check it every frame instead, wouldn't that fix the issue?
To do the testing, one should increase the NPC speed to 100 and check for problems.
it's possible that it never goes further away if you run in perfect circle, or if the NPC runs in a spiral, so this might not work.But I like this idea and in the same spririt,you might do the check on the zAngle. If this angle change of 180 degrees, then you've past the waypoint. What do you think?I think I've got a better idea. Based on what I originally tried in AiCombat to fix. Which was to check if NPC is getting further away from waypoint, if I move this logic into PathFinding.checkPathCompleted() it will be available for all AiPackages.
Basic change is to add member variable to PathFinding to record distance each time checkPathCompleted() is called and compare it with previous call.
gus wrote: it's possible that it never goes further away if you run in perfect circle, or if the NPC runs in a spiral, so this might not work.But I like this idea and in the same spirit,you might do the check on the zAngle. If this angle change of 180 degrees, then you've past the way-point. What do you think?
Why is that a problem here? Sure, the more framerate you get, the more accurate pathing will be. But even with unplayable framerates of say 10 frames per second, the pathing precision would still be better than what we have now.Checking every frame is not a good idea as it would give different results for different computers, making testing hard.
That still doesn't make pathing truly framerate independent. You can't check pathing more than once per frame, because there isn't new world state to respond to. If the game gets below 10 frames per second, we'd have less than 10 pathfinding checks per second.However, testing every 0.1 sec should be fine.