Mounting System Animations (WIP)

Warning

This document is currently a work in progress (WIP).  It's a lot of text and not a whole lot of demonstration.  Over time I plan to improve that but for now I just need it to get out the door.

Developing Animations for the Mounting System.

For your single player game with absolutely (zero, zilch, nada) no plans of expanding the game with multiplayer features in the future, then any animations will work fine for mounting and dismounting be they with root motion or without.  However if your game is to be a Multiplayer game then you have some serious considerations to make.  Unreal Engine is a powerful engine that supports both Root Motion Animations and fully Networked Game play but it does not do these things very well at the same time. 

If you do not want to read this article there is a 5 minute video I made a while back that sort of explains the main problem.  Check out the Additional Resources Link at the bottom.

Common Problems with Networked games and Root Motion

I personally have hit two common problems that persist as of UE 4.25, and again this is not an issue with the Plugin but an issue with Unreal Engine itself.  The First is  “The Montage Play Speed” Problem and is the most obvious.  The Second is what I call the “Lag Offset Problem” and is much more insidious.  Both of these problems arise with connected clients, any one playing as a Listen Server will not observe them but any connected players will experience them.  You may be able to remedy these by temporarily turning off Movement Replication during these montage sequences and/or disabling root motion on only the client but with out considerable additional development these problems still persist.

The Montage Play Speed problem occurs with any root motion animation played on a client.  For reasons unknown to myself the play rate of any animation with root motion at least double the normal play rate.  This includes all animations including sequences, montages, blend spaces, etc.  You can do some code hackery to check if the animation is playing on a connected client and attempt to slow it down, but that in of itself can be tricky and does not always work. I have also attempted triggering the Montage to play only on the server but then it does not play at all on the client.

The “Lag Offset Problem” occurs at a very specific circumstance.  Part of the mounting system’s functionality is to allow developers to play an animation to start mounting and start dismounting.  At the end of those animations the system attaches the character’s capsule to the mount or detaches it from the mount.  I make no assumptions on the things you want to do with this plugin and so I leave it up to you, the developer, whether you want to allow riders to attach or detach while the mount is moving and that movement often is the cause of the Lag Offset Problem.  A very interesting phenomenon occurs when you add movement into this equation of Networked Gameplay plus Root Motion Animations plus character attachment.  The player’s capsule is offset proportionally to the amount of lag between the client and the server, meaning the bigger the lag the more the character will float off of their intended seat on clients and it is in the direction of the movement.

So these are two of the issues you will need to handle if you are wanting to deal with Root Motion Animations in a Networked game.  For now these are outside the scope of this plugin, that may change in the future as the engine continues to improve.  And the main reason why it is not a priority of the mounting system is because there are ways around this problem for networked games by creating your animations slightly differently for mounting and dismounting that do not leverage Root Motion.

Mounting Animations for Networked Games

In all honesty I would suggest not having any animations for online games when it comes to getting on or off mounts.  Root Motioned Animations cause the greatest amount of trouble and scripted motion animations will look the best but require the most work.

Scripting the animation usually requires that designers and programmers (either blueprints or C++) work on building out a sequence of moving the capsule and playing animations at the same time using customized curves and timing systems and handling UE4’s move replication.  Unfortunately this is beyond the scope of this document.  Basically if you got good programmers and good artists on your team you should be able to figure this out.

What I will talk about is specialized animations which only require that the artist build the animations a certain way to produce a decent mounting and dismounting effect.  I am sure a talented technical artist can hammer out the details far better than what I will present but it should get you most of the way there.

Building Specialized Animations

The animations provided in the Demo Project are built using this methodology.  There are a few key things to note.  The main thing is you will need to build the animations based on the structural makeup of the Pawn or more specifically the Character Object that represents the Rider. 

For instance all ACharacter Objects have a capsule that represents the root component.  It is the root component (usually the capsule unless you have a custom pawn) that gets attached to the mount or vehicle, not the character mesh.  As an artist you may be tempted to build animations based on the root of the character model, usually that is located at the feet.  Instead you need to build the animations according to the midpoint of the capsule that will surround the character and be attached to the mount. 

This usually means you’ll need to shift your character down below the floor grid to compensate for the differences.  I tend to build the sitting on mount animation first then work backwards from there.  That way I know how the character is supposed to look while on the mount and about where.

Finally on the imported animations you want to set blend in and blend out to be Zero.

(Images to come, for demonstration see Video)

Additional Resources

My Video on Building Animations for Networked Mounting.  Yes it is an older video but still relevant.
https://www.youtube.com/watch?v=KIZP3kkomSs&list=PLK-uozTlWMkysM9B9unrrWSTrhoWhrakk&index=6

Root Motion Over Network discussion on UE4 Forums.  This provides a few additional methods to accomplishing root motion over the network but be warned none of it is easy.
https://forums.unrealengine.com/development-discussion/animation/97130-root-motion-over-network-how-its-done

Redit: Root Motion in Multiplayer:
https://www.reddit.com/r/unrealengine/comments/8j6ova/root_motion_in_multiplayer/

This is a general Root Motion or Scripted Motion Video for anyone interested in the differences and why you would want to use one over the other.
https://www.youtube.com/watch?v=j7XZ3Q8JNfM

A VERY good tutorial on how to setup a Full Root Motion Animation System but it only works well in Single player games:
https://www.youtube.com/watch?v=QCA4ZQzFZ9s&list=PL8xcKsKsXEfvKkHFIEwfrkAxz0wq6ykPm&index=1