Getting started with electrics
In this tutorial, I'll be showing you the basics of electrics/electronics in the game.
Survivalcraft offers several electronic devices, such as lamps, switches, buttons, pressure plates... But it also includes items a bit more complex, for example: 4-bit counter, truth table circuit, logic gates and more.
We'll start by a complete listing of the electric/electronic items in the game:
- Wire: use it to connect electric devices between them.
- Logic NOT gate: inverts the signal (0 = 1 and 1 = 0)
- Logic AND gate: has two inputs and one output. Both inputs must be on so the output is on.
- Logic OR gate: has two inputs and one output. Either one or both inputs have to be on so the output is on, as its name specifies.
- Logic XOR gate: has two inputs and one output. The output is on when only 1 of the inputs is on. (doesn't matter which one)
- Delay gate: as its name tells it, it will delay any signal for about 0.2 seconds. There are plenty of ways to increase or decrease the time, refer to the game wiki for more info.
- SR Latch: can be used as a memory element holding a single bit. Has three inputs (S, R and Clock) and one output. A signal on S input sets the state to 1; a signal on R input resets the state to 0. Output always indicates the current state of the latch. Can work in synchronous or asynchronous mode. Refer to the game wiki for more details.
- 4-bit counter: an electric 4 bit counter with increment, decrement, reset and overflow detection capabilities (useful for chaining counters). Outputs its current value at the top via an analog signal. You can use Analog-to-digital converter to extract the actual 4 bits, if needed. Signal on the right input increments the counter, while signal on the left one decrements it. Refer to the game wiki for more details.
- Memory Bank: writable memory bank containing 256 4-bits words. The memory can be addressed using two 4-bit addresses lines placed on the left and right. If an address line isn't connected, it's assumed to be 0. Value stored in the memory bank under the specified address can be read at the top output. Bottom input is used as a clock in similar way to SR Latch (see above). Refer to the game wiki for more details.
- Truth table circuit: a programmable circuit that uses a user-entered truth table to determine value if the output for all possible combinations of the inputs. There are 4 inputs elements on all sides and one output at the back (to access the output element, it must be placed on a wire-through block (see below) ). Truth table contains output values for all possible input values combinations.
- Real time clock: a real time clock that provides an accurate and always up to date readout of time. The clock value changes even if it's far away from the player. Zero value of the clock is at the point when the game started. You cannot reset the clock, it always tells the time since the game started. The clock outputs via 5 outputs, each of them 4-bit analog signal. Refer to the game wiki for more details.
- Random generator: can be used to generate random electric signals. Has a single clock input and one random output. Output is an analog signal and always indicates the latest result of the random generator. Refer to the game wiki for more details.
- Digital to Analog converter: converts 4 digital signals fed to its sides to one analog signal at the back (place it on a wire-through block to access it).
- Analog to Digital converter: converts one analog signal fed to its back to 4 digital signals output through its sides (place it on a wire-through block to access it).
- Sound generator: takes four inputs: pitch (left), octave (right), volume (top) and tone (bottom). All of these inputs are analog. The pitch ranges from C note (value of 0 V) to D note in the next octave (value of 1.4 V). 1.5 V at pitch input means pause; no sound is played. The octave input can be used to shift the pitch by up to two octaves. Refer to the game wiki for more details.
- Battery: an electric battery used to power electric circuits. It will connect to any wire placed next to it and power it to a constant voltage, which is 1.5 V by default. The voltage can be adjusted by editing the battery.
- Lightbublb: electric lamp, emits a lot of light when connected to a source of power.
- Electric detonator: this detonator contains a small amount of sensitive explosive and is used to initiate larger, less sensitive explosives, such as gunpowder kegs. It will explode when hit by a hard object, or when an electric currents flow though it.
- Switch: it is used to set the state of an electric circuit to 1 (lever up) or 0 (lever down). The voltage remains in the selected state until the lever is moved again.
- Button: Used to momentarily set the state of an electric circuit to 1. The duration of the pulse generated by the button click is about 1/10 of a second, after which time the outputs return to 0 state. A button can be triggered by a projectile striking it.
- Wooden/Stone pressure plate: it generates output of 1 when it is pressed, for example by you or an animal standing on it or by a projectile striking it. As soon as the pressure is removed from the plate, the output signal returns to 0.
- Photodiode: used to detect light. The diode will set the state of an electric circuit to 1 if there is enough light hitting its surface.
- Motion detector: the detector will produce signal whenever it detects motion in front of its face, up to about 8 blocks. The output if the motion detector is between 0.8 and 1.5 V, indicating how close to it the object is moving.
- Red/Green LED: a light which emits light. When connected to a power source it emits weak colored light. The light is too weak to light up the surroundings, but it's easily visible.
- Blue/White 4-LED: a set of 4 square Light Emitting Diodes. When connected to a power source, LEDs emit weak colored light. The element splits the analog signal into 4 bits to determine which of the 4 diodes should be lit. The light is too weak to light up the surroundings, but it's easily visible. Useful for creating high resolution screens.
- Red/Green/White/Blue 7-segment display: it displays one of the 16 hexadecimal characters : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F based on a single analog input supplied to it. The input value is converted to 4-bit digital form and used as a hexadecimal character to be displayed.
- Wire-through Blocks (planks, stone, semiconductor): a block with a wire running across a hole drilled through the middle. This block behaves exactly the same as planks/stone, but can conduct electricity when both ends of the embedded wire are connected to something. It is very useful when there is a need to run electricity through solid walls, or to insulate the wire from unwanted connections with other ones.
- Shooting Target: a target can be used for shooting practice (spear, bow, crossbow). It will signal a hit with an analog signal. The voltage of the signal determines how close to the center the hit occurred, from 0.8 V at the outside of the target to 1.5 V at its center.
All the information was taken from the in-game wiki.
No comments:
Post a Comment