ccgould / FCStudios_SubnauticaMods

Mods made for Subnautica Game
MIT License
39 stars 23 forks source link

Move to BepInEx #26

Open jet082 opened 1 year ago

jet082 commented 1 year ago

QModManager has been depricated and does not support Subnautica 2.0. BepInEx is the new standard and thus updating the mod has become necessary.

Per the discord:

Hello @everyone,

We're taking the opportunity provided to us by the Subnautica update to retire QModManager in favour of BepInEx.

As a matter of fact, QMM is not actually a mod loader, but a middle step in the mod loading chain. BepInEx was the mod loader we used, then it loads QModManager, then QModManager loads other mods. So QMM is a mod loader for a mod loader. This middle step in QMM was very problematic for us and usually caused hundreds of mods to die on the spot after each Subnautica update. Maintaining and developing QMM was also more complicated than it needed to be because any change made caused problems for already existing mods.

QMM will be archived and only used for Subnautica's Legacy branch on steam and moving on, mods will instead use BepInEx as the mod loader.

What does this mean to me as a mod user? If you're using the Legacy branch in steam for Subnautica, you're fine and no further actions are required.

However, if you're using the latest Subnautica update, "Living Large", you must uninstall QModManager from your game, and look for mods that use BepInEx instead. You can find out how to uninstall QMM in the <#902110747801301023> channel.

What does this mean to me as a modder? This means you'll need to update your mods to use BepInEx instead of QMM. Your mod's entry point must be converted from:

using QModManager.API.ModLoading;
using QModManager.Utility;
using HarmonyLib;

[QModCore]
public static class QPatch
{
  [QModPatch]
  public static void Load()
  {
    var harmony = new Harmony("Your unique mod identifier");
    harmony.PatchAll();
  }
}

To BepInEx:

using BepInEx;
using HarmonyLib;

[BepInPlugin(GUID, MODNAME, VERSION)]
public class MyPlugin : BaseUnityPlugin
{
  // You may also use Awake(), Update(), LateUpdate() etc..
  // as BepInEx plugins are MonoBehaviours.
  private void Start()
  {
    var harmony = new Harmony(GUID);
    harmony.PatchAll();
  }
}

For more information on BepInEx, please visit their docs at https://docs.bepinex.dev.

At the meantime, we're also working on an SMLHelper migration to BepInEx, so stay tuned.

jet082 commented 1 year ago

This seems to be worked on currently in the branch AlterraHub_Mod_Suite_V2. I'd close the issue, but it's probably nice to have listed until the changes are pushed to main.