[1.1.74] Pathfinder is slow when landfilling
Posted: Thu Jan 05, 2023 8:48 am
Hi
I have been speaking to Klonan about this issue in Discord.
How I came about this issue was I noticed the pathfinder was taking extremely long to find a path when I was testing my path retry settings for Constructron-Continued. Klonan was right to think it was the retry system / mod code and I couldn't disagree so I spent a couple of days overhauling my code and searching for the bug to no avail.
The main thing I noticed that pushed me to report this as a bug was that I was absolutely sure that there was one "entry point" function which requested a path and placing a break point in that function triggered nothing when the pathfinder would continuously try to get from A to B but not fire the event handler or fail but instead continuously try over and over.
Issue in action:
https://youtu.be/fisKp7d1mx8?t=30
https://youtu.be/fisKp7d1mx8?t=100
I recommend watching the above at 0.25x speed.
You can definitely attribute SOME pathfinder requests to the retry system I agree.
But on the second link at ~1:40 there is a VERY distinct difference that causes well over 50 path attempts(not via lua code retry's) for it to finally 'finish'.
Same can be seen at ~2:40 https://youtu.be/fisKp7d1mx8?t=158
Interestingly when I zoom in on this and the path resolution modifier already looks to be set at 0 instead of -2 which is exactly what retry attempt 5 does in my code.
My theory is that this looks like the pathfinder itself is struggling to find a path but also doesn't want to abort and fire on_script_path_request_finished.
To test this theory, I set the path resolution modifer and bouding_box to be the smallest size on the initial request(instead of using retry system) and setup the spider remote to trigger the pathfinder. I witnessed the same seizure behavior though not to the same extent at first but when you start building landfill the problem grows exponentially worse. Before/after video: https://www.youtube.com/watch?v=KqkTg0oKeXk
My only conclusion is that I have found some kind of edge case in the pathfinder that when tiles change, causes some kind of reset or loop in the pathfinder.
I have been speaking to Klonan about this issue in Discord.
How I came about this issue was I noticed the pathfinder was taking extremely long to find a path when I was testing my path retry settings for Constructron-Continued. Klonan was right to think it was the retry system / mod code and I couldn't disagree so I spent a couple of days overhauling my code and searching for the bug to no avail.
The main thing I noticed that pushed me to report this as a bug was that I was absolutely sure that there was one "entry point" function which requested a path and placing a break point in that function triggered nothing when the pathfinder would continuously try to get from A to B but not fire the event handler or fail but instead continuously try over and over.
Issue in action:
https://youtu.be/fisKp7d1mx8?t=30
https://youtu.be/fisKp7d1mx8?t=100
I recommend watching the above at 0.25x speed.
You can definitely attribute SOME pathfinder requests to the retry system I agree.
But on the second link at ~1:40 there is a VERY distinct difference that causes well over 50 path attempts(not via lua code retry's) for it to finally 'finish'.
Same can be seen at ~2:40 https://youtu.be/fisKp7d1mx8?t=158
Interestingly when I zoom in on this and the path resolution modifier already looks to be set at 0 instead of -2 which is exactly what retry attempt 5 does in my code.
My theory is that this looks like the pathfinder itself is struggling to find a path but also doesn't want to abort and fire on_script_path_request_finished.
To test this theory, I set the path resolution modifer and bouding_box to be the smallest size on the initial request(instead of using retry system) and setup the spider remote to trigger the pathfinder. I witnessed the same seizure behavior though not to the same extent at first but when you start building landfill the problem grows exponentially worse. Before/after video: https://www.youtube.com/watch?v=KqkTg0oKeXk
My only conclusion is that I have found some kind of edge case in the pathfinder that when tiles change, causes some kind of reset or loop in the pathfinder.