Difference between revisions of "LogiX Overview"

From Neos Wiki
Jump to navigation Jump to search
m (→‎Extracting: Correct input/output for ref nodes.)
(→‎Creating: Expand upon wire creation and destruction.)
Line 29: Line 29:
 
== Creating ==
 
== Creating ==
  
The LogiX Tooltip can spawn a node browser, which provides the majority of nodes you will need. It is organized into categories; see the [[LogiX]] page for a table explaining the various categories.
+
The LogiX Tooltip can spawn a node browser, which provides the majority of nodes you will need. It is organized into categories; see the [[LogiX]] page for a table explaining the various categories. Double-clicking is necessary both to navigate the nodes and to select one.
 +
 
 +
Your currently selected node will be displayed by your tooltip, along with the packing root (see below).
  
 
Double-clicking in the world after selecting a node will spawn it. To connect nodes, physically touch the input or output with your tooltip, then pull your primary input (probably your trigger). Release when hovering over a compatible input or output to create a wire.
 
Double-clicking in the world after selecting a node will spawn it. To connect nodes, physically touch the input or output with your tooltip, then pull your primary input (probably your trigger). Release when hovering over a compatible input or output to create a wire.
 +
 +
To cut a wire, pull the trigger away from any existing wires or nodes and drag. A line will appear. Any wire touching the line when you release the trigger will be destroyed.
 +
 +
Grabbing a wire with your laser will create a relay. Relays let you reshape your wires, as well as connect multiple inputs to a single piece of data (or multiple impulse wires to a single impulse input).
  
 
For some types, like ints and strings, you can press secondary while dragging from an input to create a new input node, which will let you enter a value directly. For any type, you can press secondary while dragging from an output to create a new display node, which will show the current value.                             
 
For some types, like ints and strings, you can press secondary while dragging from an input to create a new input node, which will let you enter a value directly. For any type, you can press secondary while dragging from an output to create a new display node, which will show the current value.                             
Line 38: Line 44:
  
 
Some nodes have '''dummy''' inputs, which are bright purple. They will transform into the appropriate type when you connect something.
 
Some nodes have '''dummy''' inputs, which are bright purple. They will transform into the appropriate type when you connect something.
 +
 
== Extracting ==
 
== Extracting ==
  

Revision as of 07:17, 11 January 2021

Background

LogiX is a dataflow programming language. This means that it is laid out as a graph, rather than as a long list of instructions.

Programs are laid out in physical space; you can use all three dimensions to organize your nodes and wires.

Basics

Operations, such as addition, are represented as nodes. Data (values, like numbers and text) flows between nodes on wires.

Example of a LogiX graph that multiples and adds some numbers

The LogiX above multiples and adds together some numbers. Note how data flows from source to destination. This is directed; data can't flow out of the left side of a node or flow into the right side of a node.

In addition to data, impulses can also flow from node to node. An impulse fires in response to something happening, like a timer going off or a button being pressed. An impulse is always run by exactly one user. You can think of an impulse much like how execution occurs in a normal language: there is one and only one "place" the program is in at any moment.

Example of a LogiX graph that uses impulses

The LogiX above writes the current time to a variable whenever the button is pressed.

Note how the value in the variable does not equal the current time! It will only change when an impulse occurs.

Impulse wires can be identified by their white and gray chevron pattern; impulse inputs and outputs are also shaped like chevrons.

Usage

To create or modify LogiX graphs, you need to have the LogiX Tooltip equipped.

Creating

The LogiX Tooltip can spawn a node browser, which provides the majority of nodes you will need. It is organized into categories; see the LogiX page for a table explaining the various categories. Double-clicking is necessary both to navigate the nodes and to select one.

Your currently selected node will be displayed by your tooltip, along with the packing root (see below).

Double-clicking in the world after selecting a node will spawn it. To connect nodes, physically touch the input or output with your tooltip, then pull your primary input (probably your trigger). Release when hovering over a compatible input or output to create a wire.

To cut a wire, pull the trigger away from any existing wires or nodes and drag. A line will appear. Any wire touching the line when you release the trigger will be destroyed.

Grabbing a wire with your laser will create a relay. Relays let you reshape your wires, as well as connect multiple inputs to a single piece of data (or multiple impulse wires to a single impulse input).

For some types, like ints and strings, you can press secondary while dragging from an input to create a new input node, which will let you enter a value directly. For any type, you can press secondary while dragging from an output to create a new display node, which will show the current value.

You can always plug an output into an input of the same type. In other cases, the types may be compatible after a cast, which will be automatically created when you make the connections.

Some nodes have dummy inputs, which are bright purple. They will transform into the appropriate type when you connect something.

Extracting

Your tooltip can "extract" fields and components in three different ways to let you observe and control the world:

Extract Interface
Press secondary whilst grabbing a slot or a component (or any of its fields) to create an interface card. The interface card provides inputs, which you can use to read values from the component. You can also drag outputs into the interface card to create a drive node.
Extract Drive Node
Press secondary whilst grabbing a value field to create a drive node. The drive node is an input, and will control the value of its field. Only one thing can drive a field at a time.
Extract Ref Node
Press secondary whilst grabbing a reference field to create a ref node. The ref node can be used as an output, to get a reference, or as an input, to target things like Write nodes.

Packing

Once you've finished your LogiX, you'll want to pack it to hide it from view. Grab a reference to a slot in the same hand that has your tool, open the context menu, and select Set Packing Root. Then, hold the secondary input down while pointing at a LogiX node, and it, along with all connected nodes, will be packed under the slot.

Packing removes the visuals for nodes, but preserves their positions. They are also parented to the packing root, and will thus move along with it.

You can unpack LogiX by grabbing a slot and selecting the Unpack option in your context menu. This restores all nodes beneath that slot.

Glossary

Background

Type
The type of a piece of data describes what values it can have and what it means. Some common types are integers (whole numbers), floats (numbers with decimals), strings (text), and booleans (true/false)
Data
A piece of data is a value. 5, 5.3, true, and "hello world" are all data.

Basics

Node
A single unit of LogiX that performs some kind of operation, such as adding two numbers or sending an impulse every frame.
Wire
A connection between LogiX nodes. A wire can carry either data or an impulse.
Relay
A node that allows you to control the shape of wires. You can also connect multiple data wires to the output of a relay, or multiple impulse wires to the input of an impulse relay.
Input
A piece of data that goes into a node. Only one wire may flow into a non-impulse input. Many impulse wires may flow into one impulse input.
Output
A piece of data that leaves a node. Many wires may flow out of a non-impulse output. Only one impulse wire may flow out of one impulse output.
Impulse
A single event that is run by a single user. Impulses flow through the LogiX graph. Impulses cannot be duplicated or split -- they will follow one path, and only one path. Some kinds of nodes can produce impulses, such as Raw Data Tooltip Events.

Specifics

Passthrough Node
A node that accepts an impulse. Every passthrough node, except for the Display Impulse node, will have at least one impulse output. These nodes can change the state of the world; see Write for an example.
Transient
A piece of data is transient if it only exists during an impulse. For example, On Collision Start's ICollider output only exists during the impulse triggered by the collision.
Cast
A node that is automatically created if your data isn't of the right type. Casts may lose precision (e.g. float-to-int loses the decimal and may be significantly wrong if the float is too big).
Value
A value type directly stores some data. Most of the types in the node picker, with the exception of User and Slot, are value types.
Ref
A ref type points to something else. User and Slot are common examples of ref types. They are often handled differently from value types, and are necessary if you want to modify something in the world.
Slot
Anything in the world. Slots can contain other slots.
Component
Something attached to a slot that adds functionality.
Field
A piece of data stored on a slot. A field can be referred to with a reference node, or read from with an interface card.
Interface Card
A LogiX node that allows you to read the fields from a slot or component, as well as generate drive nodes for the fields.
Drive Node
A node that controls a field. It directly replaces the field's value with something computed from other values, which means that each client can handle it locally. You cannot drive reference fields.
Ref Node
A node that contains a reference. You need ref nodes to give things like the Write node a target.
Write
To write is to set a value once. A write is shared over the network. Writing can only be done on non-driven fields.
Drive
To drive is to continuously control a value based on another value. Drives are handled by each user. Only one thing may drive a field at a time.
Dummy
A dummy node is one that can become a more specific node when given a type. For example, Write can write any value type, and will switch colors to match the one that is plugged into it.