Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am currently working on a terminal text game just to practice my skills (C). It will be story driven escape the mansion kind of game. Even though the game will be short I want it to support save files.

Since I am new to game programming I am not sure how should I handle save files. The game will be short yet players will be able to find a lot of objects. I was thinking about saving a structure into a .txt file OR saving lots of 1 and 0 into txt file. Where each line represents each item or progress.

Is there a better way or common way how to do it?

share|improve this question
If I understand it right, you want to save just binary information - object was found X object wasn't found? – zacharmarz Dec 23 '11 at 12:06
Did you use the LibGDX engine? It has the object called "Preferences" that allows you to save and load game? If not, what kind of game engine did you used for making game apps? – David Dimalanta Jan 29 '13 at 4:50

Saves do not usually need readability, so it's good to save them binary format. If object interactive, you should save all non-calculated fields to file, as I suppose you have multiple locations. So there will be saves for each location and hero saves (inventory, active tasks). There are many related questions. related topic

share|improve this answer
That depends on the IDE and a game engine implemented onto the IDE when you're programming a game. – David Dimalanta Jan 29 '13 at 4:51

From my small experience, one of the best ways of saving a game is using XML. You can see what is happening, you can change the save files, you can even prepare then to be used for map editors. Finally, in the end, you could always put then in the binary form.

share|improve this answer
Wouldn't you have to include an external xml library to generate / parse? Also, people could manually alter the variables? – SSH This Jul 25 '12 at 21:07
A open source, with commercial license in can be found. A binary can avoid people change if you don't want to. – J. C. Leitão Jul 25 '12 at 21:36
fprintf( fd, "format",  ...); /*save*/
fscanf( fd, "format", ...); /*load*/

Where ... represents variables and "format" describes how they are formatted.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.