My game will be client-server, and I'd like to prevent the hosting player from enjoying the usual benefits you'd associate with playing on a server. For example, the advantage of the server running ahead of time compared to clients.

Are there simple ways of mitigating host advantage? Or do I have to make something complicated? My naive solution would be having the host run a "ghost" state, and a client state, on the same map.

The ghost state is an authoritative server simulation, it doesn't render the simulation which remains invisible, but does run ahead of time making calculations and decisions as usual. The host also plays a client on the same map, in which their input is regarded as any other client across the network, and like any other client is required to wait for the server simulation to make and transmit outputs. And so the host doesn't enjoy an advantage because they aren't playing the simulation which is making executive decisions on the game state ahead of client time.

Has this solution been done by any other games, or is there a better way of handling the problem?


1 Answer 1


The best way to minimize host advantage is to have good lag compensation which makes sure that the outcomes match what the players see on their screens.

For example, When you are developing a first person shooter and want to know if a shot hits an opponent, take the latency of the shooter into account. If the shooter has a 40ms ping (round-trip time server->client->server), then check all hit collisions from the positions where the shooter was 20ms ago and against where the opponents were 40ms ago. That way you are detecting hits against what they saw on their screen when they pressed the fire button. When the victim's HP get reduced to zero that way, declare them dead but give them a grace period equal to their latency in which their shots are still counted (they made these shots before they saw their character die).

Yes, this might occasionally lead to implausible outcomes, like two high-pingers killing each other simultaneously with Hitscan weapons. But that's what you get with online gaming.

Lag compensation is a very wide topic, and the best practices and applicable techniques vary depending on the genre of your game. If you have any questions about how to mitigate lag advantage in a specific situation, feel free to post another question.


You must log in to answer this question.