Closed CptMoore closed 3 years ago
I agree that this is a problem. I'm unsure how to handle it, however. Perhaps a configuration.json
or settings.json
or something could be generated by ModTek on load with the defaults pulled from the mod.json?
Further issues:
Before upgrading, the existing mod dir should be removed to avoid old full or partial jsons sticking around. -> settings should not be in same directory as the mod.
If we want mod authors to change defaults and allow those updated defaults to be used, settings should only contain settings overridden by the user. Like a partial json to the mods default one. -> settings should not contain default values if autogenerated Dont like it that much, as i like the settings overview, but dont know of another way of distinguishing what the user has overridden and what came in as default. (Otherwise theoretically a mod author would need to create a v2 or v3 of a settings field whose default was changed by the mod, and ignore v1, but thats still ugly)
There is a special user setting, called "Enabled", that should be placed outside modjson too. -> i would move this to the settings This would be the only candidate right now for being in a user autogenerated settings.
TLDR so far
Further ideas: An alternative would be to have 2 settings files, one always autogenerated and always filled with all defaults and never read! And another with only enabled inside that the user can expand. At least a user could quickly copy paste stuff.
So final proposal: Autogenerate $ModnameSettings.json in Mods or Mods\Settings and only put Enabled inside. Autogenerate $ModnameDefaults.json alongside with all settings the mods provide.
I feel like any system that doesn't include a way for "nice" mod authors to do in-place upgrades of settings by version is probably going to have the same problems as the current system, except in more places. If an author decides the names of all their settings were wrong in the past, these things don't seem to me to solve the re-configured configuration/update, though I think the auto-generated defaults + secondary user settings thing would be a great step toward that.
Another thing to consider is having a named file control mod enabled-ness. Just a file named disable
/disable.txt
/disable.json
/etc. seems like it would be easier to deal with than popping open a mod.json file and hoping smart quotes don't ruin your day.
Factorio has a good model, there settings are displayed ingame and separate of the mods dir. So the gui is the default listing while the user specified stuff then is saved in that extra settings file outside the mod dir. Factorio also bundles mods not in dirs but in zips.
Yup, factorio has a really nice setup.
Associated Example PR: https://github.com/Mpstark/ModTek/pull/69
I bumped against this when I was looking at how to preserve user's mod settings after an update of a mod from source. I took a stab at a proof of concept here for solving this issue, based on the feedback above and my brain.
mod.json
) from mod settings (settings.json
)modtek.overrides.json
in \Mods\
that contains settings that override anything found in \<ModName>\
\<ModName>\settings.json
, which overrides any settings found in \<ModName>\mod.json
(to maintain backwards compatibility)<modname>.overrides.json
in \Mods
(one override file per mod) instead of one override file total (I find this less clean)Ultimately, my plans for BMI include a "bmi troubleshoot" which will grab all mod versions, ModTek Version, BTML version, BT version, and associated log files, and make a zip for the user to upload to us. I also plan on having BMI not just have a CLI but a frontend (think CKAN) and integrating (if possible) with Nexus Mod Manager and Nexus Mods.
I am wondering about this too recently. Separating mod info from mod setting is a much needed first step. Maybe we don't need ModTek support to implemnet that in our mods, but having a standard way to do it will be very welcomed.
FWIW I do this with several of my mods. I manually store settings I want to persist across Mod versions in BattleTech/ModSaves/
You can see examples in https://github.com/BattletechModders/LowVisibility/blob/master/LowVisibility/LowVisibility/Patch/SerializationPatches.cs and https://github.com/BattletechModders/LowVisibility/blob/master/LowVisibility/LowVisibility/Utils/State.cs
Similar functionality exposed through a common API would be extremely useful!
MechEngineer successfully uses two extra settings files, one containing the default settings that is always regenerated after starting the game, and another one where only the changes the user wants are put.
I'd prefer to have somewhere under the Mods directly.. so I can have an RTMods or MyMods directory which contains the actual mods and the settings (and the saves when using the save game features from MechEngineer). That way I can switch between mods just by renaming the whole folder and always have all stats together.
Of course making the default save path for settings configurable would allow for flexibility here.
Many mods already use their own settings folder/files. So we need a new standard. But we also have different logging per mod and different ways of even patching battletech. So not sure if ModTek can fix that this late into the game.
Since the mod.json is managed by the mod author, if a new mod version comes out, one has to overwrite the mod.json with what the mod author provided in the update.
That leads to either losing the settings or painfully having to copy-paste settings around.
By having the settings outside the mod.json, one can avoid this issue altogether, so one can just copy paste updates in the mod folder and be done with it.