Page 1 of 1
[kovarex] [0.17.16] Doubleheaded Train does not choose shortest track
Posted: Thu Mar 21, 2019 3:58 pm
by burninghey
I have built a personal train with a very long round track. It sometimes does not choose the shortest track to the right side or even worse, it goes all the way around if it only have to drive 3 meters in the other direction.
No signals at all, yet.
Reproduce: enter the train, hold ctrl and choose various locations near you
- trainbug.png (139.47 KiB) Viewed 4530 times
Re: [0.17.16]Doubleheaded Train does not choose shortest track
Posted: Thu Mar 21, 2019 5:08 pm
by TruePikachu
Are there regular train stops in place?
Re: [0.17.16]Doubleheaded Train does not choose shortest track
Posted: Thu Mar 21, 2019 10:28 pm
by burninghey
No
Re: [0.17.16]Doubleheaded Train does not choose shortest track
Posted: Fri Mar 22, 2019 12:15 am
by ruy16109
So I noticed something on your picture: you were inside the right-headed locomotive, and you ctrl-selected somewhere to the left of your train. I think because you are on the right-headed locomotive, the game sees that and decides to default the starting direction rightward. I suspect if you were on the other locomotive the train would start as you have wanted it to.
Re: [0.17.16]Doubleheaded Train does not choose shortest track
Posted: Fri Mar 22, 2019 1:40 am
by Zaflis
Is the path 2-ways or not using signal pairs? Trains will never drive against the allowed direction. edit: Found in the post you don't have any.
I was using a signaled stacker as a test with 2-headed train, it always went the shortest path. I actually thought for a moment that the bug was real until i realized my home station had no entrance from both lanes.
Re: [0.17.16]Doubleheaded Train does not choose shortest track
Posted: Fri Mar 22, 2019 8:48 am
by Engimage
The issue here is obviously about station direction. Every station has its direction on track so the train will not "reverse" to it no matter if it has backwards facing locomotive or not.
So I suppose the "temporary station" which is added to the train schedule also does have the direction which is set incorrectly in this case forcing train to follow longer route to approach the station from another side. I am also not sure if current movement direction of the train also effects the choice .
Re: [0.17.16]Doubleheaded Train does not choose shortest track
Posted: Fri Mar 22, 2019 8:58 am
by Zaflis
PacifyerGrey wrote: ↑Fri Mar 22, 2019 8:48 am
The issue here is obviously about station direction. Every station has its direction on track so the train will not "reverse" to it no matter if it has backwards facing locomotive or not.
burninghey wrote: ↑Thu Mar 21, 2019 3:58 pm
hold ctrl and choose various locations near you
That will only be true if the train's schedule is not empty, but in the screenshot it is. So it's not trying to go to a station, just any plain location on tracks.
But if there is 1 station on the tracks it might already determine which direction the rail goes, same as signals.
Re: [0.17.16]Doubleheaded Train does not choose shortest track
Posted: Fri Mar 22, 2019 10:58 am
by Engimage
Zaflis wrote: ↑Fri Mar 22, 2019 8:58 am
But if there is 1 station on the tracks it might already determine which direction the rail goes, same as signals.
Stations do not effect rail direction. You can have any amount of differently oriented stations between destinations.
The only issue is that every station adds 2000 tiles penalty to a path going through it so visually longer path may be considered actually shorter from a pathfinder standpoint.
Actually this penalty might be the real issue in the OP situation.
Re: [kovarex] [0.17.16] Doubleheaded Train does not choose shortest track
Posted: Thu Mar 28, 2019 10:07 pm
by kovarex
Thanks for the report, it is now fixed for 0.17.22
This is kind of a special case (also treated by special logic), when the search is within a single segment. And since all the rail loop has no signal or junction, it is a single rail segment.
The logic now basically selects the shorter path within the segment instead of choosing whatever comes first.