Multiplayer Sync AnimationTree

Godot Version

v4.4.1

Question

It’s my first time working on a multiplayer project. I was wondering what’s the best solution to sync AnimationTree between peers.

I have been watching a few tutorials online, however none of them seem to be a good fit for my case.

My case:

My network is client-authoritative, so clients are responsible for pretty much everything, including animations. Only authorities can run their StateMachine and animation calls are included as part of the StateMachine’s enter function. This implies that animation transitions are applied correctly on clients, but peers skip this logic as they are not authorities.

My AnimationTree is quite complex with nested State Machines responsible for each state, BlendSpace2D nodes, and more.

My first thought:

A solution I was thinking of is to link a State change to a signal which would pass along the new state, as well as the authority who called it (so the peers know to which other peer they need to apply the changes). So on signal received, only the affected peer would get its animation impacted.

My second thought:

Another solution I was thinking of was to synchronize the AnimationTree parameters, so playbacks, blends, and so on.

I haven’t tried either of these solutions as I’d love to know if there is a better approach to it (might very well be that my ideas don’t even work :sweat_smile:)

Thanks in advance to everyone who tries to help, you’re a legend! :slight_smile: