Flow is the energy pulsating through the links of your flowgraph, bringing it to life.
As already explained in the “Node” section of the Elements
page, most nodes need flow to function in any way. Only basic nodes like the “Number” node provide an output even without flow.
A flowgraph that does not have any kind of incoming flow, will have no functioning nodes and therefore nothing will occur, when running it.
Here is some crucial information on flow:
- Flow only exists in flowgraphs and not in stategraphs.
- The starting point for flow is the “on Update” node. It will only provide flow if the flowgraph is an active state.
- Most nodes have an flow input pin, for being activated, and a flow output pin, for passing the flow to the next node.
- Some nodes have additional flow output pins, that are only triggered, when the node completed its task.
The main source of flow in your flowgraph is the flow-output pin “onUpdate” node. It is activated every frame and gives flow to all the nodes in your graph.
But ofcourse there are some things that you do not want to happen constantly, like displaying a message to the player or resetting a node.
The easiest solution for this is the “Once” node, that only passes constant flow once, or on a more technical level, only for one frame:
You can see that the flow-output pin and the reset pin of the “Once” node look different, than the usual flow pin. It is what we call an “impulse” pin.
There are two ways of understanding impulse pins in Flowgraph:
The idea of an output-impulse pin is simple. It puts out flow only once not constantly.
The idea of an input-impulse pin is a bit more abstract.
It should only receive one frame of flow. If the pin would receive constant flow the node would not work properly.
Another good example for impulse behaviour is the “Countdown” node:
- “finished” Output
The “finished” output-impulse pin only passes flow once, when the node is finished. This is useful for triggering events after the countdown is finished.
- “reset” Input
The “reset” input-impulse pin could theoretically receive constant flow, but constantly resetting the countdown would make the node nonsensical. Therefore it should only receive flow once, to reset the node, when needed.
The general idea for flowgraph is to build it from left to right and pass flow from the “on Update” node through the whole graph.
This concept naturally leads to the idea of daisy chaining your nodes from left to right, which provides you with a linear and well readable structure for your flowgraph:
It is also possible to branch out your graph, since there is no limit to the links connected to a pin.
This makes especially sense, for things that logically are happening at the same time.
Please beware that when building these kind of branching structures, that there is no guarantee for the order of execution for the different nodes.
Another thing to be mindful about is that when setting a variable , that the new value won’t be set until the next frame.
To understand how flow is propagated throughout your flowgraph, you can view it during runtime.
This visualizes all active links, that are providing some kind of output.
If you want a better feeling for which nodes are currently active in your flowgraph, feel free to switch the viewmode to “Heatmap”. You can read more about this feature on the Windows page.