Profile system #163
Labels
design
Concerns the architecture of the engine
enhancement
New feature or request
modding
Concerns new modding features beyond the scope of porting vanilla's codebase.
refactoring
This requires refactoring existing code
Projects
This is inevitable, because upgrading mods isn't a well-supported use case, and everyone else does it in their own modding scenes anyway.
Right now, there is no path redirection for things like
require("mod.my_mod.api.Whatever")
. There is an assumption that you will only ever have one version of a mod "installed" at a time, which right now means "it exists in themod
folder."The profile system would enable you to have more than one version of a mod installed. "Installed" in this case would now mean "there is a version
X.Y.Z
of this mod available for profiles to use." There would be some saved metadata that points to the profile to use, and each profile would get its own folder and some kind ofactive_mods
list that contains the mod paths to load. Per profile, only one copy of a mod would be active at a time, the same as it is now.mod
would now contain folders likeevolution-0.1.0
andevolution-0.2.1
beside one another, but otherwise their contents would remain exactly the same as before.Then the runtime would do some require path hackery in
env
to redirect paths undermod.<...>
to point to the currently active mod. The list of mods to load would be separate fromconfig
, as it needs to be loaded very early in the startup cycle.As a user, you would be able to create and switch profiles from the title screen, but the changes would only get applied on the next startup. There would be one "default" profile with only the base mods (
base
,elona
) that gets generated on first run, and the rest you can add in whatever else you want.Save files (and their backups, from #158) would be partitioned per profile.
Eventually we might consider adding a "locking/unlocking" mechanism like npm's lockfiles so you can upgrade mods, but because upgrading mods is a very complex feature I'd rather put it off until the need becomes pressing. For now, if you have at least one save inside a profile and you want to change its mod configuration in an incompatible way (anything besides adding a new mod that doesn't cause a dependent version incompatibility) then you'd have to duplicate the profile first, along with its saves.
The text was updated successfully, but these errors were encountered: