Factory Town

Factory Town

33 ratings
Logistics and Computing
By Riccento
A one-stop guide for how to use Factory Town's Logistic and Compute blocks, complete with some basic logic circuits you can use yourself.

In regards to 0.153 I am currently involved in a university project and will have limited time to update guides, I will make changes when I can.
2
2
2
   
Award
Favorite
Favorited
Unfavorite
Preface (Optional Read)
Note: I will be improving this guide over it's lifetime, such as reducing wordiness or including better images. Everything in this guide is accurate as of 0.148 (the changes from previous verions have mostly fixed bugs related to compute blocks but do not impact the core mechanics discussed here.)

As someone proficient with logistic blocks but entirely intimidated by compute blocks, I noticed a lack of any sort of walk-through on the subjects. There is an in-depth video guide on logistics blocks by Sampstra Games, however I had some issue accessing the video through steam. This guide will cover the basic function of logistics blocks, but if you would like to see some practical examples and problem solving, check the video out here:

Or check out their channel here for videos on early access strategy games:
https://www.youtube.com/channel/UCksg1ApbNOYyxMmTcNKjwlg

To Sampstra, I hope you don't mind the plug, I did subscribe to your channel as compensation :)

In any case, I am now fairly confident in my abilities to use compute blocks, and I hope that this guide allows you to say the same.
1. Logistics Blocks
This section will only cover the basic functions of Logistic blocks for now. While the game offers some straightforward instruction on how to use logistics blocks, these tools will be covered in the interest of being thorough. If you would like to see some actual designs using logistic blocks, check out the video by Sampstra linked in the Preface above.
~ Barrier Gate
Pretty much does what it says; will block all worker/item movement along a designated path/conveyor, respectively, while active. No filter.

~ Rail Stop
Also self explanatory; designates a stop as an instant loading or unloading point for minecarts. No filter, but minecarts can be filtered.

~ One-Way
No surprises; restricts movement along a path to a single direction. Useful when multiple transport units are operating on congested routes.

~ Sorter
Will force filtered items from a conveyor into a buildings inventory or adjacent conveyor, but can get jammed if the destination is full.

~ Pusher
Similar to a sorter, this block redirects filtered items to a building or separate conveyor but will allow them to pass through if destination is full.

~ Grabber
Will pull filtered items from a target building onto a conveyor at any elevation the building occupies. Can even pull water from a well.

~ Splitter
Diverts items onto adjacent conveyors or into adjacent buildings. Useful for allocating fuel between multiple buildings.

~ Blocker
Prevents specified items from passing through. Acts as a blacklist (everything but this.)

~ Filter
Only lets specified items through. Acts as a whitelist (only this.)

2. Compute Blocks
Honestly, this is the real reason you came here. While the game offers some information about what these blocks do, many players will have a hard time figuring out how to actually use them in their factories. These blocks are covered in their cataloged order, with examples that become increasingly complex.
~ Toggle
The primary interface between a user and a logic circuit. Alternates between an on (value of 1) or off (value of 0) output that can control multiple logistic or compute blocks, such as barriers or lamps, when supplied with any new input. Can also set other compute blocks states to active or inactive. To use, select the toggle, then right-click on the target block. The barriers below each open when their toggle is active and close when their toggle is inactive:

~ Inventory Sensor
When active, detects how many items, filtered or otherwise, are present in a target block/buildings inventory, and outputs that number. To use, select the inventory sensor, designate a target building's offset by right-clicking (set to the first click by default), then right-click on the target block. In the world below, the top sensor opens the barrier when an item is in the silo and closes it when the silo is empty; the bottom sensor trips the toggle with each new item added or removed, opening and closing the barrier accordingly:



Note: the sensor can sometimes be tripped if an item passes through the block it is outputting to. This was difficult to replicate, so it's probably a rare occurrence, however it did happen when gathering screenshots.
~ Bool Function
When active, provides an on (1) or off (0) output to a block based on its set logic function and inputs. To use, select the bool block, then right-click on the target block:
  • And Gate
    Outputs a 1 if all inputs are active; otherwise, outputs a 0:


  • Or Gate
    Outputs a 1 if any of its inputs are active; otherwise, outputs a 0:


  • Not Gate
    Outputs a 1 if any of its inputs are deactivated (i.e. a silo is emptied), and outputs a 0 if any of its inputs are activated (i.e. a silo receives an item):


  • Nand Gate
    Outputs a 0 if all inputs are active; otherwise, outputs a 1:


  • Nor Gate
    Outputs a 0 if any inputs are active; otherwise, outputs a 1:


  • Xor Gate
    Outputs a 0 if all inputs are the same (i.e. all silos are empty or all silos have at least one item); otherwise, outputs a 1:
~ Agent Trigger
Similar to the inventory sensor, this block is triggered when an item, filtered or otherwise, enters or exits a tile, and gives an output of 1. Once triggered the output value will be constant, and the block must be reset, the means of which will be addressed later with the Logic Set Block. However an update will be sent with each item that passes. To use, set the target offset by right-clocking, then right-click on the target block.

~ Logic Lamp
A block that lights up whenever it has a positive input, and gives an output of 1. To use, set it as the output of another block, then, if necessary, right-click on the target block.

~ Logic Set Block
This block redirects its input as an output to another block without changing the targets activity or output. To use, set as the output of another block, then right-click on the target block. The circuit below is a basic detection system:



Here's how to make it, if you're following along:
First, the toggle on the lower left turns all blocks on or off, acting as a power switch (toggle to left set block, to And gate, and to agent trigger.)
The left set block runs into the upper toggle, which acts as a reset line for the trigger and lamp (toggle to lower set block and to lamp.)
The lower set block controls the agent trigger state, and has inputs from the reset toggle and the And gate.
The agent trigger detects items on the conveyor above it and sends output signals to the lamp and the upper set block.
The upper set block sets the reset toggle to on, meaning the system is primed for reset once the trigger is tripped.
The lamp only outputs to the And gate, acting as its second input.
The And gate outputs to the lamp while comparing the inputs from the lamp and power toggle, and both turns the lamp off when the power toggle is switched off and prevents the lamp from being switched on when the power toggle is switched on.
~ Logic Pusher Block
This block forces its target to send its output without modifying the block itself. In essence, the logic pusher makes the target block repeat its output without changing the state or the output. To use, set as the output of another block, then right-click on the target block. In the system below, a toggle is connected directly to a lamp, while a tripped agent trigger, also outputting to the lamp, is connected to a toggle via a logic pusher block. Even if the first toggle switches the lamp off, the second toggle forces the trigger to switch the lamp on again, even if nothing has tripped it:

~ Counter Block
A number display block that increments by 1 for every time it receives an input and outputs its stored value. To use, set as the output of another block, then right-click on the target block. In the setup below, the toggle to the left activates the counter while the toggle at the right end resets the counter:

~ Number Block
A number display block that displays and stores the value of its input, and outputs that number. To use, set as the output of another block, then right-clock on the target block.


Note: this block does not store fractions or decimals. Saving the decimal part of a number requires the use of math blocks, which are covered next.
~ Math Block
A block whose output is the result of a math operation on the value of its input to its stored value; for equation operations the output is 1 if true and 0 if false (i.e. 17 > 10 yields 1.) A value can be manually stored or automatically stored using a set block. To use, set as the output of another block, and right-click on the target number block. Below is storage readout using math blocks:



First, the inventories of all barns are added together and displayed in the center (the top pusher blocks are connected from their respective inventory sensors to the leftmost number block to force the system to update.)
Next, the circuit on the right activates lamps according to the sum's relation to the target value (200 in this case.)
Finally, the blocks at the bottom divide the sum into its respective digits and displays them on separate number blocks.

Note: the modulo function outputs the integer modulus (remainder) of a number after it is divided by the stored value. Thus, 145 divided by 10 is 14.5, whose modulo 10 is 4.5, or 4 (14.5 modulo 7 would be 0, since 7 divides 14 evenly with 0.5 remaining, which is truncated to 0.)

To save decimals, such as with 12 / 7, first multiply the numerator (top number) by some power of 10, like 1000. Performing the operation 12000 / 7 yields ~1714; by using the digit splitting technique shown above you can have some number blocks display the result as 1_714, where the 7, 1, and 4 are in the tenths, hundredths, and thousandths places, respectively.
~ Signal Gate
A block that relays its input as an output, but only if the gate itself is activated by a logic set block. To use, set as the input of some desired output and of a logic set block, then right-click on the target block. The lamp below is dark since the gate through which an output is sent is closed:



Note: if supplied with 2 or more simultaneous inputs that aren't passed through a set block, the gate will relay all inputs, but in an unpredictable order. The block doesn't appear to favor inputs based on input value or the distance to, position of, or age of the input block.
~ Timer Block
A block that stores its input and, after a specified time delay, sends the value as an output, and can also be used as a clock to track factory production rates. To use, set as the output for the desired source block, then right-click on the target block. Below is a logic circuit that tracks items gathered per minute:



Thank you for your patience on this.

Only 1 toggle will be the input; connect this toggle to the pusher and the set block between it and the timer circuit, as well as of the timer blocks.
For the timer circuit connect the 4 outer tiles in a clockwise fashion, then the gate blocks into the center counter tile. Set the timers to 1, or 1 second.
Connect middle set block to the gate tiles.
Make the following chain: pusher > dummy toggle (leave off), dummy toggle > upper set block, set block > counter. This will reset the timer when you switch the circuit off.

The left circuit is as follows: agent trigger > counter, counter > x60 math block (conversion to minute), math block > division block, division block > number display (can be dissected as described in the math section.)
Now run the timer counter block into the adjacent set block, then the set block into the division math block.

Basically, the power toggle turns on the timers, which alternate powering each other on and off while activating the counter. The agent trigger line counts the items generated and defines this in terms of minutes. The division block then divides by the time and returns a rate.

Note: the timer block has a possible value of 0, which seems to match the frame rate of your computer (could be the tick rate, I'm not a tech guy), which will run faster if there's less going on to chew up cycles. I tried to make a timer that implemented this, however the rate was very unstable. It might still be useful, but this is beyond my expertise.
~ Delta Block
A block that relays its stored input if it is different from its current value, but not if it is unchanged.
To use, set as the output for the desired source block, then right-click on the target number block. Below is a timer that resets once the target time is reached:



Thank you for your patience.

Follow the timer circuit schematic in the previous section.
Create the following chain: Counter > math block (equals or greater/equal), math block > delta, delta > power toggle.
Finally run the set block from the reset line into the delta block.

The math block compares the timer with the target time in seconds (1 hour is 3600 seconds.) While this happens, the delta block is fed a series of 0's, which it stores but does not relay, since they are all the same input. Once the threshold is reached the delta block is fed a 1, which it sends to the power toggle, switching it and the circuit off.

Notice that the delta block is set at 1 for true, and if the timer is started up again it will be fed a 0, which will trip it again and disable the timer. For this we run in the reset line to change its value to 0 so that the series of 0's is unbroken upon restart.
Closing Remarks
I hope you were able to master both Logistic blocks and Compute blocks after reading this walk-through. If you have any constructive feedback or questions, feel free to address me below in the comments. Consider liking or adding to favorites if you found this helpful. :)

Also feel free to check out my guide on a compact 100 house hub for 0.144a.
8 Comments
Slime Prestige VI Jul 20, 2024 @ 2:09am 
toppop3

If you use a fluid pipe connector to take out of the tank, then you can connect that to the underground pipes while also being able to turn it off.
toppop3 Jul 18, 2024 @ 5:07pm 
Decent, well-thought out with examples. I'm sure if anyone reads this AND takes the time to "playground" the example (using admin mode or just open play) they will gain a good idea of how to use these admittedly obtuse and not well documented logic blocks.

I have come across the case that I find no comment on here, nor elsewhere in the community posts (perhaps I overlooked it?)

My issue is the problem of interfacing with underground/above ground components. For example I have an underground pipe supplying other buildings from a silo holding fish oil. I have an underground pipe from the silo and simultaneously occasionally feeding caravans. I'd like to stop the underground pipe from carrying the oil unless a certain quantity of oil is over a fixed amount. In my case the pipe should be "on" only if the silo contains more than 64 units of oil.

Do you have any insight on this issue without using above ground pipes for distribution?
Riccento  [author] Jan 12, 2022 @ 4:06am 
Much appreciated! Glad it is still of some use
JawssTech Jan 12, 2022 @ 3:34am 
This Logic Block section is nearly two years old and stands the test of time. The information was relevant and just what I was looking for. I'm not sure whether I've found a comparable guide anywhere else. Please accept a steam point award for your good work.
Qwazzy Nov 24, 2021 @ 12:36pm 
Ehhh, adding my own two cents, I don't really agree at all with what Eternal's saying. Phrases like the ones they called out before are normal and not bothersome at all. The only problem would be is if something that was "self-explanatory" actually wasn't, and I didn't catch anything like that when perusing this guide. I dunno why it bothers them that much.

To be fair, I still don't think I'll be using the computing blocks much. It's never been my strong suit in games like Factorio either. In my first completed savefile of Factory Town I used the computing blocks pretty much for one thing, which was outputting supplies from a barn to sell at market only if the barn's inventory was greater than a certain amount, that way I could keep some on hand for building new structures and whatnot.
EternalClimb Jul 1, 2021 @ 7:48am 
Just as a note.
If you like to put jokes in a guiding text, stick to good ones and place them after the informative part.
Because, case with guides is people recourse to those multiple times and it is not fun to stumble over same 'comedic' notes again and again.
Riccento  [author] Jul 1, 2021 @ 3:44am 
Comedic relief, I suppose.

As stated in the preface, there isn't / wasn't a written guide for the logistics blocks, only a video that I couldn't access through steam (the actual video is quite thorough, so I made sure to reference it). Many logistics blocks are self explanatory, but only covering the confusing ones didn't make sense to me. And rather than make 2 separate guides, I lumped them together.

I trust this to be satisfactory.
EternalClimb Jun 30, 2021 @ 10:35am 
" self explanatory"... "Also self explanatory".. "not surprisingly"
Why would you make a guide on apparent thing? Just filling the text with useless words?