Mod Updating
Mod Updating
- Rotated turret tops to point to the right, making them consistent and
interchangeable with weapon art
- Added Mod Requirements - a unified way for mod creators to specify how their
content interacts with other mods. Following new fields are now a part of
ModMetaData:
-- modDependencies
-- incompatibleWith
-- loadBefore
-- loadAfter
- Refer to "MOD METADATA" section for more info.
- Recommended mod Preview image aspect ratio changed to 2.468:1, it takes less
space on info screen. All preview images will be automatically fit into this space.
- Added LoadFolders.xml that allows to have different sets of folders to load
content from per each game version. More in 'LOAD FOLDERS XML' section.
==========================================
=========== MOD FILE STRUCTURE ===========
==========================================
Mods are located in the 'Mods/' folder relative to your RimWorld install folder.
Such as:
-RimWorld/
-Mods/
-YourMod/
Mods can have very different inner structure depending on what they do and what
version(s) of the game they support.
But every mod must define an 'About' sub-folder, that contains an 'About.xml' file:
-YourMod/
-About/
-About.xml
About folder also allows you to place a preview image for your mod:
-YourMod/
-About/
-Preview.png
This image will show up on your mod's info page in game. It can be any size, but
recommended aspect ratio is 2.468:1.
------------------------
-------Mod content------
------------------------
Defs/ - If your mod adds new XML definitions (ThingDef, PawnKindDef, JobDef
etc.), this is the place for them.
There's no strict rules on naming or folder layout for Defs, but
generally it's best to keep it consistent with the base game:
-Defs/
-RecipeDefs/
-Recipes_Production.xml
-Bodies/
-BodyParts_Humanoid.xml
-SoundDefs/
-YourModNewSoundDefs.xml
Languages/ - Custom translation keys. Some cases when you'd to define them:
Make sure you use UTF-8 encoding when saving language files, or
special characters won't show up properly in-game.
Source/ and Assemblies/ - If you're making a C# mod, you'll want to have your C#
project(s) in the 'Source' folder and compile the resulting class libraries(*.dll)
into the 'Assemblies' folder.
Your folder structure will look something like this:
-Assemblies/
-ProjectNameA.dll
-ProjectNameB.dll
-Source/
-ProjectNameA/
-SolutionNameA.sln
-...
-ProjectNameB/
-SolutionNameB.sln
-...
It is important to know that when the game is scanning for your mod's content, it
goes through a list of load folders. You don't have to put all your mod's content
in the root directory.
Each of load folders can hold its own content structure, like this:
-YourMod/
-Common/
-Patches/
-ReplaceTreeTextures.xml
-Textures/
-...
-1.5/
-Patches/
-ReplaceTreeTextures_1_5_Specific.xml
-Textures/
-...
This allows you to have different sets of content per each game version but also
share content between versions if needed.
List of load folders can be defined per each game version in LoadFolders.xml (you
can learn more about writing 'LoadFolders.xml' in 'MOD LOAD FOLDERS' section).
-YourMod/
-About/
-About.xml
-Preview.png
-Assemblies/
-ProjectName.dll
-Source/
-ProjectName.sln
-...
-Common/
-Patches/
-ReplaceTreeTextures.xml
-Defs/
-
-Textures/
-...
-Sounds/
-...
-1.1/
-Patches/
-ReplaceTreeTextures_1_1_Specific.xml
-...
-Textures/
-...
-1.5/
-Patches/
-ReplaceTreeTextures_1_5_Specific.xml
-...
-Textures/
-...
==========================================
============ LOAD FOLDERS XML ============
==========================================
Before loading content for your mod, the game will first check if there is
LoadFolders.xml defined, that has a list of folders for current version.
If not defined, the game will try to fallback to previous version or whatever
available(look at 'Fallback versions' paragraph to learn more).
<loadFolders>
<v1.1>
<li>Common</li>
<li>1.1</li>
</v1.1>
<v1.5>
<li>Common</li>
<li>1.5</li>
</v1.5>
</loadFolders>
Each version entry name must be in format Major.Minor and start with prefix 'v'
(e.g. v1.5).
There must be at least 1 folder defined for each entry.
All folders defined for an entry must exist.
You can add root folder via <li></li> or <li>/</li>, but it's cleaner to keep
content in 'Common'.
When loading your mod, game looks for mod content structures in each load folder
for current version.
Contents of all folders are combined together, and in case two files have the same
path and name, the last one in the list has priority.
So if mods load folders for current game version look like this:
<v1.5>
<li>Common</li>
<li>1.5</li>
</v1.5>
And you have 'Amazing.dll' defined in both 'Common' and '1.5', it will load the
'Amazing.dll' from '1.5'.
Individual load folders can be used conditionally by checking if mods with specific
packageIds are currently active.
This can be done by using IfModActive/IfModNotActive XML attributes. For example:
<v1.1>
<li>1.1</li>
<li IfModActive="Ludeon.Rimworld.Royalty">RoyaltySpecific</li>
</v1.1>
Fallback versions.
If list of load folders for current game version is not defined, the game will
attempt this fallback path:
-Otherwise:
<li>Common</li>
<li>/</li>
-YourMod/
-Assemblies/
-Defs/
-Textures/
-Sounds/
-...
-1.1/
-Assemblies/
-Patches/
-...
-1.2/
-Assemblies/
-Patches/
-...
Or, if you don't need to share Defs, Patches and Assemblies between versions:
-YourMod/
-Textures/
-Sounds/
-...
-1.0/
-Assemblies/
-Defs/
-Patches/
-...
-1.1/
-Assemblies/
-Patches/
-...
-1.2/
-Assemblies/
-Patches/
-...
But be wary that if you define folder named 1.0, the game won't look for Defs,
Patches and Assemblies in root folder.
==========================================
============== MOD METADATA ==============
==========================================
Each mod must include an "About.xml" file located in mod's "About" folder(So the
full path is "About/About.xml").
About.xml defines a single ModMetaData structure, containing following fields:
-----------------------------------------------------------------------------------
--------------------------
- <name> (string, required)
A mod name of your choosing. It's best to keep it descriptive and short.
-----------------------------------------------------------------------------------
--------------------------
- <author> (string, optional)
Your name/nickname. This may help people find your other content or recognize
you. If this field is not specified, game will use "Anonymous".
-----------------------------------------------------------------------------------
--------------------------
- <packageId> (string, required)
A unique identifier by which other mods and the game will refer to a mod.
<packageId> must follow a specific format:
* Alphanumeric characters and dot only.
* No spaces.
* At least one dot.
* No repeated dots in a row, or starting or ending with a dot.
* 60 characters or less.
* Cannot contain word "Ludeon".
Examples:
<packageId>AuthorName.ModName</packageId>
<packageId>AuthorName.ModSeriesName.ModName</packageId>.
Examples:
<supportedVersions>
<li>1.0</li>
<li>1.1</li>
</supportedVersions>
<supportedVersions>
<li>1.0</li>
</supportedVersions>
-----------------------------------------------------------------------------------
--------------------------
- <modDependencies> (list, optional)
A list of mods that have to be installed and active in order for your mod to
function.
This allows player to easily view and resolve dependencies on the mod info page.
Consists of:
* packageId(required)
* displayName(required) - A player-facing name of the required mod.
* downloadUrl - A page where player can get this mod.
* steamWorkshopUrl - This is preferred over downloadUrl in the Steam
version of the game.
Example:
<modDependencies>
<li>
<packageId>ModderName.ModSeries.ModName</packageId>
<displayName>ModName</displayName>
<steamWorkshopUrl>steam://url/CommunityFilePage/123456789</steamWorkshopUrl>
</li>
<li>
<packageId>ModderName.ModSeries.OtherModName</packageId>
<displayName>Other Mod Name</displayName>
<downloadUrl>https://moddername.com/modname</downloadUrl>
</li>
</modDependencies>
-----------------------------------------------------------------------------------
--------------------------
- <incompatibleWith> (list, optional)
A list of mod packageIds that cannot be active at the same time as your mod. They
still can be installed, but not active.
Example:
<incompatibleWith>
<li>Ludeon.Rimworld.Royalty</li>
<li>ModderName.ModSeries.ModName</li>
</incompatibleWith>
-----------------------------------------------------------------------------------
--------------------------
- <loadBefore> (list, optional)
A list of mod packageIds that this mod must precede in load order to work
correctly. Player can use Auto-sort button to resolve these automatically.
Example:
<loadBefore>
<li>ModderName.ModSeries.ModName</li>
</loadBefore>
-----------------------------------------------------------------------------------
--------------------------
- <loadAfter> (list, optional)
A list of mod packageIds that this mod must be after in load order to work
correctly. Player can use Auto-sort button to resolve these automatically.
Example:
<loadAfter>
<li>ModderName.ModSeries.ModName</li>
</loadAfter>
-----------------------------------------------------------------------------------
--------------------------
-----------------------------------------------------------------------------------
--------------------------
You can add custom fields to About.xml that aren't present in the game's code but
may be parsed by other means.
To avoid getting errors about these fields when game is loaded, you can use
IgnoreIfNoMatchingField XML attribute like so:
<customData IgnoreIfNoMatchingField="True"></customData>
-----------------------------------------------------------------------------------
--------------------------
----------------------------------------
------ Versioned About.xml fields ------
----------------------------------------
<descriptionsByVersion>
<v1.1>Some description that will appear only for 1.1.</v1.1>
<v1.2>Some description that will appear only for 1.2.</v1.2>
</descriptionsByVersion>
<modDependenciesByVersion>
<v1.1>
<li>
<packageId>modder.firstmod</packageId>
<displayName>First Mod</displayName>
<downloadUrl>google.com</downloadUrl>
</li>
</v1.1>
<v1.2>
<li>
<packageId>modder.firstmod</packageId>
<displayName>First Mod</displayName>
<downloadUrl>google.com</downloadUrl>
</li>
<li>
<packageId>modder.secondmod</packageId>
<displayName>Second Mod</displayName>
<downloadUrl>google.com</downloadUrl>
</li>
</v1.2>
</modDependenciesByVersion>
If there's a versioned field with data defined for the current version, it will
override the base field's value. Otherwise, the base field will stay the same.