Modding Help "includes", "priority", and mod load order

Discussion in 'Starbound Modding' started by BrainDDOS, Aug 7, 2020.

  1. BrainDDOS

    BrainDDOS Guest

    Hello all. I am currently trying to order my mods manually due to some conflicts and was wondering if anyone know how the "includes" parameter works in the metadata file.

    My primary concern is ordering

    According to the wiki, the "includes" parameter stipulates "Any mods listed here will be loaded before this mod (regardless of their priority value), if they exist"

    So, consider 3 mods: Mod A, Mod B, and Mod C. Also consider a couple cases.

    Case 1:

    Mod A's metadata file says
    "includes" : ["Mod B", "Mod C"]
    So, my programming intuition tells me that Starbound should load the "includes" parameter from the start to end of the array. In the end it should load like this in terms of load order, from top to bottom,

    Mod B
    Mod C
    Mod A​

    Can anyone confirm this?

    Case 2:

    Mod A's metadata file says
    "includes" : ["Mod C"]
    "priority" : 0​

    Mod B's metadata file says
    "includes" : ["Mod C"]
    "priority" : 1
    With the way priority works, would Mod C be loaded twice? Here is what i think the final mod order will be

    Mod C
    Mod A
    Mod C
    Mod B
    Is this correct? Or, since Mod A already load Mod C, would it be like

    Mod C
    Mod A
    Mod B
    Any help is appreciated! Thank you!
     
    Last edited by a moderator: Aug 7, 2020
  2. bk3k

    bk3k Oxygen Tank

    The order of loading mods in the "includes" array will be unchanged from what would otherwise happen. The difference is when Mod A loads, which would be after Mod B and/or Mod C (if one or both also exist). Lower numeric "priority" mods will load before high numbers. The base game is -9999 and the default is 0. Of course "includes" takes precedence over "priority".

    Note that "requires" functions identically to "includes" but with the exception of also requiring those listed mods. If they aren't present, then the game will silently terminate upon opening, although the log will explain why. I feel they should have a pop-up error for this case, but there is none.

    There is an exception case to "includes" and "requires". If you have some mods in /starbound/mods/ and some workshop mods, the workshop mods will load in a different phase after /mods/ do regardless of what you do.

    Note that "includes" is itself a little misleading for what it does. It should say "load_after" or something like that. Mod C will only be loaded once, as you can confirm in your logs. Since it would be then listed twice. Also that would create patching issues - like trying to remove the same path twice.

    Regarding load order, I've heard (but not personally confirmed) that the default load order may be different on Windows and Linux systems. I've never confirmed this, but apparently that can be an issue for servers that don't allow asset mismatch since the Asset Digest would be different with a different load order. That too can be solved with some effort.

    sbinit.config also provides a method to control load order in terms of your local copy of starbound, rather than doing it inside mods.
    Code:
    {
      "assetDirectories" : [
        "../assets/",
        "../mods/"
      ],
    
      "storageDirectory" : "../storage/"
    }
    Because as you see, you could make a custom array for "assetDirectories". I think (but have not confirmed) that when Starbound is normally loaded from Steam (and when not in "offline mode"), that it adds this to the end of this array -
    Code:
    "../../../workshop/content/211820"
    So that in reality you have
    Code:
    {
      "assetDirectories" : [
        "../assets/",
        "../mods/",
        "../../../workshop/content/211820"
      ],
    
      "storageDirectory" : "../storage/"
    }
    For each of these directories listed, it will also recurse 1 subdirectory deep. If you needed to finely control your local load order, you could point it directly to the mod's own directory. Obviously this could be a pain to do if you had a lot of mods, so it could be generated instead with a script. You can edit the existing file, or use the switch
    Code:
    -bootconfig <bootconfig>
     
  3. BrainDDOS

    BrainDDOS Guest

    So since /mods/ is loaded independent to Steamworkshop mods, wouldnt adding folders under all be loaded independently as well? I was thinking you could subscribe to the mod and have that the same mod under the added directory. However, I've heard that adding a Steamworkshop mod and that same mod under /mods/, it would crash. This would also possibly happen?

    In a since, mods loaded under the added directory are independent as well?

    Thanks for your answers! I am currently trying to build a Mod Manager (compatible with Steam) using Python that unpacks mods, read the metadata file, the "requires" & "includes" parameters, and allows the user to set priority based on the "priority" parameter (similar to Mod Organizer, if you have ever played Skyrim), while also satisfying the "requires" & "includes" parameters. Finally all the mods would be repacked and put back into their respective Steam folders. Since Steam only replaces the .pak files whenever that mod is updated, it should theoretically work.
     
  4. Nikoh

    Nikoh Space Hobo

    Last edited: Jan 22, 2021
  5. BrainDDOS

    BrainDDOS Guest

    Sorry for the necro, but I am back at making the mod manager. Since my career is making Python GUIs full-time, I thought maybe I'd get back at this. Relevant link: https://community.playstarbound.com/threads/community-interested-mod-manager.161946/

    Here is what I have so far: https://github.com/jessemodesto/Starbound_Mod_Manager
    The main.py unpacks all the .pak files in a directory's children (Steam Workshop's 211820 folder for example) and places a folder of all unpacked mods in project directory. Will continue when I find more about mod ordering.

    I am still trying to order mods. Currently, I think the only way is to unpack every mod and edit the metadata file to change priority. Let me know if there is another way. The method you suggested did not work:

    Using this method did not work.
    Here is my sbinit.config (I ordered it backwards than what is normally loaded in the starbound.log):

    Code:
    "assetDirectories" : [
      "..\\assets\\",
      "..\\mods\\",
       "..\\..\\..\\workshop\\content\\211820\\1107561606",
       "..\\..\\..\\workshop\\content\\211820\\902555153",
       "..\\..\\..\\workshop\\content\\211820\\885877773",
       "..\\..\\..\\workshop\\content\\211820\\729427744",
       "..\\..\\..\\workshop\\content\\211820\\733665104"
      ]
    
    Here is the starbound.log:

    Code:
    [18:30:33.048] [Info] Root: Scanning for asset sources in directory '..\..\..\workshop\content\211820\1107561606'
    [18:30:33.048] [Info] Root: Scanning for asset sources in directory '..\..\..\workshop\content\211820\902555153'
    [18:30:33.178] [Info] Root: Scanning for asset sources in directory '..\..\..\workshop\content\211820\885877773'
    [18:30:33.182] [Info] Root: Scanning for asset sources in directory '..\..\..\workshop\content\211820\729427744'
    [18:30:33.192] [Info] Root: Scanning for asset sources in directory '..\..\..\workshop\content\211820\733665104'
    ...
    [18:30:33.708] [Info] Loading assets from: 'C:\Program Files (x86)\Steam\steamapps\workshop\content\211820\902555153\contents.pak'
    [18:30:33.854] [Info] Loading assets from: 'C:\Program Files (x86)\Steam\steamapps\workshop\content\211820\733665104\contents.pak'
    [18:30:33.855] [Info] Loading assets from: 'C:\Program Files (x86)\Steam\steamapps\workshop\content\211820\1107561606\contents.pak'
    [18:30:33.855] [Info] Loading assets from: 'C:\Program Files (x86)\Steam\steamapps\workshop\content\211820\885877773\contents.pak'
    [18:30:33.857] [Info] Loading assets from: 'C:\Program Files (x86)\Steam\steamapps\workshop\content\211820\729427744\contents.pak'
    
    This is similar to the original starbound.log and original sbinit.config where no changes were made:

    Code:
    18:22:39.988] [Info] Root: Scanning for asset sources in directory 'C:\Program Files (x86)\Steam\steamapps\workshop\content\211820\733665104'
    [18:22:40.006] [Info] Root: Scanning for asset sources in directory 'C:\Program Files (x86)\Steam\steamapps\workshop\content\211820\729427744'
    [18:22:40.053] [Info] Root: Scanning for asset sources in directory 'C:\Program Files (x86)\Steam\steamapps\workshop\content\211820\885877773'
    [18:22:40.079] [Info] Root: Scanning for asset sources in directory 'C:\Program Files (x86)\Steam\steamapps\workshop\content\211820\902555153'
    [18:22:40.235] [Info] Root: Scanning for asset sources in directory 'C:\Program Files (x86)\Steam\steamapps\workshop\content\211820\1107561606'
    ...
    [18:22:40.582] [Info] Loading assets from: 'C:\Program Files (x86)\Steam\steamapps\workshop\content\211820\902555153\contents.pak'
    [18:22:40.752] [Info] Loading assets from: 'C:\Program Files (x86)\Steam\steamapps\workshop\content\211820\733665104\contents.pak'
    [18:22:40.753] [Info] Loading assets from: 'C:\Program Files (x86)\Steam\steamapps\workshop\content\211820\885877773\contents.pak'
    [18:22:40.756] [Info] Loading assets from: 'C:\Program Files (x86)\Steam\steamapps\workshop\content\211820\1107561606\contents.pak'
    [18:22:40.756] [Info] Loading assets from: 'C:\Program Files (x86)\Steam\steamapps\workshop\content\211820\729427744\contents.pak'
    
    Notice that 885877773 and 1107561606 are swapped. I looked into the metadata files for both and they both do not have a "priority" defined. I looked at the other mods' metadata files and they were loaded in order of priority:

    902555153: priority == -9998
    733665104: priority == -1
    885877773: priority ==
    1107561606: priority ==
    729427744: priority == 100

    Mods 885877773 and 1107561606 are the only that follow load order via sbinit.config, otherwise the game loads mods normally via "priority" and "requires"/"includes". Mod 729427744 has a priority of "100", so I can only assume if it has no "priority" defined it defaults to 0

    Am I missing something? Is there another way to order mods?
     
  6. Genevra

    Genevra Scruffy Nerf-Herder

    could always parse or create the Metadata files inside the pak files and change priority as desired when user saves changes
     

Share This Page