0% found this document useful (0 votes)
52 views32 pages

Logic Blocks Guide

Uploaded by

theblakcdeaht
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views32 pages

Logic Blocks Guide

Uploaded by

theblakcdeaht
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Logic Blocks Guide

June 16, 2025

Contents
1 Introduction 1

2 Logic Blocks 1
2.1 Sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2.1.1 Distance Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2.1.2 Altitude Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.1.3 Speed Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.1.4 Gravity Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1.5 Angle Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1.6 Compass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Logic gates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2.1 Output value calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3 Math blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3.1 Comparison Logic Gate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3.2 Accumulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3.3 Randomizer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.3.4 Number Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3.5 Arithmetics Logic Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3.6 Functions Logic Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.3.7 Aggregate Logic Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3.8 Hue Light Panel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3 Common block settings 14


3.1 Keybinds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.2 Toggle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.3 Timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

4 Signals 16

5 Useful Circuits 17
5.1 Pulse generator/Rising edge detector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.2 Falling edge detector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.3 Latch (T-FlipFlop) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.4 Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.4.1 General Circuit (Base 𝑁) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.4.2 Decimal (Base 10) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.4.3 Binary (Base 2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

i
5.4.4 When to use each method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
5.5 No-Delay Signal Toggle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

6 Historical Circuits 24
6.1 NOR/NOT Gate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
6.2 Feedback Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
6.2.1 Clamped Feedback Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

A Input value to multiplier for hinges/wings with control surfaces 26

B Input value to speed for servos with hold position 28

C Tips 30

List of Figures
1 Distance Sensor settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2 Altitude Sensor settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3 Speed Sensor settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
4 Gravity Sensor settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
5 Angle Sensor settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
6 Compass settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
7 Logic Gate settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
8 Output value calculation diagram made by Zoomah . . . . . . . . . . . . . . . . . . . . . . . 7
9 Comparator Logic Gate settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
10 Accumulator settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
11 Randomizer settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
12 Number Display settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
13 Arithmetics Logic Block settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
14 Functions Logic Block settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
15 Aggregate Logic Block settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
16 Hue Light Panel settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
17 Hue light panel color with saturation = brightness = 1 for inputs in the range [−1, 1] . . . . . 13
18 Diagram of the general method counter (logic gates implementation) . . . . . . . . . . . . . . 18
19 Diagram of the decimal method counter (logic gates implementation) . . . . . . . . . . . . . . 19
20 Diagram of the binary method counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
21 Diagram of the no-delay signal toggle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
22 Diagram of the clamped feedback loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
23 Graph of the multiplier for hinges as a function of the input value . . . . . . . . . . . . . . . 27
24 Graph of the speed for servos with hold position as a function of the input value . . . . . . . 28

List of Tables
1 Value modified by the input value for each block . . . . . . . . . . . . . . . . . . . . . . . . . 16
2 Comparison of the different counter methods . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3 Raw data of the input value multiplier for hinges . . . . . . . . . . . . . . . . . . . . . . . . . 27
4 Raw data of the input value speed for servos with hold position . . . . . . . . . . . . . . . . . 29

ii
1 Introduction
The goal of this document is to explain the logic system in the game Trailmakers. It also aims to act as
a comprehensive technical reference manual for all related mechanics and behaviours. This document also
contains a section about commonly used logic circuits and how to make them, to aid in the design and
understanding of more complex logic circuits.

2 Logic Blocks
Logic blocks are a group of blocks that allow to obtain and process information, which in turn can be used to
automate tasks or create more complex control schemes for creations, and more generally, perform any finite
sequence of steps (known as executing an algorithm).
All logic blocks, with the exception of distance/gravity sensors and number displays, have a display with an
arrow pointing away from the center of the block representing the value of their output signal. This arrow is
empty when there is no output (0 value), and green/red when the output is positive/negative. On gravity
sensors, this arrow is replaced with a weight icon, which has the same functionality (although it is white
when there is no output). Blocks which can take other signals as inputs (Logic gates and Math blocks),
with the exception of number displays, additionally have a second arrow pointing to the center of the block
representing the input signals, which works like the output arrow but using the value of the sum of the input
signals.
Note: due to a bug, only up to 5 characters can be used on any configurable block value. Even though the
UI rounds values 1-2 decimals, the values used are always the values that were typed, with the exception of
values in the range (−0.0001, 0.0001) which get rounded to 0.

2.1 Sensors
Sensors are a group of blocks that measure a physical property, like speed or angle, and create a boolean
output based on it.

2.1.1 Distance Sensor


Distance sensors check for objects within a straight line in front of them and a predefined distance. Objects
are detected with a raycast from a point in the detecting face, indicated by a red dot. The detecting face
glows white when the sensor creates an output, and stays off otherwise.
Its settings are shown in figure 1 and are as follows:
• Range: maximum distance between an object and the sensor for it to be detected, in meters (1 block =
0.25 m)
– Distance is measured from the surface of the detecting face, although the raycast used starts at the
center of the block. This allows it to measure negative distances in the range [−0.125, 0] m, which
correspond with the distance between the center of the block and the surface of the detecting face
• Output scale: multiplier of the output signal created by the block
• Sensor offset: horizontal position from which the detecting face sends the raycast to detect objects
• Output mode: type of output created by the sensor when it is activated (the output is always 0
otherwise)
– Trigger: output 1
– Measurement: output the distance to the detected object in meters
Same as “Trigger” when inverted trigger is used
– Normalized: output measurement
range
• Trigger: condition used to determine when to send an output
– Normal: sends an output when it detects an object
– Inverted: sends an output when it doesn’t detect an object
• Blocks only: whether to trigger only when blocks are detected

1
– If enabled, raycast stops at the first obstacle regardless of what it is, but if it’s not a block the
output will be the same as no detection

Output (on) Output (off)

Range Invert trigger

Output scale Sensor offset Output mode Blocks only

Figure 1: Distance Sensor settings

2.1.2 Altitude Sensor


Altitude sensors measure the altitude of the block relative to a predefined frame of reference. They have a
display which shows the currently measured altitude rounded to the nearest integer, or “N/A” in build mode.
Its settings are shown in figure 2 and are as follows:
• Altitude: altitude threshold to trigger, in meters above the frame of reference (1 block = 0.25 m)
• Output scale: multiplier of the output signal created by the block
• Output mode: type of output created by the sensor when it is activated (the output is always 0
otherwise)
– Trigger: output 1
– Measurement: output the current altitude in meters
– Normalized: output measurement
altitude
• Frame of reference: position of the 0 altitude point
– Ignore waves: fixed at the average sea level
– Relative to waves: at the position of the water surface at the horizontal coordinates of the sensor
– Outside of high seas and when the wave setting is set to disabled, both options are equivalent
– On space sector, it’s a “MAX” value (equivalent to 2001 m) while outside an atmosphere and the
distance to a point close to the center of the planet while inside of one
• Trigger: condition used to determine when to send an output
– Normal: sends an output when the altitude is above the configured value
– Below: sends an output when the altitude is below the configured value

2
Output (on) Output (off)

Altitude Trigger below

Output scale Output mode Frame of reference

Figure 2: Altitude Sensor settings

2.1.3 Speed Sensor


Speed sensors measure the speed of the block in a given direction indicated by the arrow on the block. They
have a display which shows the currently measured speed as a bar indicator, which is full when the speed is
higher than or equal to the trigger speed and empty when the speed is negative or 0.
Its settings are shown in figure 3 and are as follows:
• Speed: speed threshold to trigger, in km/h or mph depending on the speed unit settings
• Output scale: value of the output signal created by the block
• Output mode: type of output created by the sensor when it is activated (the output is always 0
otherwise)
– Trigger: output 1
– Measurement: output the current speed in m/s
measurement
– Normalized: output speed (in m/s)
• Trigger: condition used to determine when to send an output
– Normal: sends an output when the speed is above the configured value
– Below: sends an output when the speed is below the configured value

Output (on) Output (off)

Speed

Trigger below

Output scale Output mode

Figure 3: Speed Sensor settings

3
2.1.4 Gravity Sensor
Gravity sensors measure the gravity strength at the position of the block. They have a display which shows
the currently measured gravity as a bar indicator, which is full when the gravity is higher than or equal to
the trigger gravity and empty when the gravity is 0.
Its settings are shown in figure 4 and are as follows:
• Threshold: gravity strength threshold to trigger, relative to the normal gravity (14m/s2 )
• Output scale: multiplier of the output signal created by the block
• Output mode: type of output created by the sensor when it is activated (the output is always 0
otherwise)
– Trigger: output 1
– Measurement: output the current gravity relative to the normal gravity
– Normalized: output measurement
threshold
• Trigger: condition used to determine when to send an output
– Normal: sends an output when the gravity strength is above the configured value
– Below: sends an output when the gravity strength is below the configured value

Output (on) Output (off)

Altitude
Trigger below
Output scale Output mode

Figure 4: Gravity Sensor settings

2.1.5 Angle Sensor


Angle sensors measure the angle of the block relative to the direction of highest slope of the plane defined by
the square faces of the block. They have a display which shows the currently measured angle, with a blue
section representing the activation threshold and an output arrow representing the angle. The arrow will
always try to point up no matter the orientation of the block (will point in the direction of highest slope of
the plane it is in).
Its settings are shown in figure 5 and are as follows:
• Direction: position of the middle point of the activation threshold, in degrees
• Width: size of the activation threshold, in degrees
• Output scale: multiplier of the output signal created by the block
• Output mode: type of output created by the sensor when it is activated (the output is always 0
otherwise)
– Trigger: output 1
– Measurement: output the current signed angle (positive for counterclockwise) from either the
center (normal trigger) or the closest edge (trigger outside) of the activation threshold to the output
arrow in degrees
– Normalized: output measurement
width/2
• Trigger: condition used to determine when to send an output
– Normal: sends an output when the angle is inside of the activation threshold

4
– Outside: sends an output when the angle is outside the activation threshold

Output (on) Output (off)

Direction
Trigger outside

Width Output scale Output mode

Figure 5: Angle Sensor settings

2.1.6 Compass
Compasses measure the angle of the block relative to the closest direction to the north in the plane defined
by the square faces of the block. They have a display which shows the currently measured angle, with a red
section representing the activation threshold, and an output arrow and cardinal direction letters representing
the angle. The arrow will always try to point north no matter the orientation of the block (will point in the
direction closest to the north of the plane it is in).
Its settings are shown in figure 6 and are as follows:
• Direction: position of the middle point of the activation threshold, in degrees
• Width: size of the activation threshold, in degrees
• Output scale: multiplier of the output signal created by the block
• Output mode: type of output created by the sensor when it is activated (the output is always 0
otherwise)
– Trigger: output 1
– Measurement: output the current signed angle (positive for counterclockwise) from either the
center (normal trigger) or the closest edge (trigger outside) of the activation threshold to the output
arrow in degrees
– Normalized: output measurement
width/2
• Trigger: condition used to determine when to send an output
– Normal: sends an output when the angle is inside of the activation threshold
– Outside: sends an output when the angle is outside the activation threshold

5
Output (on) Output (off)

Direction

Trigger outside

Width Output scale Output mode

Figure 6: Compass settings

2.2 Logic gates


Logic gates are a group of blocks that take a set of boolean inputs, and create a boolean output based on
their values. The conditions used are as follows, inputs will be discussed on Signals:
• AND gate: all inputs are on
• OR gate: at least one input is on
• XOR gate: only one input is on
• NOR gate: sum of inputs is 0
Their settings are shown in figure 7 and are as follows:
• Keybinds: see Keybinds
• Toggle: see Toggle
• Timers: see Timers
• Output scale: multiplier of the output signal created by the block, explained in Output value calculation

Output (on) Output (off)

Red keybind

Green/red toggle Green keybind Timers Output scale

Figure 7: Logic Gate settings

2.2.1 Output value calculation


These are the steps used by the game to determine the value attached to the output signal created by logic
gates. For more information about signals, see Signals.
1) The gate checks if its conditions are met. If they aren’t, the gate doesn’t create an output

6
2) The gate adds up the values of all of its inputs and clamps the result to the [−1, 1] range
• Values smaller than −1 are replaced with −1, and values bigger than 1 with 1
3) The gate multiplies the result by its Output scale setting. For NOR gates, their setting replaces the
result (which would otherwise always be 0)
4) The gate sends the result as its output scale
This process can be described with the following formula:

output = output_value ⋅ boolean_operation(inputs) ⋅ ∑ inputs

Figure 8: Output value calculation diagram made by Zoomah

[Link] Example An AND gate with an output value of 0.5 has 2 inputs, one of them has an output
value of 0.8 and the other of 0.5. When at least one of them is off, it doesn’t send an output. When both of
them are on at the same time, the AND gate is able to send an output. On that case, the output values of
the inputs are first added up: 0.8 + 0.5 = 1.3. Because the sum, 1.3, is bigger than 1, the gate replaces it
with 1. Then that value is multiplied by the output value of the gate: 1 ⋅ 0.5 = 0.5. Finally, the AND gate
sends an output with the value of that multiplication, 0.5. On the steam version, if the sum of the inputs or
the output value of the gate had been 0, the resultant value of the multiplication would have also been 0, in
which case the gate wouldn’t have sent an output.

2.3 Math blocks


Math blocks are a group of blocks that take a set of numeric inputs and perform some operation to get an
output based on their values, either numeric or boolean. They are the only blocks which don’t clamp the
sum of their inputs to the [−1, 1] range before interpreting it.

2.3.1 Comparison Logic Gate


Comparison logic gates calculate the boolean value of a predefined comparison and return it as their output,
where the left hand side is the sum of all their inputs and the right hand side is a constant. They have
a display which shows the currently selected comparison mode. They are also sometimes referred to as
comparators.
Its settings are shown in figure 9 and are as follows:
• Keybinds: see Keybinds
• Toggle: see Toggle
• Timers: see Timers
• Threshold: value used for the right hand side of the comparison
• Output value: value of the output signal created by the block, explained in Signals
• Comparison mode: comparison operation to perform. Possible values are “less than”, “less than or
equal”, “greater than”, “greater than or equal”, “equal”, and “not equal”

7
– When the mode is set to “greater than or equal”, the total input is rounded to 3 decimal places
before performing the comparison, using the nearest mode and rounding numbers with a fractional
part of 0.5 up
– For the “equal” and “not equal” modes, numbers are compared with a tolerance of 𝜀 = 0.0005 (the
numbers are equal if their difference is < 𝜀)
• Clamp input: whether the result of the sum of the inputs should be clamped to the [−1, 1] range or not

Output (on) Output (off)

Output value

Red keybind

Clamp input
Green/red toggle Green keybind Timers Threshold Comparison mode

Figure 9: Comparator Logic Gate settings

2.3.2 Accumulator
Accumulators store and output a numeric value, and allow to increment/decrement it between some bounds.
They are always initialized to the value closest to 0 within the defined bounds. They have a display which
shows the currently stored value as a bar indicator, which is full when the value is the maximum and empty
when it is the minimum. Additionally, the bar indicator is white when the value is 0, and green/red when it
is positive/negative.
Its settings are shown in figure 10 and are as follows:
• Keybinds: see Keybinds
• Toggle: see Toggle
• Timers: see Timers
• Value bounds: minimum/maximum value that can be stored, the stored value will be clamped to the
range [min(minimum, maximum), max(minimum, maximum)]
• Scale: rate of change of the stored value, used to scale the value of the input
• Use steps: whether to change the stored value continuously (in which case the scale is change per
second, achieved by using 1/60th the scale on each frame) or only once per input activation (on the
rising edge of the signal)

8
Output (on) Output (off)

Red keybind

Use steps
Green/red toggle Green keybind Timers Value bounds Scale

Figure 10: Accumulator settings

2.3.3 Randomizer
Randomizers generate and output random values.
Its settings are shown in figure 11 and are as follows:
• Keybinds: see Keybinds
• Toggle: see Toggle
• Timers: see Timers
• Value bounds: minimum/maximum value that can be generated, the generated values will be in the
range [min(minimum, maximum), max(minimum, maximum)]
• Random mode: mode in which the values are generated
– Output on input: outputs a random value generated on each frame when it is activated, and 0
otherwise
– Change on input: outputs a random value generated on each frame when it is activated, and the
last generated value (initialized to 0) otherwise
– Input defines range: outputs a random value generated on each frame in the intersection between
the value bounds and the range [min(inputs), max(inputs)] when the block is activated, and the
last generated value (initialized to a random value within the value bounds) otherwise
If the intersection is empty, the value bounds range is used instead if any of the inputs isn’t 0,
otherwise the output is always 0
– -Change, +Output: generates and stores a random value on each frame when the block is activated
with a negative input, and outputs the last generated value (initialized to a random value within
the value bounds) when it is activated with a positive input

Output (on) Output (off)

Red keybind

Green/red toggle Green keybind Timers Value bounds Random mode

Figure 11: Randomizer settings

9
2.3.4 Number Display
Number displays output the sum of their inputs, similar to how OR logic gates work (although without
clamping the sum to the [−1, 1] range), and display it with an optional rounding. They display “N/A” in
build mode.
Its settings are shown in figure 12 and are as follows:
• Keybinds: see Keybinds
• Toggle: see Toggle
• Timers: see Timers
• Rounding: rounding mode applied to the sum of the inputs, always done to an integer when enabled.
Possible values are “disabled”, “nearest”, “floor” (closest smaller integer), and “ceil” (closest bigger
integer)
– When rounding is disabled, numbers are rounded to 2 decimals using the nearest mode, rounding
numbers ending in 0.005 away from 0
– For the “nearest” mode, numbers with a fractional part of 0.5 are rounded to the closest even
integer
– If the number is outside of the [−1000, 1000] range, it’s always displayed in scientific notation with
1 decimal of precision

Output (on) Output (off)

Red keybind

Green/red toggle Green keybind Timers Rounding

Figure 12: Number Display settings

2.3.5 Arithmetics Logic Block


Arithmetics logic blocks perform an arithmetic binary operation with a constant and the sum of their inputs,
and output the result. The constant is the first operand while the sum of the inputs is the second one. They
have a display which shows the currently selected operation.
Its settings are shown in figure 13 and are as follows:
• Keybinds: see Keybinds
• Toggle: see Toggle
• Timers: see Timers
• Constant: constant value to use as the first operand
• Operation: binary operation to perform. Possible values are addition, subtraction, multiplication,
division, modulo, power (𝑥constant ), and exponentiation (constant𝑥 )
– Attempting to perform a division by 0, constant𝑥 with constant < 0, or 𝑥constant with |constant| < 1
results in an output of 0
– Attempting to perform 00 results in 1 when the operation is power and 0 when the operation is
exponentiation
– When there are no inputs, the operation is performed using an input of 0

10
Output (on) Output (off)

Red keybind

Green/red toggle Green keybind Timers Constant Operation

Figure 13: Arithmetics Logic Block settings

2.3.6 Functions Logic Block


Functions logic blocks perform a unary operation with the sum of their inputs and output the result. They
have a display which shows the currently selected operation.
Its settings are shown in figure 14 and are as follows:
• Keybinds: see Keybinds
• Toggle: see Toggle
• Timers: see Timers
• Function: unary operation to perform. Possible values are absolute value, sign, square root, sine, cosine,
tangent, arcsine, arccosine, arctangent, floor, ceiling, and rounding
– Attempting to perform an undefined operation (square root of a negative number, or arcsine/arcco-
sine of a number outside of the [−1, 1] range) results in an output of 0
– Trigonometric functions use degrees as the angle unit
– Inverse trigonometric functions output the value in their principal branch
For arcsine: −90° ≤ arcsin(𝑥) ≤ 90°
For arccosine: 0° ≤ arccos(𝑥) ≤ 180°
For arctangent: −90° < arcsin(𝑥) < 90°
– For the rounding function, numbers with a fractional part of 0.5 are rounded to the closest even
integer

Output (on) Output (off)

Red keybind

Green/red toggle Green keybind Timers Function

Figure 14: Functions Logic Block settings

11
2.3.7 Aggregate Logic Block
Aggregate logic blocks perform a (variadic) aggregation operation with their inputs and output the result.
They have a display which shows the currently selected operation. Note: due to a bug, when the function
isn’t sum, the output can sometimes be updated instantly without the normal signal propagation delay.
Its settings are shown in figure 15 and are as follows:
• Keybinds: see Keybinds
• Toggle: see Toggle
• Timers: see Timers
• Aggregate function: aggregate operation to perform. Possible values are sum, product, minimum, and
maximum

Output (on) Output (off)

Red keybind

Green/red toggle Green keybind Timers Aggregate function

Figure 15: Aggregate Logic Block settings

2.3.8 Hue Light Panel


Hue light panels are lights with configurable color determined from their input value.
Its settings are shown in figure 16 and are as follows:
• Keybinds: see Keybinds
• Toggle: see Toggle
• Timers: see Timers
• Saturation: saturation of the color of the light. Ignored when the input value is negative
• Brightness: brightness of the color of the light

12
Green keybind
Brightness

Toggle Timers Saturation

Figure 16: Hue Light Panel settings

[Link] Color Calculation The color displayed as a function of their input value can be determined
with the following formula, where 𝑆 and 𝐵 are the saturation and brightness settings respectively. Figure
17 shows an example of the resulting colors for inputs in the range [−1, 1] with saturation = brightness = 1.
Inputs smaller than −1 result in the [−1, 0] range being repeated, while inputs greater than 1 result in the
[0, 1] range being repeated.

⎧HSV(360(𝑥 mod 1), 𝑆, 𝐵) (𝑥 > 0)


{
color(𝑥) = ⎨Off (Black) (𝑥 = 0)
{greyscale((1 − (𝑥 mod 1)) ⋅ 𝐵) (𝑥 < 0)

−1 −0.83 −0.67 −0.5 −0.33 −0.17 0 0.17 0.33 0.5 0.67 0.83 1
Input value

Figure 17: Hue light panel color with saturation = brightness = 1 for inputs in the range [−1, 1]

13
3 Common block settings
These are settings shared by all blocks in the game that can be activated with input signals.

3.1 Keybinds
Keybinds are the most common input to activate a block, and all blocks that can be activated have either a
single keybind (green) or two keybinds (green and red).
• All keybinds on a single block act as a single input for each seat
– An AND gate with a green and a red keybind configured will send an output when just pressing
one of the 2 keybinds, but will require someone in each seat that has control over it pressing the
keybind to send an output
– If no keybinds are configured, the input isn’t taken into account. This only makes a difference in
AND gates, which would otherwise be impossible to trigger without keybinds
• The green keybind has a positive value while the red keybind has a negative one. For more information
about input values, see Signals
– For input methods that don’t support analog inputs (keyboards and normal buttons on controllers),
the value is always 1
– For input methods that support analog inputs (controller joysticks and triggers), the value is the
one given by the input method normalized to the range [0, 1]

3.2 Toggle
Toggle allows to make inputs alternate the activation state of a block between on and off without requiring a
continuous input signal to remain active.
• There is a toggle setting associated with positive inputs (below the green keybind) and another with
negative ones (below the red keybind)
• Toggles inputs
– When the sum of the inputs goes from 0 to a different value, multiple things happen depending on
the new value:
1) If the opposite sign of the input is toggled on, it is toggled off instantly
2) If the sign of the input has toggle enabled, it is toggled: if it was off it turns on, and if it was
on it turns off (which will happen on the falling edge of the input). Otherwise, the gate is
enabled normally
– To toggle the output instead of the inputs, make the signal go through another gate with the toggle

3.3 Timers
Timers are a group of settings that allow to automate the activation/deactivation of a block after a set
amount of time.
• Timers apply to the inputs of the block and are shared by all of them, and start as soon as the block
receives a single input. For logic blocks, this still applies even if the block doesn’t meet its conditions
to send an output
• The number will be rounded to have only 2 decimal places when shown on the menu, but the number
which will be used is the one written rounded to 8 decimal places. Due to a bug, only up to 5 characters
can be written, so depending on the exact value the number of decimals which can be used will vary
• All values are specified in seconds
• Delay: amount of time between the block receives an input and the block activates
– Note: each logic gate has an extra delay of 1/60𝑠 due to the state of all the logic gates being
updated once per physics’ frame at the same time
• Duration (previously active time): amount of time before the block automatically deactivates after it
has been activated
– A value of 0 indicates that it will never deactivate automatically
– Shortest pulse length is 1 frame (1/60𝑠), values smaller than this won’t activate the block

14
• Pause (previously inactive time): amount of time before the block reactivates and the duration timer is
restarted, after the duration timer expires
– A value of 0 indicates that the block will never reactivate automatically
– It’s ignored if the duration timer is 0
• During the delay/pause timers, the block is deactivated by overriding the input value with 0
• The order of the timers is as follows: delay → duration → pause → back to duration (if pause is 0 it
ends after the duration ends)
• In the case of the delay and duration timers, even though their values are expressed in seconds, the
game handles them as a number of frames, which can be calculated with seconds ⋅ 60
– If this number is not an integer, it will be rounded down to the nearest integer
– If this number is an integer, it will randomly either be kept as it is or be subtracted one frame
depending on the exact value used, so it’s recommended to add 0.01 to the original number to
make sure it always stays in the correct number of frames
– Pause timers aren’t subject to this, and the exact time in seconds is used for them

15
4 Signals
Signals are the method used to communicate different logic blocks between eachother and other blocks. All
block inputs, both from logic blocks and keybinds, are represented with signals.
• Input/output value: value attached to each signal, usually in the range [−1, 1].
– Math blocks are the only blocks which don’t clamp the sum of their inputs to the [−1, 1] range,
instead they use the range [−(2 − 2−23 ) ⋅ 2127 , (2 − 2−23 ) ⋅ 2127 ] ≈ [−3.403 ⋅ 1038 , 3.403 ⋅ 1038 ]
– They are represented with a standard IEEE 754 single-precision floating-point number
• Truthness value: value that determines if a signal is on or off
– A signal is on if its associated value is not 0. Additionally, for blocks with multiple inputs, the sum
of their inputs must also be non-0 in order for them to be activated
When a block receives a set of inputs, it determines how it is activated based on the value of their sum.
Blocks with a single configurable keybind, except the gyro stabilizer and hue light panels, additionally use the
absolute value before interpreting it, which makes both signs equivalent. The resulting value represents the
percentage of power that whatever it activates will use, applied to the value set in its settings as a multiplier
(if applicable). Values modified for each block are in table 1. Some important notes:
• For hinges/wings the rotation speed depends on the max angle set in their settings and not on the
angle achieved with the input value, resulting in faster speeds with fractional input values for the same
final angle
• Due to a bug, fractional inputs in hinges/wings result in angles way lower than they should be. See
appendix Input value to multiplier for hinges/wings with control surfaces for more information
• Due to a bug, close to 0 inputs in servos with hold position also result in lower speeds as well. See
appendix Input value to speed for servos with hold position for more information
• For rotating servos, an angle of “infinity” actually represents 360 degrees
• For the gyro stabilizer, it only works with disabled by default, and negative values make it stabilize in
the opposite direction

Block Value modified


Engines Max speed and acceleration (torque)
Thrusters, gimbals, propellers, boat en- Power (thrust)
gines, and quantum rudders
Rotating servos, hinges, and wings with Angle
control surfaces (without hold position)
Spinning servos, helicopter engines, pis- Speed
tons, gyros, and gyro stabilizers
Tone generators Volume
Logic gates and math blocks Output value (see Logic gates and Math blocks)
Hue light panels Color (see Hue Light Panel)
Other None

Table 1: Value modified by the input value for each block

16
5 Useful Circuits
This section contains commonly used logic circuits and how to make them, to aid in the design and
understanding of more complex logic circuits.

5.1 Pulse generator/Rising edge detector


• Sends a pulse of a specific length (usually a single frame which is 1/60𝑠) when the input goes from off
to on
• Made by setting the duration to the length of the pulse on an OR gate

5.2 Falling edge detector


• Sends a pulse of a specific length when the input goes from on to off
• Made by connecting a NOT gate to a pulse generator

5.3 Latch (T-FlipFlop)


• Stores a single bit of information
• Made by activating toggle on an OR gate, requires the input to be a pulse to be easily controlled by
other gates (use a pulse generator for this)

5.4 Counter
• Stores the value of a variable with 𝑛 possible (discrete) values
• Depending on how it’s made, it can be 1 or 2 way and have cycle or not
– 1-way: the value can only be increased
– 2-way: the value can be both increased and decreased
– Cycle: determines if trying to increase/decrease the value past its maximum/minimum will result
in it cycling back to the smallest/biggest value or staying at the maximum/minimum value
– Base designs described are 1-way without cycle, with the modifications needed to implement 2-way
or cycle being explained afterwards
• The complexity of a design is the amount of logic gates used by it without counting the ones used to
create a startup pulse or always on sensors (those can be reused)
• There are 3 ways of doing it: general circuit (base 𝑁), decimal (base 10) and binary (base 2). Which
one is least complex depends on the situation
– The general circuit and decimal methods can be implemented using logic gates or accumulators.
Generally accumulator-based counters are less complex, but logic gate based designs will still be
described as they can be less complex under some circumstances (like needing a counter which
only changes its value when a function of its current value is true)

5.4.1 General Circuit (Base 𝑁)


[Link] Logic Gates Implementation
• 𝑛 = amount of cells
• The output is encoded as the position of the active gate in the row of output gates (with the one from
the first cell being the minimum value and the one from the last cell being the maximum value)
• Diagram of the circuit:

17
Cell 1 Cell 𝑘 Cell 𝑘 + 1 Cell 𝑛
Toggled OR gate Toggled OR gate Toggled OR gate Toggled OR gate
with 1 frame with 1 frame with 1 frame with 1 frame
delay (output) delay (output) delay (output) delay (output)
⋯ ⋯

AND gate AND gate AND gate

1 frame pulse
generator (input)

Figure 18: Diagram of the general method counter (logic gates implementation)

• To add cycle, add an AND gate to the last cell configured in the same way as the others and using the
first cell as its next cell
• To make it 2-way, add a new AND gate to each cell configured in the same way as the other one but
going in the opposite direction and using a different pulse generator as input
• Requires a startup pulse to one of the toggled OR gates to work (achieved with a 1 frame pulse
generator)
• Complexity
– 1-way: 2𝑛
– 1-way+cycle: 2𝑛 + 1
– 2-way: 3𝑛
– 2-way+cycle: 3𝑛 + 1
• Takes 3 frames to update
• Example blueprints: 1-way, 1-way+cycle, 2-way and 2-way+cycle

[Link] Accumulators Implementation


• 𝑛 = amount of comparators
• The output is encoded as the active comparator
• Made by choosing 𝑛 equally spaced numbers, configuring an accumulator to use steps and setting its
minimum, maximum, and scale settings to go through those numbers as the value is changed, and
connecting the accumulator to 𝑛 comparators set to equality with each of the chosen numbers
– The minimum/maximum must be the minimum/maximum chosen numbers, and the scale their
spacing. Additionally, in order for the comparators to work, spacing ≥ 0.001 must hold
– If minimum ≤ 0 ≤ maximum, 0 should be within the chosen numbers. Otherwise, the counter
needs to be pushed to its minimum/maximum value to initialize it
– For simplicity, the integers from 0 to 𝑛 − 1 are usually used by setting the minimum/maximum
values to 0/𝑛 − 1 respectively and the scale to 1, but other configurations can be useful in certain
circumstances
Using a negative minimum value allows the initial value to not be the lowest value, which
might be useful for 2-way counters
Using (positive) scale values closer to 0 allows to increase the amount of stored values beyond
101
Using different minimum/maximum values might reduce the complexity if analog value outputs
are wanted by avoiding having to perform transformation of the value ranges
– The value can be increased/decreased by sending a ±1 input to the accumulator (the circuit is the
same for 1 and 2-way)
– In some cases, it might be useful to not enable use steps and set the scale to 60 ⋅ spacing. This
allows to change the stored value on each frame, but requires the input to come from a 1 frame

18
pulse generator to get the normal input behaviour
• To add cycle, connect the comparator with the biggest threshold to an AND gate with the positive
accumulator input as its second input. Connect that AND gate to an arithmetic logic block set
to multiplication with a −1000 constant and 0.02 duration, and that arithmetic logic block to the
accumulator
– The normal input to the accumulator must come from a 1 frame pulse generator
– If using the circuit as 2-way, repeat the process with the comparator with the smallest threshold
and the negative input of the accumulator. The AND gate should have an additional −2 always on
input (which can be achieved with an arithmetic logic block set to addition with a −1000 constant).
The arithmetic logic block and input pulse generator can be reused, using negative inputs to reduce
the value
• Complexity
– 1-way: 𝑛 + 1
– 1-way+cycle: 𝑛 + 4
– 2-way: 𝑛 + 1
– 2-way+cycle: 𝑛 + 5
• Takes 2 frames to update without cycle, and 3 frames otherwise
• Example blueprints: 1-way, 1-way+cycle, 2-way and 2-way+cycle

5.4.2 Decimal (Base 10)


[Link] Logic Gates Implementation
• Works best when 𝑛 is of the form 𝑐 ⋅ 10𝑘 where 𝑐 is an integer in the range [1, 9] and k is any positive
integer. If it isn’t, more gates are needed to cap the value at 𝑛
• 𝑛 = 10amount of cells ; amount of cells = ⌈log10 𝑛⌉
• Each cell is the general circuit for 𝑛 = 10 with cycle and no input gate, except for the last cell which
can have any value 2 ≤ 𝑛 ≤ 10 and doesn’t need to have cycle
• The output is encoded as a decimal number with a digit stored in each cell (with the first cell being the
least significant digit and the last cell being the most significant digit)
• Diagram of the circuit:

Cell 1 Cell 𝑘 Cell 𝑘 + 1 Cell ⌈log10 𝑛⌉


All OR gates All OR gates All OR gates All OR gates
except the last except the last except the last except the last

Last OR gate ⋯ Last OR gate Last OR gate ⋯

All AND gates All AND gates All AND gates All AND gates

Input circuit
1 frame pulse
OR gate
generator (input)

Figure 19: Diagram of the decimal method counter (logic gates implementation)

• To add cycle, add cycle to the last cell and remove the OR gate from the input circuit
• To make it 2-way, duplicate the input circuit but connect all OR gates except the first from each cell to

19
the OR gate. Then, make each cell 2-way, connect the cells in the same direction using the first OR
gate of each cell rather than the last, and connect the new input circuit to all AND gates for the second
direction
• Might require a decoder (unless you want to show numbers on a screen)
– To create it, take 𝑛 AND gates and assign a different combination of 1 output gate from each cell
to each of them (if you only need to use it combined with other circuits, you can combine all of
their decoders into a single one to use less gates)
– Has a complexity of 𝑛 gates
• Requires a startup pulse to one of the toggled OR gates on each cell to work (achieved with a 1 frame
pulse generator)
• Complexity
– 1-way: 2⌈ ⌈log𝑛 𝑛⌉−1 ⌉ + 20⌈log10 𝑛⌉ − 19
10 10

– 1-way+cycle: 2⌈ 𝑛
⌉ + 20⌈log10 𝑛⌉ − 19
10⌈log10 𝑛⌉−1
– 2-way: 3⌈ 𝑛
⌉ + 30⌈log10 𝑛⌉ − 28
10⌈log10 𝑛⌉−1
– 2-way+cycle: 3⌈ ⌈log𝑛 𝑛⌉−1 ⌉ + 30⌈log10 𝑛⌉
− 28
10 10
• Takes 3 frames to update with cycle and 4 frames otherwise
• Example blueprints: 1-way, 1-way+cycle, 2-way and 2-way+cycle

[Link] Accumulator Implementation


• Works best when 𝑛 is of the form 𝑐 ⋅ 10𝑘 where 𝑐 is an integer in the range [1, 9] and k is any positive
integer. If it isn’t, more gates are needed to cap the value at 𝑛
• 𝑛 = 10amount of cells ; amount of cells = ⌈log10 𝑛⌉
• Each cell is the general circuit implemented with accumulators for 𝑛 = 10 with cycle and without use
steps, except for the last cell which can have any value 2 ≤ 𝑛 ≤ 10 and doesn’t need to have cycle
• The output is encoded as a decimal number with a digit stored in each cell (with the first cell being the
least significant digit and the last cell being the most significant digit)
• Made by connecting the last comparator of each cell to the AND gate from the cycle circuit of all
following cells, and the AND gate from the cycle circuit of each cell to the accumulator of the next cell.
– Requires a different input circuit: the positive input should be in a 1 frame pulse generator
connected to an AND gate connected to the accumulator of the first cell and the AND gate from
the cycle circuit of all cells. All comparators except the last on each cell should be connected to an
OR gate connected to the AND gate from the input circuit
• To add cycle, add cycle to the last cell and remove all the gates in the input circuit except the pulse
generator, which should be connected to the accumulator of the first cell and the AND gate from the
cycle circuit of all cells
• To make it 2-way, duplicate the input circuit but connect all comparators except the first from each
cell to the OR gate. Then, make each cell 2-way, connect the cells in the same direction using the first
comparator of each cell rather than the last, and connect the new input circuit to all AND gates for the
second direction
– The AND gate from the second input circuit should have a −1 output scale
• Might require a decoder (unless you want to show numbers on a screen)
– To create it, take 𝑛 AND gates and assign a different combination of 1 comparator from each cell
to each of them (if you only need to use it combined with other circuits, you can combine all of
their decoders into a single one to use less gates)
– Has a complexity of 𝑛 gates
• Complexity
– 1-way: ⌈ ⌈log𝑛 𝑛⌉−1 ⌉ + 13⌈log10 𝑛⌉ − 9
10 10

– 1-way+cycle: ⌈ 𝑛
⌉ + 13⌈log10 𝑛⌉ − 9
10⌈log10 𝑛⌉−1
– 2-way: ⌈ 𝑛
⌉ + 14⌈log10 𝑛⌉ − 7
10⌈log10 𝑛⌉−1

20
– 2-way+cycle: ⌈ ⌈log𝑛 𝑛⌉−1 ⌉ + 14⌈log10 𝑛⌉ − 8
10 10
• Takes 3 frames to update
• Example blueprints: 1-way, 1-way+cycle, 2-way and 2-way+cycle

5.4.3 Binary (Base 2)


• Works best when 𝑛 is a power of 2. If it isn’t, more gates are needed to cap the value at 𝑛
• 𝑛 = 2amount of cells ; amount of cells = ⌈log2 𝑛⌉
• The output is encoded as a binary number with a bit stored in each cell (with the first cell being the
least significant digit and the last cell being the most significant digit)
• Diagram of the circuit:

Cell 1 Cell 𝑘 Cell 𝑘 + 1 Cell ⌈log2 𝑛⌉


Toggled OR gate Toggled OR gate Toggled OR gate Toggled OR gate
(output) (output) (output) (output)
⋯ ⋯

AND gate AND gate AND gate AND gate

Input Circuit
1 frame pulse
NAND gate
generator (input)

Figure 20: Diagram of the binary method counter

• To add cycle, remove the NAND gate from the input circuit and the AND gate on the first cell, and
connect the 1 frame pulse generator directly to the OR gate in the first cell
• To make it 2-way, add a NOT gate to each cell with its OR gate as input and a new AND gate connected
in the same way as the old AND gate, but using the NOT gate of all previous cells as input instead of
the OR gates. Then replace the NAND gate on the input circuit with an OR gate and duplicate it
(with the copy being connected to the new AND gates on each cell rather than the old ones). Connect
the NOT gate of all the cells to the OR gate of the first input circuit, and the OR gate of all the cells
to the OR gate of the second input circuit
• Might require a decoder
– To create it, add a NOT gate to each cell and replace the NAND gate of the input circuit with
an OR gate like in the 2-way version (if using the 1-way versions). Then, take 𝑛 AND gates and
assign each of them a different combination of either the OR or NOT from each cell (if you only
need to use it combined with other circuits you can combine all of their decoders into a single one
to use less gates)
– Has a complexity of ⌈log2 𝑛⌉ + 𝑛 − 1 for the 1-way version, ⌈log2 𝑛⌉ + 𝑛 for the 1-way+cycle version
and 𝑛 for the 2-way versions
• Complexity
– 1-way: 2⌈log2 𝑛⌉ + 3
– 1-way+cycle: 2⌈log2 𝑛⌉
– 2-way: 4⌈log2 𝑛⌉ + 4
– 2-way+cycle: 4⌈log2 𝑛⌉
• Takes 3 frames to update for 1-way+cycle and 4 frames otherwise
• Example blueprints: 1-way, 1-way+cycle, 2-way and 2-way+cycle

21
5.4.4 When to use each method

1-way 2-way

Doesn’t require an individual decoder: Doesn’t require an individual decoder:


• For 𝑛 ≤ 10 use the general circuit • For 𝑛 ≤ 23 use the general circuit
Without cycle

• For 𝑛 > 10 use the binary circuit • For 𝑛 > 23 use either the binary or deci-
mal circuit
Show values directly on a screen (only numbers Show values directly on a screen (only numbers
for 𝑛 > 18): for 𝑛 > 23):
• For 𝑛 ≤ 18 use the general circuit • For 𝑛 ≤ 23 use the general circuit
• For 𝑛 > 18 use the decimal circuit • For 𝑛 > 23 use the decimal circuit

Doesn’t require an individual decoder: Doesn’t require an individual decoder:


• Use the binary circuit • For 𝑛 = 4, 𝑛 = 8, or 11 < 𝑛 ≤ 32 use the
binary circuit
• For 4 < 𝑛 ≤ 7 or 8 < 𝑛 ≤ 11 use the
general circuit
With cycle

• For 𝑛 > 32 use either the binary or deci-


mal circuit
Show values directly on a screen (only numbers Show values directly on a screen (only numbers
for 𝑛 > 15): for 𝑛 > 17):
• For 𝑛 ≤ 15 use the general circuit • For 𝑛 ≤ 17 use the general circuit
• For 𝑛 > 15 use the decimal circuit • For 𝑛 > 17 use the decimal circuit

Table 2: Comparison of the different counter methods

Notes:
• Calculated for 𝑛 ≥ 3, for 𝑛 = 2 a latch is always best
• All mentions of the general and decimal circuits refer to the accumulator-based implementations
• If an individual decoder is needed, the general circuit is always best
• For 2-way without an individual decoder, decimal and binary circuits are very close in terms of
complexity. Use their complexity formulas to figure out which is best for your use case. If they have
the same complexity, decimal is better due to being faster
• This is just based on the amount of logic gates each circuit uses (unless there is a tie, in which case
update speed is used). However, the amount of time it takes for the system to update might also matter
depending on the situation. In that case, refer to the circuits’ descriptions to compare the speed for the
needed use case

5.5 No-Delay Signal Toggle


• Allows to enable/disable an analog signal without increasing the signal delay like normal AND/XOR
gate methods do
• Doesn’t work when the output block is an AND/XOR gate
• Commonly used to enable/disable angle sensor stabilization (with the input being angle sensors and
the output helicopter engines)

22
OR Gate with OR Gate with
toggle keybind toggle keybind

XOR gate with


-1 output scale

Input Signals
(can be multiple Output Blocks
blocks)

Figure 21: Diagram of the no-delay signal toggle

• Example blueprint

23
6 Historical Circuits
This section contains old circuits that were previously in Useful Circuits, but have since been superseded by
new blocks. They are kept here for historical reasons and in case they are seen in older circuits.

6.1 NOR/NOT Gate


• Superseded by the NOR gate block
• Inverts the state of the input
• Made by connecting an always on input (a sensor that is always on, all sensors can be configured to
work like this but the most commonly used one is a distance sensor with 0 range and invert trigger) to
a XOR gate
• If it only has a single input that isn’t the always on input it will act as a NOT gate, if it has multiple it
will act as a NOR gate
• You can make a NAND/XNOR gate by making an AND/XOR gate output to a NOT gate and taking
the output from the NOT gate

6.2 Feedback Loop


• Superseded by accumulators
• Allows to store an analog value in the range [−1, 1]
• Made by connecting 2 OR gates to each other, connecting the input to both of them, and taking the
output from one of them
• Each frame the input is active, the stored value increases by the value of the input
– With a close to 0 input value, the circuit can be used to generate an analog output value
• One of the OR gates can be replaced with an XOR to add a reset input. In this case, the normal input
should go to the OR gate only and the reset input must be 2 different signals connected to the XOR
gate
– Be aware that this method adds a 1 frame jitter to the stored signal

6.2.1 Clamped Feedback Loop


• Allows limiting the output signal of a feedback loop to the range [0, 1]
• Diagram of the circuit:

Feedback Loop OR gate with


OR gate with
-1 output scale
OR Gate -1 output scale
(output)
Input Signal
OR Gate Always on sensor

Figure 22: Diagram of the clamped feedback loop

• Note: the input signal is reversed. This means that a negative value increases the stored value while a
positive value decreases it
• Keybinds can be added to one of the OR gates in the feedback loop to go to the max/min value. The
green keybind sets the min value while the red keybind sets the max value
• Example blueprint
• Python script to simulate the behaviour (input value is automatically reversed):
def clamp(x: float) -> float:
return min(max(x, -1), 1)

24
def update(
feedback_top: float, feedback_bottom: float, user_input: float
) -> tuple[float, float]:
return (
clamp(feedback_bottom - user_input + 1),
clamp(feedback_top - user_input - 1)
)

def print_state(feedback_top: float, feedback_bottom: float):


print("State:")
print("\tFeedback Top: ", round(feedback_top, 3))
print("\tFeedback Bottom: ", round(feedback_bottom, 3))
print("Output: ", round(clamp(-(feedback_top - 1)), 3))

feedback_top, feedback_bottom = 1, 0
print_state(feedback_top, feedback_bottom)
while True:
user_input = input("Enter input (between -1 and 1, Q to quit): ")
if user_input.lower() == "q":
break
try:
user_input = float(user_input)
except ValueError:
print("Invalid input. Try again")
continue
feedback_top, feedback_bottom = update(feedback_top, feedback_bottom, user_input)
print_state(feedback_top, feedback_bottom)
• Credits to Precache for figuring out this circuit

25
A Input value to multiplier for hinges/wings with control surfaces
Due to a bug, the angle by which hinges/wings/other blocks with the “steering help” setting rotate doesn’t
scale linearly with the input value. This section contains the multipliers used for many input values, found
experimentally. Some notes about this process:
• Final angle is the resulting angle of the hinge measured with a max angle of 90 degrees and an error of
±0.005 degrees
• The multiplier was calculated with multiplier = final90angle
• A calculator using this data made by confusionextended can be found here

Input Final Input Final Input Final


Multiplier Multiplier Multiplier
value angle value angle value angle

1.000 90.000 1.00000000 0.810 31.275 0.34750000 0.480 05.640 0.06266667


0.995 88.345 0.98161111 0.805 30.215 0.33572222 0.470 05.295 0.05883333
0.990 86.680 0.96311111 0.800 29.195 0.32438889 0.460 04.960 0.05511111
0.985 85.000 0.94444444 0.795 28.225 0.31361111 0.450 04.640 0.05155556
0.980 83.315 0.92572222 0.790 27.300 0.30333333 0.440 04.335 0.04816667
0.975 81.620 0.90688889 0.785 26.425 0.29361111 0.430 04.040 0.04488889
0.970 79.920 0.88800000 0.780 25.595 0.28438889 0.420 03.760 0.04177778
0.965 78.215 0.86905556 0.775 24.825 0.27583333 0.410 03.495 0.03883333
0.960 76.505 0.85005556 0.770 24.105 0.26783333 0.400 03.245 0.03605556
0.955 74.795 0.83105556 0.765 23.440 0.26044444 0.390 03.005 0.03338889
0.950 73.085 0.81205556 0.760 22.830 0.25366667 0.380 02.775 0.03083333
0.945 71.380 0.79311111 0.755 22.280 0.24755556 0.370 02.560 0.02844444
0.940 69.675 0.77416667 0.750 21.790 0.24211111 0.360 02.355 0.02616667
0.935 67.975 0.75527778 0.740 20.920 0.23244444 0.350 02.160 0.02400000
0.930 66.280 0.73644444 0.730 20.075 0.22305556 0.340 01.980 0.02200000
0.925 64.595 0.71772222 0.720 19.255 0.21394444 0.330 01.805 0.02005556
0.920 62.920 0.69911111 0.710 18.460 0.20511111 0.320 01.645 0.01827778
0.915 61.250 0.68055556 0.700 17.685 0.19650000 0.310 01.495 0.01661111
0.910 59.595 0.66216667 0.690 16.930 0.18811111 0.300 01.350 0.01500000
0.905 57.955 0.64394444 0.680 16.200 0.18000000 0.290 01.220 0.01355556
0.900 56.325 0.62583333 0.670 15.490 0.17211111 0.280 01.095 0.01216667
0.895 54.715 0.60794444 0.660 14.800 0.16444444 0.270 00.980 0.01088889
0.890 53.125 0.59027778 0.650 14.135 0.15705556 0.269 00.970 0.01077778
0.885 51.550 0.57277778 0.640 13.485 0.14983333 0.268 00.955 0.01061111
0.880 49.995 0.55550000 0.630 12.860 0.14288889 0.267 00.945 0.01050000
0.875 48.465 0.53850000 0.620 12.250 0.13611111 0.266 00.935 0.01038889
0.870 46.960 0.52177778 0.610 11.660 0.12955556 0.265 00.925 0.01027778
0.865 45.480 0.50533333 0.600 11.095 0.12327778 0.264 00.915 0.01016667

26
0.860 44.025 0.48916667 0.590 10.545 0.11716667 0.263 00.905 0.01005556
0.855 42.600 0.47333333 0.580 10.010 0.11122222 0.262 00.000 0.00000000
0.850 41.200 0.45777778 0.570 09.500 0.10555556 0.261 00.000 0.00000000
0.845 39.830 0.44255556 0.560 09.000 0.10000000 0.260 00.000 0.00000000
0.840 38.505 0.42783333 0.550 08.525 0.09472222 0.250 00.000 0.00000000
0.835 37.200 0.41333333 0.540 08.065 0.08961111 0.200 00.000 0.00000000
0.830 35.940 0.39933333 0.530 07.620 0.08466667 0.150 00.000 0.00000000
0.825 34.715 0.38572222 0.520 07.190 0.07988889 0.100 00.000 0.00000000
0.820 33.530 0.37255556 0.510 06.780 0.07533333 0.050 00.000 0.00000000
0.815 32.380 0.35977778 0.500 06.380 0.07088889 0.000 00.000 0.00000000
0.490 06.005 0.06672222

Table 3: Raw data of the input value multiplier for hinges

Multiplier as a function of the input value


1

0.8

0.6
Multiplier

𝑦=𝑥

0.4

𝑓(𝑥)
0.2

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Input value

Figure 23: Graph of the multiplier for hinges as a function of the input value

27
B Input value to speed for servos with hold position
Due to a bug, the speed at which rotating servos with hold position rotate changes with the input value
when small values are used. This section contains the speed multipliers used for many input values, found
experimentally. Some notes about this process:
• Speed is the speed required on a servo with an input value of 1 to match the speed of a servo with a
speed being tested and the given input value, with an error of ±0.00005 speed units for speeds lower
than 1 and an error of ±0.0005 otherwise
– To compare the speeds of the servos, they were run continuously for some time and the final angle
was compared
For servos with 360 angle, they were run for 3 min
For servos with less than 360 angle, they were run for slightly less than the time required to
reach the maximum angle
– Servos with a configured speed of 1 and 2 as well as 360 and 180 angle were tested, with other
speeds/angles being checked to verify the results
• 𝑓𝑠,𝑎 (𝑥) represents the resulting speed of a servo with 𝑠 speed, 𝑎 angle, and 𝑥 input value
• The resulting speed can be approximated by 𝑓𝑠,𝑎 ̂ (𝑥) = min ( 𝑥 ⋅ 𝑎 , 𝑠)
0.0611 90

Speed as a function of the input value


2

1.8

1.6 𝑥 360
𝑦= 0.0611 ⋅ 90 𝑥 180
𝑦= 0.0611 ⋅ 90
1.4

1.2
𝑓2,360 (𝑥)
Speed

1
𝑓2,180 (𝑥)
0.8

0.6 𝑓1,360 (𝑥)


𝑓1,180 (𝑥)
0.4

0.2

0
0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0.045 0.05 0.055 0.06
Input value

Figure 24: Graph of the speed for servos with hold position as a function of the input value

28
Angle 180 Angle 360

Speed 1 Speed 2 Speed 1 Speed 2

Input Final Input Final Input Final Input Final


value speed value speed value speed value speed

0.0625 1.0000 0.0625 2.0000 0.0625 1.0000 0.0625 2.0000


0.0306 1.0000 0.0611 2.0000 0.0153 1.0000 0.0306 2.0000
0.0305 0.9980 0.0610 1.996 0.0152 0.9950 0.0305 1.996
0.0304 0.9950 0.0608 1.990 0.0151 0.9885 0.0304 1.990
0.0303 0.9920 0.0606 1.984 0.0150 0.9821 0.0303 1.984
0.0302 0.9885 0.0604 1.977 0.0140 0.9175 0.0302 1.977
0.0301 0.9855 0.0602 1.971 0.0130 0.8528 0.0301 1.971
0.0300 0.9821 0.0600 1.965 0.0120 0.7880 0.0300 1.965
0.0275 0.9000 0.0550 1.806 0.0110 0.7231 0.0275 1.806
0.0250 0.8175 0.0500 1.645 0.0100 0.6580 0.0250 1.645
0.0225 0.7360 0.0450 1.475 0.0090 0.5928 0.0225 1.485
0.0200 0.6540 0.0400 1.313 0.0080 0.5275 0.0200 1.323
0.0175 0.5730 0.0350 1.146 0.0070 0.4620 0.0175 1.161
0.0150 0.4910 0.0300 0.9830 0.0060 0.3964 0.0150 0.9973
0.0125 0.4090 0.0250 0.8200 0.0050 0.3306 0.0125 0.8332
0.0100 0.3265 0.0200 0.6550 0.0040 0.2648 0.0100 0.6683
0.0075 0.2455 0.0150 0.4910 0.0030 0.1987 0.0075 0.5024
0.0050 0.1634 0.0100 0.3280 0.0020 0.1326 0.0050 0.3358
0.0025 0.0816 0.0050 0.1636 0.0010 0.0663 0.0025 0.1682
0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000

Table 4: Raw data of the input value speed for servos with hold position

29
C Tips
• If you want your system to not modify the input that passes through, configure all of the logic gates to
have an output scale of 1. Then, if a gate needs to have more inputs other than the original one, make
sure the sum of the output values of those other inputs is 0. This will make the output which reaches
whatever your system activates be the output that the sensors/keybinds had
• Arithmetics logic blocks can be used to get always on signals with a constant value by using the addition
operation with the desired constant. The signal can be toggled by setting the operation to multiplication
and using a +1 input
• Organize the logic gates on a testbed while working with them before adding them to your vehicle,
having the logic gates organized as opposed to scattered across your entire vehicle will make remembering
what each gate does easier. There is no wrong way to organize them as long as they aren’t randomly
placed, but the way I do it is by splitting the gates into groups depending on function, inside each
group the arrows of logic gates point towards the outputs of that gate and away from its inputs, then I
put the groups of logic gates that a group outputs to in the direction the arrows of the logic gates that
the group uses as output are pointing, while I put the groups that group uses as input in the opposite
direction
• If you have problems figuring out how to do something with logic gates, draw it on paper first, being
able to see all connections at once helps a lot. Another method is writing it with if statements as they
translate to logic gates easily (each logic gate is an individual if statement)
• If you still have any questions or need help with something, feel free to contact me on the
official Trailmakers discord server

Made by ALVAROPING1

30

You might also like