Hello guys!
Does anyone have experience with root motion animations, and have integrated them into a networked game? If so how did you achieve it?
Hello guys!
Does anyone have experience with root motion animations, and have integrated them into a networked game? If so how did you achieve it?
When I did that in the past, we had to load the animation assets on the server, and roll the animation forward in the appropriate time. This in turn means that the decision engine that determines which animation to play, also has to run on the server. It worked, but it was heavyweight, in computation even more than assets (there aren't THAT many animation assets.) You'll typically want to optimize so you only derive root motion in the animation, and don't waste time posing heads and arms that don't affect movement.
If I were to do it again, I would instead make movement be physical only, and then drive the animation progress by how far the entity has moved – this is the reverse from driving movement from animation! The code you end up doing is doing this on the client:
Your animations will then typically be done with a full cycle in “unit time” and a parameter for how much they move. Typically, there will be a tool that removes the root motion from the animation, and instead outputs the mapping from velocity/phase to frame. If you're fancy, you can use a lookup table here, to allow for irregular speed animations.
Another physical/simulation state that might be useful to know is whether you're “running with traction” or “sliding/slipping” – it's OK to detect that feet are losing traction, and start sliding; this may even affect how input commands affect movement.
Interesting, in my case I do run the server in the game engine which enables gives me the freedom to “play” with the animations.
hplus0603 said:
If I were to do it again, I would instead make movement be physical only, and then drive the animation progress by how far the entity has moved – this is the reverse from driving movement from animation! The code you end up doing is doing this on the client: determine animations to choose between stand/walk/job/run/sprint animations based on speed of physical movement roll each animation forward in time based on physical speed divided by animation speed for that animation. blend the animations – they should be “in phase” because you roll them forward the same proportion IK fix-up of feet
In this context, does roll forward mean, the change in object's position?
I've considered throttling the movement input that root motion animations can perform, could this be a reliable lightweight alternative to the solution you've proposed?
does roll forward mean, the change in object's position?
It means “wind the animation forward as many frames as needed to match the physically simulated movement.” If you know that the “run” animation goes between frame 0 and frame 99, and moves 4 meters in that span, and the physical simulation said you moved 0.31 meters, then you wind the animation forward (0.31/4*(99+1)) == 7.75 frames.
Sorry for the late response I did not receive an email notification about your comment, I understand your suggestion now regarding the animation flow, it seems like an effective idea of how to implement the root motion.
If I were to apply the above logic on a game such as Dragon's Dogma - Dragon's Dogma All Warrior Skills, would the flow be as follows?:
On a side note: do AAA companies perform a similar workflow to your suggestion?
Thanks again,
Itay
I don't know that game, but I know that some AAA companies use root motion and load the animation on the server, and others use simulated physics motion and drive the animation based on the simulation. And others just play an animation and move the character by sweeping a capsule through the world, and end up with footsteps that slide…
Which method works best for you depends on both your particular game genre, and your specific game asset pipeline and artists skills. Either way can work fine.
hplus0603 said:
I don't know that game, but I know that some AAA companies use root motion and load the animation on the server, and others use simulated physics motion and drive the animation based on the simulation. And others just play an animation and move the character by sweeping a capsule through the world, and end up with footsteps that slide…
Which method works best for you depends on both your particular game genre, and your specific game asset pipeline and artists skills. Either way can work fine.
Thanks for the knowledge, it gave me some options to try ?