4
\$\begingroup\$

(Sorry if this shouldn't be asked here, I'm unsure if it's appropriate based on what's allowed here.)

I'm not developing a game, but I'm very curious about this. I've played some large open-world games recently (Dishonored, for example), and it boggles my mind how much information must be stored for save files. If I pick up a bottle from where it spawned and throw it, then save while it's in mid-air, the save file needs to contain a) what type of bottle it is, b) where it is right now, c) what orientation it's currently in, and d) what its current trajectory is. This is the case for every non-fixed asset in the current level. Pathing NPCs have to have their current state tracked as well.

So, in general, how do games accomplish this? I'm sure the implementation varies, I'm not asking for any specific game, but the overall concept must be similar across games. Even more impressive to me is that quick saves often seem to be instant, with no delay whatsoever after pressing the key.

\$\endgroup\$

closed as too broad by Gnemlock, DMGregory, Engineer, Vaillancourt, Anko Jul 23 '17 at 14:19

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    \$\begingroup\$ Different games will address this in different ways. That's why this site is targeted toward developers asking questions about their own work - it's a lot easier to answer "here is the game I'm making, its goals, needs, and constraints. How can I implement feature X in a way that's right for my game?" that "How do games in general implement X-like features?" For general curiosity, you might find better results on a discussion forum like GameDev.net or the chat section here. \$\endgroup\$ – DMGregory Jul 15 '17 at 4:50
  • \$\begingroup\$ I too am interested in this. Unfortunately, I can't find anywhere on the Internets where this is discussed. \$\endgroup\$ – IanT8 Mar 19 '18 at 5:47
4
\$\begingroup\$

Your hunch is pretty much spot on. Games like skyrim will save the orientation, speed, and all other physics for each object. Some games will speed this process up by skipping over distant object and simply replacing them to their starting position.

Games appear to be quick about it because they use multi-threading. This means the game can be running while performing another task in the background. Most games are multi-threaded without you realizing it: the physics engine, the audio engine, the rendering engine, the input, finally the game logic itself. So when the player presses save, the game creates a task to run independently from the game logic to log all the game data. This is called an asynchronous behavior.

Games can get crafty with the storage of the data. For example again, Skyrim saves little details of all the objects far away. But notice that the game takes time to place those objects back and it might not be perfect every time. This is because the game needs to save space so all that data is compressed. You can think of compression as just an algorithm to remove duplicate lines of bits while keeping note where the duplicates are. When they are uncompressed (or inflated/extracted) the duplicates go right back where they belong. So games like Skyrim may compress the save data and extract the data while you are playing the game.

\$\endgroup\$
  • \$\begingroup\$ Perfect, this makes sense, exactly what I was looking for. Thank you so much! \$\endgroup\$ – vaindil Jul 16 '17 at 16:41

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