How to Save/load current scene like Doom does it

Gdevelop doesn’t seem to have away to save and load the game like how doom has, at least an easy way so it will be harder to make games like doom, if there’s away to do this already, yeah sorry

Also I do know you can save variable text, but that’s not what I need

That is in fact what you need.

Just like in doom, it is up to you as the developer to track object positions and statuses, which are all just number and text variables (even in doom).

Whatever data you want to track for saving and loading should be stored in your save data structure. You will need to design whatever data structure you want to keep. Because every game is different, the engine can’t build out your data structure for you.

You can save your data with a single action, so long as you have set up your data structure correctly. I personally usually set up a “GameState” global structure variable, and store any data I want to save as child gariables. My events also use the gamestate variables for their info as needed.

You can read more about saving a structure variable in this tutorial. Saving & Loading (Storage) - Advanced Tutorial - GDevelop - YouTube

Edit: if you want to learn more about every piece of data that doom manually tracks in a save file, you can read a breakdown here: User:Unmaker/Savegame format - The Doom Wiki at DoomWiki.org

Saving and loading to and from storage is done trough 2 separate events
While you will need to add some condition to each to control when they trigger
Saving have 1 action
Loading have 2 actions

So it is ultra simple
But i found users doing it for 1st time make a lot of mistakes like warping in quotes what they should not warp
And giving wrong names to storage and groups
Resulting in whole process not working correctly

So you can either follow what Silver suggested and you will be perfectly fine as long as you follow tutorial 1 to 1

Or you can try out my extension Data package from June 2nd. - FileTransfer.io

All you will need to do with it is install it and you will gain access to save and load actions for 10 variables which ranges from Save Save1 Save2… to Save9
Where all you need to do is create global variable NAMED Save (Or Save2 Save3 … Save9 as mentioned above just pay attention to which one you save so you can later load proper one)
Set it to structure and all your childs in that variable will be what is saved
So if you make Global Structure Variable named Save and add child named Level1
Your variable will be GlobalVariable(Save.Level1)
Then you add Level2 and so go on
And so you only perform Save or Load action and it is done
You may think you should put each Save in separate global variable but that would make no sense
Imagine this
If you have save slots occupied for level 1 4 and idk 7
Then you want to make new save for level 3 for example
And all that can go into 1 single parent variable (so it saves all of them at once)
Since the moment you save to 1 in game slot it will in fact save all other slots but you would not change them anyway so you destroy nothing
I hope you understand what i meant

honestly, the task im thinking would be hard is counting entities and where they were when you saved, Player is fine, but anything theres more than 1 of im not sure of, All variables, Player positioning, etc. Isnt that hard probably, but when theres more than one of a certain object, how does it transfer data properly?

1st of all i made mistake in my above message i gonna edit it
It is not MySave it is Save

And as for your question
You tell me


What you see on screenshot above are default values with which game starts for the 1st time
But after you create storage save they are different
Since actual data is saved in storage and it is only like copied to global variables then you use that global variables to set something

Like imagine now as on screenshot I have CursorX and CursorY variables which are 0
But as soon as i save them then this window will still display 0
But storage will have numbers that were there at the moment of save
And since i load this at beginning of scene
It is for me and any player trying my game set to what they were saved to

For enemies if that what you mean by many of same object
You would need to give them instance variables distributed dynamically and save that
So idk enemyID#1 enemyID#2 and so go on
And for each you save their position which can be dona automatically but HOW exactly to do it you would need to ask either here on forums or on discord

So instance variables are for specific objects?

Imagine you have text object for UI named idk UIText
Now you want to have like UI text displayed under various parts of your UI like HP MP ammo level exp and so go on
What you do?
Making duplicate of object in editor like UIText2 UIText3 UIText4 … is stupid
I mean it is ok for few objects but what if you want to have a lot more than few?
You give them instance ID
So you have only one object in editor called UIText place it on your scene
And in object panel you have option to give them instance ID
Like 1 2 3 4 5…
So you make condition that if UIText object instance ID = 1 or 2 or 3 or whatever
You do something to that text object
And that will affect that text object with that ID and not all of the same text objects

There is a way to give that ID dynamically when each object is created or do it for each existing object while you still have option to give them manually in editor
But you want to go for dynamic distribution
And so you do that for your enemies
And now you are able to create event that save enemy ID and his X and Y
And then use that to spawn enemies when loading by creating them at that position

BUT like i said if you want to learn how to make that dynamic ID distribution ask someone else on forums i am not expert here

1 Like