How are game states/saves shared as a string?

545 views

I know enough to get myself in trouble here and butchering terminology but how do games condense their save file into a sharable string or text file?

For a few of my idle games and what not you can either get a download of your current save state via a x-length alphanumeric string or a slightly bigger text file/hash. Also works for custom levels.

In: Technology

3 Answers

Anonymous 0 Comments

Any data can be converted into a string of text.

First you have the data which is just a collection of 1s and 0s, the bits, in complex patterns that then get interpreted by the computer to get your saved state.

These bits can also be interpreted as text. One of the easiest forms is to just translate them into ASCII, where each symbol comes from eight bits or one byte.

It is basically translating a long number into a shorter one, with more complex symbols.

Anonymous 0 Comments

Save files are ultimately just a collection of appropriate variables. When I save in say Fallout: New Vegas, all it is doing is writing what’s in my inventory, where I’m at, what time of day it is, what missions I have active and where I’m at with them, who I’ve talked to and what dialogue I’ve had with them, and some basic stats.

Now that seems like a lot and for an RPG game like FNV it *is* a lot, but not every game has an insane amount of variables to track. But even with a game like this you don’t write “9mm pistol, condition 76, ammo loaded 8, no modifications.” We would write something like all that out in long form on pen and paper for a tabletop game because we have to know what those numbers mean, but in the code for a videogame it might get all that info from just writing down 00507600800, where 005 is the identifier for what kind of gun, 076 is condition, 008 is ammo loaded and 00 means you haven’t put any mods on it.

Now for a much simpler game than an RPG, like I said, there’s much less data to try and track. And just using the numbers 0-9 and letters A-F (hexadecimal), I can tell you up to 16 bits (a 0 or 1, two bytes of info) with a single letter. If my code for you is 32 characters long, that’s 512 bits of info already! And if the inventory system is more simplified like having just a few key items or not, I can designate a section of those bits to represent the inventory. If it’s a 0 you don’t have it, 1 you do. The same with a linear story, with just 8 of those bits I can provide more than 250 “milestones” to know your progress exactly through the storyline.

And of course I don’t have to limit myself to 32 characters for a string code, or use just hexadecimal. Doubling the characters to every letter except Y and Z with 32 characters and I can give you a full kilobit of info.

Anonymous 0 Comments

There are two possible solutions.

Games that give you a file may be storing all of the game state in that file.

Games that give you a short alphanumeric string probably aren’t storing the whole state. What actually happens is that the full game state gets uploaded to a server somewhere, and that alphanumeric string is just the code that lets you access it. When someone else types in that string, they download the whole file.