StrataSource / Engine

Issue tracker for Strata Source
46 stars 2 forks source link

Mod specific `config.cfg` files in the steam cloud #1164

Open vrad-exe opened 1 year ago

vrad-exe commented 1 year ago

Which component should be improved?

Other

Describe your suggestion

P2CE writes and reads the config.cfg file directly to/from the Steam Cloud, without ever putting it in the game's actual cfg/ directory. This is generally fine, but causes problems for sourcemods; since they run under the same appID as the base game, the result is that settings are shared between all mods, which in many cases is not desired, such as if a mod has custom keybinds.

I originally proposed StrataSource/Engine#1165 as the solution to this, which would disable Steam Cloud entirely for sourcemods, but a better idea would probably be to just add the mod directory name into the name of the file, so mod configs are still stored in the cloud but kept separate from the base game. This means the base game config would become config_p2ce.cfg, and any other mods would have their name added in place of p2ce, e.g. config_mymod.cfg. Note that this name would be determined by the -game parameter passed in, regardless of search paths specified in gameinfo.

For backwards compatibility, if the game was launched and no config_<moddir>.cfg was detected but config.cfg was, it would execute the latter instead, and then delete it from the cloud and re-write it under the new name. Deleting and renaming it is important, because otherwise anyone who played before this point would have all new sourcemods they installed default to their config from right before this change, which is not desirable.

There is also the option of special-casing some things if the mod dir is called p2ce, but I think we want to avoid these kinds of mod-specific hacks. The system I suggested above should work fine without doing this.

vrad-exe commented 1 month ago

Discovered Alien Swarm actually does this already except it puts them in different folders instead of appending to the filename. That's probably the better approach because it means other files could cleanly be stored per-mod too.