SaveLoadUtil ​
Inherits: RefCounted
SaveLoadUtil - Manages saving and loading game state to/from JSON files Coordinates with SystemHub to gather and restore state from all game systems Uses dependency-aware loading order to ensure entities exist before effects/AI states
Methods ​
bool | save_game( system_hub: GameHost.SystemHub, save_file_name: String ) static |
bool | load_game( system_hub: GameHost.SystemHub, save_file_name: String ) static |
bool | create_player_entities_from_save( system_hub: GameHost.SystemHub, save_file_name: String ) static |
bool | restore_all_state_from_save( system_hub: GameHost.SystemHub, save_file_name: String ) static |
bool | save_file_exists( save_file_name: String ) static |
bool | delete_save_file( save_file_name: String ) static |
Array[String] | get_save_file_list() static |
int | get_world_id_from_save( save_file_name: String ) static |
Constants ​
StringSAVE_FILE_PATH ="user://saves"- The folder the saves go in.StringSAVE_FILE_EXTENSION =".json"- The extension of a save file.
Method descriptions ​
bool save_game( system_hub: GameHost.SystemHub, save_file_name: String ) ​
Save game state to a JSON file
bool load_game( system_hub: GameHost.SystemHub, save_file_name: String ) ​
Load game state from a JSON file
bool create_player_entities_from_save( system_hub: GameHost.SystemHub, save_file_name: String ) ​
Create player entities from save file WITHOUT loading their state This allows NPCs to reference players when the world loads
bool restore_all_state_from_save( system_hub: GameHost.SystemHub, save_file_name: String ) ​
Restore all saved state after world and entities are loaded
bool save_file_exists( save_file_name: String ) ​
Check if a save file exists
bool delete_save_file( save_file_name: String ) ​
Delete a save file
Array[String] get_save_file_list() ​
Get list of all save files
int get_world_id_from_save( save_file_name: String ) ​
Read world ID from save file without loading the entire game Returns -1 if file doesn't exist or can't be read