ADVANCED TRAIN SYSTEMS; Deadlocks, Depots & Train Limits | Factorio Master Class

preview_player
Показать описание
FACTORIO MEGABASE-IN-A-BOOK
Advanced Factorio Lets Play focused on making modular design for a Megabase.
The Lets Play transitions from a normal base into a Megabase with continuous and provides blueprints for every new design
The designs used are based on Factorio Master Class designs, so if you are interested in more details of those or the blueprints then check out those videos on the channel as well.

SCHEDULE:
Wednesday and Sunday at 16:00 CEST

SOCIAL:

RESOURCES:
Save games are available to Patreons in my Discord

BLUEPRINTS:

MODS:
Only Quallity of Life mods added
Afraid of the Dark - Makes the game more easy to see (particularly on YouTube)
Beatrix - Silly mod to notify when trains run out of fuel
Calculator UI - Calculator... with a UI
Car Finder - Button to locate misplaced cars/spidertrons
Even Distribution - Distribute items evenly when inserting into multiple entities
Rate Calculator - Calculator to display throughput of designs
Squek Through - Allows the movement between buildings
Vehicle Snap - Being able to drive in a straight line is nice
Power Grid Comb - Cleans up bad wire connections

#Factorio #MegaBase-In-A-Book #StayEffective
Рекомендации по теме
Комментарии
Автор

Great design lesson at the end: "Solving anything that's not the bottleneck won't actually help. You always have to solve the bottleneck first."

jbftb
Автор

Really elegant explanation!
1. If science dips below standard, check labs.
2. Pinpoint the empty lab science input/s, (probably Purple!).
3. Then check that sciences input (probably Steel!).
4. Then check Steel production input, (Iron Plates or raw Ore!).
5. Then increase Steel builds, increase Iron Plate builds, or increase Iron Mining builds!

Your base is designed in such a way that its really easy to pinpoint a bottleneck, even without a dashboard!

Great stuff as always!

anthonygadd
Автор

Just so people don't get the wrong idea, the only reason "Only focus on the bottleneck" is a hard rule here is because it's literally a closed system. You don't have unknown externalities in a factorio train network, but real world logistic networks do.

PoofyKittyPants
Автор

I haven't commented on this before because I'm sure I don't understand trains nearly well enough to give helpful advice, but the option you mentioned towards the end - simply increasing the trains requested at the loading station - would have been my short term fix for the problem. Sure, it won't fix the underlying problem of "not enough steel in the system", but it will at least get the trains rolling again while you build more steel.
I mean the stackers you have at every station basically *are* "waiting stations" just not centralized somewhere in the network but local and thus not causing any extra traffic.

MirageGSM
Автор

I know this is an older series, but I'm sure it still gets views, so gonna put this comment. I know a lot of people are going to think I'm wrong, and that's fine, but after 3, 000 hours in factorio I have learned 1 thing. the issue with your deadlocks is NOT supply and demand. You should never ever put dynamic limits on your loading stations. if a loading station has a stacker that can hold 3 trains then that station should be hard limited to 3. it makes sure that all empty trains can sit at the loader even if there isn't enough supply to fill them and keeps them from getting stuck at the unload stations. had you designed your loading stations with hard limits instead of all that dynamic limit shenanigans, you would not have had this issue. I have never had this happen because I always set dynamic limits on the unloaders and hard limits on the loaders.

problemchild
Автор

Another fix for your configuration looks to be to have N suppliers, M consumers, and max(M, N) - 1 trains. That way there is always at least one open space. However you are correct that either way you'd still need adequate resources.

In my last megabase, I removed the in/out train buffer chests and instead directly loaded the trains. Each consumer had a demand of two trains with room for one waiting to unload. The number of trains I had was equal to the total consumers and waiting spaces. Outside of building my blocks to consume too much relative to the size of my trains, it worked mostly well. With your megabase design, and that you already have stackers. It seems like with your design this would work well, I think all of your consumers at most use half a belt per car, that should give plenty of time for the next train to move from the stacker to the stop and catch up.

guru
Автор

There were actually 2 problems with your steel trains:

1. not enough supply (which you correctly identify)
2. dynamic limits changing meaning that trains can get stuck waiting for trains going somewhere else and thus not getting to stations that have available supply (4 trains at one steel block: 1 at station, 1 behind waiting, 2 behind that trying to get to the other station, effectively limiting your network to half the rate for steel trains; because this station is far away from everything and there are significantly closer steel stations, they get preferred first; eventually if the distance to stations is great enough, you can get trains at unload stations blinking destination full even though you have empty stations with supplies available)

You can mitigate #2 somewhat by overbuilding supply, but you have to increase the ratio of supply to demand as the base continues to grow. You can also mitigate it by setting a limit on each loading station such that trains cannot block trains from access to other stations (with your steel design 1 train max at each loading station). However you also require enough additional supply within a given range such that there will be enough supply by the time the train gets to the station(in your steel condition the problem wouldn't happen with 1 train max; this will happen with your green chip stations if you make them far enough apart from each other and set the max number of trains to 3).

You can get rid of the problem altogether by getting rid of dynamic limits and increasing the number of trains in the network such that there is only 1 empty slot in a given station pair limit sum. At this specific circumstance, if you ever have trains blinking "destination full" at an unload station, you do not have enough supply.

afterfallout
Автор

I'm still toying with train deadlock detection, but here's the start of an idea that may interest you:
You've already pointed out that Read Stopped Train does not show the train that is trying to leave (T=0) but does show the loading train (T=1). That is half of the solution right there. All we need is a way to detect that there is still actually a train there.

Place an additional rail signal behind the station such that it is red when there is a train at the station. This requires a small gap for whatever reason, so leave one space between the station and the new signal. Read that signal. (You could also use the signal at the rear end of the station, but that's a lot more wiring.)

If RED (from signal) > T, then there is a train trying to leave (or actually leaving, but that's transient).
Of course, more supply can't hurt.

asedeno
Автор

Love it. One thing I've started changing in my megabase is to make the on-site steel smelting sites have only one loading station, rather than two. It doesn't change how quickly steel is produced, but it makes loads appear one by one rather than two by two, so individual loads appear in half the time.

asedeno
Автор

There is a way to modify your 3rd setup to get rid of the problem you have shown. This fix will make the system a bit more robust against the resulting deadlock, so it might be useful to some people. But as it doesn't solve the underlying issue, as you have explained at 16:03 in the video and summarized marvelously in the quote at 18:55.

For the third example, you need to have the "actual station" (the one with the inserters lined up to the wagons) and the "pull-out station" entities immediately after another, such that a train in the pull-out station has its tail still inside the actual station area. (More specifically, either have such a short signal block for the pull-out station that a train of any length that could wait there will be GUARANTEED to stick out by at least 1 pixel into the actual station's signal block, or even have a single signal block for the actual station and the pull-out station. The latter has the advantage that it works with trains of any length.) Then the system will work as follows:
As soon as the train has stepped forwards into the pull-out station, another train can RESERVE a path into the actual station (since it's not "being reserved" any more - and thus this setup is fixing the very cause of your problem). But that incoming train can not yet PULL INTO the actual station that it has reserved, since the signal block is still occupied.
Only when the pull-out station is getting empty can the new train pull into the actual station, and that now GUARANTEES that it will be able to pathfind to the corresponding pull-out station - which eliminates the problem.

The first downside is that a train in the pull-out station might not get called anywhere for a LOOONG time. This will be especially probable if you apply this setup to a loading station - and provide too much capacity for filling the trains according to your plan. But it can also happen if you apply this to unloading stations and run into a situation where you have more capacity for unloading trains than for loading them. In the latter case you'll be blocking a whole module of your factory from working until the underlying issue is fixed (or until the offending train is manually pulled out).
This is why i'd suggest to only use this for loading stations.

The second problem is that it can still deadlock, but it requires up to 50% more trains than the simple system, which actually makes this a slight advantage. Where the simple system deadlocks when there's
a: trains in all open dropping stations and
b: trains INSIDE all open loading stations
(both meaning filled up to the current train limit with both a train trying to find a path and possibly trains in the stacker), this improved system will deadlock when there's
a: trains in all open dropping stations and
b: trains waiting in the stacker of all open loading stations (with their number equal to the current train limit) and
c: trains inside the pull-out stations of ALL open loading stations.
If I'm not making any mistake here, it WILL NOT deadlock until ALL loading stations with a train limit >0 have a train waiting in the pull-out station. Thus the "only" thing you gain is that you increase your capacity for waiting trains by the number of active loading stations. HOWEVER, this isn't the same type of increase as just adding 1 to the maximum train limit! The maximum train limit only takes effect when a station is basically overflowing with materials to load. Whereas even when the buffer boxes contain just over a single train load, a pull-out station can have a train inside of it. Or that train might have already left the pull-out station. But in a deadlock or near-deadlock situation, it'll be more probable to find the pull-out station full than empty. And it ALSO isn't the same as just adding 1 to the current train limit, which could call trains to near-depleted mines that won't have a full train load for hours (this system can only have a train in the pull-out station if it has "recently" filled up).

Pystro
Автор

Every time I think you've found a good solution you hit me with the "however." I'm not sure how much more I can take.

danielbuege
Автор

this is so useful. thank you for this.
i hope factorio developers add some sort of additions to the signal network where we can further influence the train pathfinding. train system becomes a headache when you have a large enough base.

_caracalla_
Автор

Move your "waiting station" to a "spur" (out of the loop, a dead-end)... wire a single pole to it, then enable "Read Train Count" and "Enable/Disable"... set the enable condition to C=0.

This works because as a train paths to leave the unloading, it tries to go to the Waiting station, immediately disables it (by setting the C value if itself), and then paths to the loading station.

The benefit of this is you only need ONE waiting station on the entire network.

Alaorath
Автор

I don't know how much this would help, but there are a couple minor tweaks that could be made to your 'standard' load and unload station to possibly make the train limit more accurate.

On the unload side, simply read the current contents of the train and add that to the contents in storage when calculating the number of trainloads being requested. This will avoid situations where a train is allocated to an unload station, but the station no longer requires the load on the next train once the unloading of the current train is complete. In essence, you are instantaneously transferring the contents of the train to the storage chests, then letting reality catch up with the bookkeeping at the speed of the inserters.

On the loading side, subtract 1 from the number of trains being requested if a train is currently being loaded (T>0) This should happen before the request count is capped. You may also wish to add the contents of the train to the contents in storage to help ensure a timely limit change. As with the unload station, this essentially performs an instantaneous transfer of inventory to the train, then lets reality catch up with the bookeeeping. Adding the contents of the train to the contents in storage when calculating the number of trains to request means that the request calculation is taking into account how much inventory will remain in the station once the train is full.

arielmoonsoo
Автор

Thanks for whole series so far....
Here's some projects list to consider
1....dedicated Sulphuric Acid Pump Block
2....Dedicated Sulphur block
3....Military Science
4....A complete Nuclear Processing Fuel]
Again THANKS for the content...Really appreciate your work

hannanashrafmughal
Автор

I was sitting here racking my brain about how to set things up to fix an oil train issue and the actual root cause it that I just don't have enough oil coming in.... Great video, I'll quit trying to put fancy bandaids on my broken leg now...

businessmonkey
Автор

I get the point of the video, always address the bottlenecks first. Great point and video.

But also, in that first example's solution, keeping a perfect ratio of requesting stations, supply stations, and the optimal number of trains, its tedious and awkward to keep that 3-way relationship perfectly balanced to avoid the deadlocks. Especially in an ever-growing base where the supply and demand ratio isn't static.

I prefer using better rail networks with more alternate pathways for getting places, with a few depots. Yes, its a little more congestion but not enough to make a difference if the depot placements are well planned and the rail network has enough alternate pathing.. I find it to be a much more hassle free experience than maintaining the perfect requester/provider/trains ratios.

gariannobinger
Автор

Your toy examples are really just looking at level 1 of the issue. The changing train limit numbers and a propagation delay from sloshing supply levels are what's getting you in the macro scale. Hope you see it when it happens

rieos
Автор

Excellent explanation / lesson, as always. I've also found this to be the case when you optimize for simpler train routing (dispatch only empty/full trains), and the addition of train limits has been a boon for reducing thundering herd problems. However, I'm not sure this applies quite as well for other routing behaviors such as inactivity or clock time where you instead optimize around a more or less constant number of trains in transit. Your approach is definitely what I'd recommend to most players, since it's easier to grok and intentionally modular. Some folks like threads, others prefer coroutines; it would be nice to see someone with your knack for accessible explanation model the latter with trains.

ScumdogMcGee
Автор

i love the fact, that nilaus dont want adcise for a solved problem (in his mention) and just share his knowledge here for others.
if u have study computer sience, these problems are not new. and sometimes u are just be able to solve a problem with more ressources (more input) rather than "build smarter"

so i can fully understand the fact, that he is not willing to answer to such comments anymore - and its nice that he is taking time to explain these things even for not computer sientists who maybe not fully understand these aspects. ( i not claim fully understandment either... i only have a gasp of this =D )

Thank you nilaus.

Pok-qqlt