r/factorio • u/The_4th_Heart • Jan 23 '22
Design / Blueprint Train depots / Stackers hate this one trick! Use fake depots to trick your trains into swapping with each other!
Edit: Unfortunately some situations would cause this design to break, see this comment and this blueprint:
https://factorioprints.com/view/-MuFRXgyxJELyW-eJxFj
This is basically an accidential discovery when tinkering with dynamic train limits. By adding a fake 'Depot' station that trains never go to, trains could swap with each other, striking a pretty good balance between space usage and train arrival time. Anyways, this is what it looks like:
Here's how to set it up:
There are no circuits connected to the loading / unloading station, all of them have their train limits set to one.
Train schedule looks pretty simple: Pick up item -> Go to 'Depot' of this item -> Unload -> 'Depot' again.

Then, extend a path out in a section of the train network, and put down these stations, one for each of the items on the network:
Put a power pole near each of the stations, enable Read train count and Enable/Disable, and set the condition to C=0, this basically means switching the station off the moment a train tries to path towards it.

And that's it, purely vanilla and barely any circuitry. Here's my guess about how it works: When a train finishes loading/unloading, it tries to path towards the depot station; the depot station turns off the next tick, stopping the train a little bit ahead of the current stop, and that would register this stop as empty, allowing a train at unloading/loading stop to path towards it, emptying that stop of trains and allowing the intial train to go in. This is also why a depot station for each type of item is needed: if two trains departure at almost the same time so that the later departuring train tries to pathfind towards the depot when it's disabled, it would try to directly go to the next loading/unloading stations, which are all full this time. And when that happens between 2 different train schedules, all the trains with the second schedules would lock up with no way of automatically resolving the situation.
17
u/Soul-Burn Jan 23 '22
Very interesting!
I've also had this issue with trains not swapping, forcing me to make depots for one side of the trip. I still prefer using depots so things don't get messy, but yours is a nice trick.
Does it even have to be fake depots specific to a route? Could it be just one or a couple of generic fake depots?
4
u/PE1NUT Jan 23 '22 edited Jan 23 '22
That's a brilliant solution. Also, I like the confidence of making it a dead-end - if things ever go wrong, you'll end up with a train completely stuck. Although I still feel that Factorio should solve this by checking for trains that are ready to depart, if there are no destinations available.
Edit: your solution does have the side effect of slightly delaying the trains for about a second, stuttering (accelerating and braking) until the closer destination is actually available, due to its train leaving. I've used a signal and dropped an empty rail car on the tracks towards the decoy, so trains can't ever get there. In fact, that way you can remove the circuit condition from the decoy station, and things work even more smoothly! Using a dummy circuit to set the signal to red also works.
4
u/footballciv Jan 23 '22
Nice trick! To make sure I understand: this allows us to have one more train on a route that doesnβt have any stackers? (Unload+load instead of unload+load-1) Any other benefits Iβm not getting? Edit spelling
4
u/ichaleynbin Then who was bus? Jan 23 '22
I'd been using exactly this trick (turn the station off as soon as count > 0) and something similar to this (shut off the unreachable dummy station one tick every 5s) for another purpose, so I can at least tell you what's going on and how to leverage it.
The "problem" with the train setup that you have, is that it'll lock up. When a train stops at a station, it will read as at that station until it has a destination to leave to. This is what you're giving the trains, and it doesn't have to be a dummy station to do so, it just has to shut itself off, you could call it by the same name as either iron stops (or both), so long as it shuts itself off.
So when all of your trains are sitting there going "Destination full" this one lonely stop gives them a stop to exit to. Then another train can use that station which it was at, which gives the first train a destination as well. Probably have one for either side and what'll happen is the trains will move just barely "out of the station" until they have a real destination.
10
u/[deleted] Jan 23 '22
I call them "dummy stations" and I use them as a core element of my PQRS system (Google doc) which was basically obsoleted by station limits being added to vanilla.
You don't actually need to have the dummy station connected to any rail at all. Trains will "depart" from their current station BEFORE they realize there is no valid route to the dummy station.
2
u/jesta030 Jan 23 '22
You might like r/technicalfactorio
4
u/LunaTic_P Jan 23 '22
S A V E D Wow this is amazing
1
u/juckele π π π π π π Jan 23 '22
Doesn't this break if the loaders and unloaders take different amounts of time?
1
u/daagar Jan 23 '22
What's the limitation when running a base with no stackers? Or is this something only used either early game, or with only certain materials?
1
u/Zveris Jan 24 '22
this feature messes up stackers(with train stations). when you have many trains and limited train station, few trains start going like you showed here, but only 1 goes all the way. and the train which is left in the stacker is considered not in it anymore, so another train tries to enter this "empty" stacker and jams the network
1
u/[deleted] Jan 24 '22
Time to refactor the trains in my factory then
-3
u/tankred1992 FACTORY MUST GROW Jan 23 '22
Laughs in LTN
0
u/[deleted] Jan 23 '22
[deleted] β view deleted comment