Calculate Playrate of Animation

This is more like a math question

I have an animation that is played in the server and clients,but due to fps,tick and other stuff the animation plays faster on the client,

Can i make a formula that accelerate the play rate so it ends at the same time as the server?

How can i make it?

if you are using Tick it comes with the delta time (without Tick() you can use GetWorldDeltaSeconds()), and you can use the inverse to get the framerate, and then periodically send the client framerate to the server; this does have the issue that framerate, and frame time is hardly ever consistent, and spike/dips happen even during animations.

alternatively you can implement keyframes for “Animation Notify” (callbacks) on the animations and if your are using Characters and PlayMontage()you can receive the callbacks from the animation to send off to the server (if you put a Notify at say 33% and 66%, then also do a callout at the Completed) if the Animation involves root motion then be sure to include the character’s Transform. the more of these Callbacks you include the more in sync everything remains, but the more traffic you are sending between client and server. For Animation smoothness I would trust the Client more then the server, but that is up to you.

if you need to sync the animation between multiple clients you can use these callbacks to manually reset the animation at the desired percentage point (this might mean doing the math for your animation of how long they are to find the time index to feed in). This could produce perceived stuttering or rubber-banding but a vast difference in framerate or connection can produce that perception anyways.

i can’t trust the client because in the end of the anim it triggers a event to continue the logic,so if the client modify the animation speed the the logic will happen very quick,which is hacking,so i guess the correct way is to simulate the server velocity of the animation in the client so they be in sync,also if i put a delay node to trigger the event to continue the logic, the client continues playing the montage faster,do you know a math that calculates the server velocity and passes it into the client?