[kovarex] [0.17.21] Train pathfinding error

This subforum contains all the issues which we already resolved.
Hottemax
Burner Inserter
Burner Inserter
Posts: 13
Joined: Tue Apr 25, 2017 10:27 am
Contact:

[kovarex] [0.17.21] Train pathfinding error

Post by Hottemax »

[Initially posted at https://www.reddit.com/r/factorio/comme ... _question/]
I have a simple train test network that can be seen here:
Factorio 0.17.21 27.03.2019 23_09_28.png
Factorio 0.17.21 27.03.2019 23_09_28.png (174.95 KiB) Viewed 1858 times
. The save file is also attached, and rail blocks can be seen here:
Factorio 0.17.21 27.03.2019 23_31_15.png
Factorio 0.17.21 27.03.2019 23_31_15.png (4.93 MiB) Viewed 1858 times

Expected behavior: To go from Stop 2 to Stop 3 the train should take the direct way by turning left, but it always takes the long way (going right at the intersection after Stop 2)
From https://wiki.factorio.com/Railway/Train_path_finding, I can not find out what is wrong - the game seems to add a stiff penalty to the intersection itself which is as simply signalled as it can be in my opinion. (if I add another stop on the upper loop, it would take a left as intended).

As was pointed out here, moving back Stop 2 one tile makes the train turn left as anticipated - but this seems like a genuine bug, since it can turn left legally anyway...
Attachments
train-test.zip
(4.8 MiB) Downloaded 57 times

Zavian
Smart Inserter
Smart Inserter
Posts: 1646
Joined: Thu Mar 02, 2017 2:57 am
Contact:

Re: [kovarex] [0.17.21] Train pathfinding error

Post by Zavian »

Personally I'm not sure that this is really a bug. By the time the train halts, the front of the train is already past the junction point, so I think that the train has already chosen which path it will take at that junction, and is already committed to turning right.
Station.plus.Junction.png
Station.plus.Junction.png (1.06 MiB) Viewed 1772 times

The easy fix/workaround is to just move the station back one tile (as you have already mentioned). If Kovarex does fix this, then he will probably end up enforcing that by preventing building a station and a rail junction on the same tile.

Hottemax
Burner Inserter
Burner Inserter
Posts: 13
Joined: Tue Apr 25, 2017 10:27 am
Contact:

Re: [kovarex] [0.17.21] Train pathfinding error

Post by Hottemax »

Why does it matter if the train "has already chosen" when it comes to the train stop? How did it make that "decision" anyway (since it should have "already decided" to turn left, since that is the shorter route)?

Edit: Also, I tested it again, if I remove a piece of rail of the right turn after it stops at Stop 2, it will turn left (so the front of the train is not really "past the junction")

And the "easy fix" is not so easy if you need to apply it all over your base, and often the layout is so optimized that moving it one tile would affect everything (there is an adjacent cell whose rail prevents moving/disjoint logistic networks would be merged etc pp) :D

User avatar
leadraven
Filter Inserter
Filter Inserter
Posts: 354
Joined: Fri Jan 18, 2019 7:23 pm
Contact:

Re: [kovarex] [0.17.21] Train pathfinding error

Post by leadraven »

Hottemax wrote:
Mon Apr 01, 2019 11:51 am
Why does it matter if the train "has already chosen" when it comes to the train stop? How did it make that "decision" anyway (since it should have "already decided" to turn left, since that is the shorter route)?
I think stop itself is assigned to the right segment.

kovarex
Factorio Staff
Factorio Staff
Posts: 8194
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [kovarex] [0.17.21] Train pathfinding error

Post by kovarex »

The problem is, that the stop itself is after the junction point, but as the train stops infront of it, it can still go both ways. Second part of the problem is, that train gets penalty for leaving block with train stop, even if it is the stop it is currently departing form, as it didn't really matter until now. The path to the left has the penalty, but the path on the top doesn't have it.

I gave this some thought and one of the ways to solve this would be to allow train stop to connect to all of the rails in the junction the same way as signals do it, but since this would come with its own set of problems, I decided to just not allow train stops in junctions.

This means that building the train stop on the position will not be possible anymore with it's own error message ("Can't build train stop in intersection").
You can still build the stop and then the rail to force it into intersection if you really persist, but it will come with the problems described in this bug report.

Post Reply

Return to “Resolved Problems and Bugs”