Swapping animation sets at runtime

Just brainstorming and trying to find a solution to a problem here, so bear with me. Bear in mind I am not an animator/artist.

So, my understanding of the animation is:

Animation Set > Skeleton > Skeletal Mesh > Character

Where the skeleton acts as an interface between the animations and the skeletal mesh. The problem comes in when you want to have a number of animations for the same character that are different in different situations. In the current version, the state machine gets cluttered and nasty.

So here is a scenario:
You have a default male human Model
A default male human Skeletal Mesh
A default male human Skeleton
5 different sets of default animations (Rogue, Warrior, Mage, merchant, Beggar)

Is there a way to keep all of the animation sets separate, swap them out at runtime, without having to create completely different character BP’s for each? What is the most efficient method for dealing with the clutter?

Since I am not on my computer I can’t give you any advice visual wise, though can guide you in a way or two.

If I wanted to have 5 classes for one player, I would personally make 5 anim blueprints and swap them in player BP depending on which class the player selected.

In Player Character BP, you can “Get Skeletal Mesh” and “Set Anim Grap” (or something close to that) so you can change it to whatever you prefer. As long as the anim graphs are identical system wise and only have different animations, same buttons will do same actions. Or different actions if you made it more complicated. :slight_smile:

Now, you could make one Animgraph for 5 classes aswell, but this would crowd the graph too much. And different Anim Graphs can have different rules of themselves. Also, a Warrior doesn’t need to have a magic casting animation. Or lets say the complex one that the Mage has.

Some games can chose the second option because they are so simple system wise. For example World of Warcraft have 7+ classes yet there are so little amount of animations. And the only connection animations has in between is blending. You could make that system in literally 5 minutes in Unreal, by simply using “Blend by Int” node in Anim Graph, and change the animations with numbers. :stuck_out_tongue:

It depends on how complicated you want to have it. Start simple, have problems as you go complex, get stuck and ask away latest. :slight_smile:

PS: I just realised you want to be able to swap at runtime. Now, my first option might for you but there will be no blending between anim graphs the moment you change it. If you want the swap in real time with blending, at the very first stage of Anim Graph, create 5 State Machines with names fitting to your classes and create a “Blend Poses by Int” node. Add them all to this node and you will be set. Just make the int part a variable so you can reach out from anywhere. :slight_smile:

Unless I am mistaken, your P.S. is basically saying that you would need to use the same anim graph with different state machines if you wanted to have the blending. I’ve been told that, and accept that as true, but I am trying to understand why. From a programming/design point of view it doesn’t make sense to me.

From the way I understand everything to be linked up (which I admit could be dead wrong), the skeleton acts as an intermediary between the Anim graphs and the skeletal mesh. Now I know that the Skeletal Mesh and Mesh, have to be configured to work together for scaling, weighting, etc.; the Skeleton and the Skeletal mesh have to be configured to work together; and the skeleton and the anim graphs have to work together. To my way of thinking, to make this possible:

Mesh would contain reference & config values for Skeletal Mesh, so there could be a many-to-one relationship.

Skeletal mesh contains config info for skeleton, so there could be a one-to-one relationship.

Anim Graphs contain a reference and config values for the Skeleton, allowing a many to one relationship.

Player controller just spams event messages for the Anim graphs to pick up on.

So I do not understand WHY you would lose your blending, or anything else, if it was changed at runtime. Essentially, as long as the skeleton and skeletalMesh do not change, nothing should be lost and the end user should see no difference except for the change in animations.

What am I missing? Trying ot figure this out so I don’t have to hassle the artists about things they can’t do anything about.

I see where you are confused now.

Back in UDK days, in order to play an animation, most of the time you had to “invade” the animation file to play what animation you wanted, exactly what you drawn in there. In Unreal 4 this is not the case anymore, not supported, and most importantly not needed.

The picture you have in your hands can easily be done by just Blend Poses by Int. But changing anim graph itself runtime will not give you blending results. One AnimGraph can only blend in itself.

I know someone else can explain you better, but the thing is, if you want everything to blend only thing you need to have is 1 Anim Graph and 5 State machines at the start, instead of having 5 Anim Graph and 1 State Machine in each. I suggest watching the tutorials of Unreal Engine channel in youtube regarding on how the animation system works.

All I can add is, it is more than just a reference container. You may not change the skeleton, but you are directly changing the anim graph file which IS the one letting you do the animations :slight_smile:

Well, the only thing I wanted to blend were the poses within a single state, so that wasn’t a major concern, and the major benefits were that more than one artist could work on animation sets(because they would be in seperate blueprints), and a better organized smaller sized animgraph.

Basically, if you had one player character, and a few different animation styles for that same character, multiple artists could be working on them, one for each style, without the commits overwriting each others work.

Thank you for taking the time to explain it though. If I were where I could watch the tutorials, I would, but unfortunately I am in an extremely low bandwidth area at the moment.