Page 1 of 1

Train Repath When Stopped

Posted: Tue Jun 06, 2017 1:18 pm
by Shokubai
Purpose
Increase throughput at large depots and remove the need for "creative solutions" to trains ignoring empty bays.

Problem
Currently trains chose a desired path and refuse to change this path for long periods of time. The effect is that a train may sit and occupy a waiting bay while a train unloads in its predetermine station leaving empty stations unused for long periods of time. The effect is ultimately a throughput limiter of materials.

Solutions
  • When a train comes to a complete stop perform a path check
  • Along with the path check allow trains to see the status of trains loading or unloading at the intended station(s) and weight those stations in some meaningful way.
  • Allow multiple trains stopped at the same block to consider each other's time stopped, planned destination, etc
  • Aggregate these new logics to produce an "efficient path" to the best station.

Re: Train Repath When Stopped

Posted: Tue Jun 06, 2017 6:26 pm
by Tekky
In OpenTTD, trains recalculate their path at every intersection (when using block signals) or every signal (when using path signals). This works very well, in my opinion. This may cause a significant additional CPU load, but, if necessary, you can always build additional waypoints so that the pathfinder has less work to do (because the search distance is significantly lower when using waypoints).

Therefore, I agree that, in Factorio, trains should also recalculate their paths regularily. But, in order to compensate for the additional CPU load, it may be necessary to introduce waypoints into Factorio, as has been suggested in this thread.

Re: Train Repath When Stopped

Posted: Tue Jun 06, 2017 6:47 pm
by Shokubai
OpenTTD was really why I settled on "when stopped" (and at waypoints) in order to avoid using too much CPU time.

Re: Train Repath When Stopped

Posted: Wed Jun 07, 2017 3:30 pm
by Stumpyofpain
hi
I think this is a very good idea, because I often have the problem, the trains needlessly stand around, because the path they wanted to drive is blocked, although there are alternatives.

Just lately a piece of rail has been destroyed.
Thus trains have stopped in the unloading station and have reported "no path".
The follow-up train wanted to drive in that 1 station instead of entering the next station. (Multi Unloadingstation)

Edit: A picture to show what happened.
This train would stay there forever... until the "no path" train leaves the bay.

Re: Train Repath When Stopped

Posted: Wed Jun 07, 2017 5:34 pm
by Shokubai
Stumpyofpain wrote:hi
I think this is a very good idea, because I often have the problem, the trains needlessly stand around, because the path they wanted to drive is blocked, although there are alternatives.

Just lately a piece of rail has been destroyed.
Thus trains have stopped in the unloading station and have reported "no path".
The follow-up train wanted to drive in that 1 station instead of entering the next station. (Multi Unloadingstation)
Depending how far you wanted to go here code wise you could get Googlemapsian (tm) and force trains to repath any time a signal or track is destroyed. I get a bit concerned about the instant load of forcing all trains to do that at once but there are definitely use cases where it might be beneficial.

Re: Train Repath When Stopped

Posted: Thu Jun 08, 2017 7:27 pm
by Rseding91
Trains already do re-path every 5 seconds when stopped at chain signals when the destination is a stop that exists multiple times in the world.

Re: Train Repath When Stopped

Posted: Thu Jun 08, 2017 8:11 pm
by Shokubai
Rseding91 wrote:Trains already do re-path every 5 seconds when stopped at chain signals when the destination is a stop that exists multiple times in the world.
In theory this sounds good but the practice simply leaves empty bays for long periods of time.

If you have 4 bays all named the same. Lets say a group of 4 trains pull in to the waiting area in close succession. All 4 trains may want to go to the same bay. 1 Trains enters and the other 3 sit. Perhaps one of those trains will change its mind but the other trains generally sit. This cascades through the entire rail network as trains sit unnecessarily when openings clearly exist.

In other train centric games this behavior simply does not exist. Trains move instantly and without hesitation.
Image

Re: Train Repath When Stopped

Posted: Wed Jun 28, 2017 1:47 am
by ssilk
Well, the basic problem is (as I currently see it), that the chain signal is not able to handle this kind of issue (unlike in that last gif).

I think this is wanted. :)

Re: Train Repath When Stopped

Posted: Wed Jun 28, 2017 10:41 am
by Deadly-Bagel
Rseding91 wrote:Trains already do re-path every 5 seconds when stopped at chain signals when the destination is a stop that exists multiple times in the world.
If I read that correctly, this doesn't apply when there's a single instance of that stop but multiple paths to it? As in your average waiting bay to ore unloading?