Train pathing penalty is incorrect if there are 2 or more trains in a segment.

This subforum contains all the issues which we already resolved.
Post Reply
jgilmore42
Burner Inserter
Burner Inserter
Posts: 7
Joined: Tue May 14, 2019 12:56 am
Contact:

Train pathing penalty is incorrect if there are 2 or more trains in a segment.

Post by jgilmore42 »

I think this is a minor issue. The workaround is simple, and figuring out what's going on isn't too difficult. But it's still a bug, so I figured I'd report it.
[0.17.79] (Build 47865, linux64, steam)

I've been attempting to recreate in survival mode the 10k-spm-cross-megabase, which is very heavily train-focused, and (like many "train waiting yard" scenarios) uses parked trains, without fuel and in manual mode, to force trains to path into the waiting area even if there aren't any "real destination" train stops that are ready to load/unload/whatever. This works, but if you try to place two trains in the false parking area instead of one, suddenly trains won't path to the correct destination anymore even when one is available, as the train stop with two parked trains is considered "closer". This can be resolved by either removing a train (why was I trying to double-check-make-extra-sure anyway?) or by placing a rail signal (of any type) between the two trains.

To reproduce:
1. Create a long straight rail. (doesn't have to be too long, mine were about 147 tiles)
2. On one end, place a train, and give it fuel.
3. create a spur rail going off to one side a short distance, so the train has to make a choice.
4. guard that intersection with signals.
5. place two stations, each with the same name, one on the spur and one at the far end of the long rail.
6. place two trains (NOT connected to eachother) on the spur. They can be lone cargo cars, or engines, doesn't matter.
7. observe as the signal protecting the spur correctly turns red.
8. tell the train placed in step 2 to go to the station.
9. Notice that the train paths to the spur station, even though there are two trains parked on it, in preference to the further station that's actually available.

The included screenshot includes the train waiting area, and the false stops, but doesn't include the further away true destinations.

Note that each false stop has two trains (engine and cargo on left, two cargos on the right) with a signal between them. If I remove that signal, all those waiting trains will just sit there even when there's stops available.

I'm fairly certain that this bug affects trains in automatic as well, but since such trains either never end up in the same segment, or aggressively destroy eachother if manually forced into the same segment, there's no real way for me to test that....
Attachments
two train waiting areas with false stops. Note there's two trains with a rail signal between them in each false stop area. Removing that rail signal makes this setup no longer work.
two train waiting areas with false stops. Note there's two trains with a rail signal between them in each false stop area. Removing that rail signal makes this setup no longer work.
20191125095203_1.jpg (830.21 KiB) Viewed 833 times

DaleStan
Filter Inserter
Filter Inserter
Posts: 277
Joined: Mon Jul 09, 2018 2:40 am
Contact:

Re: Train pathing penalty is incorrect if there are 2 or more trains in a segment.

Post by DaleStan »

9 is almost certainly because, even with the various pathing penalties, the false station is closer than the true station. What problem are you trying to solve with these false stations?

Loewchen
Global Moderator
Global Moderator
Posts: 5816
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: Train pathing penalty is incorrect if there are 2 or more trains in a segment.

Post by Loewchen »

Please post a minimalistic save file to produce the issue.

User avatar
disentius
Filter Inserter
Filter Inserter
Posts: 362
Joined: Fri May 12, 2017 3:17 pm
Contact:

Re: Train pathing penalty is incorrect if there are 2 or more trains in a segment.

Post by disentius »

Not sure how OP uses them. I use them when i have several unload stations with the same name and configure them to disable when a train is present. Prevents no path error and keeps luring loaded ore trains into the stacker when all unload stations are occupied.
I make sure that trains change path the moment an unload station becomes free by guarding them with a triple signals connected by wire: the first one sets the back two to red, this gives the station a penalty of 2000 tiles.

PyroFire
Filter Inserter
Filter Inserter
Posts: 295
Joined: Tue Mar 08, 2016 8:18 am
Contact:

Re: Train pathing penalty is incorrect if there are 2 or more trains in a segment.

Post by PyroFire »

Loewchen wrote:
Mon Nov 25, 2019 8:50 pm
Please post a minimalistic save file to produce the issue.
I have been able to replicate the issue.



And it does not matter which one you remove.



The type of signal used before the closer station (with the two trains in it) does not matter either.



Nor does it matter if a train is already parked in the closer station.
It just wants to get in there if there's 2 trains in the block.
Attachments
railtesting.zip
(1.19 MiB) Downloaded 11 times

User avatar
disentius
Filter Inserter
Filter Inserter
Posts: 362
Joined: Fri May 12, 2017 3:17 pm
Contact:

Re: Train pathing penalty is incorrect if there are 2 or more trains in a segment.

Post by disentius »

I think you are right.
Wiki says:
When the path includes a manually controlled stopped train without a passenger -> Add a penalty of 7000.
And:
Before a train moves to a target (in this case, a Train stop), it calculates the best route based on the railway network at that time.

By these rules the train should never path to the north station.

Nice find:)

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 706
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Train pathing penalty is incorrect if there are 2 or more trains in a segment.

Post by boskid »

Thanks for the report. It is fixed for next release.

Post Reply

Return to “Resolved Problems and Bugs”

Who is online

Users browsing this forum: No registered users