Friday Facts #88 - Combinators

Posted by Robert on 2015-05-29

This week's Friday Facts is brought to you by Robert, also known as that guy from Romania. I'll be talking a bit about the feature I've been working on: the Combinators.
The post is very fresh: Albert worked overnight to bring you the awesome combinator graphics and I integrated them in the game just minutes ago.

The circuit network

The combinators are new entities that connect to the Circuit Network. As a quick reminder, the circuit network is a network you create by connecting entities using red and green wires. The information on the network is just a list of items and their count.
Before, only the Smart Chests and Smart Inserter were connectible to the circuit network.

The plan is that many more entities will be connectible to the Circuit Network and with the help of the Combinators, you will be able to have more control over your factory.
Here are some entities that are planned to be connectible to the Circuit Network:

  • Lamp (can be turned on and off or show colors)
  • Power Switch
  • Accumulator/Substation
  • Storage Tank
  • Train Station(to control where your train is going)
  • Gate

The circuit network has been modified a bit. You can now connect wires directly between entities. Also every time you connect both red and green wires to an entity, their signals are summed inside the entity and this sum is considered the "input".

The combinators

So these combinators, what do they do? They manipulate the signals on the Circuit Network. At the moment there are 3 types of combinators:

  • Arithmetic Combinators
  • Decider Combinator
  • Constant Combinator

Arithmetic Combinator:

It has an input and an output. The input and output have 2 independent connections(red and green). It can preform the basic arithmetic operations (+, -, /, *) on the specified signals.

In the first example, it will sum the number of Copper Ores on the signal with the number of Iron Ores and output this sum as Red Science Packs. You can later use this signal to make other decisions.
The second parameter can also be a number, as seen in the second example.

Decider Combinator:

It also has an input and an output. It's functionality is similar to what the Smart Inserter did before. It can compare item signals.

In the first example, if the number of Electronic Circuits is less than the number of Advanced Circuits it will send a green Science Pack signal with the count of 1.
In the second picture, the steel plates are sent to the output only if there are more than 5000 of them.

Constant Combinator:

This one is simple. It sends the specified signals with the specified counts. It acts as a smart chest, without having to put the items in it.

The advanced stuff

Most of the basic stuff can be done easily, but let me show you how the combinators can be used to make more advanced things like logic gates, memory cells and timers.

Many people wanted to be able to make logic gates with binary signal. It's actually easy to do it. For example, we can say that red Science Pack is our "true" signal. One red Science Pack means true, zero red Science Packs means false. Our 2 input signals can be the red and green wires. Remember: every time you connect both red and green wires to an entity, their signals are summed inside the entity and this sum is considered the "input". Keeping that in mind, this is how the logic operations are implemented:

ANDORXORNOT

One neat thing we can do is connect the output to the input. Using this we can make a memory cell.

A memory cell has a set and a reset signal. In our case the set signal is red Science Pack and the reset signal is green Science Pack. The output signal is red Science Pack

By making a loop from the output to the input, the signals are summed and count up very fast. This way, we can make a timer.

The lamp you see is a small experiment with a type of lamp that is more visible when connected to the Circuit Network. See the video below :)

Conclusions

It may not be obvious at first, but these combinators can really do cool things, especially after many more entities become connectible to the Circuit Network. For example:

  • Have "progress bars" made from lamps that visually show how many resources you have in storage
  • When you need some items in a mining outpost, you can put those items on a circuit network and your main base will fill a train with those items and automatically send the train to the outpost.
  • You have 4 oil extraction outposts. You can have a signal showing how many resources each of your outposts has. The loading train will be automatically redirected to the outpost with the most resources.
And speaking of nice setups, here is a "Factorio" scrolling led sign I made using the combinators.

Now I am really looking forward to see what crazy things the players will make.

Rate, comment, or suggest better names for the combinators at the forums.