Announcement

Collapse
No announcement yet.

UFSM: Finite State Machine

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    [RELEASED] UFSM: Finite State Machine


    [Now available on Unreal Marketplace]

    ----------

    Hello guys! I've got something for you
    Due to the fact Unreal Engine 4's programming environment doesn't implement a FSM for us to use in code, like in previous versions, for some projects I felt compelled to kick in and implement it by myself then...
    I've developed a Plugin module which adds to the UE4 environment a bunch of functionality regarding FSMs, so then I could stop trying to address a bazillion 'If Then Elses' everywhere.

    I haven't published this yet, but as always, I believe this may be useful for many other Unreal developers so I'm posting to share. Would anybody be interested in this, a FSM Component which allows you to use AnimGraph's State Machines as visual editors?!
    I like to use the AnimGraph because it feels like I'm using Unity PlayMaker inside Unreal

    Btw, it can be used not just within Animation Graphs, it's very integrated with C++ API, Blueprint nodes, Behaviour Tree nodes, giving us many 'ins and outs' to access the same FSM Component.
    Here a few features already implemented and working well:



    * Blueprintable Finite State Machine System.
    * Blueprint Actor Component Based.
    * Event-Based Tasks/Actions can be Broadcasted.
    * Supports Enumerators as State ID.
    * Supports Runtime State-Machine Creation/Deletion.
    * Supports Runtime State-Machine Event Bindings.
    * State Machines can Tick and Track Update Time.
    * FSM Properties can be Replicated.
    * Get/Set States from C++, Blueprints, Animation Graphs, Behavior Trees.




    Here's some screenies:


    [Create a new FSM Component, right click Asset Browser]:





    [We simply add to the Actor the FSM Component]:



    [As of 1.3+ version: "Auto Activate" must be checked to activate FSM Component]



    [Then we can edit the FSM's States from an Animation Blueprint's State Machine, like this simple one]:






    [Or manipulate States from a Behavior Tree too]:






    [Or we can Read/Write FSM States from Blueprint Graphs]:






    [Or we can build a Finite State Machine in C++ Constructor, from scratch ]:



    [As of 1.3+ version: StateMachine->SetActive(true,false); is also required to activate FSM Component]



    ------------------------------


    [We can now spawn a custom Editor Graph which automatically generates a visual tree representation of your UComponent's States, for both HFSM and FSM types]:







    ------------------------------

    You can read some more details about it HERE ( https://brunoxavierleite.com/2016/07...state-machine/ )
    If you guys have interest, I submit this to Epic to have this little guy in Launcher's Plugin section (~$10 Obamas)

    ------------------------------

    TUTORIAL AND DEMO PROJECT

    Last edited by BrUnO XaVIeR; 06-30-2017, 02:29 AM.
    | Finite State Machine | Auto-Save Plugin | USQLite Plugin | Object-Pool | Sound-Occlusion | Anti-Cheat Plugin | Property Transfer Tool | Magic Nodes |

    #2
    Yes - I would be interested in this

    Comment


      #3
      I'd be interested to look at it.

      Comment


        #4
        Nice, seems pretty neat. I would be interested in this one

        Comment


          #5
          I've finished polishing this system and submitted to Epic; It's available at Gumroad for the 4.12.5 Engine version
          | Finite State Machine | Auto-Save Plugin | USQLite Plugin | Object-Pool | Sound-Occlusion | Anti-Cheat Plugin | Property Transfer Tool | Magic Nodes |

          Comment


            #6
            This is probably a really stupid question... but how well does this work with replication?
            Current Project - *shush shush* Soon. Soon.

            Comment


              #7
              Originally posted by Arixsus View Post
              This is probably a really stupid question... but how well does this work with replication?
              The component is setup for replication by default;
              All its UProperties will replicate just fine in an replicated Actor. Current State time, Active State ID, List of existing States, etc, are replicated.
              Source is also open so a programmer can customize multiplayer behavior if project has specific needs.
              | Finite State Machine | Auto-Save Plugin | USQLite Plugin | Object-Pool | Sound-Occlusion | Anti-Cheat Plugin | Property Transfer Tool | Magic Nodes |

              Comment


                #8
                Good job! My question is, can we change current active state in an existing animation blueprint by changing it's parent to UStateMachineComponent or somehow, directly without manipulating transition conditions?

                Comment


                  #9
                  Aww, this is awesome!

                  Comment


                    #10
                    Originally posted by BurakShamansoft View Post
                    Good job! My question is, can we change current active state in an existing animation blueprint by changing it's parent to UStateMachineComponent or somehow, directly without manipulating transition conditions?
                    In that case you can do it from any animation blueprint's graph; doesn't need to be a child of a specific Animation blueprint.
                    From the anim graph is possible to call a node: GetFSMComponent (Name) --> Set State (by ID or State Name).
                    | Finite State Machine | Auto-Save Plugin | USQLite Plugin | Object-Pool | Sound-Occlusion | Anti-Cheat Plugin | Property Transfer Tool | Magic Nodes |

                    Comment


                      #11
                      Interesting. Does it come with Android flavor ? (pre-built)

                      Also it would be nice to see an example where stock functionality is shown and then replaced with FMS (currently I don't quite get how it replaces stock workflow and why it could be used in lieu of stock workflow/functionality)

                      Cheers!

                      Comment


                        #12
                        There's a saying "FMS isn't useful until you use it" or "You don't need FSM until you do"

                        In Blueprints we can emulate FSMs with boolean checks, switch on bool, etc.
                        That works, but is hard to keep a "visual representation" of that pseudo-FSM and is kinda easy to get lost with so many bool checks.
                        I wanted to bring FSM functionality to my workflow because it will remove the need for me to be dependant on an ever growing amount of what I call "cluster of boolean glue". I often see my graphs populated with many boolean checks and switch on checks, I wanted to get rid of all that or at least reduce its use because Blueprints are become unreadable and when a bool flag doesn't work I expect, feels hard to track why and where...

                        Example:
                        If I simply set a FSM State to "Crouched" then automatically my controller will block actions for jumping and I no longer need to go in the input section and say "If not Crouched than Jump".
                        I just say "Jump", if the State is "Crouched" then my character already know, he can't jump right now...

                        But at the end it's just a matter of personal taste. I like the fact I don't have to create "junk properties" anymore just to flag actions that should be possible or locked
                        | Finite State Machine | Auto-Save Plugin | USQLite Plugin | Object-Pool | Sound-Occlusion | Anti-Cheat Plugin | Property Transfer Tool | Magic Nodes |

                        Comment


                          #13
                          Btw, Android should be supported; depends on the build provided by Marketplace team.
                          And yes, I may give some examples of common Blueprint setups and their FSM variations; I just wait to see where users will focus usage for FSMs. AI, player states, input, character attributes, etc.
                          | Finite State Machine | Auto-Save Plugin | USQLite Plugin | Object-Pool | Sound-Occlusion | Anti-Cheat Plugin | Property Transfer Tool | Magic Nodes |

                          Comment


                            #14
                            Nice one Bruno, I've been ******** about the lack of a simple FSM implementation that uses the existing editor for a few years now but never had time to implement one. Will definitely get this as its really helpful for UI work.

                            Comment


                              #15
                              Oh and while we're at it, any chance of a HFSM? I mean simple state machines are useful by themselves, but having a hierarchy available always gives more power.

                              Comment

                              Working...
                              X