03.1 DataPersistence


How does the Save & Load system work?

SAVING GAMES:

Here is a flowchart illustrating the operation of Save & Loading, detailing how data is securely saved into an encrypted JSON file.

1

OBJECT STORES DATA

Objects ( Player, Interactables, Pickeables, Triggers, etc... ) need to notify GameDataManager when data is changed so it can be stored until the Game Saves.

Object Generic Data is sent to GameDataManager

2

GAME DATA MANAGER PROCESSING

GameDataManager processes the Generic Data and ensures it can be serialized based on the type of data sent. Non-serializable types cannot be stored in a Json File.

3

SaveGame() IS TRIGGERED

When DataPersistenceManager.instance.SaveGame() is called, DataPersistenceManager gathers GameData from GameDataManager and sends it to FileDataHandler.

4

ENCRYPTION & JSON FILE

FileDataHandler takes GameData, and it stores it as a Json file. This file is then encrypted and saved locally in the Player computer.

Loading Games

Here is a flowchart illustrating the operation of Save & Load, detailing how data is loaded.

1

LoadGame() IS TRIGGERED

DataPersistenceManager.instance.LoadGame() is called, so DataPersistenceManager asks FileDataHandler for Data.

2

DECRYPTING JSON FILE

FileDataHandler processes this request and returns decrypted data from the stored Json File.

3

DATA IS SENT TO GAME DATA MANAGER

The Decrypted data is sent to GameDataManager, which converts it into GameData, with references to Item_SOs and other non-serializable types.

4

LOADING DATA

GameDataManager finds all saved objects within the current scene using their Unique ID ( Check Identifiable Component ) & Loads their respective data

Last updated