Editing Modding Tutorials/Mod folder structure

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
#REDIRECT [[Modding_Tutorials/Mod_Folder_Structure]]
+
This tutorial introduces you to the mod folder structure and shows you a standard folder structure setup to help you start out.<br/>
 +
 
 +
[[Modding Tutorials/Mod folder structure#Complete mod folder structure|Complete mod folder structure]] is a list of all folders you might find in your average mod directory. This includes /Core/.<br/><br/>
 +
 
 +
=What you'll learn=
 +
 
 +
You'll learn the following mod structure:<br/>
 +
 
 +
  YourModName/
 +
    About/
 +
      About.xml
 +
      Preview.png
 +
    Assemblies/
 +
      ProjectName.dll
 +
    Defs/
 +
      (..)
 +
    Languages/
 +
      English/
 +
        Strings/
 +
          NameBanks/
 +
    Sounds/
 +
    Source/
 +
      ProjectName/
 +
        ProjectName.sln
 +
    Textures/
 +
 
 +
.. Along with a few tips on how to keep your mod folder structure readable and functional.<br/><br/>
 +
 
 +
=Standard mod folder structure=
 +
 
 +
==The About folder==
 +
 
 +
Making a mod starts with you making a folder structure. Some mods need textures and sounds, while others are XML or even C# only.<br/>
 +
Every mod does however require the following structure to show up in the mods list:<br/>
 +
 
 +
  YourModName/
 +
    About/
 +
      About.xml
 +
 
 +
Along with this vital information it's possible to add a preview image for your mod. This makes the structure as follows:<br/>
 +
 
 +
  YourModName/
 +
    About/
 +
      About.xml
 +
      Preview.png
 +
 
 +
The size of the base game Preview.png is 400x61 pixels, but some mods use higher preview images. The image is centered in the mod's description, and can be of any size.<br/><br/>
 +
 
 +
==The Defs folders==
 +
 
 +
If your mod adds new content, chances are you're going to use XML files. These files are going to be stored in the folder structure as follows:<br/>
 +
 
 +
  YourModName/
 +
    Defs/
 +
      BiomeDefs/
 +
        Biomes.xml
 +
      BodyDefs/
 +
        Bodies.xml
 +
      BodyPartDefs/
 +
        BodyParts.xml
 +
      (..)
 +
 
 +
The contents of a Def folder don't follow a clear naming convention, but the folder names are generally the same in every mod.<br/>
 +
Using a non-standard name is going to make it harder for others to navigate your mod's folders, so it is advised to keep the folder names consistent with the base game.<br/><br/>
 +
 
 +
Typically, the files inside these folders are named after their contents:<br/>
 +
 
 +
  Core/
 +
    Defs/
 +
      ThingDefs/
 +
        Apparel_Hats.xml
 +
        Apparel_Shield.xml
 +
        (..)
 +
        Weapons_Melee.xml
 +
        Weapons_RangedNeolithic.xml
 +
 
 +
This makes it easier for people to navigate XML code. If your mod is going to add both apparel and weapons, or even both hats and shoes, you're best off separating the XML code in their respective files.<br/>
 +
Some mod authors choose to make a separate file for each of their items. This makes it easier for others to remove only part of your mod and keep the rest of it, but with very large mods it makes it harder to navigate the folder.<br/><br/>
 +
 
 +
==The Textures and Sounds folders==
 +
 
 +
If you're using Defs chances are you're creating a content mod. This type of mod is most likely very dull without its own custom graphics and sounds. Adding such content requires the following folders:<br/>
 +
 
 +
  YourModName/
 +
    Textures/
 +
    Sounds/
 +
 
 +
The contents of the Textures and Sounds folder usually aren't the same between mods. The base game sorts these files in various folders and subfolders, but in the end it's very hard to navigate them based on the folder names.<br/>
 +
It's possible to categorize this content by item (submachinegun#1, pistol#3) or item type (guns, buildings), as an example. Whatever you do it's best to keep the structure consistent throughout both folders.<br/><br/>
 +
 
 +
==The Source and Assemblies folders==
 +
 
 +
If you want to take a shot at [[Modding Tutorials/Writing custom code|C# modding]], you want a Source and an Assemblies folder. You'll want to create the C# project inside your Source folder, and compile the class library into the Assemblies folder:<br/>
 +
 
 +
  YourModName/
 +
    Assemblies/
 +
      ProjectName.dll
 +
    Source/
 +
      SolutionName/
 +
        ProjectName/
 +
          ProjectName.sln
 +
          (..)
 +
 
 +
''Or:''
 +
 
 +
  YourModName/
 +
    Assemblies/
 +
      ProjectName.dll
 +
    Source/
 +
      ProjectName/
 +
        ProjectName.sln
 +
        (..)
 +
 
 +
The structure of these folders is decided almost entirely by the author's editing software. Therefore the only things you have to set up are the following folders:<br/>
 +
 
 +
  YourModName/
 +
    Assemblies/
 +
    Source/
 +
 
 +
.. And then once you create a solution starting in ../YourModName/Source/ everything else will be sorted out by the software. People don't navigate these folders, they open ProjectName.sln to navigate it using their software of choice.<br/><br/>
 +
 
 +
==The Languages folder==
 +
 
 +
Unless you're on a translation team, you're unlikely to need this folder a lot. If you want to randomly generate names using your own words, you will however have to use this folder:<br/>
 +
 
 +
  YourModName/
 +
    Languages/
 +
      English/
 +
        Strings/
 +
          NameBanks/
 +
 
 +
In this folder you put .txt files with a new word on every line. Using XML you will then be able to randomly pick one of the lines in the file.<br/>
 +
In the average mod the rest of the folder is quite useless. You are unlikely to translate your mod into tens of different languages.<br/><br/>
 +
 
 +
=Complete mod folder structure=
 +
 
 +
  */
 +
    About/
 +
      About.xml
 +
      Preview.png-
 +
    Assemblies/-
 +
      *.dll+
 +
    Defs/-
 +
      *Defs/+
 +
        *.xml+
 +
    Languages/-
 +
      */*
 +
        DefInjected/-
 +
          *Defs/+
 +
            *.xml+
 +
        Keyed/-
 +
          *.xml+
 +
        Strings/-
 +
          NameBanks/
 +
            *.txt+
 +
        FriendlyName.txt-
 +
        LangIcon.png
 +
        LanguageInfo.xml
 +
    Sounds/-
 +
      */*#
 +
        *.wav+
 +
    Source/-
 +
      */*#
 +
        bin/
 +
          Debug/
 +
            *.**
 +
        obj/
 +
          Debug/
 +
            *.**
 +
        Properties/-
 +
          AssemblyInfo.cs
 +
        Source-DLLs/-
 +
          Assembly-CSharp.dll
 +
          UnityEngine.dll
 +
        *.csproj
 +
        *.OpenCover.Settings
 +
        *.sln
 +
        */*#
 +
          *.cs+
 +
    Textures/-
 +
      */*#
 +
        *.psd*
 +
        *.psd.meta*
 +
        *.png*
 +
 
 +
  Anything with a / at the end is a folder;
 +
  Anything with a . in it is a file;
 +
  The * in *.* and */ stands for any arbitrary string;
 +
  The * after a file/folder stands for an occurence of >= 0;
 +
  The + after a file/folder stands for an occurrence of > 0;
 +
  The - after a file/folder stands for an occurrence of <= 1;
 +
  The # after a folder stands for a folder depth of >= 0.
 +
 
 +
=Next up=
 +
* [[Modding Tutorials/Recommended software]]
 +
 
 +
[[Category:Modding tutorials]]

Please note that all contributions to RimWorld Wiki are considered to be released under the CC BY-SA 3.0 (see RimWorld Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)