#7 Save/Load System

Merged
ryanreed merged 18 commits from save-load-system into master 1 month ago
ryanreed commented 1 month ago
Owner

Overview

This implements a save/load system. I'm not positive whether I want to stick with this system or not for a few reasons:

  1. It can be a little tedious/cumbersome to setup or confure a new node type. Not bad but could definitely use some improvements.
  2. The save system uses the resource loader. This means the save files are substantially larger than if the system just used a custom JSON setup or something. For instance, the following is an example of the same system where we may only really need the type of node and position:
[ext_resource type="Script" path="res://save_load/resources/node_types/player_data_resource.gd" id="2_bxsj8"]
[ext_resource type="Script" path="res://save_load/resources/node_types/block_data_resource.gd" id="3_olss2"]
[ext_resource type="Script" path="res://save_load/resources/save_game_data_resource.gd" id="4_l0vj7"]

[sub_resource type="Resource" id="Resource_71kuc"]
script = ExtResource("2_bxsj8")
transform = Transform3D(0.667825, 0, 0.744303, 0, 1, 0, -0.744303, 0, 0.667825, 5.16755, 0.522701, 4.93366)
node_path = NodePath("/root/Root/World/Player")
parent_node_path = NodePath("/root/Root/World")
metadata/_custom_type_script = "uid://dodqpooodtguo"

[sub_resource type="Resource" id="Resource_wd064"]
script = ExtResource("3_olss2")
block_id = "001"
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10, 0, -10)
node_path = NodePath("/root/Root/World/BlocksContainer/Block")
parent_node_path = NodePath("/root/Root/World/BlocksContainer")
metadata/_custom_type_script = "uid://syaia0l6vjt1"

[sub_resource type="Resource" id="Resource_tceqr"]
script = ExtResource("3_olss2")
block_id = "002"
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10, 0, -9)
node_path = NodePath("/root/Root/World/BlocksContainer/@StaticBody3D@2")
parent_node_path = NodePath("/root/Root/World/BlocksContainer")
metadata/_custom_type_script = "uid://syaia0l6vjt1"

How To Use

  1. Add SaveLoadLevelDataComponent to world scene (this sets up the hotkeys, filepath, etc)
  2. Create a new node type resource that describes what to save and what to do with saved data. These are saved within save_load/resources/node_types
  3. Add SaveDataComponent to any entity that has data to save
  4. Add the Node Type resource created in step 3 to the component export variables
## Overview This implements a save/load system. I'm not positive whether I want to stick with this system or not for a few reasons: 1. It can be a little tedious/cumbersome to setup or confure a new node type. Not bad but could definitely use some improvements. 2. The save system uses the resource loader. This means the save files are substantially larger than if the system just used a custom JSON setup or something. For instance, the following is an example of the same system where we may only really need the type of node and position: ``` [ext_resource type="Script" path="res://save_load/resources/node_types/player_data_resource.gd" id="2_bxsj8"] [ext_resource type="Script" path="res://save_load/resources/node_types/block_data_resource.gd" id="3_olss2"] [ext_resource type="Script" path="res://save_load/resources/save_game_data_resource.gd" id="4_l0vj7"] [sub_resource type="Resource" id="Resource_71kuc"] script = ExtResource("2_bxsj8") transform = Transform3D(0.667825, 0, 0.744303, 0, 1, 0, -0.744303, 0, 0.667825, 5.16755, 0.522701, 4.93366) node_path = NodePath("/root/Root/World/Player") parent_node_path = NodePath("/root/Root/World") metadata/_custom_type_script = "uid://dodqpooodtguo" [sub_resource type="Resource" id="Resource_wd064"] script = ExtResource("3_olss2") block_id = "001" transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10, 0, -10) node_path = NodePath("/root/Root/World/BlocksContainer/Block") parent_node_path = NodePath("/root/Root/World/BlocksContainer") metadata/_custom_type_script = "uid://syaia0l6vjt1" [sub_resource type="Resource" id="Resource_tceqr"] script = ExtResource("3_olss2") block_id = "002" transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10, 0, -9) node_path = NodePath("/root/Root/World/BlocksContainer/@StaticBody3D@2") parent_node_path = NodePath("/root/Root/World/BlocksContainer") metadata/_custom_type_script = "uid://syaia0l6vjt1" ``` ## How To Use 1. Add `SaveLoadLevelDataComponent` to world scene (this sets up the hotkeys, filepath, etc) 2. Create a new node type resource that describes what to save and what to do with saved data. These are saved within `save_load/resources/node_types` 3. Add `SaveDataComponent` to any entity that has data to save 4. Add the Node Type resource created in step 3 to the component export variables
ryanreed added 4 commits 1 month ago
ryanreed added 3 commits 1 month ago
ryanreed added 1 commit 1 month ago
ryanreed commented 1 month ago
Poster
Owner

1 Outstanding Issue:

  • Loading any time after the first load causes only some blocks to be loaded. Unclear the reason yet.
1 Outstanding Issue: * Loading any time after the first load causes only some blocks to be loaded. Unclear the reason yet.
ryanreed added 1 commit 1 month ago
ryanreed added 1 commit 1 month ago
ryanreed added 1 commit 1 month ago
ryanreed added 1 commit 1 month ago
ryanreed added 1 commit 1 month ago
ryanreed added 1 commit 1 month ago
ryanreed added 4 commits 1 month ago
ryanreed commented 1 month ago
Poster
Owner

1 Outstanding Issue:

  • Loading any time after the first load causes only some blocks to be loaded. Unclear the reason yet.

This should be fixed now

> 1 Outstanding Issue: > * Loading any time after the first load causes only some blocks to be loaded. Unclear the reason yet. This should be fixed now
ryanreed changed title from WIP: Save/Load System to Save/Load System 1 month ago
ryanreed merged commit a736243e7b into master 1 month ago
ryanreed deleted branch save-load-system 1 month ago
The pull request has been merged as a736243e7b.
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

This pull request currently doesn't have any dependencies.

Loading…
There is no content yet.