[1.1.74] Pathfinder is slow when landfilling

Bugs that are actually features.
Post Reply
ILLISIS
Burner Inserter
Burner Inserter
Posts: 19
Joined: Wed Feb 09, 2022 10:49 am
Contact:

[1.1.74] Pathfinder is slow when landfilling

Post by ILLISIS »

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.
Last edited by ILLISIS on Sat Jan 07, 2023 2:06 am, edited 1 time in total.

Loewchen
Global Moderator
Global Moderator
Posts: 8336
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: [1.1.74] Pathfinder is slow when path starts on landfill

Post by Loewchen »

Post save file, log and steps that produce the issue please, see 3638.

ILLISIS
Burner Inserter
Burner Inserter
Posts: 19
Joined: Wed Feb 09, 2022 10:49 am
Contact:

Re: [1.1.74] Pathfinder is slow when path starts on landfill

Post by ILLISIS »

Load into map
Verify that pre-configured remote triggers the path finder.
Try to get to the left most large island like in the videos - should work fine
Rotate the inserter to activate the construction bots to build the landfill
Wait a short time
Try to get to the left most large island from where you are standing like in the videos - fails fairly consistently.
Attachments
bug-poc.zip
(8.88 MiB) Downloaded 32 times
Factorio.Testmod_0.0.3.zip
(27.07 KiB) Downloaded 33 times
factorio-current.log
(18.16 KiB) Downloaded 31 times

Rseding91
Factorio Staff
Factorio Staff
Posts: 13218
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [1.1.74] Pathfinder is slow when landfilling

Post by Rseding91 »

Thanks for the report. As far as I can tell this is working as intended. Any time a tile on a chunk the path finder is using is changed that path-find using that chunk is restarted. This is because the path finder does not know if changing that tile will make a brand new better path or invalidate the path it had already made into that chunk.
If you want to get ahold of me I'm almost always on Discord.

ILLISIS
Burner Inserter
Burner Inserter
Posts: 19
Joined: Wed Feb 09, 2022 10:49 am
Contact:

Re: [1.1.74] Pathfinder is slow when landfilling

Post by ILLISIS »

Hi Rseding91!

If I may, I would like to propose that an incremental update occur to the chunk that changed instead after the remainder of the path is found. i.e; A small incremental check to go from the last point on the previous tile to the first point on the next tile. This would assume that this is the only available/fastest way there even if two land masses were joined by landfill but that is much less noticeable than a player entity using the pathfinder doing nothing for the duration of the intersecting chunk changes.

Additionally, this raises the question, what happens after a path is found and a chunk changes? This would normally be okay as in the base game players cannot add water for example. Entities and biters collide but I guess that looks fairly smooth when they encounter something that wasn't meant to be there from the player.

Post Reply

Return to “Not a bug”