0 votes

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,...?

asked Apr 14 in Engine by Godot_Starter (266 points)

1 Answer

0 votes
Best answer

Firstly there is this tutorial https://docs.godotengine.org/en/3.2/tutorials/io/saving_games.html
This video shows how to save json files https://www.youtube.com/watch?v=L9Zekkb4ZXc

answered Apr 14 by NikhilKadiyan (104 points)
selected Apr 16 by Godot_Starter

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 removechild($Player) & then addchild(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) :p

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.