• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
BahDragon

Game Save Data

15 posts in this topic

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?
0

Share this post


Link to post
Share on other sites
you could make the file so confusing that no one knows how the data is acutally saved [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
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
0

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 :)
1

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.
1

Share this post


Link to post
Share on other sites
[quote name='FLeBlanc' timestamp='1330723629' post='4918710']
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.
[/quote]

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.
0

Share this post


Link to post
Share on other sites
[quote name='FLeBlanc' timestamp='1330723629' post='4918710']
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.
[/quote]

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.

[quote]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.
0

Share this post


Link to post
Share on other sites
[quote name='BahDragon' timestamp='1330711261' post='4918653']
...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.
[/quote]

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.
0

Share this post


Link to post
Share on other sites
[quote name='slayemin' timestamp='1330908299' post='4919310']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.[/quote]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!)
0

Share this post


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

Share this post


Link to post
[quote name='Dawoodoz' timestamp='1330963198' post='4919480']
Using strong encryption keys in your game would make it illegal in USA and Russia.
[/quote]
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.
0

Share this post


Link to post
Share on other sites
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:
[CODE]
1
8
4
1
[/CODE]


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).

[url="http://courses.cs.vt.edu/~cs2604/fall02/binio.html"]http://courses.cs.vt.edu/~cs2604/fall02/binio.html[/url]

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.
0

Share this post


Link to post
Share on other sites
[quote name='Chris_F' timestamp='1330909906' post='4919314']
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.
[/quote]

this

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

Share this post


Link to post
Share on other sites
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.
0

Share this post


Link to post
Share on other sites
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?
0

Share this post


Link to post
Share on other sites
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 [i]not [/i]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.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0