Today I Learned - Rocky Kev

TIL Creating save file versions and a update path

POSTED ON:

TAGS:

QUESTION:
When you add new features in a game, how do you handle file saves?

ANSWER: (via user/jonerandom)[https://www.reddit.com/r/incremental_games/comments/mnbaee/how_do_i_update_everyones_save_file_when_i_add/gtxhinc?utm_source=share&utm_medium=web2x&context=3]
Check save version. If less than current version, update the save data.

Also a good idea to have one function per save version upgrade, and run them in order until the save data is up to date.

For example, if someone loads a save at version 2, and the game is at version 5, run the update function from v2 to v3, then v3 to v4, then v4 to v5.

That way you only ever have to worry about adding changes for the most recent update, and you can assume all previous updates will work because you won’t ever go back and change that code.

This has worked for me in a half a dozen games that have been updated many times over many years.


Related TILs

Tagged:

TIL Dwarf Fortress Game Design

'Do not design for your experienced players' and some more tips from one of the most complicated games ever

TIL Breath of the Wild's many parameters

One of my favorite things to do is dig into how games are made on the data side.

TIL what a Shader is

Modern GPUs are incredibly flexible. Developers use shaders - to program the GPU to perform effects and complex rendering techniques. Devs write code in a shader language from an API (such as OpenGL) and a shader compiler in the video driver translates that code into binaries that your PC's GPU can run