godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.13k stars 92 forks source link

Recursive Serialization on dict_to_inst and inst_to_dict functions #9804

Open MiyamotoIsaac98 opened 4 months ago

MiyamotoIsaac98 commented 4 months ago

Im making a MMORPG/RTS videogame and im using dict_to_inst and inst_to_dict serialization for two things: 1- saving data for the database system (for now) into ConfigFile 2- sending complex structured data through network in the meaning of Requests

As serialization happens to make the object to dictionary and then this dictionary to string in the file, low-level variables objects aren't serialized but Encoded as ID, this is a huge problem because in further executions of the game the encoded ID for that object doesn't belong to any real object of the application stopping it from being deserialized, so on objects inside containers such as Array and Dictionary aren't able to deserialize ether

Change dict_to_inst and inst_to_dict to work recursively.

This can be accessed, in my opinion, in two main ways, ether you add a configuration parameter to the functions or add two new functions for deep serialization

This can be often used as many games require deep serialization processes and its the main idea behind dict_to_inst and inst_to_dict

This should be core because is a modification of Godot Global Scope scripting

AThousandShips commented 4 months ago

Please follow the form, the individual questions are important, otherwise I can help converting this into a discussion

KoBeWi commented 4 months ago

This looks like the sections were filled, but headers are removed 🤔