Page 1 of 1

[kovarex] [0.17.76] Train Can't Path When Moving Backwards

Posted: Fri Nov 08, 2019 12:50 am
by wizard07ksu
This will probably get moved to minor issues.

I got in a train and changed the mode to manual, then started moving backwards. My train setup was LCCC, and I was on a dead-end track. By moving backwards, I'd get back onto the main rail system. While the train was moving backwards, I clicked on the engine and tried to set a temporary destination (using CTRL+CLICK in the train GUI) somewhere but got an error message "No path to destination". The train was on the main rail system by then, and if I stopped the train and tried again it would work just fine.

Since automatic trains will only go "forward" relative to the direction of an engine on the train, and can only go in both directions if there are at least 2 engines, I would have expected a train facing along the track (the direction the engine is pointed in) would be able to move in that direction if you set a reachable temporary destination.

This behavior is inconsistent with a train in manual mode with a pre-set station, and then you change the train to "automatic". The train will immediately come to a stop, then start moving "forwards" towards the set station.

Re: [0.17.76] Train Can't Path When Moving Backwards

Posted: Mon Nov 11, 2019 3:26 pm
by Klonan
Can you provide a save game or a screenshot of the exact setup and series of events?

Re: [0.17.76] Train Can't Path When Moving Backwards

Posted: Mon Nov 11, 2019 10:05 pm
by TruePikachu
I think I might have encountered this one myself. The gist of repro steps would be:
  • Make a good-length section of rail
  • Put a single locomotive, with fuel, on the rail
  • Drive the locomotive backwards in manual mode
  • While still driving backwards, open the train's GUI and set a temporary stop somewhere in front of it (in terms of the way it's facing; if the locomotive is facing north and you were driving it south, the stop would be placed north of the locomotive).
I just repro'd the report successfully using these steps. You're also not able to drop such a stop on the other side either, but that's more due to it being behind the train.


That said, I'm not 100% sure if this would be classified as a bug or not. In a nutshell, the current core behaviour is such that if a train is moving, it won't attempt to establish a path that would result in it stopping and reversing; it would instead create a path in the direction of its current travel. While this "contradicts" the behaviour that occurs if you set a real stop and then put the train in auto mode (where the train will stop and reverse, but more due to the failure to find a path stopping it and the reversing happening once it attempts to find a path after stopping), it's still important for the use case of doubleheaded trains on bidirectional track; if the path becomes invalidated for whatever reason while travelling at speed, you probably don't want the train to stop and reverse down the track it came from (since it would "waste" the energy it took to get up to speed initially).

My vote would be to leave things the way they are, since the only alternatives would be to either (a) special-case a forced stop of a moving train when setting a temporary stop, which might require (b) a recode of part of the rail pathfinder so it can look in the opposite direction while moving.

Re: [kovarex] [0.17.76] Train Can't Path When Moving Backwards

Posted: Wed Nov 13, 2019 8:59 pm
by wizard07ksu
@TruePikachu

That is exactly the series of steps to reproduce this.

I filed this as a bug report since the behavior seemed odd to me. I'm fine with this being classified as "not a bug" - I did search there first but couldn't find anything related to this.

Re: [kovarex] [0.17.76] Train Can't Path When Moving Backwards

Posted: Thu Nov 14, 2019 7:51 pm
by boskid
Ref 73377

Re: [kovarex] [0.17.76] Train Can't Path When Moving Backwards

Posted: Thu Feb 20, 2020 4:29 pm
by boskid
Thanks for the report. It is now fixed for 0.18.9. There may be some tiny artifacts left, like gui showing path in trains opposite direction when pointing with mouse to somewhere while train will prefere going into same direction, but this should no longer prevent setting temporary train stop when train requires changing direction.