Resource icon

Mod, Component, & File Load Order as of Winter Patch

PlotinusRedux

Warlord
Joined
Jul 11, 2013
Messages
196
[Edit1]Added Suggested <LoadOrder> Convention[/Edit1]

Note--most mods won't have to worry about any of the below because they have no reason to care about load order. This information is really only necessary if you want to modify DLC content or the contents of other mods or you're working on a compatibility issue with another mod that could be resolved by altering load orders.

Default Order


The default load order of mods for new games is by ModRowId in mods.sqlite, which basically means mods are loaded in the order they were added to the database, with them being re-added any time the modified date of their .modinfo file changes.

When a saved game is loaded, however, mods load in alpha-numerical sort order by Mod Id--the GUID used as the "id" attribute in the root <Mod> element of the .modinfo file. If the last added Mod's id starts with "00", say, it will load last during game creation (since it was added last), but first when a game is reloaded, even before any DLC.

Basically, if your mod has load order dependent elements, don't rely on the default load order of mods--it may appear to work during your testing, but that's probably just because it's the last mod whose .modinfo you changed.

The default order of components is to load with their mods in the order in which they appear in it's .modinfo file.

The default order of files is to load with their components in the order in which they appear in the .modinfo's <Files> element, not in their order within the component. [Edit1]This default order seems rather kludgy, so I would suggest not relying on it as I wouldn't be surprised to see it change in the future, so I would suggest always using the Priority attribute (see below) to explicitly determine file order when order matters.[/Edit1]

Changing Mod Load Order


A mod will always load after any mods in its <Dependencies> list in .modinfo. However, you don't really want to use this unless unless your mod really requires the other mods to run.

There is also a <References> element which *should* force a mod to load after any mods listed there without actually requiring those mods like <Dependencies>, but it currently appears to be broken.

There currently is no reliable way to control the load order of mods. However--

Changing Component Load Order Across Mods

The <Properties> element of a component may contain a <LoadOrder>X</LoadOrder> element where X is a positive or negative integer acting globally across mods to determine the load order of the component, with lower numbers loading earlier. Thus, an <UpdateDatabase> with a <LoadOrder> of -1 will always load before the DLC content and any component of any mod that didn't specify a lower <LoadOrder>, regardless of the order the mods themselves load in. A <LoadOrder> of 1 would of course cause it to load after the DLC and any component of any other mod that didn't specify a load order.

So if you want to modify the units added by the DLC, just specify a <LoadOrder> >= 1 to make sure your component runs after the DLC components.

I've personally tested this with <UpdateDatabase>, <GameplayScripts>, and <ModArt>--it definitely works with the 1st 2, and definitely does not work with <ModArt>.

[Edit1]Suggested LoadOrder Conventions

I'll update this area as people offer better ideas or if there seems to be a consensus on a different system, but off the top of my head I'd suggest the following conventions for <LoadOrder> values:

(1) Make all your <LoadOrder> values multiples of 100, so if someone needs to slip in between the DLC and your mod or between 2 components of your mod they have room to do so;

(2) Split your <UpdateDatabase> stuff into 2 categories and put it in 2 different <UpdateDatabase> components:

(A) Stuff that is just adding/modifying/deleting individual units, buildings, etc.;
(B) Stuff that is meant to change all members of some category, like an UPDATE statement meant to change the movement of all light cavalry units.

For elements in (A), don't specify a <LoadOrder> unless you're operating on an individual item add by the DLC, in which case use a value < 10,000;

For elements in (B), specify a <LoadOrder> >= 10,100, to leave plenty of room beneath your component for other mods to add/delete/etc. things they would like your mod to affect.

(3) If you need to slip between the DLC and another Mod, 2 Mod components, etc., use the number half way between the 2 of them, to leave room for others that might need to slip between you and them latter.
[/Edit1]

Changing File Order Within Components


Under the <Items> element of any component, the <File> element may specify a Priority X like <File Priority="1">SomeFile</File>, which will determine the load order of the file within the component, overriding the order in the <Files> element off the root. X may be positive or negative, defaulting to 0 when not specified, and opposite of <LoadOrder>, higher numbers load earlier. The Priority has no effect on the same file in other Components or on the load order between components--it is strictly local to the <Items> element of the current component.

Changing Dep/ArtDef Load Order

Unfortunately there's no good answer here yet. <LoadOrder> has no effect on the order of <ModArt> components.

I've currently found no better solution than the one @Gedemon is using with R.E.D, where he's made 3 separate mods: the base RED Mod, a RED for MoarUnits extension, and an RED for Polish DLC extension. For the extensions, to use the MoarUnits one as a an example, he is adding the base RED mod and the MoarUnits mod to <Dependencies> in .modinfo and adding MoarUnits.dep's GUID to the extensions <RequiredGameArtIDs> like so:

Code:
<RequiredGameArtIDs>
        <Element>
            <name text="MoarUnits"/>
            <id text="8342b98d-80c7-4002-87bb-419646bd9b54"/>
        </Element>
    </RequiredGameArtIDs>

It's messy and ugly and requires a separate extension mod for each additional compatibility. Although note, this is only necessary in order to apply the R.E.D. look to the additional units in MoarUnits and the DLC--if you're just adding a new unit and an artdef for it, you won't have to worry about any of this (though @Gedemon will if your mod becomes popular).
 
Last edited:
I added a section on Suggested LoadOrder Conventions. If anyone has any better ideas regarding that, please share them--this was just an off-the-top-of-my-head thing to get in before everyone started just using 1, 2, 3, etc.
 
Is your avatar actually your picture? I know probability is low but I'm old myself (started with Civ 1)
...
Still younger though :p
 
Is your avatar actually your picture? I know probability is low but I'm old myself (started with Civ 1)
...
Still younger though :p

Lol, no, it's J R R Tolkien. I don't look much younger, though, and have less hair.... I started with Civ 1 as well, it was the reason I switched from my Commodore 64 to a 386.
 
When I ran into the mod loading order problem I tried to use <References> to get AI+ to load before my mod, it actually seemed to work for game creation, but I guess that was just because I changed the mod and therefore landed in last place of the mod table again. Loading savegames wasn't possible of course, because there to load order is different again.
So thank you for informing us, now I can fix this with the LoadOrder tag.
 
Lol, no, it's J R R Tolkien. I don't look much younger, though, and have less hair.... I started with Civ 1 as well, it was the reason I switched from my Commodore 64 to a 386.
I thought I saw that face somewhere... :D
And I cant remember if I played civ 1 on 286 or 386, I think it was around that time I changed CPU.

Sorry for the out of topic.
 
On a side note, I created a windows app (https://forums.civfanatics.com/threads/civ-6-mod-manager-experimental.609142/ ) to create mod sets that merge files to resolve incompatibilities in imported and artdef files that does enforce the <References> tag, so it's still useful to include it even if Firaxis isn't currently honoring it. And hopefully Firaxis will fix it themselves in the next patch.
 
Last edited:
Changing Component Load Order Across Mods
I've question about LoadOrder. Is it applied to all mods and components within them (I.e. Like one set of values) or for each component type separate (I.e. Like first the game will process UpdateDatabase, then GameplayScripts, then next type, etc)?
 
Have anyone noticed that references can also be put into Component sections?This may be the reason why references/dependencies on mod-level do not work - they might be moved level down into components.

And it's actually supported by ModBuddy. When you add a reference into e.g. UpdateDatabase component, the following will be generated in modinfo:

Code:
  <InGameActions>
    <UpdateDatabase id="RealEraStop_Database">
      <Required mod_id="08F3DDAD-42FF-3D72-2570-91D662B3326B" action_id="RealTechTree" />
      <File>RealEraStop.sql</File>
    </UpdateDatabase>
  </InGameActions>

Notice that the reference does not support Version parameter but only ID of the specific component.

Edit: After some further testing it seems that this entry does nothing, actually. It doesn't create any dependencies between mods.
 
Last edited:
Dependencies work on mod level.
 
Dependencies work on mod level.
I did some further testing and it's not quite true in Civ6.

The following example:
  • ModA has ID=70 in Mods.sqlite and ModB has ID=71 in Mods.sqlite. ModA has 2 components: UpdateText and UpdateDatabase.
  • Default loading order is as stated in the 1st post: ModA both components => ModB
  • However, when I added LoadOrder=9999 to ModA.UpdateDatabase, the load order was: ModA.UpdateText => ModB => ModA.UpdateDatabase
  • When I added LoadOrder=999 also to ModA.UpdateText, the load order was: ModB => ModA both components
 
When I said "Dependencies work on mod level", it was relative to References and Blocks who do not work at all on mod level ATM.

If you set dependencies for the whole mod, it's used instead of Mod ID.

But as you've seen the order is set a the lower level first, the higher level is used for all components that does not have an order property.

BTW anyone have tested load order for Art since the last patch ? It will be needed more than ever now that Deliverator has made such progress with the tools.
 
When I said "Dependencies work on mod level", it was relative to References and Blocks who do not work at all on mod level ATM.
Ok, now it's clear:
<Dependencies> - do work on mod level, same as C5
<References> / <Blocks> - do not work in C6
 
Sorry for the necro, if there's a more recent thread that deals with this please direct me to it.

Is the OP still correct with the latest patches? Specially, do <References> and <Blocks> work now? I also have a few other questions which are still bothering me.

Say I have two mods A and B. A has component X (LoadOrder=-1) and Y (LoadOrder=1), while B has component Z with LoadOrder undefined (=0). Am I correct in thinking that the load order would be X, Z, Y? What happens if mod A has mod B listed as Dependency or Reference (assuming the later works)? Is it still X, Z, Y or does it become Z, X, Y?

Secondly, what order are components within a single mod loaded if they have equal LoadOrder? What's the best way to ensure that my components are loaded sequentially in the exact order I want them to, without interfering or getting mixed with the loading of other mods?

Thirdly, are people sure that Priority works for individual files? I haven't done rigorous tests but I definitely felt like it didn't work when I doing lots of modding this summer.
 
I am not sure Priority was not broken by the Summer17 patch. Since that patch I cannot really say I've been able to rely on file priority.

In your example, regardless of Dependancy or Reference settings the load order of the actions will be X > Z > Y

Neither References or Dependancies create a load order for files. Dependancies seemed to before the Summer17 patch, but no longer do so.

If actions within a single mod or across mods have the same LoadOrder setting (remember that the default value is "0"), then the rules regarding filename alpha-numerics begin to apply as well as mod enabling order across multiple mods. But when reloading a saved game using the same set of mods (including DLC) the order will not necessarily be the same as when the game was first created, even if no mods have been updated, or if no mods have been disabled and re-enabled.

You only need to worry about the "mixing" or "interfering" with other mods re loading order when one or more mods are adjusting the same things in the game's database or are relying on data from another mod (or DLC). Otherwise it should never matter which order files from various mods load into the database.

The only reliable method to force file load order within a single mod that I've found across all the various patches is to create a seperate action for each file with an ascending LoadOrder setting for the action to ensure that files which need to load 2nd will always load 2nd, files which need to load 3rd will always load 3rd, etc.

Across multiple mods again the only reliable method I've found is LoadOrder.

But LoadOrder I think does not work for art assets. It only works for UpdateDatabase, UpdateText, ImportFiles, and as I recall UpdateIcons action-types.
 
Top Bottom