Announcement

Collapse
No announcement yet.

UFSM: Finite State Machine

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

  • started a topic [RELEASED] UFSM: Finite State Machine

    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.

  • replied
    Any function trying to access the removed enum item have to be edited to return a valid value from the menu dropdown.
    If it's an empty state function I would just delete the function instead then recompile the Blueprint.

    Leave a comment:


  • replied
    Originally posted by BrUnO XaVIeR View Post
    Demo projects can be upgraded by users, right click uproject file and migrate to latest engine version.
    how to fix the "Unchecked" error?

    Leave a comment:


  • replied
    Demo projects can be upgraded by users, right click uproject file and migrate to latest engine version.

    Leave a comment:


  • replied
    Originally posted by BrUnO XaVIeR View Post
    Submitted v2.1.0 for Unreal 4.22+


    WARNING!!!
    • "UNCHECKED" pin has been removed!
    • I do not recommend upgrading to UFSM 2.1+ in middle of a project, you might have to fix a lot of Blueprint errors if you use the removed "Unchecked" pin for anything (i.e, runtime states generation)
    where's the new example project?

    Leave a comment:


  • replied
    Originally posted by BrUnO XaVIeR View Post
    MaximeDupart

    Oh you say example from first page, that is outdated from plugin 1.x version.

    There's a more up to date example here:
    https://forums.unrealengine.com/unre...640#post991640
    Perfect, thanks !

    Leave a comment:


  • replied
    MaximeDupart

    Oh you say example from first page, that is outdated from plugin 1.x version.

    There's a more up to date example here:
    https://forums.unrealengine.com/unre...640#post991640

    Leave a comment:


  • replied
    Hello Bruno,
    Just updated the plugin after using it for a while and loving it.

    Building the FSM in C++ from pawn constructor using the first post code example, i now trigger the error :

    Code:
    [2019.05.17-12.18.41:513][183]FSMs: Error: [StateMachine]: 'New States' Array is zero sized.
    [2019.05.17-12.18.41:513][183]PIE: Error: {FSM}:: 'New States' Array is zero sized. -->  FSM: Make States: [Function /Script/UFSM.StateMachineComponent:MakeStates at (ShooterPlayerStateMachine /Game/Maps/UEDPIE_0_Highrise.Highrise:PersistentLevel.
    Weirdest part is that the FSM is working.

    Leave a comment:


  • replied
    Submitted v2.1.0 for Unreal 4.22+


    WARNING!!!
    • "UNCHECKED" pin has been removed!
    • I do not recommend upgrading to UFSM 2.1+ in middle of a project, you might have to fix a lot of Blueprint errors if you use the removed "Unchecked" pin for anything (i.e, runtime states generation)

    Leave a comment:


  • replied
    Submitted 4.22 version for review.

    Leave a comment:


  • replied
    Originally posted by jm991 View Post
    Hi,

    * If not, what's the best approach? Should I make an array of state machines, and just disable any of them that I'm not currently using?
    ‚ÄčThere's no need to have hierarchical FSM because you can attach multiple FSM Components (without auto activate) then use the "Go To FSM" to transition between multiple FSMs.


    By the way, since last month I have an update where the "Unchecked" output pin is removed, I've refactoring a lot the internals to just return "Abort" instead, when something is cancelled.

    I didn't publish it because this update breaks compatibility with existing projects. Would be up to you guys to decide if I should make that update available or not..

    Leave a comment:


  • replied
    Hi,

    Thanks for developing this - just purchased it last night.

    Few ?s:
    * Are sub-state machines supported? I'm using this for an ability system, and want to have several sub-state machines, 1 for each ability the character can execute
    * If not, what's the best approach? Should I make an array of state machines, and just disable any of them that I'm not currently using?

    Leave a comment:


  • replied
    The FSM is a network replicated Component.
    It's not a hierarchy of UObjects.

    Leave a comment:


  • replied
    I don't know how the FSM works. I expect the state node is an object(not just an enum value) that can response events routed from the host object, it binds the events interested from the host object when entering. Also, the state transition should be an object that can response active event when the connected node entering, then it can bind events interested (avoid adding unnecessary temporary variables) from other systems for the transition detecting.

    Leave a comment:


  • replied
    Originally posted by BrUnO XaVIeR View Post
    I'm not hot-reload user (there's only one plugin I use hot-reloading with) so I'm not sure...
    But with hot-reloading shouldn't you move plugins from Marketplace folder to your project folder to make it work properly?

    I'm in the dark just like you on this one, but I would give that a try.
    No problem! I have everything moved over to my project folder already, as I do with all plugins. I'll keep an eye on it, just wanted to see if you possibly knew anything.

    Thanks for the response! (:

    Leave a comment:

Working...
X