tutorials/io/saving_games #126
Replies: 6 comments 23 replies
-
There are two arguably better ways to save and load games:
Both are significantly easier to save and load (one line of code) and provide easy storage of godot's more complex data types like Vector2s. Resources provide extra type safety and allow for storage of sub-resources. |
Beta Was this translation helpful? Give feedback.
-
There's an error in load save file example: |
Beta Was this translation helpful? Give feedback.
-
There's an error for me with this code, where I get duplicate copies of the saved objects. var save_nodes = get_tree().get_nodes_in_group("Persist")
for node in save_nodes:
node.queue_free()
await node.tree_exited Hope this helps! |
Beta Was this translation helpful? Give feedback.
-
I am extremely sorry for not understanding where I am failing, however once corrected I hope this can be a simple example for others. The error is as follows: ok: sorry for the bookoo load of code that follows, but its skeletonized and focused on the example problem within the larger portion of my game....blargh sorry I'm on hour 42 and am yelling at my dogs, please tell me I'm missing something simple 2 scenes: Main (not group: Persist) and instantiated_save_game_node (scene is group "Persist"-global) #main.gd
and
|
Beta Was this translation helpful? Give feedback.
-
The C# example is interesting and doesn't look very idiomatic to me; would a better approach be to have Nodes that can save and load, implement an interface ( if (saveNode is ISaveable saveableNode)
{
var nodeData = saveableNode.Save()
}
else
{
GD.Print($"persistent node '{saveNode.Name}' doesn't implement a saveable interface, skipped");
continue;
} |
Beta Was this translation helpful? Give feedback.
-
What does it mean? Does it mean that it includes variables and scripts not included by default? Or that if I saving an object (a scene for exemple) it would save all the data including scripts if it saved inside of scenes? Does binary have any security benefits??? (I actually didn't expect saving the game would be such a mess! :D) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
tutorials/io/saving_games
Introduction: Save games can be complicated. For example, it may be desirable to store information from multiple objects across multiple levels. Advanced save game systems should allow for addition...
https://docs.godotengine.org/en/stable/tutorials/io/saving_games.html
Beta Was this translation helpful? Give feedback.
All reactions