Playing animation on server or client to reduce the impact of latency?

I am talking about a sword fighting game where timing and parrying play a big role.
Let’s assume that two clients are fighting and both have 100 ms latency. I’ll call the attacker A and the defender B.

If I play the animation on the client, when A hits, B will see the animation playing 0.2 seconds after A actually clicked. So assuming that B needs a reaction time of 0.3 seconds and the animation lasts 0.5 seconds, B will see that he parried when the animation was at 0.3 seconds, but from A’s perspective, the animation was already over 0.2 seconds ago when B parried (because the parry itself takes 0.2 seconds to get to A’s client). So depending on which client detects the attack and the parry, it will be fair for one and very unfair for the other.

However, if the animation doesn’t play on A’s client when he presses the button, but instead tells the server to play the animation for him, then A and B will see the animation at the same time. This would make the battle itself more fair but then A would have a worse gaming experience since his attack was only actually played 0.2 seconds after he clicked.

So, finally, my question is, should the animation play from the client which attacked (making it fair for one and unfair for the other), or should the client tell the server to play the animation (creating a bigger input lag for the given client)?

Thanks for any replies.

3 Likes

In my opinion, in games where losing does not have big consequences, it’s better to play animations client-side. If you’re developing a roguelike, a very competitive game, or a game that has big consequences for losing, play the animations server side for fairness.

4 Likes

And do you think using both methods would be too much? For example, if the game has a story mode and a PvP mode, could I use the client animations in the story mode and the server animations in PvP? That way it would be reactive when it needs to be and fair when it needs to be.

2 Likes

Sure, but I’d recommend making 2 different places for those different modes to avoid confusion,

2 Likes