Jump to content

  • Log In with Google      Sign In   
  • Create Account


Best approach to loading and saving game data?


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
4 replies to this topic

#1 Key   Members   -  Reputation: 112

Like
0Likes
Like

Posted 05 April 2012 - 12:40 PM

I've been doing some research on ways to read and write data but don't know which is the best way to go about it.

As for the writing data how do I go about saving? I went and looked through other game's save files. Why are some not in plain text? I assume they're encrypted or need to be opened with an appropriate editor.

For loading from a file, I could create some values in a text file and have it read to the game but what if I wanted to add descriptions or commentary to the file so I know what values are which and not have it read by the game? I thought about using Regular Expressions to cut out the stuff I don't need when the game is reading but is that doing more than I really need to? I'm just throwing ideas around and hoping to get some feedback.

Sponsor:

#2 alnite   Crossbones+   -  Reputation: 2061

Like
1Likes
Like

Posted 05 April 2012 - 01:35 PM

I've been doing some research on ways to read and write data but don't know which is the best way to go about it.


It depends on the game and what you want to save. There's no one universal saved game format.

As for the writing data how do I go about saving? I went and looked through other game's save files. Why are some not in plain text? I assume they're encrypted or need to be opened with an appropriate editor.


Reasons why games are not in saved in plain text to prevent cheating, and save bytes (binary format generally takes up less space in disks than text). If saved games are human-readable, then it makes it very easy for anyone to modify it. You can, for example, change your character stats all to 100 if you present them right there in plain text format. You can still do it even in binary, but at least it'd deter enough people.

For loading from a file, I could create some values in a text file and have it read to the game but what if I wanted to add descriptions or commentary to the file so I know what values are which and not have it read by the game? I thought about using Regular Expressions to cut out the stuff I don't need when the game is reading but is that doing more than I really need to? I'm just throwing ideas around and hoping to get some feedback.


Ideally, you want to be able to save in both text format and binary format. During development, you save it in text-based format (your own, XML, JSON, whatever), and you can put all the comments you want. When you are ready to release, you switch it to binary, removing all the unnecessary comments.

#3 Key   Members   -  Reputation: 112

Like
0Likes
Like

Posted 05 April 2012 - 03:47 PM

Reasons why games are not in saved in plain text to prevent cheating, and save bytes (binary format generally takes up less space in disks than text). If saved games are human-readable, then it makes it very easy for anyone to modify it. You can, for example, change your character stats all to 100 if you present them right there in plain text format. You can still do it even in binary, but at least it'd deter enough people.


I looked into saving data into binary format but I'm not very familiar with it. Is there any way to convert values into binary format through an online application? I get things like ô SOH NUL NUL

#4 laztrezort   Members   -  Reputation: 955

Like
1Likes
Like

Posted 05 April 2012 - 04:08 PM

I looked into saving data into binary format but I'm not very familiar with it. Is there any way to convert values into binary format through an online application? I get things like ô SOH NUL NUL


Typically whatever language/framework you are programming in will have some sort of binary input/output library or routines available that interface with the operating system, and provide a way to directly read or write binary data to an from a disk file. The specifics of how this is accomplished varies widely, however. What exactly are you trying to do?

#5 Maxine   Members   -  Reputation: 122

Like
0Likes
Like

Posted 06 April 2012 - 07:19 AM

You might wanna check the settings files. Those let you store variables that can be saved/loaded. When you save them they are saved even when your application is shut down.




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