BT vs FSM vs VS

Forums Nodes, Macros & Examples BT vs FSM vs VS

This topic contains 1 reply, has 2 voices, and was last updated by  pixel pusher 3 years, 7 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #663

    rixter757
    Participant

    Hey all,

    I copied this from Dbone over on the Unity forums, posting now to help answer a current question:

    NodeCanvas is Behaviour Trees and Finite State Machines, whereas FlowCanvas is much more similar to traditional scripting.
    Being a non-coder (well… almost) myself, here’s my perhaps a little oversimplified understanding of the three approaches, BT, FSM, and actual Visual Scripting FROM A NON-CODER’S PERSPECTIVE:

    Technically BT and FSM are considered visual scripting, but in reality it’s more arrangement than scripting IMHO.

    For the purposes of this write up, ACTIONS are blocks of C# code, represented in a node on a graph, and are made to accomplish a particular small task. Usually a single task.

    BT – Behaviour trees are a GROUPING of conditional actions that can run at the same time or independently. They react to changes (conditions) immediately and fire off actions as a change is detected. Any number of actions can be fired off simultaneously from one behaviour tree.

    FSM – Finite State machines are a SERIES of SOMETIMES conditional actions that run one after another. Actions are contained within “States” (another name for groups of actions) and only one state can run at a time. They most commonly are setup to switch between states after evaluating a variable. Eg: State 1 has an action that says: If boolean “A” is true, switch to state 2.

    There are great comparisons of the strengths and weaknesses of both of these methods that can be found with a simple google search, but to paraphrase pretty much all of them: they work great together. NodeCanvas also makes it extremely easy to use either, separately or together.

    BUT (there’s always a but) both BT’s and FSM’s are reliant on pre-made actions. NodeCanvas comes with many useful actions, and also many ways to get around needing custom ones (google C# code Reflection) but sometimes you’re just out of luck and something needs to be coded.

    Visual Scripting – You can do anything with plain scripting, but not all of us are that lucky (yet). FlowCanvas differs from just writing plain C# scripts in that it takes all the elements (functions, methods, etc) and makes them available on a graph to be wired up, basically giving you the power of scripting without needing to know all the finicky details about the structure and syntax. Without getting too detailed (actually…that might be all the detail I know…) you CAN create a BT and an FSM in FlowCanvas but the process would be more labour intensive and be more confusing visually as to what’s supposed to happen when, simply because you would have to create the logic behind the BT or FSM as well as what it’s supposed to be doing.

    For me, the real payoff of FlowCanvas is having good access to working with the code of OTHER ASSETS without being judged harshly by unforgiving compiler errors. I can’t count how many times I’ve wanted to integrate two different assets and I just can’t because my C# skills are…un-skillful. Usually the integration of two assets needs to happen in code and having specific actions to accomplish that is necessary.

    In summary: FlowCanvas can do nearly everything, but that power comes at a cost (added time, more knowledge needed, and a more complex graph) when you could use a BT or FSM instead with NodeCanvas. For me, that’s 90% of the time, but it’s that last 10% of cases that keeps my projects from completing while I wait for a custom action. FlowCanvas is a god-send, worth every penny, AND is getting me closer to understanding coding concepts without killing me with syntax.

    #926

    pixel pusher
    Participant

    Great summary! Thanks 🙂

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.