Difference between revisions of "Modding"
m |
|||
Line 28: | Line 28: | ||
*Use Developement Mode (Found in Options) to help debug your mod. | *Use Developement Mode (Found in Options) to help debug your mod. | ||
− | =Getting started= | + | ==Getting started== |
− | ==Format of files== | + | ===Format of files=== |
− | For defining new game content, [ | + | For defining new game content, '''[[wikipedia:XML|XML]]''' files are used. Here is an example of the format, that applies to most of the definitions: |
− | |||
<source lang="xml"> | <source lang="xml"> | ||
<?xml version="1.0" encoding="utf-8" ?> | <?xml version="1.0" encoding="utf-8" ?> | ||
Line 41: | Line 40: | ||
</SomeDefs> | </SomeDefs> | ||
</source> | </source> | ||
− | + | Remember, that the word '''Some''' must be replaced by the name of whatever are you defining. For thing it's '''<ThingDef>'''. | |
− | Remember, that the word | ||
==Mod structure== | ==Mod structure== | ||
The RimWorld mods use the following directory structure. | The RimWorld mods use the following directory structure. | ||
+ | <pre> | ||
+ | ┌About | ||
+ | ├╴About.xml (Contains info about the mod) | ||
+ | ├╴Preview.png (Image that appears above the mod info in game. Max width 600px.) | ||
+ | │ | ||
+ | ├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 | ||
+ | │ | ||
+ | ├Sounds | ||
+ | │ | ||
+ | ├Source | ||
+ | ├╴MyMod.cs (Optionally, put the source code of your mod here) | ||
+ | │ | ||
+ | ├Strings | ||
+ | │ | ||
+ | ├Textures (Put any image textures here, preferably in .png format.) | ||
+ | └┬Things | ||
+ | ├╴MyMod_ImageA.png | ||
+ | └╴MyMod_ImageB.png | ||
+ | </pre> | ||
− | + | ===Mod Info:=== | |
− | + | This is found in <code>\MODNAME\About\</code> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | 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:=== |
− | These are found in \MODNAME\Textures\ | + | These are found in <code>\MODNAME\Textures\</code> |
*You can have any path you want from this point on. | *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> | + | *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: <code><TexturePath>Things/Building/RoyalBed</TexturePath></code> |
*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. | ||
− | === | + | ===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. | ||
− | These are defined in \MODNAME\Defs\ThingDefs | + | These are defined in <code>\MODNAME\Defs\ThingDefs</code> |
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. | 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 | + | The recipes themselves are defined in: <code>\MODNAME\Defs\RecipeDefs</code> |
In here you can define what ingredients/resources are required, what can be used, and what the default recipe is. | 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 | + | Any new resources will need to be defined in: <code>MODNAME\Defs\ThingDefs</code> |
===New Turrets:=== | ===New Turrets:=== | ||
− | These are defined in two files in: \MODNAME\Defs\ThingDefs | + | These are defined in two files in: <code>\MODNAME\Defs\ThingDefs</code> |
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) | ||
Buildings_Big.xml defines the structure of the turret itself. IE: | Buildings_Big.xml defines the structure of the turret itself. IE: | ||
<syntaxhighlight lang="xml" > | <syntaxhighlight lang="xml" > | ||
− | + | <building> | |
− | + | <turretGunDef>Gun_TurretImprovised</turretGunDef> | |
− | + | <burstCooldownTicks>300</burstCooldownTicks> | |
− | + | </building> | |
</syntaxhighlight> | </syntaxhighlight> | ||
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: <code>MODNAME\Defs\ThingDefs\Resources.xml</code> |
===New Research Projects:=== | ===New Research Projects:=== | ||
− | These are found in: MODNAME\Defs\ResearchProjectDefs | + | These are found in: <code>MODNAME\Defs\ResearchProjectDefs</code> |
+ | |||
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. | ||
This is how to add prerequisites: | This is how to add prerequisites: | ||
<syntaxhighlight lang="xml" > | <syntaxhighlight lang="xml" > | ||
− | + | <prerequisites> | |
− | + | <li>-this is the <defName> of the prerequisite-</li> | |
− | + | </prerequisites> | |
</syntaxhighlight> | </syntaxhighlight> | ||
Because it's a list, you can have multiple prerequisites for a research project. | Because it's a list, you can have multiple prerequisites for a research project. |
Revision as of 19:54, 29 March 2014
MODs files are stored in:
Windows version |
path to game folder/Mods
Linux version |
path to game folder/Mods
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.
┌About ├╴About.xml (Contains info about the mod) ├╴Preview.png (Image that appears above the mod info in game. Max width 600px.) │ ├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 │ ├Sounds │ ├Source ├╴MyMod.cs (Optionally, put the source code of your mod here) │ ├Strings │ ├Textures (Put any image textures here, preferably in .png format.) └┬Things ├╴MyMod_ImageA.png └╴MyMod_ImageB.png
Mod 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
Textures:
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.
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.
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.