Why train chooses long distance?

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
User avatar
datarza
Long Handed Inserter
Long Handed Inserter
Posts: 90
Joined: Thu Sep 15, 2022 1:55 am
Contact:

Why train chooses long distance?

Post by datarza »

On the second image train #2 wants to go on the long rails instead of chooses the short rail, why?

PS: on the first image the train selected the correct rail.
Attachments
Screenshot 2023-02-24 185956.png
Screenshot 2023-02-24 185956.png (3.28 MiB) Viewed 1703 times
Screenshot 2023-02-24 185718.png
Screenshot 2023-02-24 185718.png (3.67 MiB) Viewed 1703 times
User avatar
datarza
Long Handed Inserter
Long Handed Inserter
Posts: 90
Joined: Thu Sep 15, 2022 1:55 am
Contact:

Re: Why train chooses long distance?

Post by datarza »

Can admin move this topic to Bug report section, please?
User avatar
datarza
Long Handed Inserter
Long Handed Inserter
Posts: 90
Joined: Thu Sep 15, 2022 1:55 am
Contact:

Re: Why train chooses long distance?

Post by datarza »

In addition: the same situation like on the first image (good image), but train selected wrong rail. Some times train selects good rail, but sometimes wrong.
Attachments
image_2023-02-24_191646328.png
image_2023-02-24_191646328.png (3.53 MiB) Viewed 1684 times
robot256
Smart Inserter
Smart Inserter
Posts: 1018
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: Why train chooses long distance?

Post by robot256 »

If a train is occupying the short rail at the moment a second train is computing a path through the intersection, it's possible the second train thinks the longer path is a safer option. It won't necessarily check if the shorter path becomes available before it gets to the intersection as long as the longer path stays available.
SoShootMe
Filter Inserter
Filter Inserter
Posts: 517
Joined: Mon Aug 03, 2020 4:16 pm
Contact:

Re: Why train chooses long distance?

Post by SoShootMe »

Expanding on what robot256 wrote: the Train path finding information in the Wiki explains how this works. The key points in this case are that there is a penalty for occupied blocks and (roughly speaking) as long as the train can keep going it will not change its path (none of the conditions that cause a repath will apply).

Because using the east-to-south chord is only slightly shorter than using the roundabout, it is very likely that if the chord is occupied and the roundabout is not, the roundabout will be chosen. Using the roundabout instead will block a train from the north turning west, so the effect may be more than just being a longer path, but in most cases the difference will still be pretty small.
User avatar
disentius
Filter Inserter
Filter Inserter
Posts: 694
Joined: Fri May 12, 2017 3:17 pm
Contact:

Re: Why train chooses long distance?

Post by disentius »

And: pathfinding happens when a train wants to leave its station, not in real time, unless there is a repath condition.
Tertius
Smart Inserter
Smart Inserter
Posts: 1013
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Why train chooses long distance?

Post by Tertius »

The way through the roundabout isn't longer. Count the tracks: it's the same amount of rail pieces. At least if I count them with the blueprint I use for this type of intersection:
1.png
1.png (476.15 KiB) Viewed 1568 times
By the way, you might notice I use less signals and less blocks. It's still sufficient. More signals and smaller blocks will not make trains wait less.
User avatar
datarza
Long Handed Inserter
Long Handed Inserter
Posts: 90
Joined: Thu Sep 15, 2022 1:55 am
Contact:

Re: Why train chooses long distance?

Post by datarza »

I have calculated the length and both directions contain 17 rails, so yes, they have the same length
Post Reply

Return to “Gameplay Help”