Lyra Animation Replication

Hi there,

Did anyone find out how animation are synced in lyra? For example, the HasAcceleration and HasVelocity variables used to transition between locomotion states are not replicated but clients play the correct animations. It is not documented and I couldn’t find anything in the game myself.

ty

The acceleration is replicated in c++.

For anyone still looking, acceleration is replicated to simulated proxies in ALyraCharacter with the ReplicatedAcceleration struct.

They calculate the acceleration value inside the overridden PreReplication function and compress it. Then it is decompressed in the OnRep_ReplicatedAcceleration function. From there, the replicated value is sent to the LyraMovementComponent via the SetReplicatedAcceleration function where it will override the default acceleration value that the movement component returns. They also override SimulateMovement in the movement component to ensure that the replicated value isn’t overridden by the default acceleration value.

At least that is what I made of it. :sweat_smile:. Implementing this into my current setup allowed my pivot anims to replicate to simulated proxies. Without it the pivots would only play locally

1 Like

Temporary fix here [HOW TO] Replicating Lyra Animations In Clean Project - #2 by II_KiAx_F0X_II

Yes, my friend!
After I finished making a simple version of Lyra’s Locomotion (including synchronization groups, etc.), I found that TurnInPlace and AimOffset worked normally, but acceleration-based data-driven animations such as starting, emergency stop and direction changes were inconsistent between clients. is not getting replicated, so we need to network replicate the acceleration.
I show the process as follows (assuming you are trying to fork Lyra in a new project):
In Lyra’s SLN file, you only need to find LyraCharacter.h and LyraCharacterMovementComponent.h, and copy these codes. It should be noted that FObjectInitializer needs to be used in the constructor of LyraCharacter to set LyraCharacterMovementComponent as a sub-object and CASTCHECKED, so that the acceleration will override the default value of the motion component.



微信图片_20240308173116

1 Like