Unified save system

Basically yes, I was just going to go ahead an write a feature request thread - but will do it here instead!

In my mind this would work best if it takes advantage of already implemented design in gdevelop and extending it by adding two complimentary new actions.
To me being able to create save files and load them is a must have in any game. But if you have to put in code to write each individual value to the file and load it back, this is going to get impossible in a bigger game where you have lots and lots of values.

So my proposal is like this:

NEW Action- “Write all the variables of an object to a file” (save game)

  • It writes all the variables of an object or a group of objects to a json file. It also automatically puts the value in a structure that identifies the object by it’s name, frame in which it exists and possibly UID.
    for example of an automatically generated group structure:
    Scene1>enemyMonster>UID66>health>200
    Scene1>enemyMonster>UID67>health>100

    Scene2>door>UID02>state>“unlocked” (from the “doors” group)
    Scene2>redDoor>UID05>state>“needsRedKey” (from the “doors” group)

NEW Action - “Read all the variables of an object from a file” (load game)

  • It loads all the values of an object or a group of objects from the same json file. It uses the same group naming/structure as the previous action, this it correctly identifies the correct values in the json file and writes them back to the correct object or objects (when a group is specified) and writes them to their variables.

For the Player object and some other cases with global values you dont need to keep track of a value in different Scenes. So adding to this load/save all values behavior, it would be nice to also have a tick box to make the “Store scene - for objects that exist in multiple scenes” optional.

I think this is better than saving EVERYTHING. You give some control to the designer what to save in the game, without making them work too much.
That reduces the save file size.
Save files might also get corrupt between changes you make to the game.