Nodebox: Visual Scripting for UGC (now) at your fingertips
Posted 10 hours ago

Foundations

Nodes
I knew that I want nodes to be completely separate from any Components/GameObjects.
Someone will eventually want to make a 2D node editor, a fucking NodeGraph-to-Lua transpiler or something else completely.
By making a `Node` it's separate thing and then implementing a wrapper on top of it (`Node3d`), I ensure that any weird visual scripting fantasies can be realized.
My first visual scripting fantasy was to make a `Node` just has more `Node`s inside of it, wouldn't it be neat?
Also, Nodes don't handle execution at all, they just sit there until a wrapper tells them to recalculate outputs.
("Pulse"/"Signal" pins aren't there yet, still thinking of a better way to implement them in the `Node` base class)

`Node`s store both their input and output, which sounds like overkill, but I like that you can read both (if you hover on a pin f.e.), even if it doesn't have anything connected and isn't being processed right now.
`Node` also needs to be able to add/remove it's pins, because sometimes you want that (Array/List/Dictionary initializers, sequence, etc).
`Node`s need descriptions/docs, and, also, groups and aliases, so you can propertly search for them.

Also, you need to a way to get to wrappers from them, but a single `Node` can even have multiple different wrappers at the same time. So, GetMeta<T> / SetMeta<T> were added too.

Wires
Same.
They should be wrappable, be as abstract as possible, and just pass outputs into inputs when told so.
Same metadata trick too.

Also, Nodes and Wires need to reference each other, but because everything is "in memory" and should have wrappers around them in general, I decided to shit out a ton of WeakReference<T>s, not sure if it's working properly, but seems to be fine.

The "Evaluation Engine"
Nope, it's just some goofy GameObjectSystem, that is separate for each group(node3d, wire3d) of wrappers.
There's definetely a better way, but I have NO idea what's the best way to actually evaluate them yet.
And it's almost the least complex thing in here, so, nah

Ideas for the Future

I have multiple scripting, visual scripting and VR enthusiasts behind my back.
And they don't stop yapping.


This shit needs execution flow pins ASAP
(Non-Pure nodes in Blueprint, Discrete nodes in Resonite)
Basic human need to have a button make sound when it's pressed.

Collapsing Nodes into one
(Macros in Blueprint, Fuck-all in Resonite)
Simplest way to reuse code.
Also allows people to make "kindergarten libraries", just stuff some collapsed nodes into a dupe, or save them locally, I dunno.
Collapsed Nodes are just collapsed nodes though, so if you uncollapse a node, edit it and collapse it back together, none of the others change.

"Contexts"
This might be like the second coming of Crist, but for 3D visual scripting, maybe.
A place where you can create context-wide functions and event handlers.
Normal libraries will be registered and edited there too.
Will also be the place where you allow other players to mess with your stuff.

Other feature ideas include:
  • Node Search
  • Tooltips for nodes
  • In-editor Node3d WorldPanel rendering, if even possible
  • SceneTree Explorer (to grab properties of anything, from anywhere)
  • Multiplayer support
  • A 2D Grid to snap nodes to
  • Packing/Unpacking nodes into GameObjects (same as Pack/Unpack in Protoflux)
  • Custom panels for some nodes, so that they are more compact (+, -, *, sin, ...)
  • VR Support, lol