Page 1 of 1

Why train chooses long distance?

Posted: Sat Feb 25, 2023 12:05 am
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.

Re: Why train chooses long distance?

Posted: Sat Feb 25, 2023 12:11 am
by datarza
Can admin move this topic to Bug report section, please?

Re: Why train chooses long distance?

Posted: Sat Feb 25, 2023 12:17 am
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.

Re: Why train chooses long distance?

Posted: Sat Feb 25, 2023 2:04 am
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.

Re: Why train chooses long distance?

Posted: Sat Feb 25, 2023 7:53 am
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.

Re: Why train chooses long distance?

Posted: Sat Feb 25, 2023 10:11 am
by disentius
And: pathfinding happens when a train wants to leave its station, not in real time, unless there is a repath condition.

Re: Why train chooses long distance?

Posted: Sat Feb 25, 2023 1:40 pm
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 1033 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.

Re: Why train chooses long distance?

Posted: Sat Feb 25, 2023 4:25 pm
by datarza
I have calculated the length and both directions contain 17 rails, so yes, they have the same length