Hi can someone help teach me on how to include autosave

An autosave feature that will save whenever players quits the game.

I believe it is in the storage section but it is not clear to me.

Will it work on both PC and and phone?

Please walk me through it


I have already explained the basics in this topic, I hope it helps somewhat:

Yes. On PC, it is using an external file to store values. In HTML5 (mobile) it is using web storage.

Video tutorial on how to do exactly this: youtube.com/watch?v=7YD1x1aAmJo

Thanks guys

Hi, is it possible to let players who quits the game to start back at the scene they were previously in as in the scene get restarted

I figure maybe by using variable on the previous scene when it is finished but I dont understand how to read and write value

Please help, thanks

The easiest way to go is to save only which level is completed or which level is next.
When the player completed a level, just simply write a value in to a file using the storage action. For example the number of the next level. If level 1 completed, before start level 2, write value 2 in to file. If level 2 completed, before start level 3, write value 3 in to file. And at the beginning of the game, read the value from the file. If the value = 0 or 1, load level 1 if the value = 2, load level 2. If the value = 3 load level 3 and so on.

I suggest to try to do it this way for now, if you can do it, only then try to make a save system to be able to save anywhere during the game because it is a lot more complicated.

As I have explained in the topic I have linked, when you write a value you need to enter the file name that you want to write in to, a group name that is going to hold the value in the file and the actual value. If the file doesn’t exists, GDevelop going to create the file and make sure the file name is between “” signs. When you read the value, you need to enter the file name you want to read from, you need to enter the group name which is holding the value inside the file and you need to add a variable that you are going to use the read the value in to from the file. Once you have that, you can simply check the value of the variable or pass the value to any other variable as usual.
If you don’t understand it, I suggest to create a new empty NATIVE project and try to do nothing but write a single value in to a file. In case of native project, if writing successful, you are going to find the file in your project folder and you can open it and see how the value is actually stored in the file and after it may going to be easier to understand how to read the value from the file and how to use it to create autosave.

Hey how do you write that in Gdevelop?

In the events should it be written like this?

Boss level 1 isnt visible > write 2 in “scene” of file autosave

How do you use conditions on to read this

The storage condition doesnt let me to write if read 2 in scene of file autosave > change scene 2

Store a variable currentlevel = n
When the game loads, have a scene that looks at this variable and takes you to the appropriate scene.

If variable currentlevel = 1 | go to scene level1


Ok, so there is no need for writing a value?

I have just created a quick example for you:
save_level.zip (6.83 KB)

You need to export the project to native platform, it is not going to work in preview.
It is very simple, I hope it helps :slight_smile:

Thanks man, does this work on phones?