Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


How should I begin my venture into the Game Save world?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 Tuxmascot   Members   -  Reputation: 102

Like
0Likes
Like

Posted 15 November 2012 - 03:55 PM

I am writing a text-based RPG game using some OOP and polymorphism. I wanted to add a game save function to it, but I am at a dead end as to how to do this. I don't want to use a basic 'ofstream' function, but I want to make sure the player can't edit the save file. So I was thinking about serialization or something. It also needs to be efficient for performance. I am just intimidated by all the options and I don't know what to pick or use.

Any way to do this?

Thanks!

Sponsor:

#2 Bregma   Crossbones+   -  Reputation: 5505

Like
4Likes
Like

Posted 15 November 2012 - 04:19 PM

I want to make sure the player can't edit the save file.

The only way you could possibly stop someone from modifying theor own data on their own computer is to save the game to a remote server, and even then you'd need a secure connection. Are you sure it's worth the hassle, given they could still crack your program to bypass that?

Just write your data using the standard formatting streams. You can check and edit the save game files manually that way, if only for verification, and you can let people do what they want with their own data.
Stephen M. Webb
Professional Free Software Developer

#3 Tuxmascot   Members   -  Reputation: 102

Like
0Likes
Like

Posted 15 November 2012 - 05:34 PM

Just write your data using the standard formatting streams. You can check and edit the save game files manually that way, if only for verification, and you can let people do what they want with their own data.


Yes, how would I do that? That is what I am looking for. I want to add serialization in it though.

Edited by Tuxmascot, 15 November 2012 - 05:34 PM.


#4 frob   Moderators   -  Reputation: 22849

Like
0Likes
Like

Posted 15 November 2012 - 05:46 PM

Are you asking, "How do I use file streams" ?
Or are you asking "How do I protect my data" ?

The two are very different questions. The second one assumes a knowledge of the first.

Check out my book, Game Development with Unity, aimed at beginners who want to build fun games fast.

Also check out my personal website at bryanwagstaff.com, where I write about assorted stuff.


#5 FlyingDutchman   Members   -  Reputation: 207

Like
0Likes
Like

Posted 16 November 2012 - 01:42 AM

just use a sha512 with salt and push your regular stream through it. the results you write on disk. the salt should be hardcoded somewhere.

when somehow then wants to "crack" your program, he would need to get the salt out of the binary.

Edited by FlyingDutchman, 16 November 2012 - 01:42 AM.

I open sourced my C++/iOS OpenGL 2D RPG engine :-)


See my blog: (Tutorials and GameDev)

http://howtomakeitin....wordpress.com/


#6 kuramayoko10   Members   -  Reputation: 386

Like
0Likes
Like

Posted 16 November 2012 - 06:47 AM

Simple thing to do so that you don't worry much:
Write to your save file as binary, so that the user won't be able to read it directly.

Now, if you want to hide it, you can try saving the file in a user's hidden folder:
1) In Windows you have %AppData%\Local ;
2) In Linux you have the user's home and you can create a hidden folder.
3) In a more crossplatform manner, you can use Boost Filesystem library

The references above are all in c++ to give you an idea. I don't know what language you are using, but I am sure other languages will have some libraries ready to deal with the filesystem.

Edited by kuramayoko10, 16 November 2012 - 06:50 AM.

Programming is an art. Game programming is a masterpiece!

#7 Bregma   Crossbones+   -  Reputation: 5505

Like
1Likes
Like

Posted 16 November 2012 - 09:01 AM


Just write your data using the standard formatting streams. You can check and edit the save game files manually that way, if only for verification, and you can let people do what they want with their own data.

Yes, how would I do that? That is what I am looking for. I want to add serialization in it though.

I suggest you write a pair of functions std::ostream& operator<<(std::ostream&, const Game&) and std::istream& operator>>(std::istream&, Game&) where Game is you game state you want to save. Make them friends of your Game class. Do this recursively with the members of the Game class. Write unit tests to make sure (a) the output is what you expect and (2) the istream can read what the ostream writes.
Stephen M. Webb
Professional Free Software Developer




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS