How to persist values across saves

What happens if a mod user downloads the main mod but not the Mod Options API mod? Will the main mod still fully function with default settings, or will it fail to load/activate? If the latter, then this might not be a good solution for button-clicking-without-reading mod users, and there are many. This site doesn't have a way to handle dependency mods on download afaik, and the link in your example mod is easy to miss even for people that do scan the mod description.
The mod still loads, even with the dependency listed in modinfo. For now, it fails silently with game-standard behavior but it would be possible to notify the user with a popup when that happens. Maybe with a link to the downloads page for the requirement. It's a downside for interdependent solutions until there's steam mods or a mod manager, but I think the pattern is so useful for development that it is still worth the extra hassle.
 
It's what i wrote last week and Leo wrap in a the ModSettingsManager already.

It's a good thing to have a true mod for doing it all.
What missing: Some sort of lock just before read before writing to avoid any overwrites.
Is a lock necessary? JS is single threaded and localStorage is synchronous, at least in the spec.
 
doing mod option is a step, the real one would be a ModCustomizerManagerMod
Agreed, a good next step would be separating out mod settings to their own page. My mod already has the registration of customizable settings. I don't think it would be easy/possible to enforce the behavior of registered options to avoid 37 yield color changes though, even if we all want that.
 
The mod still loads, even with the dependency listed in modinfo. For now, it fails silently with game-standard behavior but it would be possible to notify the user with a popup when that happens. Maybe with a link to the downloads page for the requirement. It's a downside for interdependent solutions until there's steam mods or a mod manager, but I think the pattern is so useful for development that it is still worth the extra hassle.
I understand the usefulness from a development view, but from a users perspective it would be better if a mod works standalone, imho. Many mods already overwrite scripts from the game, so why not have mods sort of "overwrite your framework" and use the code for this inside their mod so they can work independently and still work fine next to each other. So a template, like @leonardify posted a few posts back, instead of a framework?

Personally I would try to avoid a mod dependency as a developer, to avoid all the extra "your mod doesn't work" messages and reviews and the extra support needed because people don't read properly, whether it's a description page or an in-game popup.
And as a mod user I'm not fond of mods depending on a mod from another developer. Who to ask if something is off. Will the main mod still work if the framework mod is updated? What happens if the main mod needs to update for a new version of the framework mod, but I have two main mods depending on the framework and they're not updated at the same time?

However, if you could make it so that the main mod doesn't fail when the framework mod isn't there, then it would be fine. Then it is still independent.
 
I share the @Finwickle idea here, having dependencies right now without a mod manager to handle may create a lot of friction in user.

I really like your proposal to be clear, but we don’t have the tools to make it work in a simple way.
Maybe you can transform it in a single-file snippet, so that it’s easier to integrate it in existing mods? Maybe extending the existing ModSettingsManager?

I’m working anyway on a Mod Manager which potentially could solve this, but I’d wait since it could take some time and we can’t be sure of adoption.
 
I share the @Finwickle idea here, having dependencies right now without a mod manager to handle may create a lot of friction in user.

I really like your proposal to be clear, but we don’t have the tools to make it work in a simple way.
Maybe you can transform it in a single-file snippet, so that it’s easier to integrate it in existing mods? Maybe extending the existing ModSettingsManager?

I’m working anyway on a Mod Manager which potentially could solve this, but I’d wait since it could take some time and we can’t be sure of adoption.
I,m near end of Mod Manger integrated in GameOption on dedicated pane and a switch to seteup each mod.
 
Last edited:
here a sneak peck:


during option declaration, it take an additional property 'mod' :

mod: { value: "lf_yields", label: "LOC_OPTIONS_MOD_LF_YIELDS", tooltip: "LOC_OPTIONS_MOD_LF_YIELDS_TOOLTIP" },

if my mod not here and 'mod' property in declaration -> normal display in defind category

You can use same mod value form different mod to pack multiple mod under a screen if u made some sort of coexistant mods.
i not it but multiple group shouldn't be a problem.

and it render like:

Projet sans titre.gif


any suggestion ?
 
Last edited:
So if I understand it correctly, your mod catches other mods declaring settings if they add the 'mod' property and then redirects those settings to the new Mod tab in the game options?
And if a user doesn't have your mod, it will just go to System or Game or where the creator put it?

So no inter-dependence, just brilliance? :cool:
 
So if I understand it correctly, your mod catches other mods declaring settings if they add the 'mod' property and then redirects those settings to the new Mod tab in the game options?
And if a user doesn't have your mod, it will just go to System or Game or where the creator put it?

So no inter-dependence, just brilliance? :cool:
yes, i capture presence of 'mod' property and use it to display it as needed in the need TAB instead of It's declaraed location

With no mod, game just totally ignore the new property. and crate the option inside declared Category

I may share put project on github to make it community project
 
Last edited:
yes, i capture presence of 'mod' property and use it to display it as needed in the need TAB instead of It's declaraed location

With no mod, game just totally ignore the new property.
Sounds pretty awesome. I approve!
 
yes, i capture presence of 'mod' property and use it to display it as needed in the need TAB instead of It's declaraed location

With no mod, game just totally ignore the new property.

I may share put project on github to make it community project
so players wouldn't see my mod options at all, unless they installed your mod first? no, i cannot have such an essential feature dependent on a third party. for one thing, i don't want the support and trust burden of having to tell my users to install somebody else's mod.

a bunch of my mod features exist specifically because i was using another mod that i really liked, but it had bugs or conflicts or other features that got in my way. i really appreciate that you've made this work available, but i can't rely on external dependencies for core features.

(oops, i just read back a little further and realized that @Finwickle already said roughly the same thing)
 
no, the game use Category u define if Manager not installed.

take an exemple:

Code:
 Options.addModOption({
    id: 'show-yields',
    category: CategoryType.Game,
    group: MOD_OPTIONS_GROUP,
    mod: { value: "lf_yields", label: "LOC_OPTIONS_MOD_LF_YIELDS", tooltip: "LOC_OPTIONS_MOD_LF_YIELDS_TOOLTIP" },
    type: OptionType.Checkbox,
    defaultValue: false,
    label: "LOC_MOD_CSL_SHOW_YIELDS_ON_LOAD_OPTION",
    description: "LOC_MOD_CSL_SHOW_YIELDS_ON_LOAD_OPTION_DESC",
})


What the Manager do:
- detect ModOption with 'mod' property and keep them for 'Mods' category
What Base game do:
- totally ignore 'mod' property and create option under "Game" category
 
Last edited:
I share the @Finwickle idea here, having dependencies right now without a mod manager to handle may create a lot of friction in user.

I really like your proposal to be clear, but we don’t have the tools to make it work in a simple way.
Maybe you can transform it in a single-file snippet, so that it’s easier to integrate it in existing mods? Maybe extending the existing ModSettingsManager?

I’m working anyway on a Mod Manager which potentially could solve this, but I’d wait since it could take some time and we can’t be sure of adoption.
yes, this is what i had in mind too, a snippet that modders can include to interface with any shared infrastructure. a few folks asked me to investigate the possibility of adding a sharable Mod Options tab because of the custom City Details tab that i did. i was just starting to look into it when i ran across this.

my preference would be a small script that only creates an extra tab, in the same style as the others but starting from a blank slate. ideally it'd be a small, idempotent script or fragment that would create the new tab (only) if necessary, and then you add options to it just like you would with the original tabs. ideally it'd also be simple enough that nobody would ever need to update or change it (unless Firaxis makes a breaking change, like with the lens panel). that probably means no fancy features like the dropdown selector, but also much less chance for incompatibility or other breakage.
 
Last edited:
yes, this is what i had in mind too. a few folks asked me to investigate the possibility because of the custom City Details tab that i did. i was just starting to look into it when i ran across this.

my preference would be a small script that only creates an extra tab, in the same style as the others but starting from a blank slate. ideally it'd be a small, idempotent script or fragment that would create the new tab (only) if necessary. ideally it'd also be simple enough that nobody would ever need to update or change it (unless Firaxis makes a breaking change, like with the lens panel). that probably means no fancy features like the dropdown selector, but also much less chance for incompatibility or other breakage.
without drop down it will be a mess with XXX option quickly ...
If u have multiple mod, u can put same 'mod' value and it will generate a single entry in the drop down
 
if it got too chaotic, i was going to look into accordions so that you could collapse stuff you don't need. i think it's important for discoverability to have everything visible by default.

apologies for the misunderstanding earlier. i thought you were saying that the game would ignore the options if the tab didn't exist.
 
if it got too chaotic, i was going to look into accordions so that you could collapse stuff you don't need. i think it's important for discoverability to have everything visible by default.
I agree with this. Seeing all the mod options at a glance is preferable, and if there are too many a scrollbar would be better, and more in style with the other options tabs, than a dropdown.

How many users will have 15+ mods with options? By the time we get there, Firaxis might have brought us modding tools and some form of mod options / manager. For now, I'd say we go with all options visible directly in the tab.
 
Back
Top Bottom