Microcontrollers & Logic: Difference between revisions

From Unofficial Stormworks Wiki
Jump to navigation Jump to search
No edit summary
Sav (talk | contribs)
Line 54: Line 54:
|}
|}


==== "Logical" gates. ====
=== "Logical" gates. ===
[[File:Logical_tab_-_logic_nodes.png|frameless|682x682px]]
[[File:Logical_tab_-_logic_nodes.png|frameless|682x682px]]


Line 222: Line 222:


===== Pulse (Toggle to Push) =====
===== Pulse (Toggle to Push) =====
[[File:Pulse Symbol.png|frameless|36x36px]] "''A switch that outputs a single tick pulse. It can be configured to pulse when being switched from off to on (default), on to off, or always when the input signal changes.''"
[[File:Pulse Symbol.png|frameless|36x36px]] "''A switch that outputs a single tick pulse. It can be configured to pulse when being switched from off to on (default), on to off, or always when the input signa''-''l changes.''"


===== Push To Toggle =====
===== Push To Toggle =====
Line 248: Line 248:
===== Boolean Functions (Both <code>x,y,z,w</code> & <code>x,y,z,w,a,b,c,d</code>) =====
===== Boolean Functions (Both <code>x,y,z,w</code> & <code>x,y,z,w,a,b,c,d</code>) =====
[[File:Function Symbol.png|frameless|35x35px]] "''Evaluates a logical expression with up to <code>4 to 8</code> input variables and outputs the result.''"
[[File:Function Symbol.png|frameless|35x35px]] "''Evaluates a logical expression with up to <code>4 to 8</code> input variables and outputs the result.''"
The Boolean Functions block can perform any number and combination of AND, OR, XOR, and NOT operations on its boolean inputs using the operators:
<code>&</code> - AND
<code>|</code> - OR
<code>^</code> - XOR
<code>!</code> - NOT





Revision as of 22:06, 17 March 2026

Introduction

Microcontrollers are a way of condensing logic in Stormworks, they are programable processors that can be custom made to fulfil a wide array of tasks and use cases within Stormworks using Lua blocks, Logic Gates, mathematical functions, etc. With microcontrollers (MCs) you can use a variety of logic gates that are not accessible through the traditional parts menu within the vehicle builder, as a result not only are MCs good at condensing logic, but also give the player access to a wider variety of options and paths to take in order to fulfil the required task.

This page will go over how to create a microcontroller, and go through a majority of the logic blocks that are found within Stormworks and show you examples on how they are used with images.

Creating a Microcontroller

MC Tab Location

Properties Initial setup.

Parts Menu Example

Step 1 in any MC is creating one. At the top of your vehicle editor you will see 8 tabs, you want to select the final one labelled "Microcontroller Editor". Once in this mode, it will default you to the "Design" settings and you will see 3 tabs; "Properties", "Logic" and "Symbol".

  • Properties tab is where you will define a name and description for your microcontroller; this is what it will appear as in your parts menu. You also will have the opportunity to define the size of your microcontroller; with the smallest scale being 1 Block × 1 Block × 1 Block and the maximum being 6 Block × 6 Block × 1 Block. It is important to select the correct size however this can be edited at any time, you can make it as large as possible and condense later.
  • Logic tab is where you will set the various logic nodes.
  • Symbol Tab is where you will setup the symbol that will appear in the parts menu for your microcontroller. This is done by toggling each pixel from dark grey to light grey in a 16 × 16 grid.

Logic Nodes

Step 2 in creating a microcontroller is assigning your Logic Nodes. To do this, go to the "Logic" tab in the microcontroller designer and select the large blue addition symbol which is labelled "Add Node" when you hover your mouse over it. Once done, you will see a red on/off input node appear in the list, as well as a red circle appear on the microcontroller in the bottom left slot. From here, we can choose the kind of node, and whether or not we want the node to be an input variable (going into the microcontroller) or an output variable (leaving the microcontroller), here you can also set a name and a description for your logic nodes. The different forms of logic nodes are;

Node Layering
  • on/off - Alternatively referred to as Boolean nodes; this is your basic binary On or Off logic transfer node. The default colouring is Red
  • number - This node will transfer a numerical value. The default colouring is Green.
  • composite - This is your composite channel node; containing 32 channels for both on/off and/or number data, Meaning it is possible to pass 64 different channels of information through this single node, provided 32 different on/off values and 32 different number values. The default colouring is Purple.
  • video - This node will allow you to output a video to various components (e.g. monitor, HUD, etc) or input from a Camera component to be modified (e.g. adding a sight or data to a HUD). The default colouring is Light Blue.
  • audio - This node will allow you to input and manipulate audio from microphones. The default colouring is Khaki Green.

Following game version v1.15.10 - The Microcontroller Layers Update[1] in January of 2026 you are now able to layer logic nodes over one-another allowing for more compact microcontrollers.

Logic Editor

The Final step is going into the logic editor; represented at the top of the Microcontroller editor by the Lightbulb. This will bring you to a large grid with its own toolbar and parts menu that includes various logic gates for various different functions; in here you will also see the nodes you have selected in the "Design" tab as boxes with node input or output anchors, that share the same name and description as given in the Logic Design tab. Now you can start making your microcontroller's logic.

Logic Gates

Once you have successfully set up your logic nodes; you can begin to learn what the various logic gates do. To understand this, we will need to first understand what a truth table is; a Truth Table[2] is used to map out various logic gate or mathematical outcomes in a given system. (see example of an AND gate truth table below). In this page; we will be using A, B, C as inputs variable, and Q as output variable.

AND Gate Example
A B Q
0 0 0
1 0 0
0 1 0
1 1 1

"Logical" gates.

This section is for the "Logical" gates tab in the Parts Menu.

AND Gate

"Outputs the logical AND of its two input signals."

This logic gate will only output a signal if both inputs are toggled on.

AND Gate Demonstration
Truth Table
A B Q
0 0 0
0 1 0
1 0 0
1 1 1
NAND Gate

"Outputs the logical NAND of its two input signals."

This will output a signal if either of the signals are toggled on; but will output no signal if both inputs are toggled on.

NAND Gate Demonstration
Truth Table
A B Q
0 0 1
0 1 1
1 0 1
1 1 0
OR Gate

"Outputs the logical OR of its two input signals."

This will output an On signal if either of the 2 inputs are toggled on. This is the most common way of combining 2 on/off signals.

OR Gate Demonstration
Truth Table
A B Q
0 0 0
1 0 1
0 1 1
1 1 1
NOR Gate

"Outputs the logical NOR of its two input signals."

This gate will only output a signal if neither input is toggled on. If either or both inputs are toggled on, the gate will not output any signal.

NOR Gate Demonstration
Truth Table
A B Q
0 0 1
0 1 0
1 0 0
1 1 0
XOR Gate

"Outputs the Logical XOR of its two input signals."

This gate outputs a signal if only output a signal if either A or B are toggled on; but wont output a signal if both or neither are enabled.

XOR Gate Demonstration
Truth Table
A B Q
0 0 0
0 1 1
1 0 1
1 1 0
NOT Gate

"Outputs the logical NOT of its input signal." This will output the opposing signal inputted; On becomes Off, Off becomes On.

NOT Gate Demonstration
Truth Table
A Q
1 0
0 1
Pulse (Toggle to Push)

"A switch that outputs a single tick pulse. It can be configured to pulse when being switched from off to on (default), on to off, or always when the input signa-l changes."

Push To Toggle

"An on/off switch that is toggled every time a new on signal is sent to its input."

JK Flip Flop

"An JK Flip flop that can be set and reset using two on/off inputs."

SR Latch

"An SR latch that can be set and reset using two on/off inputs."

Constant On Signal

"Outputs a constant on signal."

This will output a constant on signal.

Constant On Demonstration
Truth Table
Q
1
Boolean Functions (Both x,y,z,w & x,y,z,w,a,b,c,d)

"Evaluates a logical expression with up to 4 to 8 input variables and outputs the result."

The Boolean Functions block can perform any number and combination of AND, OR, XOR, and NOT operations on its boolean inputs using the operators:

& - AND

| - OR

^ - XOR

! - NOT