Difference between revisions of "Modding Tutorials/Mod folder structure"

From RimWorld Wiki
Jump to navigation Jump to search
(Created. WIP)
 
m (→‎The Defs folders: Removed about/ part)
Line 28: Line 28:
  
 
   YourModName/
 
   YourModName/
    About/
 
      (..)
 
 
     Defs/
 
     Defs/
 
       BiomeDefs/
 
       BiomeDefs/

Revision as of 17:34, 11 July 2015

This tutorial introduces you to the mod folder structure and shows you a standard folder structure setup to help you start out.

Complete mod folder structure is a list of all folders you might find in your average mod directory. This includes /Core/.

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.
Every mod does however require the following structure to show up in the mods list:

 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:

 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.

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:

 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.
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.

Typically, the files inside these folders are named after their contents:

 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.
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.

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:

 YourModName/
   About/
     (..)
   Defs/
     (..)
   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.
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.

The Source and Assemblies folders

If you want to take a shot at 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:

 YourModName/
   Assemblies/
     ProjectName.dll
   Source/
     SolutionName/
       ProjectName/
         ProjectName.sln
         (..)

Or:

 YourModName/
   Assemblies/
     ProjectName.dll
   Source/
     ProjectName/
       ProjectName.sln
       (..)

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.