Difference between revisions of "Modding"

From RimWorld Wiki
Jump to navigation Jump to search
Line 14: Line 14:
 
===Linux version===
 
===Linux version===
 
|}
 
|}
 +
<code>path to game folder/Mods</code>
  
 
----
 
----
Line 21: Line 22:
 
===Mac OS X version===
 
===Mac OS X version===
 
|}
 
|}
 +
<code>path to game folder/Mods</code>
  
 
==General Modding Advice==
 
==General Modding Advice==
Line 26: Line 28:
 
*Use Developement Mode (Found in Options) to help debug your mod.
 
*Use Developement Mode (Found in Options) to help debug your mod.
  
==Mod Info:==
+
=Getting started=
 +
==Format of files==
 +
For defining new game content, [http://en.wikipedia.org/wiki/Xml XML] files are used. Here is an example of the format, that applies to most of the definitions:
 +
 
 +
<source lang="xml">
 +
<?xml version="1.0" encoding="utf-8" ?>
 +
<SomeDefs>
 +
  <SomeDef>
 +
      <defName>MyNewDefinitionOfContent</defName>
 +
      <!-- more tags will appear depending on what are you defining -->
 +
  </SomeDef>
 +
</SomeDefs>
 +
</source>
 +
 
 +
Remember, that the word <b><tt>Some</tt></b> must be replaced by the name of whatever are you defining. For thing it's <tt>&lt;ThingDef&gt;</tt>.
 +
 
 +
==Mod structure==
 +
The RimWorld mods use the following directory structure.
 +
 
 +
  <font style="font-size: 10pt; font-weight: bold">Legend:</font><br />
 +
  <font color="green" style="background:#EEE">'''optional file/folder'''</font>
 +
  <font style="background:#EEE"><i>'''the name is an example'''</i></font>
 +
 
 +
*[[#about|About]]<font color="#666666"> - Contains info about the mod</font>
 +
**About.xml
 +
**Preview.png<font color="#666666"> - Image that appears above the mod info in game</font>
 +
*Assemblies<font color="#666666"> - If your mod uses any DLL files put them here</font>
 +
**<i><font color="green">MyMod.dll</font></i>
 +
*Defs<font color="#666666"> - Contains xml definitions of the mod</font>
 +
**<font color="green">[[#thing_defs|ThingDefs]]</font>
 +
***<i><font color="green">Things.xml</font></i>
 +
***<i><font color="green">Buildings.xml</font></i>
 +
**<font color="green">ResearchProjectDefs</font>
 +
***<i><font color="green">MyProjects.xml</font></i>
 +
**<font color="#666666">... the folder name must be specific here. Look in Core mod to see what are other names supposed to be</font>
 +
*<font color="green">Source</font><font color="#666666"> - Optionally, put the source code of your mod here</font>
 +
**<i>MyMod.cs</i>
 +
*[[#textures|Textures]]<font color="#666666"> - Put any image textures here, preferably in <code>png</code> format.</font>
 +
**Things
 +
***<i>MyMod.png</i>
 +
**<i>Image.png</i>
 +
 
 +
 
 +
 
 +
==={{anchor|about}}Mod Info:===
 
This is found in \MODNAME\About\
 
This is found in \MODNAME\About\
 
*The contents of About.xml are plain text. HTML Markup tags cause NullRef's.
 
*The contents of About.xml are plain text. HTML Markup tags cause NullRef's.
 
*You can have an image for your mod. Restrict the image width to 600 pixels
 
*You can have an image for your mod. Restrict the image width to 600 pixels
  
==Textures:==
+
==={{anchor|textures}}Textures:===
 
These are found in \MODNAME\Textures\
 
These are found in \MODNAME\Textures\
 
*You can have any path you want from this point on.
 
*You can have any path you want from this point on.
Line 37: Line 83:
 
*You can randomize textures within a folder using a <textureFolderPath> pointing at a folder with multiple textures inside. Each Thing of the given def will have a random texture from the folder.
 
*You can randomize textures within a folder using a <textureFolderPath> pointing at a folder with multiple textures inside. Each Thing of the given def will have a random texture from the folder.
  
==Mod Folder Structure:==
+
==={{anchor|thing_defs}}New Interactable "Things":===
While you can name all .xml files whatever you want. You cannot rename the folders; the game looks in folders with specific names to find specific data.
 
 
 
==New Interactable "Things":==
 
 
A thing is anything that exists in the game world. It includes resources, races (humanoid and animal), buildings, furniture, and many others.
 
A thing is anything that exists in the game world. It includes resources, races (humanoid and animal), buildings, furniture, and many others.
  
Line 51: Line 94:
 
Any new resources will need to be defined in: MODNAME\Defs\ThingDefs
 
Any new resources will need to be defined in: MODNAME\Defs\ThingDefs
  
==New Turrets:==
+
===New Turrets:===
 
These are defined in two files in: \MODNAME\Defs\ThingDefs
 
These are defined in two files in: \MODNAME\Defs\ThingDefs
 
Buildings_Big.xml and Weapons_Guns.xml (Remember, these can be named anything)
 
Buildings_Big.xml and Weapons_Guns.xml (Remember, these can be named anything)
Line 64: Line 107:
 
Weapons_Gun.xml defines the weapon the turret uses. Anything can be used as a weapon for turrets, including grenades.
 
Weapons_Gun.xml defines the weapon the turret uses. Anything can be used as a weapon for turrets, including grenades.
  
==New Resources:==
+
===New Resources:===
 
These are defined in: MODNAME\Defs\ThingDefs\Resources.xml
 
These are defined in: MODNAME\Defs\ThingDefs\Resources.xml
  
==New Research Projects:==
+
===New Research Projects:===
 
These are found in: MODNAME\Defs\ResearchProjectDefs
 
These are found in: MODNAME\Defs\ResearchProjectDefs
 
You can have research trees as well, where additional research projects get unlocked as you move through.
 
You can have research trees as well, where additional research projects get unlocked as you move through.

Revision as of 20:40, 28 March 2014


MODs files are stored in:

Folders-OS-Windows-8-Metro-icon.png

Windows version

path to game folder/Mods


Folders-OS-Linux-Metro-icon.png

Linux version

path to game folder/Mods


Folders-OS-Apple-Metro-icon.png

Mac OS X version

path to game folder/Mods

General Modding Advice

  • The tilde key (`) brings up the dev console, which will report any errors it encounters. This is the quickest way to see what, if any, errors exist in your mod.
  • Use Developement Mode (Found in Options) to help debug your mod.

Getting started

Format of files

For defining new game content, XML files are used. Here is an example of the format, that applies to most of the definitions:

<?xml version="1.0" encoding="utf-8" ?>
<SomeDefs>
   <SomeDef>
      <defName>MyNewDefinitionOfContent</defName>
      <!-- more tags will appear depending on what are you defining -->
   </SomeDef>
</SomeDefs>

Remember, that the word Some must be replaced by the name of whatever are you defining. For thing it's <ThingDef>.

Mod structure

The RimWorld mods use the following directory structure.

 Legend:
optional file/folder the name is an example
  • About - Contains info about the mod
    • About.xml
    • Preview.png - Image that appears above the mod info in game
  • Assemblies - If your mod uses any DLL files put them here
    • MyMod.dll
  • Defs - Contains xml definitions of the mod
    • ThingDefs
      • Things.xml
      • Buildings.xml
    • ResearchProjectDefs
      • MyProjects.xml
    • ... the folder name must be specific here. Look in Core mod to see what are other names supposed to be
  • Source - Optionally, put the source code of your mod here
    • MyMod.cs
  • Textures - Put any image textures here, preferably in png format.
    • Things
      • MyMod.png
    • Image.png


Template:AnchorMod Info:

This is found in \MODNAME\About\

  • The contents of About.xml are plain text. HTML Markup tags cause NullRef's.
  • You can have an image for your mod. Restrict the image width to 600 pixels

Template:AnchorTextures:

These are found in \MODNAME\Textures\

  • You can have any path you want from this point on.
  • When referencing textures in your mod, using <TexturePath>, have the complete path relative to your mod, including the filename (but not the file extension) Example for the RoyalBed Testmod: <TexturePath>Things/Building/RoyalBed</TexturePath>
  • You can randomize textures within a folder using a <textureFolderPath> pointing at a folder with multiple textures inside. Each Thing of the given def will have a random texture from the folder.

Template:AnchorNew Interactable "Things":

A thing is anything that exists in the game world. It includes resources, races (humanoid and animal), buildings, furniture, and many others.

These are defined in \MODNAME\Defs\ThingDefs If you make a new workbench, you'll need to define a recipe for it. This is a list, so you can have many new recipes listed.

The recipes themselves are defined in: \MODNAME\Defs\RecipeDefs In here you can define what ingredients/resources are required, what can be used, and what the default recipe is.

Any new resources will need to be defined in: MODNAME\Defs\ThingDefs

New Turrets:

These are defined in two files in: \MODNAME\Defs\ThingDefs Buildings_Big.xml and Weapons_Guns.xml (Remember, these can be named anything)

Buildings_Big.xml defines the structure of the turret itself. IE:

		<building>
			<turretGunDef>Gun_TurretImprovised</turretGunDef>
			<burstCooldownTicks>300</burstCooldownTicks>
		</building>

Weapons_Gun.xml defines the weapon the turret uses. Anything can be used as a weapon for turrets, including grenades.

New Resources:

These are defined in: MODNAME\Defs\ThingDefs\Resources.xml

New Research Projects:

These are found in: MODNAME\Defs\ResearchProjectDefs You can have research trees as well, where additional research projects get unlocked as you move through. This is how to add prerequisites:

		<prerequisites>
			<li>-this is the <defName> of the prerequisite-</li>
		</prerequisites>

Because it's a list, you can have multiple prerequisites for a research project.

References