Does load order matter?

Started by CruelBanana, December 25, 2017, 01:43:08 AM

Previous topic - Next topic

CruelBanana

So, does mod load order matter in rimworld, like it does in, for example, skyrim? If it does, where can you find some sort of tutorial, or list which mod should follow which? Or maybe there is some general rule? Right now all I know is that tools go first.

Canute

It depend on the mod.
Some mod's got a requirement of another mod, then that mod should be load before the other.
Since A17 (A16??) modder got a new way to more compatible way to create mods, if modder follow these way, the load order doesn't matter.

But if you still expierence some weierd things or errors, you should move these proper mods at the end, or near the top.

SpaceDorf

Xpathing and patching came with a17.
At the moment there is an adfitional dll around that helps modders to detect mods that coulld conflict or interact positively with their own.
Prime example for this is dusmars Vegetable Garden and Rainbeau Flambes Fertile Fields.

Other mods don't play well with each other because the change an identical thing in the basegame.

The Best way is like canute said. If mod depend on each other load order matters.

When doing something similiar order matters,
Because if the mod does no parches the latest change counts and overwrites any other before ( similiar to skyrim )

Else it is common sense and trial and error  ;D
Maxim 1   : Pillage, then burn
Maxim 37 : There is no overkill. There is only open fire and reload.
Rule 34 of Rimworld :There is a mod for that.
Avatar Made by Chickenplucker

CannibarRechter

> So, does mod load order matter in rimworld

Yes. With Defs, last man wins. You can avoid this a bit, with Patches (patches are processed after all defs), but this just moves the problem downline, as patches are also last man wins. That said, patches touch only a small part of a def, so conflicts are less likely (but still possible).
CR All Mods and Tools Download Link
CR Total Texture Overhaul : Gives RimWorld a Natural Feel
CR Moddable: make RimWorld more moddable.
CR CompFX: display dynamic effects over RimWorld objects

Nightinggale

Quote from: CannibarRechter on December 25, 2017, 08:59:25 AMpatches are processed after all defs
I thought so too and it feels like it. However while working on ModCheck I discovered this is not the case. What happens when the loads are loaded is this:


  • list of loaded mods generated
  • Assemblies are loaded
  • Mod class constructors called
  • Looping all mods
  • For each mod, loop all xml files in Defs
  • For each Def xml file, load it into memory and then apply all patches
  • Once all Def files have been loaded, Def cross references are resolved
Assemblies (2&3) have a first one wins. However it's worse than that since loading multiple different versions of the same assembly file will result in an undefined behavior. I'm currently working on a stable solution for this problem.

As seen in #6, patches are applied to each file when the file is loaded. What's interesting is that nothing takes place between loading the file and patching it, meaning the game can't tell the difference between a patched file or if the Def xml was written as it is post patching. It really is part of the xml loading code.

If there are multiple patches, the order is the mod load order. In a mod, the order is filenames alphabetically. In case of multiple patches in the same file, they are applied top to bottom. The order will only matter if two patches replace the same tag, in which case it is the last one, which is used.

In most cases the mod order will not matter. Changing the order could change minor stuff, like the order of buildings in the build menu, but nothing gamechanging. What will require a specific load order is if a new item has a parent because that will cause an error unless the parent is loaded first.

A general rule is to follow the instructions given with the mod. I have seen a few, which adds some unneeded restrictions, but nothing bad will come from fulfilling all the demands in the description.


ModCheck has two features related to what is mentioned here. One is an error to the user if the load order is wrong. The other is telling which file to patch, which avoids trying to apply the patch to all files with massive speed boosts to follow. Both of those require the mod creator to add PatchOperations to their xml files.
ModCheck - boost your patch loading times and include patchmods in your main mod.

CannibarRechter

> If there are multiple patches, the order is the mod load order. In a mod, the order is filenames alphabetically. In case of multiple patches in the same file, they are applied top to bottom.

Ah. I see what you are saying here, and see the distinction. The end result is about the same, though isn't it? I can see some pathological cases they would be ensuring against in steps 5-6.

BTW, it used to be that various graphics were first man wins. I put in a change request for that, and that popped out in B18.

I'm confused why you are saying load order doesn't matter. If two people use the older method of overriding a def completely, there's going to be a conflict.

Also, you said "apply all patches," but you didn't say what order they are applied in. Is it first to last?
CR All Mods and Tools Download Link
CR Total Texture Overhaul : Gives RimWorld a Natural Feel
CR Moddable: make RimWorld more moddable.
CR CompFX: display dynamic effects over RimWorld objects

Nightinggale

Quote from: CannibarRechter on December 25, 2017, 07:54:09 PMAh. I see what you are saying here, and see the distinction. The end result is about the same, though isn't it? I can see some pathological cases they would be ensuring against in steps 5-6.
In most cases the result will be the same. However there are some cases where the difference matter. I had a bad experience assuming patching afterwards when I first wrote ModCheck and suddenly it would be possible to write a patch file, which was reported to take 10 minutes to load. I optimized the code to how it's actually patched, which makes ModCheck significantly faster than vanilla and this boost is only available because it patches each file individually on load. It might not really matter to the average patch writer, but technically it's a totally different solution with different pros and cons (more pros since ModCheck takes away all the cons  :D)

Quote from: CannibarRechter on December 25, 2017, 07:54:09 PMBTW, it used to be that various graphics were first man wins. I put in a change request for that, and that popped out in B18.
Yeah they actually listen for feedback. I wrote about the issue where butchers set to hauling would haul butcherProducts if any and drop the meat on the floor. The meat was only hauled if the animal had no butcherProducts. I wrote a solution in code on how to fix the problem to make it always haul meat and that change too made it into B18. If people can only haul one thing from butchering (lack of haulers), then people usually prefer to haul meat to the freezer before it rot.

What happens if two mods have graphics with the same name? Did they add modname as prefix to make sure all names are unique?

Quote from: CannibarRechter on December 25, 2017, 07:54:09 PMI'm confused why you are saying load order doesn't matter. If two people use the older method of overriding a def completely, there's going to be a conflict.
Well, I kind of forgot about that. You really shouldn't overwrite Defs. Patching is way more compatible and with ModCheck it's just as fast. Vanilla patching can be kind of a slowdown at startup though.

Quote from: CannibarRechter on December 25, 2017, 07:54:09 PMAlso, you said "apply all patches," but you didn't say what order they are applied in. Is it first to last?
You started by quoting the answer  :P
Quote from: CannibarRechter on December 25, 2017, 07:54:09 PM
> If there are multiple patches, the order is the mod load order. In a mod, the order is filenames alphabetically. In case of multiple patches in the same file, they are applied top to bottom.
So yeah it is pretty much first to last when loading mods. The order for each patch inside the same mod usually doesn't matter at all. In fact I can't think of any good reason why a patch writer would be interested unless verbose logging is enabled, in which case ModCheck will write how long each patch took to apply. Since patches have no names, they are just written in load order, though they do tell which mod they belong to.
ModCheck - boost your patch loading times and include patchmods in your main mod.

CruelBanana

Thanks for clarifying that. Good to know that modding Rimworld is not a huge pain in the ass :)