Train Pathing Improvement (Re: chain signals & parked obstructing trains)

Ideas, that are too old (too much things changed) or won't be implemented cause of some reasons or if there are obvious better suggestions.

Moderator: ickputzdirwech

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

Train Pathing Improvement (Re: chain signals & parked obstructing trains)

Post by SuicideJunkie »

TL;DR
Trains can get into a permanently waiting situation which is fairly easy to path out of with existing rules tweaked.

What ? #1
1) When pathfinding inside a chain signal sequence, the train's currently occupied block should not be discounted from consideration due to being reserved.
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 in the following situation, the train does not find the valid path through (A) + (B):
It seems that the vertical slice of track may be getting ignored because it is reserved by a train (the train doing the pathing).
ConfusedTrainCounterClockwise_labels.png
ConfusedTrainCounterClockwise_labels.png (24.75 KiB) Viewed 1293 times

Ideal path not passing through parked train, which allows immediate departure:
ConfusedTrainClockwise_labels.png
ConfusedTrainClockwise_labels.png (24.86 KiB) Viewed 1293 times

What ? #2
2)The time based penalty should include trains waiting at a stop in addition to trains waiting at a rail signal.
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.

If this time based penalty was applied to the train currently waiting at stop (C), then the pathing train would eventually go around and prioritize the 180 turn to escape.
By my math, this would take (1500-100) / .1 / 60 = 3.9 minutes to overcome the single extra unoccupied stop penalty.

Testing Notes:
After 10 minutes of waiting, the train did not repath through (A) + (B) while the blocking trains waited at the stops (C).
When all three parked trains were advanced to the signals via temporary stop orders, only then did the stuck train escape, after an additional ~4 minutes of waiting as expected.

If the time penalty accounted for trains at stops and not just at signals, then the stuck train would have been able to escape the original situation eventually.
In common situations, I expect the escape would also be prompt, since the train at the stop will either leave frequently and allow escape, or have been parked for many minutes before the stuck train started trying to escape and already have a sufficient pathing penalty built up.
train station blueprint
Why ?
Smarter trains being able to path around parked trains better improves quality of life and makes railways easier to build.
Last edited by SuicideJunkie on Mon Jun 28, 2021 1:44 pm, edited 1 time in total.

User avatar
NotRexButCaesar
Smart Inserter
Smart Inserter
Posts: 1082
Joined: Sun Feb 16, 2020 12:47 am
Contact:

Re: Train Pathing Improvement (Re: chain signals & parked obstructing trains)

Post by NotRexButCaesar »

A TLDR of
SuicideJunkie wrote:
Sat Jun 26, 2021 9:26 pm
> When pathfinding inside a chain signal sequence, the train's currently occupied block should not be discounted from consideration due to being reserved.
[...]
>The time based penalty should include trains waiting at a stop in addition to trains waiting at a rail signal.
might help make the suggestion more clear–accessible.
Last edited by NotRexButCaesar on Sun Jun 27, 2021 10:01 pm, edited 1 time in total.
: Alea jacta est. Think about why you are acting before you act.
Have you ever heard the gospel? Most have not.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12723
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Train Pathing Improvement (Re: chain signals & parked obstructing trains)

Post by ssilk »

@notRexButCaesar good, I nearly didn’t found the purpose of the suggestion.

Strong hint: viewtopic.php?f=6&t=47316 suggestion template

What to keep here in mind is that Factorio doesn’t take the train length into account. It could lead to stupid situations, when the train is longer and tries to go through the circle and back, but now blocking the whole circle and itself.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

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

Re: Train Pathing Improvement (Re: chain signals & parked obstructing trains)

Post by SuicideJunkie »

ssilk wrote:
Sun Jun 27, 2021 6:35 am
What to keep here in mind is that Factorio doesn’t take the train length into account. It could lead to stupid situations, when the train is longer and tries to go through the circle and back, but now blocking the whole circle and itself.
Adjusted formatting.

Going into the roundabout cannot block the pathing train: excessively long trains going through tiny roundabouts are famous for plowing through their own wagons, but that has no bearing on this.

The path is valid before and after, and the train will already choose the 180 path in similar situations as in the testing notes.

User avatar
ptx0
Smart Inserter
Smart Inserter
Posts: 1359
Joined: Wed Jan 01, 2020 7:16 pm
Contact:

Re: Train Pathing Improvement (Re: chain signals & parked obstructing trains)

Post by ptx0 »

it might seem trivial to you and that this will resolve the issue, but there's probably side effects of making the change when you can simply not design rail this way and avoid the issue from the beginning

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

Re: Train Pathing Improvement (Re: chain signals & parked obstructing trains)

Post by SuicideJunkie »

I'm certainly not expecting suggestions from random people such as myself to be implemented without consideration.

There are already existing rules of very similar nature in existence, as I quoted, so the devs clearly believe this sort of thing is appropriate in general, and it is not impossible.

In case you are worried, I have already adjusted my blueprints with a work around for such a situation, but trains picking a path through permanently occupied blocks for obscure reasons and never reconsidering despite chain signals giving them the option can be annoying.

User avatar
ptx0
Smart Inserter
Smart Inserter
Posts: 1359
Joined: Wed Jan 01, 2020 7:16 pm
Contact:

Re: Train Pathing Improvement (Re: chain signals & parked obstructing trains)

Post by ptx0 »

SuicideJunkie wrote:
Mon Jun 28, 2021 9:19 pm
I'm certainly not expecting suggestions from random people such as myself to be implemented without consideration.

There are already existing rules of very similar nature in existence, as I quoted, so the devs clearly believe this sort of thing is appropriate in general, and it is not impossible.

In case you are worried, I have already adjusted my blueprints with a work around for such a situation, but trains picking a path through permanently occupied blocks for obscure reasons and never reconsidering despite chain signals giving them the option can be annoying.
for the record, it's not never. run the game sped up and you'll see.

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

Re: Train Pathing Improvement (Re: chain signals & parked obstructing trains)

Post by SuicideJunkie »

ptx0 wrote:
Wed Jun 30, 2021 4:51 am
for the record, it's not never. run the game sped up and you'll see.
I did check.
Stops do not get treated like signals according to empirical testing, and no other pathing rules on the wiki's list care about ticks.
SuicideJunkie wrote:
Sat Jun 26, 2021 9:26 pm
After 10 minutes of waiting, the train did not repath through (A) + (B) while the blocking trains waited at the stops (C).
When all three parked trains were advanced to the signals via temporary stop orders, only then did the stuck train escape, after an additional ~4 minutes of waiting as expected.

JimBarracus
Filter Inserter
Filter Inserter
Posts: 348
Joined: Mon Jul 03, 2017 9:14 am
Contact:

Re: Train Pathing Improvement (Re: chain signals & parked obstructing trains)

Post by JimBarracus »

Is this a test setup or do you actually use it?

Clear case of really bad design.

Simply add a dedicated exit to the roundabouts.
No need for some weird pathfinding boogaloo.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12723
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Train Pathing Improvement (Re: chain signals & parked obstructing trains)

Post by ssilk »

Well, perhaps someone can find a situation where this makes sense. But here I don’t. So I move it to not implement because as it is I see no chance this gets implemented.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

Post Reply

Return to “Outdated/Not implemented”