0
\$\begingroup\$

Let's say, theoretically, that I'm developing a first person shooter with, of course, a map with things like walls. In the client code, the player is obviously halted upon collision with these wall objects. The server, however, only receives the player's location coordinates.

Without some sort of data encoding in the client, the player could easily read the network communication to the server and send false coordinates to the server, allowing them to go wherever they wanted.

My question is, is there a way to encode this location message to the server before it exits the client binary such that it would be extremely difficult for someone to read? Even by someone who disassembles the code to try and break the encoding? Or do all player collisions have to be detected by the server?

\$\endgroup\$
4
\$\begingroup\$

The server, however, only receives the player's location coordinates.

No.

The server receives the key presses from from the client, makes sure they're valid, then authorizes the client to move.

The client has no say in where it can go. It should act as a dumb terminal.

Then you can add client side prediction and make your game look smooth.

Without some sort of data encoding in the client, [...]

This is still a nice to have, though. Preventing players from sniffing the traffic would help avoid most hackers and trivial cheaters to create bots and the like.

is there a way to encode this location message to the server before it exits the client binary

You also have to obfuscate the client per se. Programs such as Cheat Engine can sniff the information directly in the client's memory, the data does not have to "exit the client" before it can be read.

it would be extremely difficult

That's unfortunately as far as you can get, you can't make it impossible. If there is enough money to be made by cheating in your game, some entities will try hard to reverse engineer everything and allow some players to take an unfair advantage.

\$\endgroup\$
  • \$\begingroup\$ There's no alternative to this method? \$\endgroup\$ – DonutGaz Jan 30 '17 at 11:36
  • 3
    \$\begingroup\$ Nope. The client simply can't be trusted. \$\endgroup\$ – Tyyppi_77 Jan 30 '17 at 11:41
  • \$\begingroup\$ @Greg Someone here once said: "Always assume the player is a lying, cheating bastard". This sums it up nicely. \$\endgroup\$ – Bálint Jan 30 '17 at 13:17
  • \$\begingroup\$ +1 im aggree , client MUST be the one who receive the coordinate NOT the server , its mean server only receive what action / button was pressed then simulate it and send the result to all client \$\endgroup\$ – user6668201 Jan 30 '17 at 14:29
  • \$\begingroup\$ Thanks again everyone. I now know what direction I need to take for the game. \$\endgroup\$ – DonutGaz Jan 30 '17 at 14:47
0
\$\begingroup\$

Sadly, since the map still has to be rendered on the client, since we are nowhere near the server resources to process games server-side, there really is no way to prevent aimbotting, walling ect.

You would literally have to make the game unfair for players to fix it. Implement a good reporting system and maybe a server-sided stat analysis chron that bans people that have too high accuracy k/d ect.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.