[1.1.35] Train at chain signals tries to path through stopped train

Bugs that are actually features.
Locked
SuicideJunkie
Fast Inserter
Fast Inserter
Posts: 120
Joined: Wed Aug 23, 2017 10:17 pm
Contact:

[1.1.35] Train at chain signals tries to path through stopped train

Post by SuicideJunkie »

From the Wiki:
0.17.38:
When a train performs path finding while in a chain signal sequence, the pathfinding will have a constraint to not go through reserved block before exiting the chain sequence. This solves a problem of train intersections being possible to be deadlocked even with proper chain signals usage in cases of using temporary stops or when path is changed because of station is being enabled/disabled by a circuit network. This also allowed us to to let train recalculate path spontaneously even in chain signal sequence, as it shouldn't break anything now.
However, I have a train leaving a temporary stop, which is choosing to try to path via chain signals through a parked train sitting at a stop (C), rather than passing through a pair of unoccupied stops (A), (B), that do not have occupants other than the pathfinding train itself (it does require a loopback over its own position).
ConfusedTrainCounterClockwise_labels.png
ConfusedTrainCounterClockwise_labels.png (24.75 KiB) Viewed 1057 times
My entire rail network is composed of chain signals, so the train is definitely not exiting the chain sequence.
I also would have expected a parked train's currently occupied block to count as reserved.

If the option of avoiding (A) is removed by deconstructing a signal to make the left turn shortcut be one-way southbound, the train does choose the ideal path and departs immediately, as it is only choosing between (A) + (C) or (A) + (B):
ConfusedTrainClockwise_labels.png
ConfusedTrainClockwise_labels.png (24.86 KiB) Viewed 1057 times
As a note, from the same wiki page:
When the path includes a train stop -> Add a penalty of 2000.
When the rail block contains a train that is stopped at a train stop -> Add a penalty of 500.
...
When the rail block contains a train currently waiting at a rail signal -> Add a penalty of 100 + 0.1 for every tick the train has already waited.
Clearly the path avoiding (A) by going through (C) wins by 1500 points, if it is permitted at all (from the 0.17.38 change it should be disallowed entirely as I understand it).
The time based penalty could have rescued the situation, if "train currently waiting at a rail signal" also included "train waiting at a stop", since the pathfinding train would have eventually realized that the long term parking blockage was worse than pathing through (A) and (B).
blueprint string for the train station

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

Re: [1.1.35] Train at chain signals tries to path through stopped train

Post by Loewchen »

Do I understand you correct that A and B are not in the trains schedule but you want the train to drive through both stations instead of one station with an occupied train?

SuicideJunkie
Fast Inserter
Fast Inserter
Posts: 120
Joined: Wed Aug 23, 2017 10:17 pm
Contact:

Re: [1.1.35] Train at chain signals tries to path through stopped train

Post by SuicideJunkie »

Yes. The pathing train has no stops in the area and is heading out to the wider world (originally after delivering my character a load of underground pipes via a temporary stop)

The stopped train has been parked for a few minutes and will not likely leave for many minutes more. Meanwhile there is a clear path to take immediately available.

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

Re: [1.1.35] Train at chain signals tries to path through stopped train

Post by Loewchen »

Two stops not in schdule have a higher penalty than one with a stoped train. NaB.

SuicideJunkie
Fast Inserter
Fast Inserter
Posts: 120
Joined: Wed Aug 23, 2017 10:17 pm
Contact:

Re: [1.1.35] Train at chain signals tries to path through stopped train

Post by SuicideJunkie »

Loewchen wrote:
Sat Jun 26, 2021 11:23 am
Two stops not in schdule have a higher penalty than one with a stoped train. NaB.
Dude. What happened to "When a train performs path finding while in a chain signal sequence, the pathfinding will have a constraint to not go through reserved block before exiting the chain sequence."?

That's the first thing I mentioned.

Edit:
To be clear, my understanding is "Two stops not in schedule has a lower penalty than an infinite cost path with one stop with a train inside a chain block"
Last edited by SuicideJunkie on Sat Jun 26, 2021 3:13 pm, edited 1 time in total.

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 1792
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [1.1.35] Train at chain signals tries to path through stopped train

Post by boskid »

SuicideJunkie wrote:
Sat Jun 26, 2021 2:51 pm
Dude. What happened to "When a train performs path finding while in a chain signal sequence, the pathfinding will have a constraint to not go through reserved block before exiting the chain sequence."?
This is a constraint which prevents trains from changing a path while in the intersection when their old path had a valid signal reservations to quit intersection and the new path would go through intersection in a way it would not be able to reserve all the signals required to leave an intersection. Having a train take such path is worse than first exiting the intersection the old way and then doing some detour. When a train is unable to find a path that would satisfy this condition, a train would enter a NO_PATH which is even worse than trying to leave an intersection, possibly waiting slightly on it and blocking other trains. As NO_PATH is worse, there is second repath happening in those cases which completly ignores the chain signal section constraint allowing the train to keep going without the need to recycle it through manual mode to clear the in chain signal section flag.

SuicideJunkie
Fast Inserter
Fast Inserter
Posts: 120
Joined: Wed Aug 23, 2017 10:17 pm
Contact:

Re: [1.1.35] Train at chain signals tries to path through stopped train

Post by SuicideJunkie »

Ah, that makes sense, thanks.

Edit:
Although in this case, there is a valid path that avoids the other trains, just not avoiding its own reserved block in the turnaround.


I would like to suggest as improvement having the time based penalty applied to trains waiting at stops in addition to trains waiting at signals.
That would have allowed the train to figure out the proper path in this case, and will avoid waiting behind a train that will not move.

SuicideJunkie
Fast Inserter
Fast Inserter
Posts: 120
Joined: Wed Aug 23, 2017 10:17 pm
Contact:

Re: [1.1.35] Train at chain signals tries to path through stopped train

Post by SuicideJunkie »

boskid wrote:
Sat Jun 26, 2021 3:13 pm
This is a constraint which prevents trains from changing a path while in the intersection when their old path had a valid signal reservations to quit intersection and the new path would go through intersection in a way it would not be able to reserve all the signals required to leave an intersection.
I think the key issue here may be that the train is being disallowed from entering a reserved block... which the pathing train itself has reserved as its starting point.

Given that the pathing train already owns that block, it should be exempt from the constraint in order to avoid discarding valid paths that involve a 180 turn.

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

Re: [1.1.35] Train at chain signals tries to path through stopped train

Post by Loewchen »

Make a feature request, this is not a bug.

Locked

Return to “Not a bug”