Jump to content
  • Advertisement
Sign in to follow this  
rogster001

Protect Resources from users

This topic is 2880 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 all,

Anybody have good advice on the following?

If my app uses text files to implement save and load functions, how can they be protected or hidden or whatever, basically so the user cannot just go into the folder containg them and edit them, thus ruining their app, the same goes for image files used for example. How is this done usually? I understand that image files can be built into the binary as resources, but for data that needs writing to that can't be the option.

cheers

Share this post


Link to post
Share on other sites
Advertisement
Put the files into a zip file or other archive format. Call it a day.
If someone really wants to, they are going to read the files. Its happened to most games out there. The best you can do is hide all that stuff from the casual user who doesn't want to bother figuring out how to mod/edit it.

Check out physfs

Share this post


Link to post
Share on other sites
You could also read and write your save files in binary format. I don't have a lot of experience with doing this, but shouldn't be too hard to do.

Share this post


Link to post
Share on other sites
You could add some kind of checksum.
For example if you are saving the city the player is in and the gold.
take all of the city name characters integer values and add them to gold. and add this to the end of the file. There is unlimited algorithms to do that though, it was just an example.

I am pretty sure nobody figures out how you did the checksum, if you do it right

Share this post


Link to post
Share on other sites
If you're doing this with the express purpose of trying to prevent users from modifying files on their system, you're probably wasting time. Simply choose an easy option, like shoving everything into a .zip file or a simple manually-written file format and be done with it.

There's nothing you can do to prevent users from getting at data that you store or display on their machine. "Protecting" yourself against this is silly and usually just annoys users.

Share this post


Link to post
Share on other sites
I second PhysFS as an elegant solution but I have also had luck with using SQLite3 db files and storing resources as blobs. I don't even use config files anymore since I started using SQLite. There are lots of tools available to view/manage the db files outside of your game as well which makes a quick edit here and there super simple.

While SQLite has it's differences and limitations compared to MS SQL server or MySQL you will probably be surprised as how well suited it is for games***.


*** It is very well suited for the client side of games. For anything that requires concurrency among multiple db connections then a traditional RDBMS is better suited.

Share this post


Link to post
Share on other sites
Quote:
Original post by rogster001
If my app uses text files to implement save and load functions, how can they be protected or hidden or whatever, basically so the user cannot just go into the folder containg them and edit them, thus ruining their app, the same goes for image files used for example.

I would argue that, by the time a user actually wants to modify his savegame files, he is either annoyed by the game or simply bored with it. A better solution would thus be to improve the gameplay.

After all, if a player cheats, that's his problem. And even that is still better than a player just quitting your game - at least he's still showing some interest. I know I've had some fun modifying games in the past - sometimes more fun than playing them the way they were supposed to be played. ;)


Either way, just go for something simple and easy during development. A text-based format is easier to debug than a binary one. With some anticipation, you can always swap it for a different format later on, or throw some compression on top of it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!