Save the progress of a user

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

How can I save the progress of a user, so that if he opens the game again, that he dont have to start again? What things can I save? Can I only save the value of variables, and if it is so, how can I save the value of variables? Or can I save everything like the scene tree,…?

:bust_in_silhouette: Reply From: NikhilKadiyan

Firstly there is this tutorial Saving games — Godot Engine (3.2) documentation in English
This video shows how to save json files

I just wanna add on to this too, another way i’m doing it WITH the tutorial above is having an Instance variable of my player I load into each scene. Not every game needs this. I have an autoloaded script “Globals” In the script (along with other things) is a variable for my player.

Edit: I want to emphasize I am using the saving game tutorial WITH (In addition to) my global instance. I look at globally instancing my player as a “live” save. It keeps my player variables updating during the game session. If the game is closed WITHOUT using a save game function on the player… Your player won’t be saved when the game is opened back up.

var Player = load(“Path to my player scene”).instance()

So when I change scenes I just remove_child($Player) & then add_child(Globals.Player) (The instanced autoload of my player) to my new scene.

You may not need to do this, but just in case your game could benefit from this… here you go lol. (Took me like 6 hours of research and finally a question on here/reddit for someone to suggest this to me) :stuck_out_tongue:

Aireek | 2020-04-14 17:23