Whole scene save button

Please add a action to just save every object frames, variables and position in scene. If not for html5 atleast for apk. To solve any technical problem or slow down or huge storage make it for selected objects in action.
Please think about it.

That’s something anyone could do via event based extensions

1 Like

Its difficult for me can you somehow provide me. Such actions.

I was about to ask for this feature. This will be really useful as now we have procedural generation extension and can’t save every single tile. (If you are asking what I think you are asking :sweat_smile:)

I suggest you to create a scene variable with all info you need, then transfer into json string and store it. It’s not the exactly what you need but should be a useful workaround

2 Likes

Yes, that is a great way. But, It can’t be really used in procedurely generated games as it will take thousands of events to save it and the same to load it. And it already takes minutes to load and generated the random world. This feature will be more useful as now we have the noise extension and don’t have a way to save it and that just makes it useless. Maybe this can be done by loading the seed But, it can’t be done if the player can interact with it like minecraft. I don’t really know how other engines do it But, might have a function similar to this.

@Midhil Sure you could. Make sure your objects are in a group and are given an ID on generation, then just do a for each event for that group to save their location. Its would literally be one event to save them.

Also, to clarify the noise extension is user made and has nothing to do with the engine itself.

Edit: also. As far as other engines, when I was building my save events, none of the major engines I reviewed have out of the box save systems beyond outputting to a file like GD5. This is likely due to each game having slightly different needs on how/what to save. I had checked Defold, Unity, Unreal. Some do have user made addons that provide more structure, but you still have to build out the logic.

1 Like

What does ID have to do with it? Does ID help in saving it individually? And how do I restore the IDs when I load the saved objects?

Generating an ID for the objects means you can track instance-specific data for each object instance.

Basically, when you generate your objects, part of your generation should involve:

  1. Creating an “Count” variable that starts at 1 (this is a scene variable)
  2. Issue an object variable named ID (or anything, but it’s used for ID)
  3. Applying the count variable to the ID variable (so if Count is 1, ID is set to 1)
  4. Then increasing the count variable by 1 (so the next created object has the next ID number).

By having a unique ID variable on the objects, you can then track it’s specific position in a variable along with anything else you want, and call that back.

In theory, if you’re using the same seed, your objects should always end up with the same ID numbers, too, so when you load your data, you generate the objects using the same seed, then position them based off the saved data. (You could even show/hide/destroy them based off the variables if you store that info).

1 Like

Then, can you explain the saving part, not really good at IDs :sweat_smile:

At the time you want to save, you store all of the ID variables and information into a Structure variable (Scene or global, probably global).

You then use the filesystem or storage events to store that singular structure variable (Which will include all of the children variables) into the filesystem/storage.

You do the inverse when you want to load.

You can see a variation of this in the “Save Load” example on the examples page: https://gdevelop-app.com/game-examples-starters/

1 Like

Thanks, I will try it out :slightly_smiling_face:

1 Like

Hi, can you explain how can assign the IDs that are in another structure when saving back to the respective object. I have no experience with Object variables. :sweat_smile:

If you’re generating your objects off the same seed, they should be generated back in the exact same order. So you’ll generate the IDs the same way whether it’s a new game or loaded game, then you do a “for each Objectname” and look up it’s position based off your stored variables by it’s Object ID.

Lets say your structure is “MySaveGame.IdNumberHere.X” and .Y
You’d do

For Each MyObjectNameHere
Trigger once          | Position MyObjectNameHere to MySaveGame[ToString(MyObjectNameHere.Variable(ID))].X;MySaveGame[ToString(MyObjectNameHere.Variable(ID))].Y

You can look up more about dynamic variable access here:Variables [GDevelop wiki]

1 Like