Save Game Incompatibility in modified Python class structures
0 reputation · 31 Jan 2025, 01:27 UTC
Object Serialization in Ren'Py
Ren'Py employs a modified pickle-like mechanism to serialize Python objects for save games and persistent data. This system is designed to maintain the state of complex variables across different game sessions by storing the object's attributes.
A conflict occurs when a developer modifies the structure of a custom class—such as adding, removing, or renaming attributes—after a user has already created a save file. Because the engine attempts to reconstruct the object from the serialized data, the discrepancy between the saved state and the current class definition can trigger incompatibility issues during the load process.
The goal is to determine the engine's native behavior for reconciling these differences without manually purging user save data.
- Does Ren'Py provide a mechanism to define default values for attributes that are missing from a loaded serialized object?
- What is the specific behavior when a loaded object contains attributes that no longer exist in the current class definition?