Barotrauma

Barotrauma

Not enough ratings
About the Circuit Box!
By utoto
Wiring components can be tough, especially with interconnected complex systems. It's easy to get lost in your own creations, as the number of components and wires rise. I'm glad we can all use Circuit Boxes, because wiring never looked as good as now. Let me show you how to use it.
2
   
Award
Favorite
Favorited
Unfavorite
A word about wiring
Note: Skip to the next section if you're used to wiring.

Circuit Boxes are all about wiring, and if you're not familiarized with components and wiring, I suggest reading this[barotraumagame.com] and this.[barotraumagame.com]

Barotrauma's electrical equipments pass information through signals. They can be non-zero (any numbers or characters), zero, or simply nothing. In order to know what to activate or deactivate,
boolean algebra[en.wikipedia.org] is used. It means:

  • 1 signal (non-zero) is read as true.
  • 0 signal is read as false.
  • No signal means it will not go through the component (read or sent).

And with boolean algebra, algorithms[en.wikipedia.org] can be built. Consider the following schema:

While a motion detector is detecting someone the door will be opened. Otherwise, it will stay closed.

A motion detector[barotraumagame.com] has a state_out pin that will send 1 (true) if a target is detected, or 0 (false) otherwise. We can link this to a door[barotraumagame.com] set_state pin, that will set it to open when a 1 signal is received, and to closed when a 0 signal is received.

No motion detected (0) -> (0) Closed door state
Motion detected (1) -> (1) Opened door state

Logic[barotraumagame.com] and Misc[barotraumagame.com] components are going to aid the creation of more complex circuits. For example, a Relay[barotraumagame.com] can be added to the schema above in order to deactivate the automatic system if a flood is detected[barotraumagame.com] in the rooms from the left and[barotraumagame.com] the right.

As for all the electrical components, their pins will be separated vertically. Pins of the left side of the board are called input pins, and the ones to the right are output pins. This means the pins to the left are the parameters to be fed into the component, and the right pins are results. A greater than component, for example, will check if the signal fed into the first input pin is greater than the signal fed into the second input pin. The result (1: it is greater, 0: it is smaller) will be sent into the output pin.


image source: https://barotraumagame.com/wiki/Greater_Component

The key to wiring stuff is to get to know what each installation[barotraumagame.com] and component[barotraumagame.com] offer and how they can be manipulated. You can start by following a step-by-step tutorial to get the hang of it. And, for that, I suggest opening the sub editor, loading a default submarine and following this very well written and comprehensive tutorial on automatic reactor control: https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2903538256
Understanding what it is
A circuit box[barotraumagame.com] is an electrical component that serves as a container of wiring components[barotraumagame.com] that will be placed and connected between its input and output pins, allowing the creation of complex electrical circuits without losing your mind in the process. It takes 2 plastic, 4 copper (2 with Submarine Of Things) and 4 tin to craft it in a fabricator[barotraumagame.com] with a minimum of 35 electrical skill.

As an electrical component, it has 8 input pins and 8 output pins.


image source: https://barotraumagame.com/wiki/Circuit_Box

For the Circuit Box, input pins will carry signals from external electrical components (e.g. the Fuel_Out from a Reactor) to be used from inside and output pins will deliver a processed output to be used by external electrical components (e.g. Fuel_Out divided by 100 to a Text Display).

As a container, it can be opened. An empty Circuit Box will look like this:



By adding more components and wiring them, it will look like this:


image source: https://barotraumagame.com/announcements/coming-next-week-treacherous-tides-update/

If used in-game, you will have to have the components in your inventory, or FPGA Circuits[barotraumagame.com] that can become any component inside of the box. In the sub editor, every component will be ready to be used.

In summary: A Circuit Box takes 0 to 8 inputs, process them from inside, and distributes results to 0 to 8 outputs.
Understanding what it does
Consider the following circuit I built for my custom submarine:



This system was created to remotely control, or for the sub to be remotely controlled by, a second submarine that is connected through a docking hatch.

It first needs to verify if both are connected, then check which has control over the other, and then finally broadcast or receive coordinates. Also, by pressing a button of the terminal, it should take control over the other. It works, but I, myself, can't tell where it starts or ends. Without following the wires, I can't even tell what half of these components are doing there!

It doesn't sound good, right? Well, it gets worse. The second submarine will also have to have the same circuit around, and some inputs from outside the circuit are used for more than one component. It's a nightmarish thing to organize and maintain, and so much trouble arises from adapting where things go.

But that was before the glorious Circuit Box:



Hey! Now I can tell those Wi-Fi components are the ones I am receiving coordinates from and the ones I'm sending. No magic involved, though. The system is still inside of it, but now it's way easier to tell where inputs go and where the full processed data is.



You can even add labels to explain your inputs, outputs or whatever you think needs explaining.

And from the outside, even though some inputs can be used more than once (like the first input pin from the image above), when wiring it will only be done once! I even took out the both connected step into another box, because it can be used in more than one place and in both submarines.



In summary: Circuit boxes allow one to create contained circuits, where inputs and outputs are well-defined, in contrary to how arranging components in the open are. It makes it better to maintain and to reproduce it in other submarines.

PS: The coordinates aren't being sent through two different Wi-Fi channels. One sends the coordinates in the form of Float,Float (e.g. 24,10) and the other one sends a boolean pulse when the "Take control" button is pressed from the terminal.
Understanding when to use it
Some circuits can benefit a lot from circuit boxes. They are:
  • Complex circuits: If a circuit has multiple states, uses single inputs for two or more different components, takes a lot of physical space, or can feed multiple information at once, they basically belong inside a circuit box.

  • "Used everywhere" circuits: Circuits like automatic doors need to be replicated across all doors in the submarine, and even be reused in other ones. In this case, a circuit box is easier to copy and paste, with the extra of being easier to figure out where to connect inputs and outputs. Even simple circuits would fit this one.
But not every circuit needs to be container-ed. They can be listed as:
  • Simple circuits: Additions, multiplications and straightforward stuff don't need to be inside a circuit box.

  • Individual circuits: If a simple circuit is used in only one place, there's no need to transform it into a circuit box.
This is an example of a circuit that really doesn't need to become a circuit box:



PS: If you're wondering what that is, that is a ballast flora detector. I placed an indestructible hidden battery behind each ballast. If there's flora, it drains the battery to zero. This circuit adds the charge% of the batteries, divide them by the number of ballasts of the ship, and verify if it's not 100. If true (it's not 100), it sends a message in the chat for ballast flora infection after 50 seconds (this last part is a circuit box).
Conclusion
Wiring is a core gameplay mechanic of Barotrauma. Whether it's used to fix a beacon station or to power your custom submarine, it's important to understand how it works in order to do great things. It can be as simple as a single wire between a motion detector and a door, or it can be as complex as reactor automation. For the latter, you might get used to a lot of components lying around and when you return back to them later, you will swear you were drunk while making all that.



That's what Circuit boxes are for: Handling complex circuits and enabling replicas. It contains all signal flows inside of it, and displays only what you need to plug in and plug out, which is all you should be concerned about if you're thinking outside of the functionality of the circuit.

And this concludes this guide! You can also check out the submarine I talked about here: https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=3000385617
It's a Joy-Con inspired submarine. Feel free to download it and tinker it as you wish.
3 Comments
Flightless 26 Nov, 2024 @ 8:37am 
Any idea if it helps with loading and fps when dealing with complex circuits?
utoto  [author] 25 Sep, 2024 @ 4:06pm 
That sounds like a wonderful mod! I knew it was possible to copy and paste a Circuit Box if you make a assembly of it and copy/paste it anywhere else, but having a mod to handle this part should make things easier. I'll check it out, thank you for the recommendation :steamhappy:
NightmarishWolf 2 Sep, 2024 @ 5:30pm 
Definitely a plug, but you should check out the mod called "Blueprints" it allows you to save and load blueprints inside circuit boxes instantly as long as you have the components required.