When creating even a small game, it's easy to lose control of the logic of game interactions or the thread of the narrative.
To get the most control over your project, we created the Game Flow tool. It's a scene object with a visual node editor, where you can design your game before you even put a single game object on the stage.
Game Flow links between the Animation, Trigger, State Machine, and Game Flow objects and sets the interaction and narrative logic for your game.
To get started with Game Flow, you need to create a Game Flow object in the Stage Tree using the toolbar.
Select the Game Flow object in the scene tree by double-clicking it in the scene tree. The Game Flow editing window opens.
There are two nodes Start and End on the default Game Flow canvas, we'll talk about them in another section.
On the left side of the window, on the toolbar there is a toolbox for working with Game Flow. Select the tool for creating any node, for example animation, and click it on the canvas.
In the menu that appears, there are two options:
- Create node with creating a new object
- Create node from existing object
Choosing "With creation of new object", you will create a node and object in the scene tree, which will be located in the Game Flow hierarchy which you edit.
Choosing "From existing object" you can select an object of that type from already existing in the scene tree.
Double-clicking on the created node opens the related edit panel of the object. The timeline will open for animation, the setup panel for trigger, and the canvas of the state machine will open for the state machine.
The created nodes can be linked with each other:
- select the "Pointer" tool
- move the cursor to the source node (from which you want to draw the links). (For a state machine, hover over the desired stack.
- hover over the link start arrow (any arrow, they are equivalent) and holding the left mouse button drag to another node
- when you hover on the target node and it is highlighted with a blue circle, release it
- select the desired type of connection and the connection between the nodes is created.
Some nodes can only be source nodes:
- The trigger can be connected to Animations and Game Flow, but cannot be connected to other triggers and state machines.
- State machines can be connected to Animations and Game Flow, but cannot be connected to triggers and other state machines
- Node Start can be combined with Animations and Game Flow, but not with triggers and stats of other machines
Animations and Game Flow can be connected to each other in any way.
As with triggers, there are three types of connections between nodes in Game Flow.
- Started: means that the next node in the connection will run when the current node's object starts its work.
- Continue : means that the next node in the connection will work as long as the object of the current node will continue its work
- Ended : means that the next connected node will work when the current node object finishes its job
In fact, the trigger connections from different objects are trigger events of the related objects, all of which you can find in the lists of trigger events when you create them in the Trigger panel - Animation, Trigger, Game Flow, State Machine with state
Note: The Continue state cannot be passed to Game Flow and End nodes.
The Start and End nodes are used when creating a Sub Game Flow. Sub Game Flow is a Game Flow that is embedded in another Game Flow.
The Start note is needed to start a Sub Game Flow. When a signal comes to the node from the client (the Game Flow which contains this Sub Game Flow), the next after the Start node is started and this Sub Game Flow is considered to be working. First the Sub Game Flow goes to the Started state, and then to Continue. All Sub Game Flow connections start working, if the Game Flow has been turned off before.
The End node is needed to stop Sub Game Flow, when the node receives a signal from internal object of this Sub Game Flow, it goes to Ended state and all its internal connections stop working.
Note: For predictable operation of nested Sub Game Flow, we recommend to turn them off inside Sub Game Flow itself or in the scene tree. In this case, no connections inside will be triggered until the Start node signal appears, even if some object inside works.
To help yourself in development and not to forget what this or that object in your Game Flow is for, you can leave notes with a comment node. We strongly recommend leaving comments when you create assets that other users will use, this will greatly improve the understanding of your asset by other game developers and make your asset popular.
Create a comment node.
Write the comment you want.
If necessary, connect the comment to the desired node.
You can connect one comment node to any number of nodes.
Connections between objects can be completed with trigger events. To do this, double-click on the necessary connection between objects.
Add the desired trigger events in the Game Flow Editor window in the Trigger Panel.
Now trigger events will be triggered when all conditions specified by the initial object, the trigger event type and the additional trigger event in the relation are fulfilled.