Game Save Data

Started by
14 comments, last by samoth 12 years, 1 month ago
thanks for all the help. Good info here.
Advertisement

Using strong encryption keys in your game would make it illegal in USA and Russia.

I don't know about Russia, but it's not illegal in the US. The supreme court ruled that encrypted data falls under the protections of free speech. And you certainly won't get in trouble if you're encrypting data which isn't related to criminal activity.

However, there ARE export regulations on strong encryption software to designated countries. Though, I think it's kind of pointless since the strong encryption algorthims are publicly available.
Maybe you already know about Binary IO, but let's assume you don't.

If you save data in text format, it will be easy for people to edit the save game. When saving in text format, your numeric variable's values will be saved as the number represented in ASCII character. As you probably know, there are 256 ASCII characters. These characters take exactly one byte when you save them in a text file.

The text file will look like something like this:

1
8
4
1



If instead you save your data in binary format, your numbers will be saved as the byte's number itself (from 0 to 255). If you want to save larger number than 255, you will need more than one byte (each byte is 8 bits). When saving in binary format, you normally often don't need to play with such details manually. Your file will look like a bunch of random characters, and those willing to hack it should deserve to be successful (in my opinion).

http://courses.cs.vt.edu/~cs2604/fall02/binio.html

If you really want to make it harder to hack (it's always possible to hack an encryption method when it can be decrypted by your program), you must use encryption methods. You can create your own encryption method using some mathematical operation on number, or you can use existing ones.
[quote]Firemen get paid even if there's no fire, and that's a good thing -me[/quote]

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.


this

seriously, your development time is much better spent on gameplay than trying to avoid this kind of cheating.

Stefano Casillo
TWITTER: [twitter]KunosStefano[/twitter]
AssettoCorsa - netKar PRO - Kunos Simulazioni

Just make binary files it should be enough for single player games...
If u want to troll those hackers, place some fake save files (with random content and binary ofc) in your dir and hide the real one elswhere with an unrelated name.
I agree on just writing binary data. Write only the values to the file, then read it in a specific sequence to identify what those values mean. Or create a file structure that fits your needs (and make it simple, if it's possible), but you probably don't need to put the labels in the file.

As people have said before, if you are going to encrypt the file, how would you secure the key (it must be somewhere your code can read it, so other can find it too)? Is it worth the time and resources you'll need?
Just to add onto the encryption idea;
http://www.cryptopp.com/
Guys, rot-13 encryption or simple xor with a short string wrapping around is really just as good as AES.

Both the key and the decryption algorithm must be part of the program, otherwise the game will not be able to read its own save files. Therefore, AES is none better than the simplest encryption algorithm. It adds absolutely zero extra security, no matter how advanced an algorithm and how long a key you use.

On the other hand, even a simple wrap-around xor encryption will make the data look "sufficiently random" so you are unable to make out a pattern with a hex editor or figure out what's what using a pen, paper, and a pocket calculator. And that's just how far 99% of the people will go, and it's just as good as you can get.

As a sidenote, the Enigma was not cracked with "rudimentary computer power", but failed by sheer arrogance. The Enigma (even the early model) was far ahead of its time and far beyond anything anyone could possibly have "cracked" until at least 30 years later.
It's well-documented by contemporary witnesses that the truth was much closer to what's pictured in a 1963 James Bond movie (a.k.a. some guy carrying "the magic super typewriter in a black suitcase" over the border at night with everyone else on his heels), except in this case "Bond" was a Polish factory worker near Warshaw stealing specimens of the rotators and the configuration info. It is also well-documented that code tables had occasionally been stolen and later repeatedly been captured on board of captured ships. Though tables were written in water-soluble ink and there was strict order on how tables and rotors had to be destroyed and the boat be sunk afterwards to avert capture, there exist many records of survivers that describe that this was often not done.
For propaganda reasons, and out of a sense of superiority that one can hardly understand nowadays the obvious facts were ignored. A few modifications were made over time, but these were little effective, again for obvious reason.

This topic is closed to new replies.

Advertisement