Description
What is it?
Don't you just hate it when you accidentally connect the red circuit wires belonging to 2 outposts to the same pole and thus messing up your logic?
Finternet to the rescue! Finternet is kindof like the Internet (hence the name), or at least a WAN (Wide Area Network). It sends your data in very short bursts and attaches addresses to it. This way you can have dozens of nodes connected to the same red wire network without getting any data corruption.
How to install
- First plop down the Bus Controller somewhere and connect the medium power pole to your red circuit network. You only want to install one controller, otherwise it'll mess up your system.
- Then place a Finternet Node wherever you have to send and/or receive data or a Receiver Node if you only want to receive data.
- Configure your node. You need to give it a unique address. This is very important. In every node blueprint, there is one concrete tile with a constant combinator on it. The
Yvariable represents the address of that node and should be changed to something unique. - Connect the red wires of the TX and RX poles to the rest of your network. You're now linked up and ready to send and/or receive.
- Connect the red wires of the IN or OU poles to your own circuit logic. IN means data goes into the node (that's the data you want to send) and OU means data that comes out of the node (that's what you receive from somewhere else).
If you want to test the system, place the Node + dummy input + output memory blueprint over the Finternet Node blueprint and forget about step 5, I already did that for you. Turn on the constant combinator with the green signal to send something.
How to send data
You can use any signal, positive or negative, except for the yellow and green signals. Also be very careful with the R signal because that is used to determine the receiving node.
The Finternet Node accepts a burst of at least 1 tick or a continuous signal as input. Do note that only the first 1 or 2 ticks of input are sent. Everything after that is ignored until the node has sent its data. The node starts working as soon as data is detected on the red wire. A continuous signal is only sent once, unless it changes.
In order to get your data at the right location you can set the R variable as the address of the recipient. If the recipient is always the same you can set this variable in the variables constant combinator (the one on the concrete where you set the Y signal). If you set the R signal here it will act as a default so if you send an R signal along with your data it will use that one instead.
How to receive data
That's easy. Incoming data is sent to the OU pole for a couple of ticks. So if you want to save that data you should build a memory cell to store it. Along with your own data the R signal contains the address of the sender so you could send a reply if you like.
Why is it so big?
Well first of all I'm no circuit network magician. There might be easier solutions than my approach. I'm always ready to learn and improve my design.
Secondly, a large portion of the node design consists of making sure the right data is being sent. Because of the way Factorio works it is impossible to prevent two nodes from sending information at the exact same moment. So instead of trying to prevent that from happening, I detect when it happens, and when it does the message is sent again after a random amount of ticks until only one of the nodes sent something.
And thirdly, there's a bunch of filters that convert the input signal to a 1 tick pulse with positive and negative values and it also filters out elements that I'll be using myself (green and yellow signal). So if the rest of your system is designed to only generate 1 tick pulses and it doesn't generate green or yellow signals you could remove all that logic from the Finternet Node.
Credits
While I built this thing, I borrowed some things that I incorporated. So, to give credits where credits are due:
- thank you to the Factorio Wiki users. The Combinator Tutorial was immensely useful
- thank you GopherAtl from the Factorio forums. I learnt a lot from your Combinators 101 post
- thank you phi1010 from the Factorio forums. I used your memory cell to store my data
- thank you DaveMcW from the Factorio forums. Your Random Number Generator is the reason my Finternet Node keeps sending data after having messed up