0

Flow machine, State machine, Flow state and Super state

BoltBolt 3 years ago updated by barskey 3 years ago 2

Hi all. I am a newbie in Bolt. Sorry for troubled all brothers here. After I went through the menu of Flow Machine(FM), State Machine(SM), Flow State (FS) and Super State (SS), my confusion on the definition and usage among all the above terms has increased. 

Would you mind to tell me the answer to the following questions? Thanks.

1) Do FM and SM has any affiliation/co-op relationship? If they do, is anyone's power/function of them superior to the other?

2) I found both FM and SM are doing some similar things. Both of them are telling and determining what a game object need to done when a change/state affected it. Besides, both FM and SM are event-driven. They all will be triggered to do something when a condition of the event is true. So, what the difference between them? 

3) From my understanding of FS and SS, both of them are created inside an SM. FS and SS can be co-existed in the same level inside an SM.  The difference between these two terms is FS in an SM will be a series/sets of events, conditions, actions etc.... . Nevertheless, SS is just a single unit inside an SM. An SS contains FS and another SS. Am I correct?

Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):

Newbie too, but I think your question is more generic than Bolt. FM and SM are just different views of the same thing: SM is how you see the solution from human perspective, while FM is the actual implementation of the system. SM is like a general of an army who looks at the strategic map and decides where the troops should go, what route they should take, then pass an order to his underlings (FM), who calculate resource, time and execute it. Because of that, SM is more useful in the design phase when you use your human language to define targets and lay down possible checkpoints (states) to reach to the targets. Later during debugging, by checking whether a checkpoint is reached or not in the SM, you can narrow the location of error before starting to mess with logical craps actions inside a FM.

Hope that helps.

+1

In Bolt, all of your drag-and-drop units and connections are done in a graph. It is the visual representation of all your connections and functionality. There are two types of graphs, Flow Graph and State Graph - more on those shortly. A Machine is the component that you will add to a GameObject which will contain the graph. There are two types of machines (one for each type of graph), Flow Machine and State Machine.

Background on States:

By definition, a Finite State Machine is a model to represent a particular state that your object can be in at any given time, and the transitions between these states. These transitions are shown as connections (arrows) between states, and inside the transition is logic deciding when to make the transition. A simple example of a Finite State Machine would be an enemy controller, where the enemy's states are Idle, Patrol, and Chase. It might transition from Idle to after a period of time, and could transition from Patrol back to Idle when it has reached its destination. And it would transition to Chase when it has seen the player, etc.

Back to Bolt:

So in Bolt, a State Machine is the component that gets attached to the GameObject, and it is essentially a Finite State Machine. It holds a State Graph, which is the visual representation of our states and transitions. Within this State Graph, you add states and transitions. A State can either be a Flow State (a state which will contain a Flow Graph) or a Super State (a state which will contain another embedded State Graph). And the transitions themselves contain logic, so they contain Flow Graphs as well.

I do realize that it can be difficult to wrap your head around this from descriptions alone. Have a(nother) read of this section: Manual Link and here's a basic example with all the things.

Player (GameObject)

  • Flow Machine (component) called PlayerController
    • Flow Graph - configured to check the Input every Update tick, and move the player, etc.

Enemy (GameObject)

  • State Machine (component) called EnemyController
    • State Graph
      • Super State (Patrol) transitions to Chase when in range
        • Flow State (Idle) - transitions to Move after 5 seconds
        • Flow State (Move) - transitions to Idle after reached destination
      • Flow State (Chase) transitions to Patrol when out of range