Sign in to follow this  

Hide my Resources?

This topic is 3598 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I am 75% through writing what I hope to be a commercial game, using VC++ and various graphics engines (libraries). Can somebody please tell me the best way to hide my resources from the user? For example my game uses a very large and extensive script file that is a simple text document. It contains copyright AI logic plus the user could simply hack the game apart by editing the text file directly. There is also over 200mb (uncompressed) of graphics, plus 3d objects etc that I absolutely prefer to protect as much as possible for reasons I won't go into right now. Obviously a determined hacker/cracker would find the files no matter what I did and I accept that but I'd still like to make it as hard as possible. The type of questions I have are: How do I convert everything to a binary form? If I do so will this impact my game so much (converting backwards and forwards on the fly) that it will become useless? Do I need something like MD5 encryption and pack everything? Then unpack everything during initialisation at runtime and destroy the resources at game end? I can see this failing easily if game crashes or user deliberately stops it or accesses the working directory (to look for the resources) during runtime. Unless the game exits cleanly the resources would not be destroyed at shutdown (leaving only the packed version). This must be a common problem so what do other game developers do? I have plenty of MD5 encryption code but I'm not sure if it should be used on the fly as files are loaded and unloaded during the game? Loading up a graphic is already the biggest performance hit on my game. Any advice is greatly appreciated. m0ng00se (NZ)

Share this post


Link to post
Share on other sites
Most developers simply don't care.

If it is a singleplayer game modability is an advantage, if it is a multiplayer game the server should keep the gamestate valid anyway making a modified client worthless (Unless both the server and client are modified appropriatly, which would make the modablity an advantage once again).

If anyone wanted to steal your assets they could do so anyway (The game has to contain both the key and the algorithm required to read the data), the only way to protect your assets properly is in court.

You might however want to use binary fileformats in some situations, preferably formats that are as close to the way the game stores the same data in memory as possible (to reduce/remove the need to parse the data) , compressing the data can further reduce loadtimes and is often a good idea, (Disk I/O is generally so slow these days compared to CPU and RAM speeds that you can save alot of time that way)

Share this post


Link to post
Share on other sites
Think about it: Blizzards mpq fileformat, used in Diablo 2, warcraft, starcraft and in world of warcraft is _hacked_ since ever and Blizzard don't care about it.

I would only make a md5 hashingtest by uploading a Highscore if really necessary. On Multiplayergames the server should control what a user can do.

Share this post


Link to post
Share on other sites
You'd probably be interested in file-system wrappers like PhysicsFS.

Quote:
Original post by m0ng00se
How do I convert everything to a binary form? If I do so will this impact my game so much (converting backwards and forwards on the fly) that it will become useless?

All of your files area already binary... You could pack them all together into a giant binary file such as a ".zip" to stop people from casually browsing through them.

Quote:
Original post by m0ng00se
Do I need something like MD5 encryption and pack everything? Then unpack everything during initialisation at runtime and destroy the resources at game end? I can see this failing easily if game crashes or user deliberately stops it or accesses the working directory (to look for the resources) during runtime. Unless the game exits cleanly the resources would not be destroyed at shutdown (leaving only the packed version).

First, MD5 is a hashing algorithm, not an encryption method.
Second, if you were going to encrypt the game data, there's no reason to write the decrypted data back to disk!
Your proposal is basically:
1) Load encrypted file from disk into memory
2) Decrypt in memory
3) Store decrypted file from memory to disk
4) Load decrypted file from disk to memory
5) Deserialize decrypted file into game object

If you are going to encrypt your files, you will need to edit your game-framework so that it can load a file from a chunk of memory instead of from a file-name... You should basically be working with a 'virtual file system'.
I.e. cut out steps 3&4 from above
1) Load encrypted file from disk into memory
2) Decrypt in memory
3) Deserialize decrypted file into game object

Share this post


Link to post
Share on other sites
Fair enough. I admit that I learnt a lot about writing games by hacking other people's games apart to see how they worked although I've never used anybody else's resources in something of my own. Just wanted to understand how they did certain things. So I guess it is a bit of a cheat to then try and lock all my own stuff up.

It's not just protecting my own stuff though. If a user worked out how my game worked they could change a specific text file to get into "secret" bonus levels, achieve high scores, even change all the AI logic to suit their own needs.

Still I hear what you are saying though. Big deal if they hack away at it. Let them if they want to. Just put it out there and let it live or die on it's own merits like any other program.

Visions of all my graphics appearing all over the net. Oh well, free advertising I guess. Thanx for the feedback.

m0ng00se

Share this post


Link to post
Share on other sites
Quote:
Original post by m0ng00se
It's not just protecting my own stuff though. If a user worked out how my game worked they could change a specific text file to get into "secret" bonus levels, achieve high scores, even change all the AI logic to suit their own needs.

Still I hear what you are saying though. Big deal if they hack away at it. Let them if they want to. Just put it out there and let it live or die on it's own merits like any other program.


They can and will hack it anyway no matter what you do. Anytime you have both the "encryption" and the "key" on the same system it can be hacked. So you may as well just save yourself some time: zip everything up or create your own custom file format. That's it. no one bothers doing anything more than that; it's just a waste of time.

If it's single player how does it affect anyone if they can unlock the "secret bonus level" or "hack your AI apart"? It doesn't; in fact the most common result of something being able to be hacked in this way (doesn't affect others) is that more people buy it and the community stays alive longer.

-me

Share this post


Link to post
Share on other sites

This topic is 3598 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this