Unity: saving & loading state for an open world game

Allison Liemhetcharat
14 min readFeb 27, 2021

In most games, the player is able to save their progress in the game, so that they can continue their saved game at a later time. In the different game genres, there are multiple ways games can be saved. For level-based games (e.g., Candy Crush Saga, Overcooked!), a player’s progress is automatically saved in between levels, e.g., the game remembers that the player has completed levels 1–1 to 2–10. In role-playing games, players may be able to save at almost any time (e.g., Knights of the Old Republic, Mass Effect), or at certain checkpoints (e.g., Final Fantasy VIII). In open-world crafting/survival games, saving the game can be automatic (e.g., Terraria, Forager), when the character goes to bed (e.g., My Time at Portia, Garden Paws), or possibly at any time at all.

Saving and loading the game state of an open world game can be particularly tricky, since the state of the world can vary greatly from player to player, depending on what they have done in the game. For example. one player may have cut down a forest, while another player may have dug a tunnel through a mountain, so their save games have to be generic enough to capture the player-specific differences in their games. Besides the “natural” aspects of the open world, NPCs may also have different states, especially if the player is able to save at any point in the game (whether manually triggered by the player, or automatically). For example, an NPC may be in the midst of patrolling a path, while another NPC may be in the midst of battle.

--

--

Allison Liemhetcharat
Allison Liemhetcharat

Written by Allison Liemhetcharat

Proud mom, roboticist, software engineer.

Responses (1)