# How to stop users from manipulating Game Save Data

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

## Recommended Posts

I've been building a role playing game on PC using the Java language for 2 months.

I managed to implement a "save and load system" in 3 days.

The roadblock currently with development is "it is really easy to find the textfile from the game's folder and just start editing the numbers which can ruin the game exploration and balance."

The save file needs to be a textfile because Java has this file input and output object that knows how to handle textfile. I am not sure if it can handle any other file extensions.

What are my options to stop users from manipulating a game save data text file?

gameSaveData.txt

MapScreen: 0
Map Position: 0 0
Camera: 245 -215
Character's Level: 5
Character's Life: 50
Character's MaxLife: 50
Gold Amount: 29
NPC0: FINISHED
NPC1: FINISHED


##### Share on other sites

First thing, don't make it so readable Use meaningless labels, and no newlines so it's a pain to find the number you're after.

Second, do some sort of encryption on the numbers (could be as simple as differential encoding, so changing one number modifies everything after it).

For a single player game, there's no need to prevent save hacking... just deter it so the player doesn't feel like they're wasting time by playing the game when it would be so easy to type in a number. If anyone cares enough to make a save editor tool, let them have their fun.

##### Share on other sites

So long as your game is offline, players cheating hurt others in no way. If a user wants to enjoy your game by cheating, let 'em. Your job as a game developer is to give them a product they enjoy, not to force them to enjoy it the way you want them to.

If you want to make them work for it, you can encode your file. Simply moving to a binary format instead of text at least stops the casual cheaters for the first few days if you're lucky. If you're unlucky then it takes them months or years because your game is unpopular and nobody is really trying.

I assume your game is offline as storing save game information on players' local disks in an online game is pure madness.

Although I agree you should let people play a game a way they want to, I don't even remotely agree that people should basically be encouraged to cheat by leaving things open to generic editing. Even making saves binary adds quite a bit of protection because the amount of effort and knowledge required to change the saves then goes up significantly.

I'm actually not sure where this apparent encouragement online about cheating in games came from, for some reason people seem to think cheating is only a thing when it affects other people. If anything you should be encouraging people to not cheat unless they're doing something like messing around after they beat the game, which is something that should not require screwing with the save file anyway.

First thing, don't make it so readable Use meaningless labels, and no newlines so it's a pain to find the number you're after.

Second, do some sort of encryption on the numbers (could be as simple as differential encoding, so changing one number modifies everything after it).

For a single player game, there's no need to prevent save hacking... just deter it so the player doesn't feel like they're wasting time by playing the game when it would be so easy to type in a number. If anyone cares enough to make a save editor tool, let them have their fun.

Actually.. yeah, pretty much this. Although quite frankly you shouldn't need to obfuscate it really, in most cases just saving files in binary is enough of a deterrent to people. I'd only worry if its a five second change to make you invincible in your game or something, then its a little TOO open.

##### Share on other sites

So long as your game is offline, players cheating hurt others in no way. If a user wants to enjoy your game by cheating, let 'em. Your job as a game developer is to give them a product they enjoy, not to force them to enjoy it the way you want them to.

You got a point there.

##### Share on other sites

So long as your game is offline, players cheating hurt others in no way. If a user wants to enjoy your game by cheating, let 'em. Your job as a game developer is to give them a product they enjoy, not to force them to enjoy it the way you want them to.

[...]

Although I agree you should let people play a game a way they want to, I don't even remotely agree that people should basically be encouraged to cheat by leaving things open to generic editing. Even making saves binary adds quite a bit of protection because the amount of effort and knowledge required to change the saves then goes up significantly.

I'm actually not sure where this apparent encouragement online about cheating in games came from, for some reason people seem to think cheating is only a thing when it affects other people. If anything you should be encouraging people to not cheat unless they're doing something like messing around after they beat the game, which is something that should not require screwing with the save file anyway.

For me, its two main points.  The first is that if someone goes to the trouble of trying to modify a save file, it's probably because of a failure of the game.  It's either too hard for them, too boring, or maybe the save points are too far away and some progress was lost due to a game crash or whatever.  And for a singleplayer game, who are they hurting by this 'cheat'?

The second main point is development time misspent.  Now, yeah, swapping to binary for a save file isn't exactly a huge cost (and that is fine move imho), but I've seen time and again people delving into encryption algorithms and various obfuscation techniques and obsessing over something that the majority of players aren't even going to bother doing, and those that do --  well, see the first point.

And as an aside, if all your files are text, there is a nice side benefit of your game being easily moddable.  Sure someone might mod your game to make all the bad guys have 1 hit point, but someone else might add new enemies, swap art, or create a super hard mode.

##### Share on other sites

And for a singleplayer game, who are they hurting by this 'cheat'?

And here is a prime example of why I don't like people that spread nonsense like that, it isn't "cheating" its cheating. It is changing the game save file to manipulate your progress, it is bypassing the coded rules of the game, and to me its like some crappy debate or something. There's no morals or "oh its opinion" it is cheating.

In fact that's the part that gets me is 90% of the time the people that do exactly that will almost religiously defend the idea that they aren't cheating, because they don't want to feel like they're doing something wrong or whatever. I mean if you want to cheat, sure, cheat, admit it, but cheat.

But there is no moral debate here, editing a games files to change your progress is cheating, simple as that. I also find it silly that people objectify the idea that unless someone else is affected by your cheating that you shouldn't strive to avoid it. Reality check: you shouldn't encourage people to cheat in games, the entire point of games is to overcome the challenge presented by the developer.

This is not a "does a tree make a sound" debate, if you cheat at solitaire it is still cheating, if you cheat at minesweeper it is still cheating, someone does not have to observe you cheating in order for you to be cheating.

The second main point is development time misspent.  Now, yeah, swapping to binary for a save file isn't exactly a huge cost (and that is fine move imho), but I've seen time and again people delving into encryption algorithms and various obfuscation techniques and obsessing over something that the majority of players aren't even going to bother doing, and those that do --  well, see the first point.

I can't really take this as much of a point because honestly even in a scenario of someone going stupidly overboard like encrypting save files and something it would still be a very minimalistic time investment. If someone wants to whine about this taking so long to implement I'd probably ask them why they're spending a month installing crappy DRM into their game then too, along with a dozen other bad ideas they're probably using.

And as an aside, if all your files are text, there is a nice side benefit of your game being easily moddable.  Sure someone might mod your game to make all the bad guys have 1 hit point, but someone else might add new enemies, swap art, or create a super hard mode.

Yeah lets encourage horrible modding practices like Minecraft while we're at it. If modding your game is a thing it should be designed as a thing, not, "hey lets leave protections off so everyone can hack the hell out of my game by changing files." Lets not even begin to mention how silly distributing such a mod would be. "Oh here, just.. overwrite all your saves with this.. or all your config files." Edited by Satharis

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 14
• 30
• 9
• 16
• 22