[Feature] System for saving and loading option presets using a local file #727
+867
−1
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.
Hey there, I have implemented a working version of a preset saving and loading system and would like some general feedback :). Unfortunatly, I currently keep finding bugs.
The system works both in singleplayer (Skirmish) and in multiplayer. The system allows you to save settings in your local lobby and save them to a preset, which can be restored at a later point.
The feature got requested multiple times (#270 #460).
Implementation
In the current iteration I added a button below the advanced options to access the Preset Menu.
The button opens the preset loading and saving menu.
New presets can be selected in the drop-down menu when clicking
<new>
This opens a prompt where you can enter a name.
Saving
When opening the optionPreset panel, various settings are collected from the current lobby and stored in local variables.
When clicking the save button, the settings will be added to the
optionPreset.json
file under the preset name. The file will be created/ written in your installation folder.Only options that are selected in the
Load Option
tab will be saved.Loading
The settings will be read from the file and saved to local variables. The values are applied at their places in the lobby. Some settings are differently applied in singleplayer and multiplayer. Additionally, you can specify the settings that should be loaded in the
Load Option
tab. If a specific setting is not defined for a preset, the setting will be ignored, and the current value will remain.Quirks/Workarounds
Features
As of now it supports saving and loading of.
Multiplayer specific
Other features:
optionPreset.json
file gets damaged, it gets copied to anoptionPresetError[date].json
with the current date and replaced with a blank file.Limitations/ Known problems:
Untested:
Ideas for future work/ Ideas