[Initially posted at https://www.reddit.com/r/factorio/comme ... _question/]
I have a simple train test network that can be seen here: . The save file is also attached, and rail blocks can be seen here:
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...
[kovarex] [0.17.21] Train pathfinding error
[kovarex] [0.17.21] Train pathfinding error
- Attachments
-
- train-test.zip
- (4.8 MiB) Downloaded 57 times
Re: [kovarex] [0.17.21] Train pathfinding error
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.
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.
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.
Re: [kovarex] [0.17.21] Train pathfinding error
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)
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)
Re: [kovarex] [0.17.21] Train pathfinding error
I think stop itself is assigned to the right segment.
Re: [kovarex] [0.17.21] Train pathfinding error
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.
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.