-
-
Notifications
You must be signed in to change notification settings - Fork 296
Save system cleanup #2695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Jowan-Spooner
wants to merge
27
commits into
dialogic-godot:main
Choose a base branch
from
Jowan-Spooner:the-big-save-rework
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Save system cleanup #2695
Jowan-Spooner
wants to merge
27
commits into
dialogic-godot:main
from
Jowan-Spooner:the-big-save-rework
+812
−611
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Introduces a new DialogicSaveState resource. This is the first step in many to make the saving logic more modular and completely remove Dialogic.current_state_info. For easier debugging, the save system saves this as a .tres for now, which makes it impossible for encryption to work, this can be changed back later. Subsystems now have the pack_state() and unpack_state() methods, which collect it's exported variables into a dictionary.
This changes the full_event_history to be stored as texts at runtime. I don't know how people use this rn, so idk if this is a problem. It makes the code cleaner for now, we'll see.
clear_game_state -> _clear_state post_install -> _post_install pause, resume -> _pause, _resume
Dialogic.print_debug_moment is now a little cleaner and includes the line in the textfile, where the current event is.
Restructures the text subsystem for better organization and readability by grouping related functions into regions.
Allows subsystems to store extra_state on save and use it on load. This is mainly intended for state outside the subsystem script, e.g. on nodes in the style or custom parts like portraits, backgrounds, etc. The textbox visibility is now handled per "textbox-identifier", which can be specified on the dialog_text node. A new "active_textbox" can be changed via script.
New property Dialogic.PortraitContainers.debug_draw.
These shouldn't be saved and were shouting some errors on load, now they are properly decoupled.
Adds _get_state and _load_state to the DialogicPortrait and implements them on the layered portrait.
A little scared about this one, but I think it makes sense.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Compatibility Breaking ⚠️
This PR breaks compatibility in some way
Enhance ⚡
Improve a feature's workflow.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note: this is not about the Save subsystem API, which might get a cleanup as well in the future. This is about how dialogic stores and restores its state internally.
This restructures how dialogic stores its state. It completely removes the
current_state_infodictionary in favor of proper properties on the subsystems. This makes it easier to know what will be in the state dictionary at any point and more reliable what type those infos have. It also puts the burden of keeping track of the state more directly on the subsystems.Pros:
The new save flow is like this:
Dialogic.get_full_state()@exportedproperties_pack_extra_state()returnsThe load flow is the opposite
Dialogic.load_full_state(state)@exportedproperties_load_state()(Style subsystem first)get_extra_state()to restore dynamic info, e.g. custom portrait state, textbox visibilityAs you might have noticed I implemented a few things previously not possible:
start_hiddenandauto_visibilityproperties. Auto visibility is basically the same ashide_when_empty, but works on the subsystem instead of directly on the node (which made the visibility state really hard to keep track of).From my tests this fixes a bunch of issues with saving/loading and personally I find it easier to work with this new system, so it should be easier to fix issues in the future.
Compatibility breakage
This breaks compatibility in many ways:
custom_state_infobreak. This is more annoying, but hopefully not too many people out there 🙈Subsystem.pause()andresume()are now_pause()and_resume()Subsystem.clear_game_state()is now_clear_state()Subsystem.load_game_state()is now_load_state()Subsystem.post_install()is now_post_install()Text.update_textbox()has been removed in favor ofText.textbox_update_visibility(visible, instant, identifier)andText.textbox_handle_auto_visibility(text, identifier)Dialogic.get_full_state()now returns a DialogicSaveState resourceDialogic.load_full_state()now takes a DialogicSaveState resourceThis makes the minimum godot version required 4.4
Other Stuff
get_background_node()to the Background Subsystemdebug_drawto the PortraitContainer subsystem, which draws outlines around portrait containers and their names