-
Notifications
You must be signed in to change notification settings - Fork 79
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
improve: save system (performance & safety) #445
Conversation
FYI: there is |
Ok, good to know. I'll leave it for later though because it doesn't have the key performance impact.
Sure, how about we use fmtlib for the time being? |
|
@Try string_frm str;
// assuming we implement .data() and .bufLength()
fmt::format_to_n(str.data(), str.bufLength(), "my text {:.2f}", andNumber); It can also be used under the hood of the |
Default: 640px / auto Example: ```ini [SAVE] SCREENSHOT_WIDTH=1280 ```
Initial intent was to use |
Sure |
* fallback for invalid start point * refactor player creation
Hey @PoetaKodu, I've noticed you closed the PR rather suddenly. Is this something you'd like to get back to later? |
@Nindaleth I'm preparing a better structured version of this PR. |
Goal
To make the save system instant and with a safer API.
Progress
Improve performance:
Current: records/entries always ensure that parent folders exist using a search that becomes sluggish when dealing with tens of thousands of files and directories
Proposed: rewrite the code so that the directory structure is guaranteed and no additional checks are required
Current: using
std::stringstream
to manipulate text withsetEntry(...)
Proposed: descent one folder/file at a time and use
std::to_string()
only when needed. Also: test whether we can usestd::to_chars()
Current: each file larger thank 256B is compressed during the writing process
Proposed: create an uncompressed archive and defer compression to another thread after the game is saved and running (configurable)
Current: image captures everything in the game window
Proposed: default to max width of 800px (and automatic height) and expose configuration field to set a custom size
Improve security
Current: reading and writing use two separate pipelines meaning it is very easy for them to get out of sync in the future
Proposed: create a per-class scheme that handles most of saving details, allowing for logic override if needed
Fix bugs:
priview.png
change topreview.png