Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Save's file  (Read 5245 times)

0 Members and 1 Guest are viewing this topic.

darekg11

  • Full Member
  • ***
  • Posts: 127
    • View Profile
Save's file
« on: November 29, 2010, 09:47:36 pm »
Helo users, I wonder hwo You secure Your save file from editting it by users?
Do You just encrypt it and then durining load decrypt it?
Do You basically store crypted save file in directory and then decrypt it durning game and when qutting just delete old save file, save new values to plain file and then crypting it? If so which algorithm do You use?


Thanks in advance.

Spodi

  • Full Member
  • ***
  • Posts: 150
    • View Profile
    • http://www.netgore.com/
Save's file
« Reply #1 on: November 30, 2010, 12:46:18 am »
That is pretty much the approach people will take when encrypting their game files. Most people don't really bother with encrypting it much. Even a lot of commercial games leave their save files unencrypted - some while even using a human-readable format such as XML. But plenty of games use their own format (usually just binary file I/O since it is fast and often easy to serialize) so it looks encrypted, when in reality its just in a format that makes no sense to you.

Any algorithm would do. I'd personally go for something very fast with no inflation if I were to ever do this. Though if I wanted to obfuscate the save files, I'd prefer to just compress it with a fast, light-weight compression algorithm. That way you get some other benefit instead of just obfuscating the data.

It really isn't worth putting much time or effort into it, and definitely not worth using something that will have a noticeable impact on performance. If people care enough, they will just reverse-engineer the decryption code from your program's binary. Or, even easier, just use a memory editor.

I personally find encrypted save files more annoying than anything. At least when its unencrypted and in a format you can understand (like XML), you can repair your own faulty save files (like if your character gets stuck in a wall).

finaiized

  • Newbie
  • *
  • Posts: 4
    • View Profile
Save's file
« Reply #2 on: November 30, 2010, 06:12:20 am »
It depends if the game is single player or multi-player. If it is single player, it doesn't really matter if you encrypt it or not - it's their lost if they don't play it through and they could easily hack it anyways. However, if it's multi-player, the scene is a little different - you should at least make a conscious effort to encrypt it. Simply encrypt it to a file, then decrypt it on load as you have mentioned. Any algorithm works here. For example, you could use a symmetric-key algorithm like AES.

Alternatively, a simpler but less secure method that you could employ in single player as well is to simply store your save data as a plain file, hash it, and store the hash in the registry. Then when you load the save data, simply check if the two hashes match - if so, they save data has not been modified. Remember that it is still very easy to discover the hash and change it accordingly. Ultimately, you should not waste too much time trying to protect your save data. As long as you keep out the majority of the non-techy users out, then you are fine. The rest will hack the data no matter what you throw at it.

darekg11

  • Full Member
  • ***
  • Posts: 127
    • View Profile
Save's file
« Reply #3 on: November 30, 2010, 08:14:31 am »
Hmm, do You guys know any compression algorithm which is compatible with Winrar 2.x and can setup password for archive?

 

anything