Save system design

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By OldKalash7

Hi,

I’ve started a small game project for school and one of the features i have to implement it’s a basic save system. I’ve checked the tutorial in the official docs, however i don’t know if it’s suitable for me since i want to use binary files for saving instead of JSON files.

Initially i thought of a monolithic design of some sort, like the saving / loading process it’s managed by a singleton or a global class. But now, I’m thinking of a more scene approach system. It’s a bad idea having every scene, every time that scene enters the tree and calls ready, to handle the load of what the scene needs ( for example, player position or health for player scene).

For saving, I would be something like this:

get_tree().call_group() 
# Check if has method
# call save

Since I don’t plan on using a lot of scenes and transitions, Is this advisable or could lead to potential pitfalls?

Thanks in advance.

:bust_in_silhouette: Reply From: exuin

Yeah - the saving docs are desperately in need of an update. What you’re doing is fine - the saving method in the docs should work for JSON as well as binary files.

I did open a pull request to update the saving docs but I somehow managed to squash every commit into one lol

Thanks for the advice. I will do it that way then.

OldKalash7 | 2021-03-28 12:06