How do i fix 2 players hitting eachother at the same time

So i have an issue, in my game there’s a combat system and when 2 players hit eachother at the same time they both get hit and stunned. How do i avoid this?

Maybe adding a system so that whenever two players attack each other 2 random numbers are generated between 1-100 The higher number gets to stun the other player and is unable to be stunned

This is what I use, but the number generated is a decimal fraction of a second (to make it impossible for a tie). There’s always a first one to die.

1 Like

Yeah that’s better, You really wouldn’t want a tie

The only problem is i don’t wanna make my game rng, i wanna make it be skill-based

You could check on the server if the the player who wants to stun someone is already stunned…

You need some way of knowing who attacked first, whether they stunned the other player, and be able to invalidate the attack request of the second player. The first attack must be processed before the second is processed. Maybe a queuing system?

This is definitely a server side combat system.