[0.16.51] Train trying to go through busy track despite free tracks available

Bugs that are actually features.
titan34
Burner Inserter
Burner Inserter
Posts: 5
Joined: Wed Aug 16, 2017 5:25 pm
Contact:

[0.16.51] Train trying to go through busy track despite free tracks available

Post by titan34 »

What did you do?

I built the attached track layout. The west stop (not visible in the screenshot) is called Load and the two stops in the screenshot are called Unload. Just before the Unload station, I have a six-track train stacker. All trains go to Load and Unload with a circuit condition as a waiting condition (so that I can manually control when each train leaves each stop).

I placed the first two trains at the Unload stops. Then I built one train at a time at the Load stop and told it to go to Unload.

What happened?

The first three trains entered the free tracks in the stacker as expected. The fourth train stopped at the entrance chain signal despite the fact that three free waiting tracks are available.

What did you expect to happen instead?

I expected the fourth train to enter one of the free tracks in the stacker.

General notes

This is a recreation of an issue I found in my current main game (started a few weeks ago). That game has a dozen mods and is fairly large, so I decided to try to recreate the issue in the sandbox with no mods enabled. This was to ensure that the issue was not caused by mods (which I didn't believe, since none of the mods have to do with trains, but you can never be sure without actually verifying), and to make it more convenient for anyone who wants to debug it.

I'm fairly certain that this setup worked in 0.15. I had an even larger game there with many similar setups, and I didn't have this issue back then. When I wanted to build the station in my main game (where I first noticed the problem), I actually went back to the old 0.15 game and made a blueprint, to ensure that I copied the layout exactly.

Screenshot (with show-rail-paths on) and saved game attached below:
Factorio Pathfinder Issue.png
Factorio Pathfinder Issue.png (4.21 MiB) Viewed 1426 times
Train Pathfinder Issue.zip
(3.88 MiB) Downloaded 70 times

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

Re: [0.16.51] Train trying to go through busy track despite free tracks available

Post by Loewchen »

There is no advantage for the train to take the southern route. NaB.

Bilka
Factorio Staff
Factorio Staff
Posts: 3305
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: [0.16.51] Train trying to go through busy track despite free tracks available

Post by Bilka »

Loewchen wrote:
Fri Jan 04, 2019 4:40 pm
There is no advantage for the train to take the southern route. NaB.
To expand on that: The bottom two trains are blocking the rail going from the stacker to the station. These two trains add more penalty to the path finder. The top rail in the stacker needs to path through 2 trains, same for the third and all other free stacker lines. So, the "train penalty" is big for all lines and the train decides by distance. There the top route is obviously shorter and is chosen.

You can work around this by not letting the trains leave the stacker if no station is empty - place chain signals on the exit line instead of normal signals.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

nosports
Filter Inserter
Filter Inserter
Posts: 274
Joined: Fri Jan 19, 2018 5:44 pm
Contact:

Re: [0.16.51] Train trying to go through busy track despite free tracks available

Post by nosports »

I think the train weights the (envisioned) waiting time against the longer path thouse decided not take the longer...

I don't have (serious) stackers in my map as i plan more with chest-stacks as buffer.
as far as i have noticed it works if the paths of all the stacker stations are the same length, so i think if you feed the new arrivals from the bottom to the stacker it would work as you intend....

titan34
Burner Inserter
Burner Inserter
Posts: 5
Joined: Wed Aug 16, 2017 5:25 pm
Contact:

Re: [0.16.51] Train trying to go through busy track despite free tracks available

Post by titan34 »

Loewchen wrote:
Fri Jan 04, 2019 4:40 pm
There is no advantage for the train to take the southern route. NaB.
Ok, so why did it work for the third train, i.e. the one on the southernmost occupied waiting track?
Bilka wrote:
Fri Jan 04, 2019 4:49 pm
To expand on that: The bottom two trains are blocking the rail going from the stacker to the station. These two trains add more penalty to the path finder. The top rail in the stacker needs to path through 2 trains, same for the third and all other free stacker lines. So, the "train penalty" is big for all lines and the train decides by distance. There the top route is obviously shorter and is chosen.

You can work around this by not letting the trains leave the stacker if no station is empty - place chain signals on the exit line instead of normal signals.
Actually, I think that your solution was my original design back when I built my first stacker, but if I recall correctly, when I had chain signals at the end of the waiting tracks, sometimes the waiting train would continue to wait for a while even after one of the blocking trains had departed.

But still, I'll try your solution. Maybe it works better today.

Update: Before I even replied, I decided to try. It works fine.

I even tried moving the train stops a bit away from the stacker, so that at least one train can fit between the stacker and the train stops. That works too. All stacker tracks are used, even though a train sits on the track between the stacker and the train stops. Which is great, since then I don't have to redesign all my train stations, although I don't understand why this works but not the layout in my original post.

I also noticed a minor graphical glitch. Two locomotives are intersecting a little bit (outlined in red in the screenshot).

Anyway, thank you for your help!

Screenshot and saved game:
Factorio Pathfinder Issue 2.png
Factorio Pathfinder Issue 2.png (4.38 MiB) Viewed 1402 times
Train Pathfinder Issue 2.zip
(4.68 MiB) Downloaded 67 times

Post Reply

Return to “Not a bug”