Announcement

Collapse
No announcement yet.

UFSM: Finite State Machine

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

    #61
    I've made some changes to a few core function nodes on the blueprint side. To avoid having to branch their default results with more and more Switch nodes, I've set them to output their results already branched as execution pins...
    This change will be available on update for the 4.14 engine once more tests are made and I'm sure I didn't introduce any stupid bugs
    Soon™ :

    | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

    Comment


      #62
      I love cleaner nodes ^_^

      Comment


        #63
        Update mentioned above have been published by Epic;
        Note: those updated nodes are going to break your pin connections from the earlier versions, so reconnecting them is an unfortunate need for this update; but I promise it's worth it!
        | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

        Comment


          #64
          Well, so... Due to popular demand I had to take some time and implement this:

          On the Details panel of your FSM Component you will be able to define default transitions from State to State, within the FSM / Transition tab.
          Those 'links' are a place where you can dictate which State comes next without having to deal with any Blueprint code, just type in the name of target next State your FSM is supposed to go after you're done with current State.
          Optionally, when this transition is executed, you can also provide name of a Blueprint Function to be executed exactly the same time such transition happens (in case you want to run some code or validate a transition);
          I'm not quite sure why developers requested this a lot, I like to make my own transition functions myself because there I can go crazy and check for anything I want to
          But I understand how useful it is, so... At the moment it look like this:



          One of my Enum Blueprints, I will use this as example for clarity (it's useful because it's faster this way, but we can just type the States by hand if we want to):





          On the FSM Component, I tell the 'Enumarator' field to use this Enum, simple selecting it from dropdown list;
          After picking my Enum with State names, let Unreal do its magic:





          In this case bellow I am using another Enumerator, the one I use the setup my Character's movement;
          Once States and links are the way I need, I then create an optional call-back function and give it the same name I set in "Function", right bellow "Next State" field:






          Now that I have setup there on Details panel a default transition which says "whenever finished Normal State then go to Jump State", in Blueprint Graph I don't care anymore how / when / why the FSM will change its current State from "Normal" to something else.
          Since I know that default transition is set to be Jump when Normal exits, now I just call "Finish State" instead of manually telling the FSM to explicitly go to a State I chose based on IFs and ELSEs somewhere in the Blueprint Graph:






          This behaves a lot like Animation Graph's transitions system, since my Blueprint Graph is telling the FSM Component to go to the Normal State as soon as the character ends his jump and on the other hand Normal State is being finished every 4 seconds with a link to Jump State again...
          The result is a loop, my pawn is now jumping every 4 seconds by itself without any inputs from my Player Controller; with a Callback function which does nothing, I just put a Print String in that function for the sake of demonstration.
          Instead of calling If (something) then SetState()... Just called "Finish State" function; And then the result is this, Normal --> Jump --> Normal ---> rest 4 secs ---> Jump... and so on:





          You'll still have to call "Finish State" function somewhere though; that is up to you decide when and where to call it, making the FSM Component trigger this automatic State transition only when you "approve" current State to leave.
          After some more tweaks I'll send this to Epic's team for an update, hopefully it was very straightforward to understand what I was trying to explain
          Last edited by BrUnO XaVIeR; 01-07-2017, 07:27 PM.
          | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

          Comment


            #65
            Wooo this is great!, you are one of the most responsive developers here in the market. many thanks for this Bruno, this is looking excellent!
            pd: Excuse my English.

            Comment


              #66
              I have finished updating UFSM 1.4 for UE 4.15;
              Gumroad pack is uploaded and ready, I have submitted Marketplace pack to Epic Marketplace Team.

              Note: I am dropping updates for UE4.13 and lower as the core is no longer fully compatible.
              | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

              Comment


                #67
                1.4.0 for UE4.15 is now available on Marketplace.
                | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

                Comment


                  #68
                  Hello! Hola Bruno! I just wanted to ask a quick question that I;ve been searching for ages and I didn't quite understand, but what are the posibilities of a FSM and, what are the advantages of using a FSM vs making all the controllers on the "pawn" for example? does it helps with multiplayer games where you can share a single FSM that can work with every character instead of hard copying all of the information from one character to another? or what other advantages it posses aside from making things cleaner?

                  E.

                  Comment


                    #69
                    Originally posted by elisamuelps View Post
                    Hello! Hola Bruno! I just wanted to ask a quick question that I;ve been searching for ages and I didn't quite understand, but what are the posibilities of a FSM and, what are the advantages of using a FSM vs making all the controllers on the "pawn" for example? does it helps with multiplayer games where you can share a single FSM that can work with every character instead of hard copying all of the information from one character to another? or what other advantages it posses aside from making things cleaner?

                    E.
                    Yes you could share a FSM State through the PlayerState blueprint and have multiple pawns switch over to the same state, they would act like replicated behaviour for each different pawn across the network as long the blueprints use the same logic.
                    All would be needed is grabbing the uint8 State ID of the target pawn's FSM... That would help you save a significant amount of data replicating throughout game's internet connection as well.

                    You can use FSMs for absolutely anything you wish in your game design patterns, there's some use case example videos on page 1 of this post.
                    | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

                    Comment


                      #70
                      {UFSM 1.5.0} : {UE4.15}


                      * Implemented RPC Library.
                      * Added GetCurrentStateName() function
                      * GetStateID() function renamed to GetCurrentStateID()

                      In 1.5.0, I have added for you a Library of RPC functions that will help you out with networking,
                      multiplayer game development. Keep in mind these RPCs doesn't implement multiplayer for you!
                      They are a package of functions which you can use to quickly manipulate FSM State from Clients
                      or Server with ease, but still do not enforce you to follow any particular networking model.
                      (you still code your networking structure your own way)

                      One thing you have to note though:

                      Internally, the 'On Begin State', 'On Update State' and 'On Exit State' events executes locally.
                      This is intentional, I do not want to risk throttling your game's bandwidth; you replicate what
                      your game needs when you see fit for your particular networking model instead.
                      When you have to change and send a State from Server to Clients or from Client to Server,
                      the RPC Library have these built-in functions that will now help you out with these tasks.
                      The system will try to help you as much as it can; it will even warn you if you mistakenly call
                      a Client-to-Server RPC or Server-to-Client RPC in the wrong direction:

                      [CLIENT]: 'Client-to-Server' is called on Client FSM and executed on Server;
                      [SERVER]: 'Server-to-Client' is called on Server FSM and multicast execution over to Clients;

                      You get a little log warning if you, by accident, try to execute a multicast on Clients or try
                      to call a Client RPC on Server. Helps a little to keep sanity when making net code on Blueprints.
                      This will be specially useful for the people new to multiplayer networking.


                      Note this update is for UE4.15+ only, I basically re-wrote the whole thing and cannot keep it
                      backwards compatible after all the changes we had on UE4.15.

                      With this udate I will also make available the project demo converted to multiplayer logic;
                      There's only three variable properties replicated for this entire Character Controller:

                      * uint8 StateID
                      * uint8 PreviousStateID
                      * float StateTime

                      'StateID' replication is enough to let the Character replicate all of its behaviours across the
                      network, since all his actions are based on FSM containers, all one Player has to do is request
                      to the Server a StateID change, this simplifies multiplayer logic quite a lot and reduces
                      bandwidth traffic by avoiding replicating unnecessary amount of properties:



                      Click image for larger version

Name:	UFSM_Networking_I.jpg
Views:	1
Size:	470.5 KB
ID:	1123639
                      Click image for larger version

Name:	UFSM_Networking_II.jpg
Views:	1
Size:	410.3 KB
ID:	1123640



                      (I will send it over to Marketplace Team in few days, I suppose around two weeks you have it up)
                      Last edited by BrUnO XaVIeR; 03-16-2017, 05:04 AM.
                      | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

                      Comment


                        #71
                        {1.5.0}

                        I've finished revision for this update, demo project is now ready so I'll submit the package with demo over to Marketplace team this next weekend.
                        Some of the last changes, added to the ones listed above, are:



                        * Removed 'Transient' specifier as it is no longer needed in this case. You can fully instantiate FSM Assets now with no issues.


                        * Added options for you to pick which internal properties you wish to replicate without having to dive into C++ code:


                        Click image for larger version

Name:	UFSMReplicateID.jpg
Views:	1
Size:	39.3 KB
ID:	1123797



                        * Successfully incorporated Unreal's 'Validation' process exposed to your [CLIENT] Nodes.
                        If, for any reason you see fit, the Client doesn't pass a test and the validation fails then the Server will force quit the culprit Client:


                        Click image for larger version

Name:	RPCValidation.jpg
Views:	1
Size:	755.1 KB
ID:	1123803



                        * I have moved logging from the Output Log panel over to the Blueprint's Message panel.
                        These logs will not fire if you uncheck the 'Debug' checkbox on your FSM Component;
                        These logs fire only when you play in Editor and your FSM has checked the 'Debug' checkbox as well:

                        Click image for larger version

Name:	PIELogs.jpg
Views:	1
Size:	235.8 KB
ID:	1123798
                        Last edited by BrUnO XaVIeR; 02-22-2017, 09:28 PM.
                        | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

                        Comment


                          #72
                          Hallo

                          I feel like I'm missing something but after installing this plugin the "Finite State Machine component" isn't available to me in the add component menu.
                          All FSM nodes and the FSM project settings show up as expected.
                          Would be nice if you could tell me how to fix this.

                          Edit: I tried it in 4.14 and 4.15
                          Last edited by PeterJaschkowske; 02-26-2017, 01:46 PM.

                          Comment


                            #73
                            Originally posted by PeterJaschkowske View Post
                            Hallo

                            I feel like I'm missing something but after installing this plugin the "Finite State Machine component" isn't available to me in the add component menu.
                            All FSM nodes and the FSM project settings show up as expected.
                            Would be nice if you could tell me how to fix this.

                            Edit: I tried it in 4.14 and 4.15
                            Right click Asset Browser window and create your FSM Component Asset, from this menu:

                            Click image for larger version

Name:	FSM_Asset.png
Views:	1
Size:	47.8 KB
ID:	1124034


                            After you create your Asset, your new FSM Blueprint will be visible in the "Add Component" list.
                            | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

                            Comment


                              #74
                              Great, Thank you!

                              Comment


                                #75
                                Originally posted by BrUnO XaVIeR View Post
                                {UFSM 1.5.0} : {UE4.15}

                                Status: Testing


                                ...

                                This update mentioned above is now live on Marketplace; with changes included for the new 'Include What You Use' C++ specification.
                                | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

                                Comment

                                Working...
                                X