LogiX Impulses

From Neos Wiki
Jump to navigation Jump to search
Other languages:

Many LogiX nodes can affect the world. For example, Duplicate Slot will create a copy of its input slot, and Set Global Transform sets the position, rotation, and scale of a target slot.

Clearly, these changes must happen in a specific order. We cannot set the position of a duplicate that we haven't made yet.

This is where impulses come in. An impulse occurs in response to an event, such as a button being pressed, a player joining the world, or a collision occurring. Impulses flow along impulse wires (which have white-and-gray chevrons pointing in the direction of travel). Nodes that take impulses (called passthrough nodes) will execute when an impulse reaches them.

Impulses are evaluated by one, and only one, player. An impulse cannot be "unowned"; this is why many nodes that generate impulses require a User input.

Some nodes, including many under the Flow category, have more than one impulse output. These can be used to provide control flow -- for example, the If node uses a boolean input to decide which of the two impulse outputs to use. Note that impulses will never be sent in two directions at once: there is always one and only one impulse.

Context

Since an impulse can be produced in response to a specific event, there may be data that only makes sense -- or only even exists -- during the impulse. If a collision is not occuring, nothing is being collided with; if a slot is not being duplicated, then there is no duplicate to use.

Thus, some values are transient, and can only be accessed during an impulse. When examined directly, you will probably see a null or default value. If you are trying to debug a program involving passthrough nodes, you can use the Write and Write Ref nodes to record these values.

Almost all outputs from passthrough nodes are transient. The outputs are directly related to the impulses that come from the node; it would not make sense for them to be on the node if they weren't!

The context of an impulse disappears when the impulse ends. Importantly, some nodes, like Delay, will end the impulse they receive, then fire an entirely new impulse some time later. This is why Delay With Value exists; it allows for a single value to be preserved.

Conversely, dynamic impulses preserve the evaluation context: the impulse that leaves a Dynamic Impulse Receiver is the same one that goes into a Dynamic Impulse Trigger.

Breakage

An impulse is instantaneous; the world is completely frozen until the impulse is over. Thus, if an impulse takes an abnormally long amount of time to complete, it will cause whoever is running it to freeze. This can happen if...

  • A While loop's condition is stuck on True
  • A For loop is set to run too many times
  • A loop of impulse wires exists
  • A dynamic impulse receiver causes itself to be triggered

Once a time limit is reached, the impulse is forcibly stopped. The offending nodes will become broken, turning them red and preventing them from working. After fixing the problem, you can reset the nodes by pointing at them with a LogiX tooltip and hitting secondary.