Chapter 7. Server-side Hit Detection
There are many multiplayer games which involve shooting at their core, and there will be plenty more to come. These games all need some way to keep in sync who's shooting at who, and who gets hurt and dies. There are a number of ways to solve this problem.
The most obvious solution is simply to have player clients send a damage message. If the player hits someone, send a damage message to the server. The server deals damage to the appropriate player. There is a huge, glaring flaw in this design: players can, and will, cheat the game. It's truly staggering how many client-side hacking programs there are available—programs that send messages to the server, programs that directly modify variables on the client, and so on. A player could easily specify any player to be damaged, and any amount of damage to deal. It gets even worse if the client handles damage messages instead of the server, as the client can also make themselves...