Running barebones graphs

FlowCanvas Forums Support Running barebones graphs

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #3352
    bzxxxo
    Participant

    I use flowcanvas graphs with no blackboards or local variables. Additionally, all data is loaded from the game state, and I manually execute relevant nodes from code.

    However, it seems that the graphs need to be running to be able to manually execute nodes, but starting graphs introduces some overhead.

    My graphs essentially act as event listeners. I’m constantly getting graphs from a pool, injecting data into relevant nodes, starting them, calling flows in those relevant nodes, pausing the graphs and then returning them to the pool. This gets really chunky when there’s potentially hundreds of graphs and hundreds of events being called.

    Before reducing the number of events and converting certain graphs to code — what’s the minimal way to run a graph completely barebones with no blackboard or stored variables, manually calling flows, for best performance?

    #3356
    Gavalakis
    Keymaster

    Hello.

    Graphs do indeed need to be started, since the “start” (which is more like an “enable”) is required so that the graph is initialized, all ports be bound, etc. Once after initialization (“start”), there should be no overhead for a graph just being active (considering that it does nothing else of course) and thus there is no reason to pause it and restart it. Quite the contrary, pausing and restarting would create more overhead than a graph being active (once again depending on what nodes are being used in the graph).

    The most barebones way to run a graph, is without a FlowgraphController component but rather directly by instantiating a previously made graph (a flowscript asset for example) and starting that graph through code. However that alone would not have any significant difference since the FlowgraphController is quite simple and only acts as a way of doing this automatically for you basically.

    To sum up, while starting a graph will create overhead when it is started (so that the graph is deserialized, initialized, etc), an active graph will not create any overhead thereafter on its own. For starting graphs, you can also utilize the Async mode for initialization, which is found on the FlowscriptController inspector (“First Activation” -> “Async”). This will initialize most of the graph in a separate thread.

    Let me know.

    Thanks!

    Join us on Discord: https://discord.gg/97q2Rjh

    #3360
    bzxxxo
    Participant

    Hey Galakis, thanks for the detailed response. Gotcha, yeah starting the graph seems to be the choking point. Since I’m pooling the graphs, several objects could be taking turns using the same graph instance, so just to be sure I’m pausing and starting them when they leave or enter the pool. If I don’t do that, and instead leave the graphs enabled/started while they’re waiting in the pool, that won’t cause any overhead then? And I guess it wouldn’t really cause any issues either, since I’m not using blackboards or persistent variables in the graphs?

    Thanks again, this product is incredible

    #3364
    Gavalakis
    Keymaster

    Hello again and sorry for the late reply and your kind feedback!

    Yes that is correct. If you leave a graph enabled (not paused) in the pool it won’t cause any overhead, unless of course the graph does have an even node that requires updating like of course for example an “On Update” event node, or a legacy Unity input Event node (those also do require updating).

    Thanks again!

    Join us on Discord: https://discord.gg/97q2Rjh

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.