Basic behavior of elements and electrical state behavior.
How power is transmitted
The source of all power is a power cell. If there is a conductive path from a power cell to an terminal objects that reacts to power, then that terminal objects will be turned on. This only happens in self tests and robberies, in build mode power does not propagate and most terminal objects will appear off.
In this image you can see that Wire are conductive so power can pass from the source through the to the indicator panel and thus turn it on. "Open" indicator panels are also conductive. This means you can use them as a path for the electricity to take, and they will also light up when powered:
As you can see, the lights pass power through. It's important to note that there are some tiles that are not completely conductive, but rather only let power pass through one way, an example of this is horizontal wire:
These do not pass power up or down, just horizontally. The lights are not powered because they are not receiving power. Components do not "draw" or "pull" power out of tiles, the power must be fed into them.
Next to note is that some tiles are not conductive at all, but still react to power:
Non-conductive panels (they have a little n in the upper right corner indicating they aren't conductive) are obviously not conductive. If power is fed into them they will turn on, but they will not pass power to surrounding tiles. Here you can see that the first light is directly powered by the wire. Power cannot get through this light to the wire behind or lights above and below, so no more are powered.
Switches generally change between being conductive and not conductive, for example:
The switch is in its up state, in which it is not conductive. Power can not get through to activate the light. When we press it however:
It goes into its down state, in which it is now conductive. Thus, power can get through and to the light.
Some tiles are conductive, and others are not. Here are a few of the traps you are likely to be using:
Trash compactors are not conductive.
Neither are powered doors.
Shock panels, however, are conductive.
All electricity state changes appear to occur immediately, there is no "propagation delay" like in Minecraft, however some more complicated mechanism however do make use of the fact is calculated in "sub-steps" in which there is a delay.
There are some simple rules to understanding the tiles that use electricity that can help you remember how the electronic tiles work. One of those is color coding, we try to use consistent colors, and multiple colors may be used in the same the object to convey information about how the tile behaves. For instance, the Trash Compactor has light blue highlights when powered (and closed) and it has dark orange connectors to show the while it takes power it does not conduct power through itself. Another example, both lit powered Indicator Panels show light blue, however, the conductive one has yellow connections and the non-conductive again has dark orange. In the cases of the "connections", they also indicate which way power goes. Relays only trasmit power horizontally never up and down. The fact that there are yellow connections on the left and right sides indicate this. Additionally, the dark orange terminals on the top of the relays show that they take a power input from the top, but do not transmit power in that direction. :
|Light Blue||Power/Has Power|
|Dark Orange||Non-Conductive (but takes power)|
Gates and logic
These tiles look and act similar, but are inverted from each other. When either is powered from above the u or n symbol will go from dark blue to light blue indicating it is powered from above. Also, the horizontal bar will turn from black to grey when it is transmitting power horizontally.
With these behaviors "Logic gates" can be made:
This is an "And" gate. For the light to be on, both switches have to be pressed down. The upper switch lets power flow through to the top of the Powered Relay, and thus pushes the bar down. The second switch lets power flow through this switch horizontally.
If only the the upper switch was pressed then the bar would be down, but there would be no power to get through to the light. If only the lower switch was pressed, then the power could not get through the Powered Relay as it would be in its non-conductive state.
This next example looks almost identical, but has a Inverted Powered Relay instead of a normal Powered Relay:
If the bottom switch is pressed, then power can get through to the light. However if the upper switch is pressed, it powers the Inverted Powered Relay which will then cut off power to the light. For the light to be powered the bottom switch has to be pressed and the upper one has to be unpressed.
Below are descriptions of all electrical components, and then a table of logic gates.
- Wire - normal wire connects all four edges to let power through, vertical wire connects only the top and bottom, horizontal wire connects only the left and right.
- Wired Plastic Wall - acts like wire, but blocks movement like a plastic wall.
- Switch - changes state from conductive to non conductive and vice versa when stepped on by nauts or animals.
- Permament Switch - initially non conductive, changes to conductive when stepped on and cannot be toggled back off.
- Vertical Rotary Switch - acts like vertical/horizontal wire and toggles between them when stepped on. Initially vertical power is connected.
- Bridged Wire - connects power vertically and horizontally, but does not let them interfere.
- Powered Relay - conducts horizontally when power is applied to the top, does not conduct when there is no power applied.
- Inverted Powered Relay - conducts horizontally when there is NO power applied to the top, does not conduct when there is power applied.
- Power Cell - applies power to adjacent tiles.
- Indicator Panel - Green - lights up when powered, but does not conduct power (acts like Powered Door or Trash Compactor).
- Indicator Panel - Red - lights up when powered, and conducts power (acts like Shock Panel).
- Security Switch - only button that can be activated by bots. Acts like a Sticky Pressure Switch. Cannot be pressed by droids or player.
- Trash Compactor - Safe (closed) when powered. Deadly when unpowered. Does not conduct electricity.
- Powered Door - Acts as a wall when powered. Open when unpowered. Does not conduct electricity.
- Shock Panel - Deadly when powered. Safe when unpowered. Conducts electricity.
Logic Gate Examples
You'll probably eventually make something like this and wonder what happens:
The power should at first get through, letting it up and around to the top of the switch. This however turns the switch on, which stops power getting through. Now that no power is getting through though the switch should become unpowered and let power through again; it should get stuck in a loop!
If you make it though you'll see that it doesn't rapidly change back and forth as fast as the game can handle, or even just when you take a step, it "settles" into a state that looks exactly like it does in the picture. To understand why we first need to understand substeps.
A lot of the following examples will be created in castledraft, the map editor, as it allows showing which are on and which are off.
For the game to figure out the final state of electronics, it goes through many "substeps". This simulation happens every single time a naut makes a move or uses a tool.
In a substep, first, power propagates through anything conductive that it can. Then at the start of the next substep, voltage triggered (inverted) switches are triggered according to whether or not they were receiving power at the end of the last turn. The game keeps running through substeps until in the whole terminal repeats a "state" and one substep exactly matches another.
Lets say we make something like this:
When we step onto the switch, power will immediately get through the conductive switch and wire, but won't yet trigger the inverted power relay (VTIS).
It will take until the start of the next substep for the switch to update according to whether or not it is receiving power from above:
Once this happens, power can immediately get through on this same (second) substep:
And the light is powered. On the third substep the game sees that everything has stayed exactly the same, so stops the simulation at three substeps and gives the above state as the final state that you see.
Joshwithguitar put together a castledraft map to act as a visual guide to electronic substeps: http://castledraft.com/editor/2sP62y
Each row in the above example represents the substeps that the game goes through in order to determine the state of the different electronic configurations.
In the rows the leftmost circuit represents the initial state of a circuit before a pressure switch is turned on. The circuits to the right represent each cycle after the button is pressed until it repeats a state. The to the far right the final state as it will appear to the player.
Going back to the initial circuit though, what happens with this?:
This map shows the substeps that it will go through: http://castledraft.com/editor/oJviC2
By the third substep the game detects a repeated state, where everything is exactly the same as it was before, which means that it is going to loop. It doesn't need to go through any substeps after the third. The game simulates this loop again and finds the lowest seen state of each tile. This means their unpowered state. It then settles each tile individually down into their lowest seen state, and you end up with the circuit shown on the far left, which also happens to be what it looks like in build mode.
Even though it looks like power should be getting through, the game has forcefully decided that the and VTIS should be off, as that was the lowest state they were seen in during the loop.
Power flows both ways along , so be careful when using multiple gates together. Although in this example it seems like the bottom light only lights up if both switches are powered, pressing the bottom button will also provide power to the voltage trigger switch, lighting up the light even though only one button is pressed. One solution to this problem of bi-directionality is to use a "diode" type circuit.