Save & Load System

In this document we take a look at the save/load system of DVN.
Contents
- Auto saves
- Manual saves
- Quick saves
- Serialization behavior
- What is saved / what isn’t
- Save thumbnails
- Save system override
- Narrative-based resume
- Configuration
Auto saves
Auto saves is a default setting that is turned off.
To enable auto saving simply open the settings view and click auto save.
There is no configuration or anything needed to make auto save work in DVN.
Auto saves will use a specific slot and not the predefined save slot of a gameplay.
Manual saves
Each time you start a new game the game is given a save id which will be used when loading the game again too, which means you are always located in a specific save file (even if the save file has not been created yet.)
This makes sure users never save into the wrong slot, as each gameplay only has a single slot allocated.
To save your game simply press Save when playing and it will automatically save the current state.
Quick saves
Quick saves work similar to manual saves, except they use the specfic allocated slot for quick saves.
Serialization behavior
Save files are currently located as part of the game settings object, but in the future they might be moved in separate files (with backward compatibility.)
What is saved / what isn’t
The following information is saved in your save file:
- Save ID
- Save Time
- Current Scene
- Current Background
- Current Music
- Metadta (map of strings)
- Gameplay Seed
- Gameplay RNG calls
- Current Scene Text
- Original Scene Name (The parent scene of the node)
Save thumbnails
All save files automatically creates a thumbnail located in data/game/saves
Save system override
It is possible to override or save additional data using events.
The following functions can be used:
void loadedGameScripts(SceneEntry[string] scenes, SaveFile saveFile);
void savingGame(SaveFile[string] saves, SaveFile saveFile);
Narrative-based resume
DVN supports narrative-based resume when loading a save file.
Instead of only restoring a scene by its ID, DVN also stores the original scene, the sub-scene (node), and the text that was active when the save was made. When the save is loaded again, DVN will try to resume from the same narrative position by comparing the saved text with the current script text.
How it works When you load a game:
- DVN reads:
- originalScene - the scene where the save was originally made.
- scene - the current sub-scene / node identifier.
- text - the text that was active at the moment of saving.
DVN compares the saved text with the current text for that node using a Unicode-safe Levenshtein similarity.
A similarity score in the range 0.0 - 1.0 is calculated:
- 1.0 = identical text.
- 0.0 = completely different.
- DVN compares this score to a user-defined threshold.
- If the similarity is greater than or equal to the threshold, DVN resumes at the saved node.
- If the similarity is below the threshold, DVN falls back to the start of the original scene instead.
If the original scene cannot be found at all, endGameView() is called on the event handler, and it is up to the game to decide what to do next (return to title, show a message, etc.).
This allows the script to change between versions (typo fixes, line tweaks, minor rewrites) without immediately invalidating player saves.
Configuration
The similarity threshold is configured as an integer percentage in your game settings:
"saveFileTextMatchPercentage": 90
- Range: 0 - 100
- Meaning: minimum required similarity between the saved text and the current text for DVN to resume at the node.
- Example: 90 means "only resume at this node if the text still matches at least 90%; otherwise restart from the beginning of the scene".
Lower values make DVN more forgiving to script changes.
Higher values make DVN stricter and more likely to restart from the scene start if the text has changed.
Scope and limitations
- Narrative-based resume only applies when loading from a save file.
- It does not affect starting a new game.
- If you heavily restructure or rename scenes, old saves may:
- fall back to the start of the original scene, or
- trigger endGameView() if the scene no longer exists.
- This system is best seen as "best-effort continuity" when updating your script, not as a guarantee that old saves will always resume at the exact same node after major story rewrites.