How do people design the save game feature in large/complex games?

1.18K views

The save game feature seems simple but it’s mind-blowing how it can return the exact state of a game with all elements/events organised in the correct order. Can anyone explain how it works?

In: 668

39 Answers

Anonymous 0 Comments

Let’s say you have game of tic tac toe and you want to save the board state in a file. The board is 3×3 large and let’s say zero equals x, one equals o, two equals empty.

You could save the board by going from left to right, top to bottom row:

220202022 then represents this board:

“`
X
X
X
“`

OK you just made a file format for tic tac toe. Other games do the same but just include more data. Let’s say you defined a specific order of saving for example

1. The version of the save format
1. Dialog options you took
2. Items and their position in the inventory
3. Amount of gold you have
4. Your username
5. Your x, y and z coordinates
5. etc.

Now you just go like before from left to right and save each thing with a value et voilà you persisted state.

Write a loading screen that reads said file in the exact same order and you have your state back.

You are viewing 1 out of 39 answers, click here to view all answers.