Syncing up animations between two characters on all clients

I’ve been trying to sync up an Action priority animation between two characters with no avail. The issue is that the animation is pretty long, and one of the two characters may start the animation while the other character is pretty far along in it, so I need the TimePosition of the second character’s AnimationTrack to sync up with that of the first character if they’re not started at the same time.

I’ve tried creating both animations on the server, but the issue is that the TimePosition property is not replicated, inhibiting my ability to read/write this property reliably in the context of either the server or on the client.

I’ve also tried creating each animation on the client of the character being animated, but again, the TimePosition replication issue prevents this from being possible.

I tried creating all of the animations on each client, but it seems that as soon as I play an animation in the local character itself, due to how character animation replication is entrusted to the client, this animation seems to take priority over the locally created ones (on the other character’s clients), causing them to de-synchronize due to latency differences between the clients.

I even tried using an AnimationController created on each client in each character, but didn’t want to hassle with having to recreate all of the default Humanoid animation logic.

Does anyone have an idea for how I can reliably synchronize the animations between characters? I need the animation to appear perfectly synchronized for each player in the game, regardless of any latency issues. Am I forced to use locally created AnimationControllers, or does anyone have an alternate approach that I haven’t tried?

2 Likes

May I ask what is the use-case for this?

Something like a cutscene that involves characters being dynamically added to the scene.

The most effective way I could thing of is cloning the character rig on the client that you want the animation to sync up with and then play the animation on the cloned character model.

Unfortunately, this solution would be ineffective given that players still have control over their characters during these animations (it’s more of an “interactive cutscene”, I guess you could say), hence my inability to use a local AnimationController, since I still need the default movement to function as usual.

You could also sync the movements on the cloned model.

The issue is when using player characters, not non-player characters, as a consequence of how characters are networked.

Using your code on a player’s character will not work because the server cannot read or write to the TimePosition property of AnimationTracks played on that character since it is not replicated across the client-server boundary. Character animations are managed by the client, not the server.

Creation a false character is definitely an inefficient solution to this problem, and would open up a whole set of new problems, unfortunately

If I change the TimePosition of the animations playing on other characters, the issue I run into is that the other character’s animation replicates from their client, overwriting the local TimePosition change made. I could bypass this behavior by overwriting the TimePosition every frame, but I’d like to avoid such an expensive solution for what should be a much less demanding problem.

I’m sorry for the incredibly late necro post, but have you found a solution, this has been killing me for the past like 2mo.

6 Likes