-
Notifications
You must be signed in to change notification settings - Fork 1
Silksong.DataManager #6
Description
Background
The Silksong.DataManager plugin (working title) is our extension of the limited config capabilities in BepInEx.
Requirements
- It should be possible to read and write arbitrary JSON data via this with newtonsoft (shipped with the game)
- It should be possible to handle the following scopes of data:
- Global user data - any arbitrary files at a path which can be set by the user. This could be used for holding large amounts of data across profiles, e.g. skins
- Global user data is derived from the following requests:
- As a user I do not want to have to take additional steps to install skins, or to risk losing skins entirely, when switching mods/profiles
- As a user I do not want large assets taking up disk space at unconfigurable locations
- It might be the case that it is more reasonable to defer these problems to Cogfly; if this can be done this can be discarded from scope
- Global user data is derived from the following requests:
- Profile-scoped mod settings - similar to HK global settings but scoped to a profile
- Global-scoped mod settings - similar to HK global settings, not scoped to a profile. Synced by steam cloud.
- Save data - similar to HK local settings, synced by steam cloud.
- Global user data - any arbitrary files at a path which can be set by the user. This could be used for holding large amounts of data across profiles, e.g. skins
- It may be desirable to create a mechanism to easily and/or automatically merge profile and global settings (with profile settings taking precedence in conflict so they can be set by modpacks and such).
- When deleting a save, all save data for that save should be deleted
- When loading a save, it should be prevented if the save contains data from a mod that is not installed. Mods should be able to opt out of this behavior by indicating their data is not critical for the save to function.
- With the exception of global user data, all of these types of files are automatically loaded and saved at the appropriate time (e.g. mod settings loaded when game loads and saved when game closes; save data loaded when save loads and saved when game saves).
- The paths of all these types of files should be easily accessible to mods so they can read and write custom data without using the primary DataManager APIs (particularly of interest for the global user data folder). For example, if save data is implemented like HK where a plugin implements an interface that deals in only objects of the SaveData type and the API automatically saves and loads data in that shape, there should still be a way for mods to access
Silksong.DataManager.Paths.ModdedSaveDataFolder.
Implementation Idea
What we had in HK was pretty good, using an interface approach. The only thing that's pretty ugly there is the way that mods are notified that save data is being reset from a quitout (by receiving default(T) settings to OnLoadLocal).
Also pasting my initial proposal for reference
Profile settings - tied to a profile, not synced by steam cloud, these live in $Profile/BepInEx/config/pluginguid.json. These serve the same purpose as what bepinex can do but for more complex settings.
User settings - equivalent to HK global settings, synced by steam cloud, living at $Saves/mod-settings/pluginguid.json.dat
Save data - equivalent to HK local settings, synced by steam cloud, living at $Saves/userX-modded/pluginguid.json.dat. We should have some features here that hk mapi is missing such as not allowing you to load a save which has data from a mod that is not installed (unless that mod has explicitly said it is safe beforehand) and allowing modeling some subset of data as immutable to allow mods with larger saves to reduce disk writes
User data - a user configurable path to hold larger data like skins (uses bepinex config to define this path with some sensible default idk)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status