Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working on a small multiplayer game with a whole bunch of scripting components.

I know I can't store my files in plaintext otherwise anyone would be able to change the functionality of core parts of the game.

What is the best way to go about preventing this sort of "hacking?"

Would it just be best to develop the program using the script files then just copy the files into strings that are hardcoded in the program?

share|improve this question
Related:… – Byte56 Mar 10 '14 at 3:07
up vote 3 down vote accepted

If you store the script files on the client, in any form where you can eventually read them on the client, you can't "protect" them. They will always be open to exploitation, even when hard-coded into the game's executable or "encrypted" (as they must be decrypted to run).

You can prevent casual exploration by packing the files in some non-obvious format, but that isn't security against hacking either.

To prevent players from exploiting by altering scripts (or any other data), you have avoid placing trust in the client. Store everything you can on the server, transmitting commands to the clients (for scripts; this is how scripts in Guild Wars 2 work, for example). What you can't do exclusively on the server, make sure to verify on the server at least.

If you are making a peer-to-peer game, this is harder. Typically you'll want to employ "gossip"-based verification, where every connected peer (or some subset at random thereof) verifies actions and the results are compared to ensure they agree. You usually need to tune the heuristics involved to get a good play experience.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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