Logic Editor
Last updated
Last updated
Logic in INCARI is what allows us to take our 2D/3D assets and turn them into fully-interactive user interfaces. Traditionally, building this kind of complex system was only achievable by writing a lot of code, however by utilising INCARI's powerful visual scripting tools, we can build these systems without writing a single line! This section introduces you to some of the core concepts and terminology of INCARI's Logic Editor.
Logic Editor - The main window which contains all things logic-related. It is compartmentalised into several different sections discussed below.
This tab shows a list of all nodes in your logic tree. When you select an item in the Explorer tab, the corresponding node is simultaneously selected in the Logic Graph.
The most important section of the Logic Editor. If the nodes and variables are the paints and materials at your disposal, then the Logic Graph is the canvas. This is where we build our systems from the ground up and where you will spend most of your time while using INCARI.
Fundamentally it is comprised of a combination of two entities: Nodes and Connections.
Nodes are components which each have a specific, singular function. The majority of Nodes evaluate data values based on input parameters, but they can also represent Variables, Events and Objects.
Sockets are like the ports on an electronic device. Along with Connections, they allow us to link Nodes to each other. In INCARI, sockets are either:
Input (receiving an instruction or data value). Sockets on the left-hand side of a Node are Input Sockets.
Output (sending an instruction or data value). Sockets on the right-hand side of a Node are Output Sockets.
Beyond that, we have Pulse and Data Sockets, denoted by white triangles (►) and coloured squares (⬛) respectively. For example, when we refer to an "Input Pulse Socket", we are normally referring to the white triangle in the top-left-hand side of a node.
The concept of Sockets, makes much more sense in the context of Connections (See below).
Connections are the "wires" that link our components together. This is how we pass data between nodes and how we determine the execution order of our logic. Connections come in two categories and are related to the type of Socket they are plugged into. The two categories are Pulse and Data.
These connections do not carry any data between nodes. What they do is tell nodes that it is time for them to do their thing. Once a node has finished its execution and its purpose has be fulfilled, the next node connected via the Pulse connection will then begin its task. Pulse connections are represented by a white "wire", linking two Pulse Sockets, represented by white triangles (►). Multiple connections can be plugged into a single Pulse Input Socket, however only one connection can come out of a Pulse Output Socket. Pulse Connections are also referred to as Pulses.
These connections pass data values between nodes. We do this by connecting the Data Output Socket of one node into a Data Input Socket of another node. Both the input and output sockets must be of the same data type. Data Sockets are represented by a coloured square (⬛), the colour of which, corresponds to the Data Type. Conversely to Pulse connections, Data Input Sockets can take only one input connection, whereas Data Output Sockets can have multiple output connections. Unlike Pulse connections, Data connections do not initiate the execution of a node.
The Node Attribute Editor (referred to simply as Editor hereinafter) is similar to the Attribute Editor, except rather than adjusting the Attributes of Objects, we can adjust the Attributes of Nodes. Node Attributes are specific to that particular Node and are documented in their corresponding entry in the Toolbox section. Often, Node Attributes are simply an alternative to using Input Connections and can define a default value if there is no Connection attached to that particular Input Socket. There are exceptions however, where Attributes can be set only in the Editor, and there is no equivalent Socket available, which are discussed below, in the Node-Specific Attributes section.
Coming under the "Node" heading of the Editor, these Attributes are available on nearly all Nodes. and can only be set in the Editor.
All Nodes have the following Attributes:
Name - The name of the Node. This isn't editable unless it is a Function.
Type - The type of Node. This isn't editable and will often be the same as the name, unless the Node represents something which the user defines, like Functions, Variables and Objects.
Enabled - Allows the entire Node to be ignored by enabling/disabling it. This is useful when you want to test and debug a specific part of your logic, as you can disable entire node trees temporarily. All subsequent nodes linked via Pulse Connections will not be executed.
Most Nodes also have an additional attribute:
Pulse Pass Through - Similar to the Enabled attribute above, it disables the evaluation of a Node. The difference with this option however, is that subsequent Nodes linked via Pulse Connections will be executed. This is useful when you only want to disable part of a Node Tree, rather than the entire thing.
As stated above, most Node Attributes are an alternative to Data Input Connections and allow us to set default values, in the absence of such a Connection. There are cases, though, where Attributes can only be set in the Editor, which modifies the way that the Node functions.
Some Nodes work with different Data Types, however these need to be explicitly defined in the Editor, so that the Node knows which type it will receive (Input), and/or the type of data it will return (Output). Where multiple Data Types are available, there will be a drop-down menu in the Editor. Changing the Type will also change the colour of the corresponding Socket.
Some Node Attributes correspond to something outside of the Logic Editor, such as a Scene, Screen, Object, Text Object or File. In this case, you will see a small square, which will either have a thumbnail, related to that type of File or Object, or the text "drag here". To assign something to the Attribute, simply drag and drop it onto the square.
There are a few Nodes in INCARI that allow you to customise the number of Input/Output Sockets. The purpose for this is very specific to that particular Node, but the process of adding/removing parameters is the same.
By clicking the plus button (+) you can add additional elements, which will be added to the bottom of the list.
By clicking the cross button (x) you can remove elements. If you click the cross on the list header, it will remove all of the elements, whereas if you click the cross on a list item, you only remove that single element.
You can also rearrange the order of the elements by clicking and dragging elements using the rearrange button (⠿).
All Node Trees in INCARI must originate from a special type of Pulse Socket, called an Event. While most Nodes require an Input Pulse Connection to both evaluate and trigger subsequent, Pulse-connected Nodes, Events don't necessarily require an Input Pulse to fire, and are actually triggered as a response to a pre-defined action or occurrence.
INCARI currently has two designated Event Nodes, to trigger logic based on user input. They are KeyPress and KeyRelease, which you can read more about in those sections of the documentation.
There is also the Project Node, which triggers its OnLoaded Event once the project is loaded in INCARI Player.
In addition to their standard input/output Sockets, some Nodes also have their own Event Sockets, which can usually be recognised by their label, which will be prefixed with the word "On", for example OnCancel, OnChange, OnReset. The conditions that cause these Events to fire are specific to that particular Node, however it is good to be aware that they exist and how to tell them apart from other Pulse Output Sockets.