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

1.11K 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

Not sure about others but here’s how I do it.

Make everything you need to save into an easy to record number. For example: You need to save where a player is physically in your game but you have a bunch of areas so one number for their position isn’t gonna cut it. Break it down and save what area the player is in by assigning each area in your game an ID (Forest = 0, Cave = 1, Ocean = 2, etc.). Then you just have to save their position within that area. So you end up saving two values for where the player is in the game physically.

As for items/inventory; assign IDs to every item a player could possibly have in their inventory. Then you’re just saving that number and when the game re-loads the inventory it knows what numbers to load as what items.

As for story progress, that’s just a checklist of story flags. Each time a player has hit a key part of the story check it off the list. So when you load that player’s save, you just check what they’ve reached and what they haven’t reached to determine where to put them in the story.

Again, this is just how I do it, not saying it’s the only way to do it.

Hope this was insightful!

Anonymous 0 Comments

I make games.

One part of the games is the data, such as say an inventory. This data is organized as classes. Each class that needs to be saved or loaded has appropriate methods. This adds up real quick.

The easiest and fastest way to do this is to to just save the raw data, the zeros and ones if you will. Internally the data can be things like a string, or integer. So you just save all the strings and int, and load them in the correct order. But the smallest upgrade to your game, and your save files no longer work.

Another common method is key value pairs. Here you save two things together. As in “age = 24”. This provides a little more flexibility compared to the above method. Your save file won’t break when more things are added, but there is a lot of overhead.

Then there is the need to link things together. Imagine the sims where a sim can be friends with another sim. You would only save an identifier, like the sims full name. Then when you load, you need to link it back together by finding the sim with that name. Linking is usually done after loading all the other data, otherwise you may try to link to something which hasn’t been loaded yet.

I’m glad you understand how much work goes into something as trivial as saving and loading.

Anonymous 0 Comments

Since we’re here, what about games like minecarft and ark where you have an open world you build random things in?

Anonymous 0 Comments

In the simplest term, it’s a bookmark. A small slip of paper is less complex than the entire book with a lot of drama, politics, romance etc. Although, some games can screw up the save file because they usually scribble a lot of rubbish on that bookmark.

Anonymous 0 Comments

The information to save the position / states of all the elements is akin to a list of words and numbers and takes little to no space up at all.

Every time anything in the game moves or does anything its position is tracked, when you hit save game all those states are collected and when you hit load all those states are pulled out of a table or something.

Anonymous 0 Comments

So really the amount of information that *needs* storage space can vary depending on the complexity of the game, network state requirements, anti-cheating measures, and whatnot.

Let’s take a game like the Witcher III. The only real things you’d need to truly save are quest journal data, inventory/stash, x/y coordinates and the area you logged out on, and profile/build data like level, acquired currency, skill point allocation. There’s creative ways to compress all this information also to minimize the amount of space saved, but lets just say for the most simplistic approach, with no anti-cheat concerns it just gets saved in a big JSON object. Realistically speaking that object wouldn’t even need to be that large, and serializing it to a file wouldn’t take a whole lot of disk space at all

Basically let’s just say we have sections for all of the above categories and just save it as plain text, or a catalogue of lists simply stating the IDs of items/quests you have or have completed, and the location data which is literally just x/y and zone. Write all of that information down in a notepad file in an easy to read format even if it’s not syntax correct, for an English speaker and then save it. That’s the maximum amount of disk space a save file really needs to take up, uncompressed.

Hint: it won’t be that large

Anonymous 0 Comments

I actually started my own small indie game studio and we had to figure out saving. You would be surprised about how little data gets saved in a game. Take a role playing game. You need to save the level, the stats, where you are, and what quests you finished, and what items you have collected

Anonymous 0 Comments

I once made [an RTS](https://store.steampowered.com/app/888040/Metal_Fatigue/) in which I just wrote all of the program’s memory to a file. You could be mid-mission, with hundreds of units on the field and missiles in flight. It worked so well that when it loaded a saved game it thought it was saving it. I had to exempt a single value so the game could tell the difference.

Anonymous 0 Comments

Game design is not an obscure and unreadable mess, programmers and developers now exactly where everything is…. Not by heart but it is easy to lookup with the development tools they use

No matter how large or complex a game “seems” at the core those are just variables, your look, your inventory, location, the status of the world, quest log etc etc etc…. Variables that can be saved and loaded rather easily.

Granted the whole development process needs to be augmented with the notion that there is going to be a save system in a game, but that is decided at the planning phase before a characther is written in the program code