Sign in to follow this  
PiNtoS

hiding data from the user

Recommended Posts

I have several types of data, among them a bunch of text files that I've used for various initializations, and I don't really want the user to fiddle with them. I'd rather not have to convert them all to binary, because I want it to be easy for me to change them. Obviously, this is a bit contradictory, but I was wondering what the standard way to deal with this problem is. Also, I've got the same question about image files - I don't want the user to be able to mess with those. I don't really play games myself (I'm just a humble coder), so I don't know what professional games do; but it would be strange if, e.g., you could change what the characters look like in Half Life.

Share this post


Link to post
Share on other sites
Quote:
but it would be strange if, e.g., you could change what the characters look like in Half Life.
http://www.moddb.com/games/1/half-life

But, to get back to your actual question, a simple checksum will prevent all common users from modifying your data files, if you don't want to encrypt them.
You can use encryption too, to make it a bit harder to steal your artwork. However, you should be aware that sooner or later someone with more than average common skill and time will circumvent whatever you do anyway.

Share this post


Link to post
Share on other sites
I'm guessing binary files are the standard. You don't have to do it manually, a very simple C++ function will do it for you - read it as ASCII and output it as binary, nothing more than a switch in an fstream. Also, it would be a good idea to write an archiver so you can bunch all your individual files into a single file and use that rather than having many different files.

You can't stop the user fiddling with them, only make it a bit harder. Even if they are binary there's nothing to stop them being opened in a hex editor, although the user will have a harder time editing it than they will a line in an ASCII file that says 'enableCheats=0' ;)

Share this post


Link to post
Share on other sites
Quote:
http://www.moddb.com/games/1/half-life


Yeah, I know Half-Life can be modded - I kinda meant changing the actual game.

Anyways, I'll probably just go the binary route. As for the artwork, do professional games encrypt their image files?

Share this post


Link to post
Share on other sites
Quote:
Original post by PiNtoS
Anyways, I'll probably just go the binary route.


What makes you think changing it to binary makes it any safer? There is only negligible difference between plain text and binary encoding - data is the same.

Also, binary data can be edited in plain-text editor, as long as it doesn't modify individual characters.

Quote:
As for the artwork, do professional games encrypt their image files?


No.

Some do, but they like to waste their time.

Share this post


Link to post
Share on other sites
Quote:
What makes you think changing it to binary makes it any safer? There is only negligible difference between plain text and binary encoding - data is the same.


I know; I don't mean for this to be a failsafe solution. I just don't want someone wandering into the data folder and idly changing values. If they want to work a little harder, well, then so be it.

Share this post


Link to post
Share on other sites
You could just go with some sort of encryption, and then write a text editor tool that will read in, decrypt, allow you to edit, then encrypt it again before dumping it to a file.

Personally I wouldn't even bother with any of this stuff, but that's me (I can get lazy).

Share this post


Link to post
Share on other sites
Quote:
Original post by NewBreedIf you do this, don't store the checksum in a text file. ;)
You can as well. For Joe Everybody, calculating a checksum that's stored in a not immediately obvious place is enough. Also, the "security by obscurity" technique works pretty well for him.

For someone with a little skill and time, this is of course no barrier, but neither are much more advanced techniques if your game is anything like interesting.

Users can always disassemble your code to figure out whatever clever thing you invented to protect your data. No matter how complicated your protection is, it can be figured out in no time, if people just want to.
Having executable and data on their disk, users can (and will) disassemble and debug your code, read or modify process memory, or use tools like GLIntercept to get to your content/data.

Worrying too much about this is wasting precious development time, because it will happen anyway, and there is not much you can do.

Share this post


Link to post
Share on other sites
Quote:
Original post by samoth
Worrying too much about this is wasting precious development time, because it will happen anyway, and there is not much you can do.

Certainly true.

Besides, for some people, modding a game is fun. Sometimes more fun than just playing it. It's one reason why games like Half-Life stayed popular for so long and it's also how Counter-Strike even came into existence.


So why don't you want your players to be able to fiddle with your game? :)

Share this post


Link to post
Share on other sites
You might use a virtual filesystem, like PhysFS for example.
Clicky
Makes it easy for you to manage files and pack them at the same time, and makes it harder for non-specialist users to mess with the files.
As said before, if people want to fiddle with game data, they will.

Share this post


Link to post
Share on other sites
Quote:
Original post by Fase
You might use a virtual filesystem, like PhysFS for example.
Clicky
Makes it easy for you to manage files and pack them at the same time, and makes it harder for non-specialist users to mess with the files.
As said before, if people want to fiddle with game data, they will.


Not really hard, unless you consider dropping a file onto winzip hard. :p

Share this post


Link to post
Share on other sites

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