Trailmakers
CrazyGamer400 Jun 9, 2023 @ 1:11pm
Logic Blocks Explained
First of all I know theres the guide section but im posting here first because im not sure if my findings are correct or if its everything. I want to make an easy and exhaustive explanation for new players, what the logic blocks do including fractional inputs and outputs, and negative inputs and outputs. Also i know flashbulb games with the help of LittleCornDogs already made a logic tutorial but that video didn't really cover everything, so i am also going to repeat some information from that video.

-General Logic-
Everytime a logic block is connected to either another logic block or a functional block, the result is multiplied to that block and a certain feature is then scaled accordingly. For example an OR gate with a result of 0.5 is connected to a servo set to 90 degrees, the servo will then rotate 45 instead because 90*0.5=45. However every block is effected differently, blocks with only one parameter (usually speed/power) gets scaled by the result, but for blocks with multiple parameters (servos, hinges, pistons) gets effected differently. Servos, only the angle is multiplied, speed isn't effected. Hinges its angle again, although i should mention that theres a glitch where hinges aren't scaled linearly (multiply result with parameter) instead its exponential. For example a hinge angle parameter is set to 90 degrees, if its was linear then getting 45 degrees we multiply 90 by 0.5, but because of the glitch the actual value to get 45 from 90 is about 0.86. Finally pistons, their speed is effected but not distance extended. Also camera blocks have multiple parameters but i have no idea what it effects if anything.

-AND-
It activates when EVERY input is not 0, however you might have noticed that if -1 and 1 are inputs it doesn't activate, i will explain why that happens in "How Fractional/Sign is applied for AND, OR, XOR for input/output"

-OR-
Activates if ANY input is not 0

-XOR-
Activates if ONLY ONE input is not 0

-How Fractional/Sign is Applied for AND, OR, XOR for Input/Output-
AND, OR, XOR follow a simple step. Given input values, add (subtract if negative) them all up with a maximum value of 1 and minimum of -1 and them multiply the summation with the output parameter and finally output the result. But thats just to figure out how much to output, it won't activate unless the condition unique to each logic gate is satisfied. For example take an AND gate and set the output parameter to 1 and input 0.4, 0.5, -0.1. Its them summed up 0.4+0.5-0.1=0.8, then 0.8*1=0.8, Every input is non 0 so it activates with a result of 0.8. You may now see why an AND gate doesn't output if the inputs are -1 and 1. The sum is 1-1=0 and 0*anything=0 So even if the condition that all inputs are non 0 are satisfied, it will still output a 0 so it doesn't do anything.

-How Embedded Inputs Effect Logic Gates-
You may question what happens if you directly put an input in the logic gate itself. It just treats it as a +1 input if green and -1 input if red. Its equivalent to another logic gate inputting a +1 or -1 and having it continue the steps mentioned above.

-Distance Sensor-
Activates when somethings blocks the screen within a certain distance. 1 meter = 4 blocks. Invert trigger has it trigger if nothing is blocking it within a certain distance

-Speed Sensor-
Activates when a specified speed is reached in the direction of the arrow. Trigger below activates if when its below a specified speed.

-Altitude Sensor-
Activates when a specified altitude is reached, Water is altitude 0. Maximum is 2000 m. Trigger below activates when its below the specified altitude. Relative to waves only applies to high seas but imagine the block and draw a line vertically down until it hits the water, it then treats that point as altitude 0. It changes as the waves change as well. Ignore waves just acts like a regular altitude sensor.

-Angle Sensor-
Activates if the tip of the arrow is within the blue area, grey if trigger outside is enabled. You can change the direction and size of the area and if your too lazy to type 90, 180, or 270 degrees. Rotating the block physically is the same as inputting those values.

-Compass-
Works the exact same as the Angle Sensor but its now horizontal and the arrow is always pointing north. North is a point beyond the map and corresponds to the top of the TAB map.

Comment if i missed anything or if anything is wrong.
< >
Showing 1-3 of 3 comments
alvaroping1 Jun 9, 2023 @ 4:37pm 
Originally posted by CrazyGamer400:
Hinges its angle again, although i should mention that theres a glitch where hinges aren't scaled linearly (multiply result with parameter) instead its exponential. For example a hinge angle parameter is set to 90 degrees, if its was linear then getting 45 degrees we multiply 90 by 0.5, but because of the glitch the actual value to get 45 from 90 is about 0.86.
That's not exactly correct. The angle does follow a somewhat exponential function, but it's not exactly exponential since it reaches 0 in the range [0, 0.263) and at 0.263 it suddenly jumps to 0.01 multiplier (i measured the actual multiplier at over 100 input values). Additionally, it doesn't follow the defining property of exponentials of its slope at some point being proportional to the value at that point (when you calculate the slope at each point from measured data and normalize by dividing by the value at each point, the resulting function isn't constant and greately varies)

Originally posted by CrazyGamer400:
-How Fractional/Sign is Applied for AND, OR, XOR for Input/Output-
AND, OR, XOR follow a simple step. Given input values, add (subtract if negative) them all up with a maximum value of 1 and minimum of -1 and them multiply the summation with the output parameter and finally output the result. But thats just to figure out how much to output, it won't activate unless the condition unique to each logic gate is satisfied. For example take an AND gate and set the output parameter to 1 and input 0.4, 0.5, -0.1. Its them summed up 0.4+0.5-0.1=0.8, then 0.8*1=0.8, Every input is non 0 so it activates with a result of 0.8. You may now see why an AND gate doesn't output if the inputs are -1 and 1. The sum is 1-1=0 and 0*anything=0 So even if the condition that all inputs are non 0 are satisfied, it will still output a 0 so it doesn't do anything.
Again, not entirely correct. First, that's how it works for all blocks, not just logic gates. Secondly, the behaviour for 0 value outputs is inconsistent between versions. On the steam version, it is indeed treated as no output. However, on other versions, it's treated as a output with 0 value. On most blocks this doesn't make a difference as the resulting behaviour ends up being the same after scaling is applied, but on blocks which ignore the analog value and just use its truthness value (such as lights/hover pads), it's treated as an on input

Originally posted by CrazyGamer400:
-How Embedded Inputs Effect Logic Gates-
You may question what happens if you directly put an input in the logic gate itself. It just treats it as a +1 input if green and -1 input if red. Its equivalent to another logic gate inputting a +1 or -1 and having it continue the steps mentioned above.
Another thing you missed: both keybinds are treated as the same input (this confusses many people, as for example an AND gate with both keybinds set will activate when you press either as it only has a single input), and they count as a separate input for each seat with control over that gate (particularly troublesome when you have keybinds in AND gates, as they will have to be pressed in all seats at once)

Overall it's a fairly decent guide, although there are still some things missing (how toggle/timers work in gates with multiple inputs for example, which is not exactly how you would expect). For a more in depth guide, you can check out the one i made[github.com]
Among us balls Oct 26, 2023 @ 12:17am 
this is the most stupid logic block system this should be made into a math block

all I want to do is make a simple logic block that allows me to give input to a thruster when a certain button is activated and stop giving input when the input is removed not this bs I don't need to be able to triangulate things with logic blocks
alvaroping1 Oct 26, 2023 @ 4:37am 
Originally posted by Among us balls:
this is the most stupid logic block system this should be made into a math block

all I want to do is make a simple logic block that allows me to give input to a thruster when a certain button is activated and stop giving input when the input is removed not this bs I don't need to be able to triangulate things with logic blocks
This system can directly be simplified to what you want by simply ignoring output values. There is no point in splitting the functionality
< >
Showing 1-3 of 3 comments
Per page: 1530 50

Date Posted: Jun 9, 2023 @ 1:11pm
Posts: 3