Friday Facts #138 - Better Circuit Network III

Posted by Robert on 2016-05-13, all posts

0.13 release is getting close. The programming guys are trying to finish the features so we can start internal playtesting and bugfixing next week. The art guys are working hard on the new trains graphics.
In the meantime, here's some more information about the circuit network.

Circuit Network Connector Discarded

If you remember my last FFF I wrote about adding a new entity called Circuit Network Connector that would have been used for connecting normal entities to the circuit network. The community had some good examples of why it was a bad idea, so we went back to the way it worked before. This means that you can continue to connect entities to the circuit network directly.

Consistent GUI

One of the problems that had to be solved was GUI interaction. Sprinkling circuit network related GUI elements randomly in the entity GUI looked pretty bad and was hard to understand. The solution is 2 small buttons in the top-right of circuit connectable entities GUI, they will appear when you research the circuit network and the logistic network respectively. Clicking the circuit network icon will open a window that lets you set up how you want the entity to interact with the circuit network. The logistic network button works in a similar way.

The window is usually separated into 3 parts:

  • Connection information: if and what it's connected to.
  • Mode of operation: sets how you want this entity to interact with the circuit network. Tooltips briefly explain what each mode does.
  • Mode of operation settings: various settings depending on the selected mode of operation.

Everyone gets a logistic condition!

The good thing about this GUI separation is that it also allows finer control, so most entities that can be turned on or off by the circuit network can also be turned on or off by directly using a logistic condition. You can now turn off pumps, offshore pumps, inserters, transport belts, lamps and power switches directly using a logistic condition, no new entities required, just click the magic button after researching the logistic network.

Wire highlights

This is something for those who make huge combinator networks. It's really easy to get lost in wires when making complicated setups. Now hovering over entities that have red/green wires connected to them will highlight the wire network.

Accumulators and Transport belts

Probably one of the more interesting entities that can now be connected to the circuit network are Accumulators and Transport belts.
Accumulators send the current charge level, so you can finally easily turn off steam engines at night or activate backup power based on accumulator charge levels.
Transport belts can be turned on or off based on circuit or logistic condition. You can also read the contents of the belt in 2 ways: pulse mode and hold mode. Pulse mode sends a signal for 1 tick when an item enters the belt. Hold mode will send the number of items on the current belt as long as they sit there. Those familiar with combinators will probably figure out that pulse mode is very useful for calculating the throughput of the belt or calculating the total number of items that passed though that belt.
This logic works for one belt tile, not for the whole length of belt.

Performance and how it works [Technical]

Previously, the way the circuit network worked was that every entity that could be connected to the circuit network had all network connection information, circuit conditions, logistic conditions, etc inside of it. That meant that if you had thousands of inserters in your map that were not connected to the circuit or logistic network, some RAM and savegame space was wasted.
This was not really a problem, but if it would have been done the same to all the new entities, especially transport belts, it would have become a problem.
The solution is simple. The relevent data(network connection information, circuit conditions, logistic conditions) is packed into something I call 'control behaviors' (because they tell the entity how to behave when they are controlled by the circuit or logistic network). These behaviors are only created when it's required: when you connect a circuit wire or when you want to set a logistic condition.
This is relevant to modders. Modders have access to these behaviors. To get a behavior instance you call luaEntity.get_control_behavior() or luaEntity.get_or_create_control_behavior(). The second method creates the behavior instance if it does not exist.

TLDR version of all the circuit network changes implemented and coming to 0.13

  • Power switch, which can turn electricity on or off automatically based on circuit condition.
  • You can turn off pumps, offshore pumps, insertes, belts, lamps and power switches directly using a logistic condition.
  • The lamp can change it's color based on circuit network signals.
  • Roboport is connectable to the circuit network. It sends the logistic network contents.
  • Accumulator is connectable to the circuit network. It sends it's charge level as a percentage.
  • Transport Belt is connectable to the circuit network. It can be turned on or off and it can send it's contents to the circuit network.
  • Requester chest's requested items can be set automatically from the circuit network.
  • Inserters can now send the item held in hand to the circuit network. Smart inserter can have it's filters set automatically from the circuit network.
  • Connected Red/Green wires are highlighted when hovering over a combinator or entity connected to the circuit network.
  • Combinators show some information in alt mode, including input and output arrows.
  • More virtual signals.
  • The constant combinator has an on/off switch.
  • New combinator graphics and graphical improvements.
  • Constant combinator can be rotated.
  • All types of inserters can be controlled by the circuit and logistic network, once the respective network is researched.
  • All types of chests can be connected to the circuit network. Smart Chest was removed from the game.
  • Circuit network and logistic network conditions can now be accessed by icons in the top-right corner of the entity's GUI, for all entities.
  • Decider combinator "input count" option makes the combinator copy the count of the specified output signal from the input signals, instead of copying the count from the condition. This might break some setups. https://forums.factorio.com/13706

The plan is to release 0.13 soon. I'll try to get more things ready. The list of plans now is as follows(in no particular order)

  • Mining drill - read the amount of resources remaining, read the Pumpjack resources per minute
  • Gate - Detect if a player is nearby, close and open the gate
  • Train Station - read the contents of the stopped train and control trains by disabling/enabling the station
  • Train Signals - still in the process of designing it. Basically be able to stop trains or see if a train is about to arrive

Czech game of the year awards

Last week some of us went to the Czech game of the year awards ceremony. And good news, we managed to win not one, but two of the four awards. Factorio won Best Technical Award and Best Gameplay Award.


As usual, PM me or reply at the forums for suggestions, complaints and comments.