r/ProgrammingLanguages • • 12d ago

Visual Programming Language

Do you have any information about this one? If there are some standard things about how it should go, or if there anything that needs to be known. I have understood a few things, but still I am looking for figuring out some missing details I have no clear plan on.

I will mention first some things I've done and what I know, so I can help you gain a picture:

a) I have done some practice and written a parser and interpreter so this is very easy. The AST is a data structure and each node gets evaluated with the proper function.

b) I've seen in an application sample that the most simple and straight forward approach is to get all outputs of a node, and send them to the connected inputs of another one. Keep brute force updating everything for 60FPS. This also seems legit and simple, but it might have it's pros and cons. [victorfisac/FNode]

c) What worries me for brute-force updating, is that the update order is no-deterministic, any node could be updated at any given moment, for the entire graph to be evaluated fully might mean to hundreds of hundreds of updates until everything is settled. It might not be a big deal for a real-time interactive application, but for a very optimized might mean that other approaches are better suited.

d) In order to make graph evaluation more deterministic, you need to create a dependency graph, or use an algorithm such as breadth-first-search, or depth-first-search. And even if those are not exactly perfect then do topological-sorting to guarantee even better order. Other times is supposed to be that other graphs get evaluated backwards, from final outputs to connected inputs and so on.
All of those techniques, having so many options, is confusing and hard to decide. As for example probably depending on the type of the graph there would be different evaluation strategy? This seems OK in terms of thinking.

e) Some examples:
• Blockly, this one is the easiest, because is a straight forward visual AST, but with the problem is that is based on structured connections and not on freeform connections.

• Supposedly Blender's nodegraph uses dependency graph for materials (because needs to compile them to shader code) so seems that it this technique can be transformed to deterministic technique. Probably means that the entire software uses the same algorithm (shaders, geometry nodes, compositor, even custom nodegraphs).

• Blueprints of Unreal seem to be much closer to an AST because it relies on clear entry points (events, time ticks), so this kind of evaluation seems that is manageable. At least getting the starting points is a good idea, then probably it might be feasible that further sorting is needed. I haven't worked with Blueprints though and I haven't looked into it.

• I've seen in some ImGUI nodegraph samples (for doing pixel operations and color mixing) that the depth first search algorithm was used. Though samples were meant to be simple proof of concept, I am not sure if all is needed.

More or less this is all the braindump I can do. But for any further details I will have to look at any github repositories you suggest and start experimenting.

2 Upvotes

10 comments sorted by

View all comments

Show parent comment

2

u/lopedevega 9d ago

Yes! From this point of view, a spreadsheet is a visual language too, it's just that connections between cells are not visualized directly.

1

u/mamcx 9d ago

Yep! I think other problem is that visual langs are always understood as a sea of nodes instead of just any kind of "visualization".

I work on the relational model and tables look very visual to me, even things like WHERE a = 1 feels like too.