Jump to content
  • Advertisement
Sign in to follow this  
BahDragon

Game Save Data

This topic is 2467 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

How do I save game data at like a save point? I know how to use input and output files with c++ but the problem with that is a player of the game can easily go into the file and edit the numbers to change the character and where he is in the game. I don't want to allow someone to edit the save data that easily. Any ideas?

Share this post


Link to post
Share on other sites
Advertisement
Guest m41q
you could make the file so confusing that no one knows how the data is acutally saved smile.png
or maybe encrypt it in some simple way (i don´t assume client try to crack the file that hard)

if thats not your thing you could search the web for the methods that are used be companies or just take a look in some savefiles yourself

Share this post


Link to post
Share on other sites
I like the idea of encryption :)

You could use the Ceasar Cypher: When you're encrypting a bit, add a fixed value to it before writing it to file. If your addition value is +2, then A => C. It's super simple to implement and its also pretty simple to thwart. You could make it slightly more complicated by using a pseudo random number generator to generate your fixed values. The key is that the sequence of random numbers needs to be the same every time. So, if you generate a random value between 1->26, and then add that value to your byte, you'd get something like:
Unencrpted string: {AAAA}
Random Numbers: {13, 21, 4, 16}
Encrypted String: {A+13 => N, A+21 => U, A+4=>D, A+16=>Q}

So, if someone knows that their health is 16 and they open up your file to look for that value, they won't find it :) But, if they are really determined and reverse engineer your code to figure out what encryption algorithm you're using and the random number seed you're using as a key, then they can easily decrypt and encrypt your saved data file. I'd probably not concern myself with the 0.01% of the population who might do that.
If you want to use a nuke to hammer a fly, you could look into using AES 256 bit encryption. Nobody will crack that without extreme effort and hardware. It's military grade :)

Share this post


Link to post
Share on other sites
The people that care to hack your save game data are going to hack your save game data, regardless of any encryption or obfuscation. Everyone else doesn't give a shit. You might as well reduce your development time by not going out of your way to complicate things overmuch.

Share this post


Link to post
Share on other sites

The people that care to hack your save game data are going to hack your save game data, regardless of any encryption or obfuscation. Everyone else doesn't give a shit. You might as well reduce your development time by not going out of your way to complicate things overmuch.


I agree with the above. people will hack the save data if they want to. however, if you really want to encrypt the save data, I would suggest developing an enigma-based encryption algorithm.

Share this post


Link to post
Share on other sites

The people that care to hack your save game data are going to hack your save game data, regardless of any encryption or obfuscation. Everyone else doesn't give a shit. You might as well reduce your development time by not going out of your way to complicate things overmuch.


I think the cryptographic community would strongly disagree with you. A file encrypted with AES256 would take longer than the age of the universe to break via brute force. It's certified by NIST to process up to top secret data, so save game files would probably be pretty safe. I'm betting that there's code floating around somewhere out there which implements AES, so adding it would be relatively trivial.

I agree with the above. people will hack the save data if they want to. however, if you really want to encrypt the save data, I would suggest developing an enigma-based encryption algorithm.[/quote]
Enigma ciphers? Uhm, no. If the allies were able to break that during WW2 with rudimentary computing power, it doesn't speak well towards the security of the cipher. I strongly suggest using AES since it meets modern security standards.

If you use AES, your game data won't be hacked by someone decrypting it. They'll have to modify the game data while its sitting in memory.

Share this post


Link to post
Share on other sites

...but the problem with that is a player of the game can easily go into the file and edit the numbers to change the character and where he is in the game.


What exactly makes you say that?

Unless you are storing variables in a human readable, XML or INI like format (and you really shouldn't be), then it shouldn't be "easy" at all.

I think the notion that you should encrypt the game saves is just plain silly. Encryption should be used for bank account transactions and nuclear launch codes. What difference does it make if somebody out their decides they want to cheat at a single player game? Is the safety of the free world at stake?

Simply storing your data in a binary format that can quickly be loaded into memory and used without any type of conversion or parsing is going to be good for performance and will already be difficult to figure out when it comes to cheating.

Share this post


Link to post
Share on other sites
I think the cryptographic community would strongly disagree with you. A file encrypted with AES256 would take longer than the age of the universe to break via brute force. It's certified by NIST to process up to top secret data, so save game files would probably be pretty safe. I'm betting that there's code floating around somewhere out there which implements AES, so adding it would be relatively trivial.
But if it's encrypted, how is the game supposed to be able to load its own save game files? If it uses the encryption key to decrypt it, then someone will be able to hack that from the executable. Whilst this will be harder than simply reading it from plain text, this is still a case of obfuscation, and therefore could be broken more directly.

I do agree though that if one did want to do something like this, one might want to look at modern methods, rather than messing around with things like Caesar ciphers. Is there a known good solution for this problem? I guess this is similar to issues of DRM (though IIRC in some cases DRM systems have the advantage of hardware support).

Though I agree with others that (for single player at least) it's not worth worrying about. Perhaps save as binary just so it isn't totally trivial, but if someone wants to spend time hacking it, who cares? (And if someone releases a game-save-editor as sometimes happens, then they're creating extra awareness and advertising for your game!)

Share this post


Link to post
Share on other sites
Hidden
Using strong encryption keys in your game would make it illegal in USA and Russia.

Share this post


Link to post
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!