[0.17.17] Trains do not select available path when multiple stations are in this path

Bugs that are actually features.
Post Reply
Gimlinus
Burner Inserter
Burner Inserter
Posts: 13
Joined: Tue Feb 26, 2019 2:24 pm
Contact:

[0.17.17] Trains do not select available path when multiple stations are in this path

Post by Gimlinus »

Hello,

Considering my last bug report, I'm hoping this one is a real one (that's somehow a strange hope 😁)

I think there may be a problem with the path finding algorithm for trains. I looked on the forum and I'm not sure I find a similar setup for this bug. I think the only closely related was viewtopic.php?f=182&t=67034 but I'm not completely sure it is the same bug.

Here is my setup.

BugReport - 0.png
BugReport - 0.png (1.36 MiB) Viewed 1081 times
BugReport - 0bis.png
BugReport - 0bis.png (138.62 KiB) Viewed 1081 times

I have two trains and 3 stop stations. The tracks form a loop with an escape path for trains
- On the most outward path, there is a station "Loading" on which a train is stopped indefinitely (waiting for his cargo to be full). Thus this path is block indefinitely. Moreover, there is a circuit condition on the loading station that disable it when a train is at the station (which is the case here so "Loading" is disabled)
- On the most inward path (the escape path as I call it), there is two open stations "trash loading" and "steam loading".
Before the junction between this two paths, I put a chain signal (it is blue in the first picture as expected since there is a path available).

The problem comes when I ask my small train (the one with only locomotive) to go to the other side of the track with a temporary station. Instead of using the free escape path, it tries to go through the blocked path hence waiting indefinitely at the blue chain signal (see below)

BugReport - 1.png
BugReport - 1.png (141.59 KiB) Viewed 1081 times
BugReport - 2.png
BugReport - 2.png (1.61 MiB) Viewed 1081 times

Strangely enough, when I remove one of the two stations in the escape path (either "trash loading" or "steam loading") then the small train finds the proper path and go to its destination (see picture below)

BugReport - 3.png
BugReport - 3.png (128.33 KiB) Viewed 1081 times

I also tried this without temporary station by adding two stations "loop" and "loop2" on both sides of the main loop, and by asking the small train to rotate between the two. The behavior is similar. If I leave the two stations "trash loading" and "steam loading" on the escape path, the small train still tries to go through the blocked path, but if I remove one of them then it loops correctly.

With the two stations "trash loading" and "steam loading":

BugReport - 4.png
BugReport - 4.png (150.43 KiB) Viewed 1081 times

With only one of them:

BugReport - 5.png
BugReport - 5.png (162.74 KiB) Viewed 1081 times

I waited several minutes to see if the train was just "taking his time" to find the correct path but apparently it does not.

I put the save and my logs in attachment.

Thanks for your work !

Edit: I created the save with the mod "Creative Mod 1.0.4" but the problem was noticed on a normal vanilla game

Best
Attachments
factorio-previous.log
(4.78 KiB) Downloaded 46 times
factorio-current.log
(4.66 KiB) Downloaded 61 times
TrainBug.zip
(2.99 MiB) Downloaded 59 times

Engimage
Smart Inserter
Smart Inserter
Posts: 1067
Joined: Wed Jun 29, 2016 10:02 am
Contact:

Re: [0.17.17] Trains do not select available path when multiple stations are in this path

Post by Engimage »

This issue is similar to another one 68225
So every station adds 2000 tiles penalty to length of the path going through it.
In your case two stations on the inner path are 2000 tiles longer than outer path no matter if stations is disabled or not. If there is an equal amount of stations the train would be effected by a small penalty that red signal adds thus choosing the free path correctly from your standpoint.
So this is not a bug and is working as intended.

A workaround in your case could be adding multiple (like 10 in a row) normal signals instead of 1 at the entrance, with all of them being disabled via circuit network. This would add quite some penalty to that path making inner one prioritized in this case. Sadly I do not remember exactly how much penalty does manually disabled signal add. That might be 500 or 1000.

Gimlinus
Burner Inserter
Burner Inserter
Posts: 13
Joined: Tue Feb 26, 2019 2:24 pm
Contact:

Re: [0.17.17] Trains do not select available path when multiple stations are in this path

Post by Gimlinus »

PacifyerGrey wrote:
Fri Mar 22, 2019 11:30 am
This issue is similar to another one 68225
So every station adds 2000 tiles penalty to length of the path going through it.
In your case two stations on the inner path are 2000 tiles longer than outer path no matter if stations is disabled or not. If there is an equal amount of stations the train would be effected by a small penalty that red signal adds thus choosing the free path correctly from your standpoint.
So this is not a bug and is working as intended.
I read about the algorithm in wiki but in my setup, there is also the train that is waiting at the stop station to wait for his condition to be validated.
From what I read:
When the path includes a train currently waiting at a rail signal -> Add a penalty of 100 + 0.1 for every tick the train has already waited.
Are you telling me that the penalty for every tick does not apply for trains that are waiting at train stop ? Because if it does then after 20000 ticks, the escape path should be "shorter" than the one with the blocked train.


EDIT: If indeed the presence of the train blocking the path does not influence the penalty with time (i.e. even if the train is blocked for several hours) then I agree it is not technically a bug but that is a very counter intuitive behavior, one that does not make any sense.

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

Re: [0.17.17] Trains do not select available path when multiple stations are in this path

Post by Rseding91 »

Depending on the wait condition not everything has a defined "time in ticks" before the train will leave and in those cases the wait condition is just ignored since the train could leave in a few seconds or never.
If you want to get ahold of me I'm almost always on Discord.

Gimlinus
Burner Inserter
Burner Inserter
Posts: 13
Joined: Tue Feb 26, 2019 2:24 pm
Contact:

Re: [0.17.17] Trains do not select available path when multiple stations are in this path

Post by Gimlinus »

But then you can apply the same reasoning with a train stopped at a rail signal. If I put two train in a row, one waiting at the train station, one waiting at the rail stop, then a third train would then chose the correct only because the second train is stoped at the rail signal, even though this second train could leave in few second or never.

So why the difference ?

Edit: Well I'm not in luck in finding bug then apparently ^^

Post Reply

Return to “Not a bug”