[kovarex] [0.17.45] Trains repathing in chain signals don't obey reserved block restriction under certain circumstances

This subforum contains all the issues which we already resolved.
Theikkru
Filter Inserter
Filter Inserter
Posts: 416
Joined: Wed Mar 27, 2019 2:18 pm
Contact:

[kovarex] [0.17.45] Trains repathing in chain signals don't obey reserved block restriction under certain circumstances

Post by Theikkru »

See 70684. What I thought was a more general bug turned out to be very specific.

When you tell a train to change its destination by clicking one of the station play buttons in its schedule, it ignores the following restriction:
FactorioBot wrote: Fri May 10, 2019 2:36 pm Changes
  • When a train performs path finding while in a chain signal sequence, the pathfinding will have a constraint to not go through reserved block before exiting the chain sequence. This solves a problem of train intersections being possible to be deadlocked even with proper chain signals usage in cases of using temporary stops or when path is changed because of station is being enabled/disabled by a circuit network. (68681) This also allowed us to to let train recalculate path spontaneously even in chain signal sequence, as it shouldn't break anything now.
[...]
As far as I can tell, this ONLY happens if you change its destination by clicking a play button in the schedule. If you cause the train to change its destination by disabling or removing (either physically or from the schedule) its intended destination stop, the train follows the restriction as expected (for this setup).

I'm attaching an example save, with a symmetric rail setup and two locomotives:
ex.png
ex.png (1.28 MiB) Viewed 3269 times
The bottom locomotive is under circuit control, while the top one is to be controlled manually.

If you set the bottom one off by switching on the train signal on the constant combinator, it will attempt to reach the stop to the bottom right, but that stop will be disabled as it enters the roundabout. The train will continue right through the disabled stop and stop behind the rightmost cargo wagon while attempting to return to its original stop (bottom left). This is the expected behavior:
ex2.png
ex2.png (1.33 MiB) Viewed 3269 times
However, if you open the schedule for the top locomotive and tell it to go to its second stop (the top left one), and then switch back to the first stop (top right) as it enters the roundabout, it will attempt to path through one of the cargo wagons in the roundabout, (violating the restriction above,) and stop in the roundabout:
ex3.png
ex3.png (777.28 KiB) Viewed 3269 times
Save:
Attachments
Test2.zip
(10.17 MiB) Downloaded 181 times
Last edited by Theikkru on Mon Jun 03, 2019 3:39 pm, edited 1 time in total.
Theikkru
Filter Inserter
Filter Inserter
Posts: 416
Joined: Wed Mar 27, 2019 2:18 pm
Contact:

Re: [0.17.45] Trains repathing within chain signals do not obey reserved block restriction under certain circumstances

Post by Theikkru »

I've discovered that the pathing behavior changes strangely depending on where the reserved blocks are. I've been shuffling the cargo wagons around and trying to figure out the rules, but it's as clear as mud to me. Here's a case where even the circuit-controlled train repaths incorrectly:
another.png
another.png (824.91 KiB) Viewed 3213 times
Xeridanus
Burner Inserter
Burner Inserter
Posts: 12
Joined: Fri Mar 25, 2016 11:57 am
Contact:

Re: [kovarex] [0.17.45] Trains repathing in chain signals don't obey reserved block restriction under certain circumstan

Post by Xeridanus »

I think I know the cause of the problem. From reading through the posts I think the pathfinder is finding a reserved block in all possible paths so it defaults to previous behaviour of going for the shortest path possible. Do you think this lines up with your findings?
Theikkru
Filter Inserter
Filter Inserter
Posts: 416
Joined: Wed Mar 27, 2019 2:18 pm
Contact:

Re: [kovarex] [0.17.45] Trains repathing in chain signals don't obey reserved block restriction under certain circumstan

Post by Theikkru »

No, because the pathfinder should prioritize exiting the chain sequence into an unreserved rail block above anything else (at least according to the rule), and there will always be at least one exit from the chain blocks that fits that description: the path that the train originally reserved to authorize its entry into the chain sequence in the first place.

Besides, ALL of the examples above are cases where the new path is invariably blocked by at least 1 cargo wagon at some point, yet the pathfinder still follows the rule sometimes (the circuit train in the first post's example, for instance).
kovarex
Factorio Staff
Factorio Staff
Posts: 8207
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [kovarex] [0.17.45] Trains repathing in chain signals don't obey reserved block restriction under certain circumstan

Post by kovarex »

The problem basically was, that the "in chain sequence" state was lost when changing path by clicking a different station, which is fixed (together with test) for the next release.

Thanks for the report.
Post Reply

Return to “Resolved Problems and Bugs”