[kovarex] [0.17.7] Disabling waypoint between train & train-breaking-distance doesn't cause trains to repath.
[kovarex] [0.17.7] Disabling waypoint between train & train-breaking-distance doesn't cause trains to repath.
Middle: Same as top, but the train slows down on the third signal. Train paths to the destination until it starts slowing down, then repaths to next waypoint.
Bottom: Waypoint disables when the first signal stops being green. Train repaths to next waypoint.
All trains have the same schedule and run on solid fuel. Test was done in a sandbox scenario with max (+100%) braking force researched.
I've attached a blueprint with the test shown. Build the blueprint, set all trains to automatic, and turn on the constant combinator (offscreen to the left) to reproduce the bug.
I'd expect all three trains to repath towards the second waypoint and turn left, or at least the top and middle tests should have the same result.
Efficient inefficient design.
-
- Fast Inserter
- Posts: 132
- Joined: Fri Oct 05, 2018 3:49 pm
- Contact:
Re: [0.17.7] Disabling waypoint between train & train-breaking-distance doesn't cause trains to repath.
This appears to be the same issue as I reported in this thread. Didn't see your thread when I reported it.
Re: [0.17.7] Disabling waypoint between train & train-breaking-distance doesn't cause trains to repath.
So, near as I can tell, a train whose braking point reaches its enabled path end waypoint stop immediately extends its path to its next stop and remembers which block it has to enter to actually pass the waypoint, but doesn't update its schedule until it actually enters that block.
The interval between reserving the block past the waypoint and actually entering it is weird, a waypoint-only state where the path end stop isn't next on the schedule. When the waypoint disables itself, for the top two trains in your blueprint it's next on the schedule but it isn't the path end stop, and they don't repath, why should they? they're not pathing to that stop any more anyway, they've already reserved a path past the desired waypoint, the schedule has already had its desired effect on the train's behavior, after which it disabled itself.
This is exactly what's desired for regular stops: I think everybody can agree trains that have arrived at their stop should stay there if the stop disables itself, the schedule has already had its intended effect, the train stopped there, disablement doesn't affect past decisions and behavior, only future decisions it might make about that stop.
And I think everybody can agree that waypoint stops that disable themselves after the train has passed the waypoint shouldn't affect the train's route, the schedule has had its desired effect, the train's route went past it.
But when the train plans and reserves a path past an enabled waypoint to its next stop, and if nothing _else_ forces a repath it is guaranteed to actually pass that stop, the question here is whether that's the end of "the desired effect". It was never going to actually stop there, it has already routed past there, what's left to achieve?
With the train that's stopped itself at a regular stop that then disables itself, it's already looking at something besides path_end_stop, it's done worrying about this one and it's on to the exit conditions. With the train that's routed itself past a waypoint that then disables itself, it's done worrying about this path_end_stop, it's worrying about the next one. In both cases the train's current task is something other than doing the right thing at the particular path_end_stop in question, and the answer's the same: if the train's not worried about that particular path_end_stop, it's not worried about whether it's enabled or not.
Suppose you had a fast very long train with multiple waypoints on its schedule, with the behavior the way it is now the train only has to worry about one path end stop at a time, but the otther way there's literally no limit to the number of stops a train might have to be watching in case they disable themselves. I think this is the clincher, currently trains only have to watch one stop for disablement every tick, what you're asking for would require them to scan an arbitrarily-long list each tick.
The interval between reserving the block past the waypoint and actually entering it is weird, a waypoint-only state where the path end stop isn't next on the schedule. When the waypoint disables itself, for the top two trains in your blueprint it's next on the schedule but it isn't the path end stop, and they don't repath, why should they? they're not pathing to that stop any more anyway, they've already reserved a path past the desired waypoint, the schedule has already had its desired effect on the train's behavior, after which it disabled itself.
This is exactly what's desired for regular stops: I think everybody can agree trains that have arrived at their stop should stay there if the stop disables itself, the schedule has already had its intended effect, the train stopped there, disablement doesn't affect past decisions and behavior, only future decisions it might make about that stop.
And I think everybody can agree that waypoint stops that disable themselves after the train has passed the waypoint shouldn't affect the train's route, the schedule has had its desired effect, the train's route went past it.
But when the train plans and reserves a path past an enabled waypoint to its next stop, and if nothing _else_ forces a repath it is guaranteed to actually pass that stop, the question here is whether that's the end of "the desired effect". It was never going to actually stop there, it has already routed past there, what's left to achieve?
With the train that's stopped itself at a regular stop that then disables itself, it's already looking at something besides path_end_stop, it's done worrying about this one and it's on to the exit conditions. With the train that's routed itself past a waypoint that then disables itself, it's done worrying about this path_end_stop, it's worrying about the next one. In both cases the train's current task is something other than doing the right thing at the particular path_end_stop in question, and the answer's the same: if the train's not worried about that particular path_end_stop, it's not worried about whether it's enabled or not.
Suppose you had a fast very long train with multiple waypoints on its schedule, with the behavior the way it is now the train only has to worry about one path end stop at a time, but the otther way there's literally no limit to the number of stops a train might have to be watching in case they disable themselves. I think this is the clincher, currently trains only have to watch one stop for disablement every tick, what you're asking for would require them to scan an arbitrarily-long list each tick.
-
- Fast Inserter
- Posts: 132
- Joined: Fri Oct 05, 2018 3:49 pm
- Contact:
Re: [0.17.7] Disabling waypoint between train & train-breaking-distance doesn't cause trains to repath.
It's an unintuititive behavior, especially given that the train schedule doesn't update at the point where it changes destinations, only at the point where the train passes the actual waypoint station. I would expect that changes to any waypoint stations would continue being honored until the train actually passes them. The train is clearly still checking if it's passed that station or not as it updates its schedule once it does pass the station.quyxkh wrote: ↑Wed Mar 13, 2019 9:42 pm But when the train plans and reserves a path past an enabled waypoint to its next stop, and if nothing _else_ forces a repath it is guaranteed to actually pass that stop, the question here is whether that's the end of "the desired effect". It was never going to actually stop there, it has already routed past there, what's left to achieve?
The interesting thing here though is that farcast's second condition this is clearly not what's happening. The train routes past the waypoint, then reroutes when it sees the red signal, and then paths through the next waypoint. Meaning it hasn't actually finished with the previous waypoint, as the waypoint is still in the schedule until the train actually passes the station. If it were already cleared then the repath in the second row of farcast's gif caused by the red signal would not redirect the train through the top waypoint station.quyxkh wrote: ↑Wed Mar 13, 2019 9:42 pm With the train that's stopped itself at a regular stop that then disables itself, it's already looking at something besides path_end_stop, it's done worrying about this one and it's on to the exit conditions. With the train that's routed itself past a waypoint that then disables itself, it's done worrying about this path_end_stop, it's worrying about the next one. In both cases the train's current task is something other than doing the right thing at the particular path_end_stop in question, and the answer's the same: if the train's not worried about that particular path_end_stop, it's not worried about whether it's enabled or not.
Train length wouldn't directly affect this (since only waypoint stations in front of the front of the train would matter), as any train with the same ratio of wagons:locomotives has the same braking distance. Though I suppose that train weight and braking force would matter, which can be related to length if there is large wagon:locomotive ratio, or artillery wagons present (which have same braking force as normal wagons, but weigh 4 times as much).quyxkh wrote: ↑Wed Mar 13, 2019 9:42 pm Suppose you had a fast very long train with multiple waypoints on its schedule, with the behavior the way it is now the train only has to worry about one path end stop at a time, but the otther way there's literally no limit to the number of stops a train might have to be watching in case they disable themselves. I think this is the clincher, currently trains only have to watch one stop for disablement every tick, what you're asking for would require them to scan an arbitrarily-long list each tick.
You're right though that it might cause the train to need to be aware of all the waypoint stations within its braking distance + the station it currently has as its destination. If it's going the other way around though, with stations sending events to trains that have them as their targets when they get disabled it might not be too onerous as compared to the current method (train just becomes able to receive signals from multiple stations, but the signal is still only sent once per station that is disabled).
-
- Fast Inserter
- Posts: 132
- Joined: Fri Oct 05, 2018 3:49 pm
- Contact:
Re: [0.17.7] Disabling waypoint between train & train-breaking-distance doesn't cause trains to repath.
This behavior may have changed; I was able to find a difference in behavior since the last time I did the test. See here:
viewtopic.php?f=7&t=68145
EDIT: Interestingly, it hasn't. I just ran farcast's blueprint, and it behaves exactly like in his gif in0.17.16, but the trains do not behave the same in my game. I'll have to mess around some more now, maybe the difference is that he has three differently named stops and I only have two, or else I'm doing something else strange.
EDIT2: The three stops is not the difference, I'll try some more stuff.
viewtopic.php?f=7&t=68145
EDIT: Interestingly, it hasn't. I just ran farcast's blueprint, and it behaves exactly like in his gif in0.17.16, but the trains do not behave the same in my game. I'll have to mess around some more now, maybe the difference is that he has three differently named stops and I only have two, or else I'm doing something else strange.
EDIT2: The three stops is not the difference, I'll try some more stuff.
-
- Fast Inserter
- Posts: 132
- Joined: Fri Oct 05, 2018 3:49 pm
- Contact:
Re: [0.17.7] Disabling waypoint between train & train-breaking-distance doesn't cause trains to repath.
So I continued investigating this some more, and I'm not sure if farcast positioned his signals where he did on purpose, or it just lucked out that way, but I think I've figured out the current behavior. Demonstrated in this video with pause mode showing the exact ticks where the difference in behavior happens. I've attached the save as well if anyone wants to mess with it.
I think I've got the behavior figured out now (version 0.17.16):
I think I've got the behavior figured out now (version 0.17.16):
- Trains consider a waypoint station to be "passed" (and remove it from their schedule) only once the front of the train is ~2 tiles beyond the station.
- If the waypoint station becomes disabled prior to the train's braking distance reaching it, the train will repath immediately.
- If the waypoint station is disabled after the train's braking distance reaches it, the behavior will depend on some additional conditions:
- If nothing forces the train to repath prior to the train updating its schedule, the disabled waypoint is passed, and removed from the schedule.
- If something does force the train to repath (basically if it brakes for any reason) prior to the schedule being updated, the train will not consider the disabled waypoint to have fulfilled its waypoint schedule item, and will repath to another waypoint station.
- Attachments
-
- farcast_train_waypoint_demo.zip
- (2.07 MiB) Downloaded 125 times
-
- factorio-previous.log
- (5.6 KiB) Downloaded 151 times
-
- factorio-current.log
- (7.69 KiB) Downloaded 160 times
-
- Fast Inserter
- Posts: 132
- Joined: Fri Oct 05, 2018 3:49 pm
- Contact:
Re: [kovarex] [0.17.7] Disabling waypoint between train & train-breaking-distance doesn't cause trains to repath.
Kovarex, do you have any thoughts as to which way you're leaning for fixing this one? Is it going to be "waypoints are struck from schedule as soon as braking distance passes them" or is it going to be that turning off a waypoint prior to the train physically passing it will immediately cause a repath to another of the same name? I definitely prefer the second, but could understand using the first.
Re: [kovarex] [0.17.7] Disabling waypoint between train & train-breaking-distance doesn't cause trains to repath.
I'd also prefer knightelite's second option, as the first would make waypoints less useful in heavily combinator controlled train systems.
Speaking from experience, I may be a bit biased...
Speaking from experience, I may be a bit biased...
Efficient inefficient design.
-
- Fast Inserter
- Posts: 132
- Joined: Fri Oct 05, 2018 3:49 pm
- Contact:
Re: [kovarex] [0.17.7] Disabling waypoint between train & train-breaking-distance doesn't cause trains to repath.
Definitely why I started looking into this as well, I was thinking "Hey, I can shrink these blueprints down to 1/4 of their previous length using these new waypoint stations!"
Re: [kovarex] [0.17.7] Disabling waypoint between train & train-breaking-distance doesn't cause trains to repath.
This is not a simple thing to decide/change.
Changing path closer than the braking distance is tricky as the train might choose a different path with a red signal, which would cause it to stop much faster than it physically normally could. We already discussed this specific problem at some point (as it can happen currently as well in some cases) and it should be solvable by providing "minimum free distance" when pathfinding a train that is in motion. This would restrict the pathfinder from selecting a path where it has to stop sooner than it would be normally possible.
But I would prefer to not do this kind of change at this point, as it would require non trivial changes and some consequences that wouldn't be expected, like train being forced to some part of the rail network where it would never normally go, as it would be the only free path etc.
The question I would like to ask instead is: Why do you need this behaviour so much? Isn't there some more straightforward way to achieving your goal?
Changing path closer than the braking distance is tricky as the train might choose a different path with a red signal, which would cause it to stop much faster than it physically normally could. We already discussed this specific problem at some point (as it can happen currently as well in some cases) and it should be solvable by providing "minimum free distance" when pathfinding a train that is in motion. This would restrict the pathfinder from selecting a path where it has to stop sooner than it would be normally possible.
But I would prefer to not do this kind of change at this point, as it would require non trivial changes and some consequences that wouldn't be expected, like train being forced to some part of the rail network where it would never normally go, as it would be the only free path etc.
The question I would like to ask instead is: Why do you need this behaviour so much? Isn't there some more straightforward way to achieving your goal?
-
- Fast Inserter
- Posts: 132
- Joined: Fri Oct 05, 2018 3:49 pm
- Contact:
Re: [kovarex] [0.17.7] Disabling waypoint between train & train-breaking-distance doesn't cause trains to repath.
In my case, I achieved the goal already without waypoint stations back in 0.16. It just required leaving the train's full braking distance between stations so they wouldn't slow down at each one (with 1-2 ratio trains, that is about 120 tiles). I had been hoping that with 0.17 I would be able to make shorter segments with waypoint stations instead so the individual blueprints could be smaller and less cumbersome to place. But if I still need to leave the train's full braking distance before disabling a waypoint station in 0.17, then for my use case there's no advantage to using them instead of regular stations.
What I'm doing is making all the trains have the same schedule, and passing metadata in the circuit network along the rails as the trains travel down them. Each branch point in the rails then makes a decision on where the train should go based on its metadata, and routes it appropriately.
You can check out this reddit post and the associated videos if you're curious about how it works.
I'm not sure what farcast wants this change for .
What I'm doing is making all the trains have the same schedule, and passing metadata in the circuit network along the rails as the trains travel down them. Each branch point in the rails then makes a decision on where the train should go based on its metadata, and routes it appropriately.
You can check out this reddit post and the associated videos if you're curious about how it works.
I'm not sure what farcast wants this change for .
Re: [kovarex] [0.17.7] Disabling waypoint between train & train-breaking-distance doesn't cause trains to repath.
I'm making my own combinator LTN inspired by this reddit post. I used RattlemBones' method in a two-lane RHD three way junction, and, while it works just fine in 0.16, trains have to slow down while passing through the junction if they're moving too fast. If I could use the new waypoints, train throughput should only be marginally lower than a circuit-free three way junction.
The junction is pretty much complete, I'm still working on the stations to go with it though. I can share pictures/blueprints if you'd like, but I'd like to save the full write-up for when the whole system is finished.
While it's not necessary for this bug to be fixed, I would greatly appreciate if it was.
The junction is pretty much complete, I'm still working on the stations to go with it though. I can share pictures/blueprints if you'd like, but I'd like to save the full write-up for when the whole system is finished.
While it's not necessary for this bug to be fixed, I would greatly appreciate if it was.
Efficient inefficient design.
-
- Fast Inserter
- Posts: 132
- Joined: Fri Oct 05, 2018 3:49 pm
- Contact:
Re: [kovarex] [0.17.7] Disabling waypoint between train & train-breaking-distance doesn't cause trains to repath.
Slightly derailing this thread, but that post is extremely cool, and I wish I had seen it sooner! Sounds like you and RattlemBones are doing something very similar to what I came up with, with attaching metadata to the trains and then doing stuff based on that; just with a different type of metadata.
So you basically want this for exactly the same reason I do .
So you basically want this for exactly the same reason I do .
Re: [kovarex] [0.17.7] Disabling waypoint between train & train-breaking-distance doesn't cause trains to repath.
Yeah, pretty much.
To clarify a bit, in my case, the station can't be disabled until it's absolutely certain the train is moving in the right direction. That only happens when the physical train enters the next block after the rail split. There's no other method that I'm aware of. Disabling it sooner risks the train pathing through the wrong exit, and to allow trains to pass through the split at full speed would require a huge distance between the split and each station.
So my only options are:
To clarify a bit, in my case, the station can't be disabled until it's absolutely certain the train is moving in the right direction. That only happens when the physical train enters the next block after the rail split. There's no other method that I'm aware of. Disabling it sooner risks the train pathing through the wrong exit, and to allow trains to pass through the split at full speed would require a huge distance between the split and each station.
So my only options are:
- Accept sub-optimal train throughput by allowing trains to slow down.
- Accept ridiculously huge junction exits allowing maximum throughput.
Efficient inefficient design.
-
- Fast Inserter
- Posts: 132
- Joined: Fri Oct 05, 2018 3:49 pm
- Contact:
Re: [kovarex] [0.17.7] Disabling waypoint between train & train-breaking-distance doesn't cause trains to repath.
That's what I did with my original version; made everything 125 tiles or thereabouts long. It does get a bit large.
That's definitely my reasoning as well .Using waypoints instead would allow maximum throughput without the huge exits. That's why this mildly inconvenient bug should be fixed as soon as possible!
-
- Fast Inserter
- Posts: 132
- Joined: Fri Oct 05, 2018 3:49 pm
- Contact:
Re: [kovarex] [0.17.7] Disabling waypoint between train & train-breaking-distance doesn't cause trains to repath.
So I had a thought (that might be dumb) on how to implement the behavior that farcast and I want. Would it be possible to create some kind of "virtual station" <train braking distance -1 tile> along the train's path from the waypoint station, and only consider the waypoint station to have been "passed" by the train once the braking distance passes this virtual station? Then when the real waypoint station becomes disabled, the virtual waypoint stations would disappear, forcing the train to repath to find another correctly named waypoint station to pass through.
That could be dumb idea for any number of reasons, but I figured I would post it anyway in case it's useful.
That could be dumb idea for any number of reasons, but I figured I would post it anyway in case it's useful.