GithubHelp home page GithubHelp logo

Comments (3)

Wouterdek avatar Wouterdek commented on May 10, 2024

I think this would be more in-line with how the Unreal Engine Blueprint system functions, where each execution node would propagate synchronously, performing its respective action and then returning to execute the next node.

Actually, Unreal blueprints are compiled from the node graph to a class before they are used in game. (source) It does a better job of hiding it by providing visual feedback on what the nodes do in a debugger during execution, but under the hood it is compiled before usage. Some advantages to this strategy are easier debugging, performance optimization by a pre-existing compiler, less runtime overhead, greater portability of the resulting code, ...

That being said, if you don't like using strings you could consider using expression trees instead. These can be both serialized and transformed into a runnable function at runtime.

If you want to skip the intermediary step entirely and go straight to running code from nodes that is possible too. Instead of producing functions as strings, you would put the code straight into the node (or store a Func/Action). Each node of your node viewmodels could implement a common interface which provides a Run() method. Invoking this method on node A calls the Run() method on each of the nodes connected to its inputs to obtain the input values. It then calculates the result of node A and returns it. If you call Run() on the last node in the chain, the entire tree is recursively evaluated. Note that the inputs/outputs don't hold values, but only serve to connect functions.

If you decide that you want the functions to be run immediately as they are connected, then you would probably end up with something similar to the calculator example.

Does this answer your questions?

from nodenetwork.

Col45 avatar Col45 commented on May 10, 2024

Thank you it does answer my question. I am assuming the Compile() methods are what gets called recursively? And in those methods there should be the entry point to executing additional code?

from nodenetwork.

Wouterdek avatar Wouterdek commented on May 10, 2024

That is correct.

from nodenetwork.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.