Client vs Server animations

So I’m currently working on a fast-paced combat game and I’ve done quite a bit of reading and experimentation with animations on the client vs server. However, I’m unsure how I could line up effects and sounds that would be played on the server and the keyframes of an animation on the client. (I’ve also heard it’s more performant to play them on the client since it’s less work on the server, but then I’ve had others say it has no impact on performance to play them on the server? Not sure who is correct)

If I were to run a punching animation the client, then when the keyframe is reached for when the players punch hits, I would have to send a remote event to the server in order to play the effects on the server, but there would be a slight delay correct?

So what’s the best approach for lining up fast-paced effects on animations from the client to the server? Should I just be playing animations that use keyframe reached events on the server?

Either way you will get a delay.

If played on client, you will see no delay, but the other players will see a delay from you to server, and from server to their client.

If played on server, there will be a delay from when you press punch key, until server receives and plays the animation, then you and everyone else get a delay from server to client.

If the animation is played on a model with a humanoid ‘such as a character’ the animation will replicate from the client to the server, then to all the other clients

I think having a delay from keypress to server, then animation plays and delay back to client is not the way to go. It would probably feel so laggy and look horrible. I think you should play your animation on the client. Sure the other clients will get a delay, but it will be the same as they would get if you played it on the server.

1 Like

Yeah that makes a lot of sense, so then I’d just be firing the event for checking the hit and adding the effects upon reaching the keyframe on the client then right?

Yes, I think that would be correct.
I know in games outside of Roblox, it is done like this.
When the player does an action, first the client checks if its allowed
Then it starts the animation, and tells the server the animation started, and at what time.
The server gets the signal, and first checks to see if it is not allowed, it does nothing
if it IS allowed, the server send the signal to all clients (except the one who started it all) and tells them to play the animation and includes the time stamp of when the original animation started.
When the other clients get this information, they can see when the original animation started, and so
they can play the animation at a slightly faster speed to have the animation end approximately when the original animation will end.

I don’t know how much Roblox does behind the scenes syncing animations and things, I’m sure they do a lot.

So probably most simple is best, make it look nice on the client, let the server check for hits and such, and then worry about the other clients least.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.