Factorio – Vanilla Bot-Based Logistic Train Networks Guide

An in-depth guide for making bot-based logistic train networks in vanilla Factorio.

Introduction

What are logistic trains?
Logistic trains incorporate a smart scheduling system that tells each train to bring materials to stations that request them only as needed. This makes a supplying station available to deliver to any one of multiple requesting stations efficiently and without the need for multiple trains.
This is unlike simple scheduling where a train is set on a fixed path to deliver only to certain stops. Regular trains set to empty contents at a station will also stay at the station until fully empty. This lowers overall throughput and sometimes makes adding queues before a station necessary. Regular trains are also prone to suffering long loading times at a supplying station if the station cannot keep up. Of course, a time limit condition can be set, but this in turn leads to the train running continuously which causes additional problems.
With logistic trains, they are automatically sent to a requesting station low on materials, empty their contents as fast as possible, and immediately return to an available supplying station.

Uses for logistic trains
Using logistic trains makes expanding a base easier and can save you from a headache in the long run. New mining outposts are automatically connected to the network and can be requested from anywhere within it. Repairs can be requested by a distant station such as artillery outposts and a train containing materials can be sent automatically.

Why bots?
Bots eliminate the need for belts, which in turn removes the need for belt planning and allows more compact builds. More importantly, unlike belts, bots have an essentially unlimited throughput through speed upgrades and adding more of them to a network.

Can I use belts?
Unfortunately, some core design mechanics in this guide depend on the function of logistic chests that will not work with belts.

Disclaimer and Prerequisites
This guide does not contain any blueprints. Its purpose is to teach fundamentals so you can expand on that knowledge and make your own builds which suit your needs. A very basic understanding of logic circuits and how they work in Factorio is necessary. All trains are assumed to run in one direction using dual tracks. Rail signaling will also not be explained; just remember this basic principle for any intersection: chain before, signal after. The designs in this guide may also not be the most efficient, or there may be errors; if there is something that can be done better please leave a comment below!

Basic Output (Loading) Station

  • This example uses a station which loads only iron plates that are output from a smelting facility.

  • Let’s name the station “Iron – Out”. All subsequent stations that output iron plates will be named the same name. We want a signal output once all the requester chests are filled, which will then enable the train stop with the Set Train Limit option. This signal type can be anything; we will use a train stop icon to represent the Train Limit Signal.
  • This station uses a 1:4 locomotive:cargo wagon configuation.

  • Each wagon has a capacity of 40 slots, and each wagon is loaded by 12 requester chests.
  • Since iron plates stack to 100, in order to fill a wagon each chest should have a minimum of (40*100)/12 = 334 iron plates requested. To make it simple lets round this up to 400. Each of the 48 chests should request 400 iron plates.

  • All of the 48 chests are connected to the input of a decider combinator. The combinator outputs a Signal of 1 if Anything is greater than or equal to 400*12*4 = 19200, or in other words once all requester chests are filled. Remember that the signal type must be the same as the type being detected by the train stop.

  • Before the output from the decider combinator is connected to the train stop, 2 optional features can be added. First, the signal can be multiplied by an arithmetic combinator, which in turn multiplies the total train limit. This is rarely ever used and adds the need to make a queue before the stop, so it is left at the default of Signal*1.

  • The second more useful feature is a set of lights which turn green once the station is ready to accept a train. Both lights are set to use colors and enable only if the Train Limit Signal is greater than or equal 1. This is of course connected to the main signal wire along with a constant combinator that outputs a Green Signal of 1. The purpose of the 4 black signals before the color signal is to prevent the color from showing on the Alt-Mode info on the combinator, which may cause confusion.

  • Finally, the train schedule is set to a simple full cargo condition for the output loading station and an empty cargo condition for the input unloading station.
  • Remember that it is important to place an adequate amount of roboports next to the station as it will be a high traffic area after loading.
  • Below is a reference table for setting the chest requests and decider combinator for 1:4 trains.
Item stack size Requests per chest Decider combinator
50 200 9600
100 400 19200
200 700 33600

Basic Input (Unloading) Station

  • This example compliments the previous one as a station which unloads the iron plates at the input of a factory block for use
  • Let’s name the station “Iron – In“. Remember that all other stations that request iron plates should be named the same name. The train stop will also have the Set Train Limit option enabled.
  • We want to have incoming trains unload their full cargo and leave. However this means there must be a buffer before the station begins requesting another train. This is done by using a mix of active and passive provider chests in a 2a:2p:2a ratio, where the items unloaded into active chests will immediately be used. This leaves a portion of iron plates remaining in the passive chests until the active chests are exhausted. Only when the active chests run empty will items be taken from the passive chests, triggering another train request after falling below a threshold.
  • Why use a 2a:2p:2a ratio of active and passive chests when unloading? This prevents an imbalance of items left in chests that cause issues with unloading. This is explained in detail in this video by Nilaus.

  • Having unfiltered storage chests anywhere in the network will cause the iron plates in the active chests to be siphoned into them. If this is the case, having several storage chests placed next to the station which filter for iron plates will consolidate them to those chests instead, with 4 chests being more than enough. These chests will be used first due to storage chest priority.

  • 4000 iron plates will be unloaded relatively evenly into 12 chests per wagon, leaving about 1333 plates in the 4 passive chests. Having 4 wagons brings the total buffer to 5333 items.
  • All of the 48 chests are connected to the input of a decider combinator. We want the station to call another train when the passive chests begin providing the remaining items. The condition states that a Signal of 1 is sent if Everything is less than or equal 5000. Note that the Everything condition continues to send a signal even when all chests are empty.

  • As with the output station, an arithmetic combinator can be included to multiply the train limit, as well as lights set to turn on when the station is active and requesting a train, in this case yellow.
  • Do not forget to request fuel for the train. Since unloading is usually done at more centrally located factory blocks, I prefer to place refueling requests only at input stations instead of output stations.
  • The unloading station is a very high traffic area, and placing multiple rows of robotports may be necessary for larger factories
  • Below is a reference table for setting the decider combinator for 1:4 trains.
Item stack size Decider combinator
50 2500
100 5000
200 10000
  • An overview of the entire system is shown below. Mining and smelting are done above the output station on top. Once requested, the iron plates are brought down to the input station, where it is used in gear production

Liquid Output and Input Stations

  • Stations for transporting liquids follow the same principles as solids, but are relatively simpler and do not involve bots.
  • For a 1:4 train, each fluid wagon can carry 25000*4 = 100000 units. The 8 loading tanks can each store 25000 units as well, having a total storage of 200000.
  • Each tank is connected to the decider combinator set to 100000, enough for 1 train. Note that the storage tanks will continue to fill even when the condition is met, filling to a maximum of 2 trains worth of liquid, which serves as a nice buffer.

  • At the unloading station, the decider combinator is set to 50000. This will request a train after half of the unloaded liquid has been used.

Advanced Output Station

  • This example uses a station which loads various items from the main base that are brought to any outposts that request a refill.
  • We will name the station “Resupply – Out“. The station supports a 1:4 train: the 1st wagon carries only nuclear fuel; the 2nd carries only logistic bots; the 3rd carries a mix of construction bots, repair kits, etc; and the 4th is empty to receive returning items. Note that it is important to set filters on mixed cargo wagons such as the 3rd one by using middle click.
  • Since the 4th wagon is empty, the train schedule cannot be set to wait for full cargo. Instead, each item has a condition set.

  • The decider combinator is set to Everything = 2. The constant combinator is outputting a Signal of 1 for every type of item that can be loaded, and it is input into the decider combinator. The purpose is to test if ALL of these signals have an output of 2.
  • We can see for every type of item, a decider combinator is testing if there is enough of that item ready in the chests. Any item that reaches its set amount will output a Signal of 1, which is sent to the Everything = 2 decider combinator. This signal of 1 along with the signal of 1 for that particular item produced by the constant combinator will add to 2.

  • As an example, the 1st wagon can hold 40 nuclear fuel. 6 requester chests each request 7 nuclear fuel, which in total add up to 42, enough to fill the wagon. These chests are all connected to the input of the item’s decider combinator to test if they are ready. The combinator is set to output a Nuclear Fuel Signal of 1 if Nuclear Fuel is greater than or equal to 40, otherwise it will output 0.

Advanced Input Station

  • This example continues the resupply network from the previous section.
  • This station and any others are named “Resupply – In“. Note that the train stop has an added condition of Send Circuit Network info. This sends the train limit signal to the train, which in this case is either 0 or 1.
  • Looking at the train scheduling, we want the train to leave if Train Limit Signal = 0 (station is no longer requesting) AND 15 sec of inactivity. This 15 sec buffer is to compensate for fluctuations in the available logistic bots in the network, which is explained later. An added OR 30 sec of inactivity condition forces the train to leave to prevent instances of stalling.

  • The decider combinator is set to Anything != 1. The constant combinator is outputting a Signal of 1 or every type of item that can be resupplied, and it is input into the decider combinator. The purpose is to test if ANY one of these signals has an output of 2.
  • We can see for every type of item, a decider combinator is testing for the threshold of that item. Any item falling below the threshold will output a Signal of 1, which is sent to the Anything != 1 decider combinator. This signal of 1 along with the signal of 1 for that particular item produced by the constant combinator will add to 2.

  • The 1st wagon contains only nuclear fuel. The condition of the inserter is set to enable if <6. The corresponding decider combinator set to if Nuclear Fuel <1, output Nuclear Fuel Signal of 1. In other words, about 6 items will be unloaded every resupply and falling below 1 item will trigger a new resupply.

  • The 3rd wagon contains a mix of various items to be resupplied, so filter inserters are used to unload each. Each inserter and its corresponding decider has its own condition as explained above. Note that each storage chest is filtered for exclusivity. Inserter stack size can also be overridden for more even loading. The additional inserter moving repair kits into the roboport is completely optional.
  • In this isolated view of the circuit dealing with all items other than bots, note that none of the inserters and combinators are connected to their corresponding chests. How are the number of items being read? In the robotport menu, the Read Logistic Network Contents option is enabled (see image in next section). This roboport is therefore reading the items in the entire logistic network. Using this roboport, we send its output to all of the inserters as well as the decider combinators for each item. Using this method, the chests should be left unconnected to the circuit or else item counts will be doubled.
  • The 4th wagon accepts various items that are ready to be brought back. In this example, the 2 chests are filtered for electric miners and speed modules that are no longer needed at a mining outpost.

Advanced Input Station – Bots

  • An explanation of how bots are managed deserves its own section. The complexity lies in automatically determining the amount of logistic bots required in a particular network, which is done by buffering the fluctuating amount of remaining available logistic bots.
  • In the roboport, Read Robot Statistics is enabled. We have designated signals L and C for the TOTAL logistic and construction bots in the system, respectively. X and Y will be designated for the AVAILABLE logistic and construction bots, respectively.

  • Management of the construction bots is simple. Above is a view of the isolated circuit. In this network we want 50 total bots supplied, with the threshold for refills at 25. This is done as explained in the previous section. Note that the placement of the roboport requires a chain of 2 stack filter inserters, since using a long inserter is too slow. The stack size is overridden for even loading.

  • For logistic bots, let’s say we want to maintain a range of 50-100 available bots in the network as a buffer. In a typical network, the number of available logistic bots tend to fluctuate and may dip down to 0 during peak activity. Since we do not want to request a new train every time available bots fall below threshold for a split second, we need to buffer the detection time. 30 sec should be a good amount to determine if more bots are required.

  • Above is an expanded view of the isolated circuit for easier viewing. Since we want an upper limit of 100 avaialble bots, the inserters are set to enable if X<100. Note that in this case the inserters are not filter inserters since the 2nd wagon of the train only carried logistic bots.

  • When the available bots fall below 50, we want to send out a signal. We will name this Signal A, which is sent to the input of an arithmetic combinator with the condition of A*1, output A which will serve as the clock. Important to note is that the output of this arithmetic combinator is connected back into its input.
  • Here is an explanation of how the clock circuit works: Signal A is initially a value of 1, so 1*1 = 1Signal A is being output and looped back into the combinator in addition to the original Signal A of 1, resulting in 2*1 = 2. Therefore signal A will increment by 1 for each game tick.
  • A common mistake is to use A+1 instead of A*1. Using A+1 will result in 1+1 = 2. And on the next loop it will be 3+1 = 4. As we can see, this signal increments by 2 instead of 1 each game tick.

  • Signal A will begin to count up as soon as available bots fall below the threshold. We complete the circuit by testing if Signal A is greater than 1800, then output Logistic Bot Signal of 1. Since a game running at 60 UPS has 60 ticks per IRL seconds, 1800 is the equivalent of 30 seconds which is the buffer we chose.
  • Finally, don’t forget to output the logistic bot item signal into the train limit combinator.

Deadlock Prevention

Logistic trains operate in this manner:

  • An empty train seeks and goes to the nearest available output station of the material type it is designated to.
  • The train is loaded at the output station, and it either parks at the station because no input station is requesting, or it seeks and goes to the nearest available input station.
  • The train unloads at the input station, and it either seeks and goes to the nearest available output station again, OR it cannot find an available output station and stalls at the input station.
  • We can immediately see the issue here which will lead to a deadlock. Not having enough available output stations providing the designated material will prevent its trains from returning to them.
  • The solution to this problem is simple: always have more supply than demand! For example, make sure your mining operations are keeping up with consumption. Adding an extra crude oil outpost may be enough for a single train to alternate between them if 1 of them is not available yet. Also remember to never have more trains than output stations for a particular type of material.
This guide about was written by Mozartichoke. You can visit the original publication from this link. If you have any concerns about this guide, please don't hesitate to reach us here.

About the author