No announcement yet.

Change State Machine Conduit Usage

  • Filter
  • Time
  • Show
Clear All
new posts

    Change State Machine Conduit Usage

    Hi Epic,

    I'd like to suggest a change to the usability of the Conduit node in animation state machines. The actual functionality is great, but I'd like to store my multiple states inside the Conduit node and have an arrow going into the node be the rule to reach the Conduit (like any other state would require).

    My reason is clutter.

    I have 8 stop animations that all belong to the transition state between Walking -> Idle. WalkFwdStop_LU, WalkFwdStop_RU, StrafeLeftStop_LU, etc.

    And I have 8 stop animations that all belong to the Running -> Idle state. And Crouch Walking -> Idle.

    And I have 8 start animations for the inverse of all of those states. That's 48 state nodes, with tiny arrow lines connecting them all together in the most messy ways possible (what if you are stopping from a Run then start walking forward midway through your stop animation? Need a rule to handle that). It's a hot mess - nearly impossible to manage even for me, who created the state machine.

    If the conduits could somehow encapsulate those specific states it would clear up my state machines dramatically and make them less soul crushing to look at.

    This is an older picture of my state machine, which only showcases 8 of my 48 "Start/Stop" state nodes. It's freaking spaghetti now and I really can't even determine which line goes to which state without hunting for 5+ minutes. That makes it really difficult to work when you need to adjust one "thing" that affects 16 states.

    Last edited by Zooch; 12-05-2014, 01:50 AM.

    Just wanted to update this to show I'm not the only one interested in some state machine love:


      Wow.. I'm just getting into the whole animation "realm", learning about blend spaces, state machines and all that.. then I saw that scary spaghetti monster from the answerhub post o_o.
      That's just frightening.. I don't even know if I want to mess with animations anymore lol

      Anyway sorry for being slightly off-topic here, I just had no idea state machines can get that complicated just for "basic" movement.

      I'm curious though, and forgive me if I sound like a noob (cause I am xD) but isn't there a better way to handle all those one-off animations (like walkFwdStart, walkBwdStop etc.)? do you absolutely have to make a state for each one of those?
      I mean if you were to make a fighting game for example, with 100+ different moves, you would need 100+ different states plus transition rules?

      4.10 Update! -> [Community Project] WIP Weather & Ocean Water Shader
      WIP Interactive Water Shader, WIP 2D Water Sim
      WIP FFT Ocean w/ Foam, Quad-tree Infinite Ocean LOD


        Not sure if this works for you, but you could setup all those transitions inside the "Blend Graph" of the "Transition Rule" itself. I think it would clean up you spaghetti stuff quite a bit

        Here, a beautiful picture
        Attached Files
        Last edited by doC; 12-09-2014, 02:45 PM.
        GiM - Games in Motion


          I think this could be a solution. Unfortunately the documentation is a bit outdated:

          You can see they didn't have the Blend Graph when they made the documentation Edit: This might not be the case since they didn't set the blend to custom, but I guess that's not really the point I was trying to make.

          My follow-up question is, how do you apply logic in the blend graph? I'd like to have Idle -> Walk, with the transition rule handling all 4 of my WalkStart directional animations by determining the direction (a variable) the player is moving.
          Last edited by Zooch; 12-09-2014, 07:32 PM.


            There is a select node available in the Blend Graph where you could select the appropriate transition animation based on index.
            GiM - Games in Motion


              I would also like to see some improvement on the state machines. Its a very nice system, but it can get a little big when trying to get alot of different states, idle, crawling, crouching, walking, running, jumping, leaping, hovering, dying.

              Of course that is an extreme example =)
              W3 Studios


                Originally posted by Devero View Post
                I would also like to see some improvement on the state machines. Its a very nice system, but it can get a little big when trying to get alot of different states, idle, crawling, crouching, walking, running, jumping, leaping, hovering, dying.

                Of course that is an extreme example =)
                The state machine system can lead us to create spaghetti chaos like the one we see in the picture. However, that's not the way everyone uses them. I would suggest, rather than improving them, give users more learning material on how to take the most of them.

                A simple blend poses by Bool, using a "Crouch" Boolean would already half your graph, allowing you to reuse those states.

                Click image for larger version

Name:	BlendPosesByBoolOREnum.JPG
Views:	1
Size:	70.3 KB
ID:	1118015


                I'll give you here example of a more expandable StateMachine which would allow you to have not only 2 states, but as many as you want, also could be shared amongst different characters.

                Did you know there is a way to expose a pin of an animation or blend space node? I find it useful to connect different context sensitive animations. This way, you could have the same idle state playing your "Standing" and your "Crouching" animations. It's a variable right? so just store those animation names via the eventgraph. Using something like this would already reduce your graph by half, and it would also make it scalable, in case one day you decide you need your character to swim.

                Click image for larger version

Name:	BlendsWithPins.JPG
Views:	1
Size:	41.2 KB
ID:	1118008

                As you can see here, it could be your standing walkrun and your crouching walkrun. Blendspaces accept a variable, like speed, this means you could have your land2idle, land2walk, and land2run animations in a BlendSpace rather than in 3 different states.

                Let's go back to the pins tho, BlendSpaces are explained somewhere on youtube, a google search could def help you with that. How do we get Animations in those slots?
                What I did was create a few structs so I could avoid hard coding any of those animation names. This also allows me to change not only character states, but also characters themselves. (This is a bit more complex so I won't go into detail in this post)

                Click image for larger version

Name:	Structs.JPG
Views:	1
Size:	15.3 KB
ID:	1118009

                These are the blueprint nodes we will need to store our animations.
                The Structs are have in them Blendspace and animations variables, depending on what we want to use in the AnimGraph. I also add a "loop" boolean, you can add as many extras as you want, additive animations... anything you can imagine.

                Click image for larger version

Name:	AnimStructs.JPG
Views:	1
Size:	68.0 KB
ID:	1118010

                The blueprint, AnimList, is a list of animations, which will hold ALL our animations, all the states, all the possibilities...

                Click image for larger version

Name:	AnimListOpen.JPG
Views:	1
Size:	69.3 KB
ID:	1118011

                We then add it as a CLASS variable on our AnimBlueprint and we can get it's defaults, all those animations!!

                Click image for larger version

Name:	AnimListinEventgraph.JPG
Views:	1
Size:	35.9 KB
ID:	1118012

                We then need a "current animations" struct so we can plug the animation names to that final slot we'll use on our state machine. Here I've used a simple Boolean to change which ones to store, but you if you have more states you can use enums, structs, you can change anims based on speed, have a flying movementset if the character is in the air, or a swimming one if he/she is underwater.

                Click image for larger version

Name:	CurrentAnimsSet.JPG
Views:	1
Size:	85.2 KB
ID:	1118013

                Now we have our list of anims stored in our struct variable ready to use them in our animation state machine,

                like so:

                Click image for larger version

Name:	AnimList.JPG
Views:	1
Size:	81.3 KB
ID:	1118014

                As you can see here, the same blendspace allows me to play crouch and standing idles, halving all your different states, and if you then combine the lands to use a single state and a blendspace your spagetthi becomes a very tidy set of just:
                1. Idle
                2. Idle2move (if you want to have more control)
                3. WalkRun
                4. Jump
                5. Fall
                6. Land.

                I hope it helps!



                  Originally posted by Rik View Post
                  snip snip
                  Not even going to apologize for the necro on this post; your answer was a goldmine, Rik. Thank you.
                  Grand Marshal of the Parade of Madfellows


                    And to necro again....

                    Rik - This is awesome stuff.... thank you for sharing