-1
\$\begingroup\$

I have a game and my tilesheets are placed in the images/ folder.

If a user edits the tilesets, they can make them transparent (I use white as my transparent color on them) and in game basically remove all obstacles and stroll to the level exit.

What's the common or most sensible way of sorting out so the user can't tamper with them?

EDIT: I've already encrypted the file, if the user replaces the file with anything else with the same name it still attempts to load it and place transparent tiles, allowing the user to exit unhindered.

\$\endgroup\$
2
  • \$\begingroup\$ Your edit suggests you've already implemented a strategy to encrypt and replace the file. Why isn't that sufficient? \$\endgroup\$
    – Anko
    Commented Oct 8, 2014 at 21:10
  • \$\begingroup\$ Why do transparent textures change the game in that way? Is it part of the gameplay that those obstacles must be removed to reveal the exit? \$\endgroup\$ Commented Oct 8, 2014 at 22:33

2 Answers 2

3
\$\begingroup\$

A determined modder can and will always modify any part of your game which runs on the users system. You can put obstacles in their way to make their life harder, but you can't stop them. Creating a hash of your assets can be countered by finding that hash in your executable and changing it too. When you encrypt your assets, people will find the decryption key and algorithm in your executable. When you obfuscate your executable, they will find a deobfuscator. You can buy an expensive license for a commercial anti-cheat tool and add it to your game, but these tools can't protect themselves from getting hacked. They are just software, and any software can be hacked when the hacker has access to them. For every ACT there is a hack which counters it.

Conclusion: It's futile.

But when your game is offline, then why bother? The cheaters are only cheating themselves. When they enjoy your game more when it provides no challenge at all, good for them. Let them have their "fun". They aren't hurting anyone except themselves.

However, when your game is online, it's something different. Cheaters can destroy the fun for any honest players who try to compete with them. The only good way to prevent cheating in a multiplayer game is by having an authoritative server which receives raw input from the clients, calculates all game mechanics itself and sends only those results to each client which it is supposed to know. That way the user can modify their client as much as they want. It won't help them when the server won't accept any illegal moves and won't give them any useful information the player isn't supposed to know.

There is, however, one family of cheats an authoritative server can't prevent: Automation. Be it aimbots in a FPS or a farmbot in an MMO - the only way to detect them is with heuristics or with observant moderators.

\$\endgroup\$
2
\$\begingroup\$

Once you've finalized your texture, create a hash of the file. Store that hash somewhere else in assets. When the level is loaded, create a new hash when you load the texture and compare it to the hash created when you finalized. If the hashes are different, the file has been altered.

Further, you might really consider what your motivation is for preventing modification of the game. Some people like to tinker with their games. This is a common behavior and often rewarding, and if the effect is negative, it only ruins the experience for the tinkerer.

If your game is multiplayer and competitive, you'll probably want to make some efforts to prevent modification. However, this quickly becomes a diminishing returns type situation. The more advanced your anti-hack, the smaller the target audience is (because fewer people have the skills to perform advanced hacking). This means that the most challenging work you can put into preventing hacking is only going to stop the smallest number of users.

You may want to focus your efforts on simple, broad changes that prevent casual hacking. It's more important that you finish your game and it's fun to play, then preventing a small fraction of its players from cheating.

\$\endgroup\$
1
  • \$\begingroup\$ You should add a disclaimer that even the hash solution can be worked around. \$\endgroup\$
    – bogglez
    Commented Oct 9, 2014 at 2:15

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