Introduction to Electrical Engineering with the Video Game Rust

 Introduction


Rust is a widely known video game loved by many fans for its unique always-on PvP and unforgiving raw human interaction. Rust also includes realistic aspects of electrical engineering which makes it a perfect medium as a tool to engage others in learning a topic that may otherwise appear daunting. In marketing, relatability lowers the barrier of understanding, similarly to how Minecraft Education version taught the basics of physics and chemistry, or basic finance principles can be taught through Monopoly.


Rust, Created by FacePunch, 2013.


Using a video game as the medium as opposed to a more traditional approach such as diagrams or circuit kits is intended to demonstrate the concepts in a fun and interactive setting that anyone reading this could try themselves at home. This guide will introduce you to some basic concepts such as circuits, XOR gate, switches, and various components. This guide is not intended to replace learning about theory and safety of electricity.


Understanding the Parts

Electric circuits are the interconnected systems of components that create pathways for electricity. The combination of components performs specific tasks such as powering a light fixture. I will discuss the different components; although not exhaustive, these are the main set of tools used for basic tasks and functions.


Basic Circuit with Split outputs


Switches

Besides the basic switch which functions as a gate to stop or allow the flow of electricity, the other switches are used more often for advanced logic and functionality. The following list below is ordered by the layout of each switch/gate as shown in the image below respectively. 

Switch: The switch is a toggle to open or close a circuit manually.

XOR Gate: This will only allow electrical passthrough when it receives exactly one input. An example will be demonstrated later.

OR Gate: This will output power when any input is active. An example would be a set of multiple sensors around the base, set to tool cupboard authorization only, therefore when someone not authorized walks past any one of the sensors an output signal is sent. This could be set up to a turret and door, or perhaps just an interior light allowing the residents of the base to know someone is outside.

AND Gate: This will only output power when multiple outputs are active, such as a direct power source and a separate manual switch.

Timer Switch: This will allow electrical current to pass through for a set amount of time. This can function as a gate or a standalone switch depending on the purpose.

Splitter: This item divides the signal in three. The power is divided equally between the three channels. To delegate power distribution, a splitter in conjunction with an electrical branch would be necessary.


Example of Switches and Splitter


Components

Although there are many electrical components, the important three are a branch (black), a root combiner (red), and a memory cell (green). The RAND switch (orange) and the blocker (blue) are for more complex setups.

Electrical branch: This is the most important component. It is easy to wire directly from a battery to a switch, to the items you want to power. However, addressing the different power demands is made possible by the configured power allocation properties of the electrical branch. This is a simple version of adjustable voltage dividers, power distribution units (PDUs), or programmable logic controllers (PLCs).


Circuit Load Distribution

Root combiner: a root combiner joins two root electrical sources into one output. If the power demands of your circuit exceed the power output of your electrical source, a root combiner can increase the power output by combining multiple sources such as two solar panels. This tool can be daisy chained to link more than two power sources with a branch and an additional root combiner. It will take one additional root combiner for every root electrical source greater than two because one of the inputs is the previous combiner. As a note, the branch output cannot exceed 100, and the unused output must either be wired into a dead loop or set as 0 output. To exceed 100, use a splitter in addition to the previous steps to increase the maximum  value to 300.

Memory Cell: The simplest explanation of this component is that it stores and holds a state based on its input signal. It is essentially a T flip flop. To be exact, it’s a D-Type Flip Flop. Imagine power going into two output nodes. The first input allows node 1 to send an output and node 2 remains off. When the input is sent again, node 1 remains off, and node 2 now sends an output. 1_0 -> 0_1. In a later example, the memory cell is used as a denouncer, meaning it stabilizes the signal by aligning it to a clock. This same process would be used in real security systems.

 

Example of Components


Power Sources

Power sources are the items used to generate power for the system. These are then stored in some manner. In Rust the only option for storing power is through batteries. In real life, there are countless methods of the storage of energy from batteries, to supercapacitors, to more mechanial methods such as pumped hydro storage or compressed air energy storage (CAES). 


Generators of Power


There are three sources of power generation in Rust. The two shown are the main produces of energy in the game and change to their environment. The third is not shown becuase it's a generator and is powered by fuel. The wind turbines power output is significantly higher than both the solar panel and a generator, however it is limited based on the available wind and the height it is placed. The solar panel only creates power in the daytime and is limited to the strength of the sun and the angle of the solar panel. A circuit may function directly from the power source to the circuit; however, a battery is necessary for the regulation of power such as when no power is being generated by a solar panel at night.


Small, Medium, and Large Batteries


Applications and Circuits

Quickly look at the different examples of outputs for electricity. All demand a different level of electrical output, and not all are constantly running. The non exhaustive list includes lights, sprinkler, turrets, water purifier or pumps, or fun items like the disco ball and boombox. The electricity demand of a small blue light will be much different than a turret powering the automation of player elimination. Circuit priority is crucial for both power allocation and for separating circuits for their intended purpose. Using a light switch as the passthrough for your turret would leave a turret that only works when the light is on. No good...


Output Devices


This is the simplest circuit you could make. It includes a suspended lamp, a simple switch, and a small battery. The battery has a charge but does not have a way of generating more power once it is used up. In this circuit the charge of the battery is blocked by the switch until the switch is turned on, allowing the electricity to go the lamp and illuminate the bulb. The reason a traditional circuit board is more effective in teaching this concept is the part you can’t see finishing the loop. The wire goes through the components and then back to complete the circuit. If the circuit were not to be complete, then the light would not turn on regardless of the switch being on. In this instance, turning off the switch disconnects the circuit, therefore stopping the circuit from being complete.


A Basic Circuit

Now that you understand a basic circuit that turns on a light, there are many ways this could be more complicated (and useful). Firstly, adding a power source is essential to not run out of power. A solar panel can be wired directly to the battery. A larger battery will replace the small battery to allow a higher power output. To increase the efficiency (and save the planet), a timer set in seconds for the duration of the night cycle would give light only when its needed. Additionally, a proximity sensor (in the same circuit later than the timer) would provide light both only during the night cycle, and in the presence of a player. This could either be achieved with a blocker to stop the output of the timer when the proximity sensor is not active, or an AND gate that would require both the timer to be on and the proximity sensor to be active.


HBFB Door Closing Circuit

Now let’s make a more complicated circuit. This circuit combines automation and security. No more strangers going  “deep” and stealing all my hard-earned loot. Let’s shut the doors before they even have the chance.

What you will need for this setup: at least one door, a door controller, three branches for power output and power delegation, a memory cell for the memory state of the door being “closed” as to not accidently allow the circuit to be triggered into opening the doors, a XOR gate, an indicator light, and a button to reset the circuit via the memory cell. Lastly you will need some mode of detection. In this example I use an HBFB sensor that has a constant state of 0 until visual of an unauthorized player is detected. The “whitelist” is controlled by the radius tool cupboard and updated automatically via authorization of the tool cupboard.

The setup can be easily daisy chained by attaching the door controller outputs in a string before attaching it to the branch that is controlled by the output of the memory cell.

The circuit functions in the following order: the power is created by an external solar panel. The electricity is then funneled into a medium battery. There is no switch, so the power is sent directly to the first branch. This branch sends 98% of the power out to the second branch and 2% (the required amount) to power the HBFB sensor. 1% powers the HBFB and 1% passes through to the memory cell under the “set” derivative. In the second branch, 2% is wired in the input of the XOR switch, and the rest into the power input of the memory cell. In the memory cell there is still an inverted output (node 2) and , output (node 1), the reset, and the toggle. We will only need the reset and inverted output. The reset is wired to the button. The inverted output is wired to the third branch. We use the inverted output because this ensures the state of closed for the door for memory value and is the opposite input we need for the second input of the XOR switch. Power out is sent to the door controller, branch out is sent to the XOR switch. The XOR output is sent to the laser lights (which would indicate the circuit being on). If the default position of the door is to remain open, this would also indicate that a player has tripped the wire and is either trapped or outside the base and the door is not closed requiring the reset button to be hit.

This setup could be used to trap players intentionally if the sensor was placed inside with an open door inviting them in. Replacing the light sensor with an additional door and controller with a turret behind the door would automatically eliminate the player. With an item called the “smart alarm”, wiring this to the XOR output (and a splitter so you can have multiple XOR outputs) would even allow you to push a notification to your phone that your free loot has just arrived in your base! A timer set at the length of server loot despawn would allow the doors to automatically reopen once the timer has run out allowing the process to happen all over again without compromising your new free loot!



Click the link HERE to see the door in action.

Comments