Same netID, two depots: Will it favor the nearest?

Adds new train stops forming a highly configurable logistic network.

Moderator: Optera

Post Reply
zOldBulldog
Smart Inserter
Smart Inserter
Posts: 1161
Joined: Sat Mar 17, 2018 1:20 pm
Contact:

Same netID, two depots: Will it favor the nearest?

Post by zOldBulldog »

From observing the behavior:

- It seems that trains returning to a depot always go to the closest stop.

So... if I configure two separate depot stations away from each other, is it safe to assume that trains will likely return to the closest station/stop unless they are already occupied?

I am not looking for perfection, but am merely trying to reduce traffic when most of the deliveries are "local" by adding a local depot station, but keeping the same network so that if for any reason the trains need to go across they do.

User avatar
Nosferatu
Fast Inserter
Fast Inserter
Posts: 228
Joined: Fri Jan 20, 2017 4:48 pm
Contact:

Re: Same netID, two depots: Will it favor the nearest?

Post by Nosferatu »

Same net ID, same name?
I think it will choose the closest based on vanilla pathfinder calculation.
Which also means occupied is only a penalty.

Make sure all depots can hold all trains...

zOldBulldog
Smart Inserter
Smart Inserter
Posts: 1161
Joined: Sat Mar 17, 2018 1:20 pm
Contact:

Re: Same netID, two depots: Will it favor the nearest?

Post by zOldBulldog »

Nosferatu wrote:
Tue Mar 28, 2023 6:58 pm
Same net ID, same name?
I think it will choose the closest based on vanilla pathfinder calculation.
Which also means occupied is only a penalty.

Make sure all depots can hold all trains...
Ty, I suspected that, but wanted to be certain.

I do plan to have enough depots on each station to hold all of the local trains and then some (for safety and for cross-over runs).

torne
Filter Inserter
Filter Inserter
Posts: 341
Joined: Sun Jan 01, 2017 11:54 am
Contact:

Re: Same netID, two depots: Will it favor the nearest?

Post by torne »

If you aren't going to have enough room at every depot to hold every train in the entire network then you may eventually get a traffic jam if you get unlucky and don't take any steps to prevent it. As Nosferatu mentioned, this is just the vanilla train pathfinding: as far as I know LTN doesn't use a temporary stop to send trains to a specific depot when they're returning, the train is just sent to the stop name. The station already being occupied by a train does not prevent the train pathfinder from sending the train there - it just applies a penalty to the distance. If your network is large enough then a train that's very close to an already-full depot might choose to head there rather than going to one that's much further away.

There's a few ways you can prevent this depending on how you want the trains to behave:

1) You can just make sure every location can accommodate all the trains in your entire network as Nosferatu suggested. May not be practical, but guarantees no issues.

2) You can set the vanilla train limit on all the depot stops to 1 (or however many you have queueing room for at that particular stop). This guarantees that the vanilla pathfinder will never send a train to a stop that's already full. This will cause issues if you have more trains than total depots in your network, though, as the trains will just refuse to move from wherever they ended up rather than queueing up near a depot, but.. just make sure you don't do that :)

3) You can name the depots in different areas of the network differently. Trains always return to a depot with the same name, so this allows you to assign each train a particular "home" depot that it will always return to, while still allowing them to make deliveries to/from anywhere in the network if needed (since that's only based on netID). This ensures you don't end up with all the trains congregating at the same place by chance, and keeps them roughly spread out across the network.

The downside of the naming approach is that it's less "dynamic" - if it happens at some point in time that you have lots and lots of deliveries to do near the west depot and very few near the east depot then trains from the east will have to spend a bunch of time going over to the west side to make deliveries then going back to the east side to park, which may be slow and cause congestion. With all depots named the same, the trains will instead mostly end up parked at the west depot, which will be better as long as most of the deliveries continue to happen in the west, but if the pattern changes they will take a while to "sort themselves out" again to be more appropriately distributed.

zOldBulldog
Smart Inserter
Smart Inserter
Posts: 1161
Joined: Sat Mar 17, 2018 1:20 pm
Contact:

Re: Same netID, two depots: Will it favor the nearest?

Post by zOldBulldog »

I do plan to have lots of extra stops at each depot station.

Since my train network is designed so that most trips will be local and only a few trips will cross into a different area, so it seems that the best option for me is (3).

mrvn
Smart Inserter
Smart Inserter
Posts: 5704
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Same netID, two depots: Will it favor the nearest?

Post by mrvn »

Nosferatu wrote:
Tue Mar 28, 2023 6:58 pm
Same net ID, same name?
I think it will choose the closest based on vanilla pathfinder calculation.
Which also means occupied is only a penalty.

Make sure all depots can hold all trains...
You can set the train limit for each stop in the depot to the number of trains the stop can hold. That way when the depot is full the next train will go to the other depot even if that is further away.

If you have a stacker set the limit to stacker-size / num-stops + space-per-stop.

User avatar
Nosferatu
Fast Inserter
Fast Inserter
Posts: 228
Joined: Fri Jan 20, 2017 4:48 pm
Contact:

Re: Same netID, two depots: Will it favor the nearest?

Post by Nosferatu »

Thanks. I just realised that the LTN part of my factory is old - pre train limit...
So i could make that part a bit more dynamic and trains would park closer to where they where used.
But the other end of the journey is still random correct?
LTN chooses a random train in the same net ID for a job - not the closest...

mrvn
Smart Inserter
Smart Inserter
Posts: 5704
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Same netID, two depots: Will it favor the nearest?

Post by mrvn »

Afaik LTN will choose a train close to the provider.

Post Reply

Return to “Logistic Train Network”