Skip to content

Add SDL Logic Nodes#458

Open
Hoikas wants to merge 10 commits into
H-uru:masterfrom
Hoikas:sdl_nodes
Open

Add SDL Logic Nodes#458
Hoikas wants to merge 10 commits into
H-uru:masterfrom
Hoikas:sdl_nodes

Conversation

@Hoikas

@Hoikas Hoikas commented Jul 15, 2026

Copy link
Copy Markdown
Member

Intro

This PR adds a set of logic nodes that can be used to more easily track the flow of execution and information. Almost all of these nodes export PythonFileMods under the hood. The Python File Nodes are great in that we have them, but it gets challenging when they are used with Responders because the flow control is inverted in that case - the responder node is an input to the PFM node and script, but the script can trigger the responder, meaning it should logically be an output. These nodes make it so that responders are outputs. See an example tree:

image

This tree combines two different situations and should probably be separated in a real Age. The upper tree is the more complicated one. It shows a clickable that will only be possible to click when the Rm02BtnEnabled SDL variable is set to true. When the clickable is pressed, the Rm02SpinTorus SDL boolean is toggled. When Rm02SpinTorus is true, the animation attached to the Rm02Torus object plays. When the variable is false, the same animation stops. This is the proper way to design logic interactions in the game to synchronize among multiple clients correctly, and the flow is quite clear IMO.

The bottom tree is an exercise for you, the viewer, to figure out. Be advised, although the "SDL Clickable" node is shown in the image above and described in the text above has actually been removed from this PR due to some design concerns. I will open a separate PR with that node and describe the design concerns there soon.

I do not have a demo blend to share at this time, so here is a list of the nodes added and the Python files they use in commit order. I may make a few more minor adjustments to this to ensure that some in-node lists start populated, but the code is otherwise complete, IMO. This is the follow-up promised in #449, and I expect I will want to merge this one shortly after it. Feedback needs to be prompt.

Nodes

Logic > SDL Variable

This just holds an SDL variable's name and shows logic flow. It doesn't actually export anything.
image

Logic > Change SDL

Changes an SDL value when notified.
Files: xAgeSDLBoolToggle, xAgeSDLBoolSet, xAgeSDLIntChange
image

Logic > SDL Boolean Trigger

Trigger a responder when an SDL bool changes
Files: xAgeSDLBoolRespond, xAgeSDLBoolAndRespond
image

Conditions > SDL Boolean Condition

Gates the firing of some other condition behind an SDL variable. Doesn't enable/disable the attached condition.
File: xAgeSDLBoolCondResp
image

Logic > SDL Boolean Gate

Takes >=2 SDL variables as inputs and performs either a logical AND, OR, XOR, or NAND on them, storing the result in an output variable.
Filenames: xAgeSDLBoolAndSet, xAgeSDLBoolGateSet
image

Logic > SDL Value Map

Uses an in-node lookup table to set the output variable value from the input variable value.
File: xAgeSDLVarSet
image

Logic > SDL Integer Trigger

Fires specific responder states based on an SDL int value.
File: xAgeSDLIntStateListResp
image

Logic > SDL Value Trigger

This is like SDL Boolean Trigger, except for a set of specific integer values.
File: xAgeSDLIntStartStopResp
image

Bonus Chatter

Also, in order to "convert" from being inside of a Responder to triggering the Change SDL node, the "Trigger MultiStage" message node has been renamed to just "Trigger". The "Trigger" node can trigger a MultStage or any condition... such as Change SDL. This will be a powerful way to set SDL variables at specific points during responders, eg on a oneshot marker ("DoorButtonTouch" anyone?).

Hoikas added 5 commits July 16, 2026 13:01
This adds a new node for changing an SDL variable by drawing connections
from conditions to SDL variable nodes. I initially wanted to use a logic
thunk here just link in the link event node, but I found that plAACO
doesn't forward the "whodoneit" information that some scripts use. So,
this just forwards the attached condition.
This adds q node for responding to SDL boolean events. The SDL Bool
Trigger node is designed to fire off a Responder when an SDL variable is
in the expected boolean state (true or false). Optionally, the Responder
can be gated on another SDL variable. The node swaps between
xAgeSDLBoolRespond and xAgeSDLBoolAndRespond as needed.
This adds an SDL Boolean Condition node that triggers an attached
Responder if a condition becomes true while an SDL boolean variable is
true. The underlying script is xAgeSDLBoolCondResp, which was added in
MOUL. The script also exists in the Offline KI, so it's a pretty safe
one to bet on.
The "trigger multistage" node was a generic this-player-triggered-it
message anyway. We now have some pretty generic SDL setting stuff, and
it would be nice to fire those from responders. This is the tool we'll
use for that.
This implements a real SDL boolean logic gate node. Some good future
work here would be to force a minimum of two input node sockets to be
visible at all times.
@Hoikas

Hoikas commented Jul 16, 2026

Copy link
Copy Markdown
Member Author

Rebased due to conflict from merging #449.

@Hoikas Hoikas mentioned this pull request Jul 16, 2026
Hoikas added 5 commits July 16, 2026 20:53
This allows a socket definition to spawn a minimum number of sockets on
a node. This is most useful for the SDL Boolean Gate node where there
should always be a minimum of two input variables. Showing a minimum of
two sockets is a good way to convey that requirement.
Blender does have a "COMPACT" drawing mode for list templates, but I
find that those are somewhat odd - they display an item picker as an int
property that barely makes sense to me. It's better, IMO, to just draw
something resembling a standard list by hand that emulates the long form
list. Just more compact.
This is basically a fancy lookup table, except for SDL.
This node is a wrapper for xAgeSDLIntStartStopResp, which has been in
the game since TPotS. A notable use of this in MOUL was for the Kahlo
Pub collapse effect.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant