I am looking for ways to prevent cheating on a multiplayer browser game. I saw this answer where it was mentioned that obfuscation is not an effective technique.

My plan is not only to obfuscate the code differently every time the page is loaded but periodically change the protocol that the client uses to communicate with the server. This would mean that even if they were able to deobfuscate the client-side code, they would need to update the protocol every time I changed it or they wouldn't be able to communicate with the game servers. I know that this will be difficult to implement, but I believe that I can do it.

Would this work? I know that it's impossible to outright prevent cheating, but I believe that this would make it extremely difficult.

  • \$\begingroup\$ If a particular strategy does not work, doing that strategy more will also not work. All the hacker needs to do is learn each of your protocols and swap to their corresponding hacked client. If your game becomes popular, hackers will collectively have more time to put into learning faking your protocols than you have to invent new ones. What kind of cheating are you trying to prevent? You'll do better asking for solutions to that specific problem. \$\endgroup\$
    – DMGregory
    Aug 7, 2020 at 23:11
  • 1
    \$\begingroup\$ You might want to focus on designing and building your game in such a way that cheating is irrelevant. Your time will be better spent than playing an infinite game with cheaters. \$\endgroup\$
    – Vaillancourt
    Aug 7, 2020 at 23:14
  • \$\begingroup\$ @DMGregory that is true. I'm creating a shooter and my main concerns are wall hacks and aimbots and stuff like that. \$\endgroup\$ Aug 7, 2020 at 23:14
  • \$\begingroup\$ @Vaillancourt well the game is a shooter so I'm not sure how I could make cheats irrelevant without completely changing the game \$\endgroup\$ Aug 7, 2020 at 23:15
  • \$\begingroup\$ There you go ;) with a multiplayer browser shooter game, you absolutely have no control over the client, and you would have no way to detect client based cheats. \$\endgroup\$
    – Vaillancourt
    Aug 7, 2020 at 23:33

1 Answer 1


Summarizing the comment thread above:

No amount of obfuscation will stop cheaters. The most it will do is slow them down by a little - and if your game gets popular, the amount it slows them down will be much less than the time it takes you to implement these obfuscation features. Time you could be spending making your game better for all your non-cheating players.

The strongest protection against cheating is to design your game in such a way that a player gains no advantage by cheating. If you want to prevent wall hacks, ensure that seeing through walls gives no advantage - because the game client doesn't know about players on the other side of the wall until they're about to become visible anyway. The server deliberately withholds this information so cheaters and non-cheaters alike need to actually get in position to see around the corner.

Distinguishing an aimbot from a very skilled player is very challenging, but obfuscation wouldn't stop aimbots anyway — a hacker can intercept the graphics driver calls to find the locations of on-screen targets, and fake input to take the reticle there, without ever touching the game's code. So you need to catch it on the server. Usually by watching for patterns of inputs and looking for telltale artifacts of a script's calculated values moving differently than a mouse or analog stick driven by a human hand.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .