Editing Modding Tutorials/Getting started with mods
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: | ||
{{BackToTutorials}} | {{BackToTutorials}} | ||
− | This page is a tutorial on how to create a | + | This page is a tutorial on how to create a Rimworld mod it will step you through the process of creating a mod from scratch. from basic file structure to writing code for your mod. This tutorial is aimed at people who have never created a mod before and are looking to get started. and is meant to be an updated guide for the old tutorials on the wiki. |
− | = | + | |
− | + | =Introdusion= | |
+ | Rimworld mods are created using XML and C# code. XML is used to define the content of the mod and C# is used to add functionality to the mod. For now, we will focus on XML and later tutorials will cover C#. | ||
+ | |||
+ | To get started we will create the basic files and folders that are needed for a mod. We will then add some basic content to the mod and test it in the game. | ||
=Goal of this tutorial= | =Goal of this tutorial= | ||
− | By the end of this tutorial | + | By the end of this tutorial you will have: |
# Install software needed to make a mod | # Install software needed to make a mod | ||
# Create a mod folder structure | # Create a mod folder structure | ||
Line 15: | Line 18: | ||
=Software= | =Software= | ||
− | To | + | To Get started making a mod with XML you will need to download the following: |
− | * | + | * a copy of Rimworld (duh) |
− | * | + | * a code editor |
* [https://steamcommunity.com/sharedfiles/filedetails/?id=1847679158 RimPy] (This is a Mod manager that will make it easier to test your mod) | * [https://steamcommunity.com/sharedfiles/filedetails/?id=1847679158 RimPy] (This is a Mod manager that will make it easier to test your mod) | ||
− | * [https://git-scm.com/ Git] can be scary at first | + | * [https://git-scm.com/ Git] Git can be scary at first but it is a very useful tool. and can be used to keep track of changes to your mod. (optional but highly recommended) |
− | |||
==Code Editor== | ==Code Editor== | ||
− | There are many code editors out there | + | There are many code editors out there some of the most commonly used are: |
− | * [https://code.visualstudio.com/ Visual Studio Code] is a free code editor and has a lot of useful features and tools | + | |
− | + | * [https://code.visualstudio.com/ Visual Studio Code] is a free code editor and has a lot of useful features and tools (this is what I will use). | |
− | |||
* [https://www.sublimetext.com/ Sublime Text] is a free code editor that is popular. | * [https://www.sublimetext.com/ Sublime Text] is a free code editor that is popular. | ||
+ | * [https://notepad-plus-plus.org/ Notepad++] is a very lightweight code editor that is very easy to use however it is missing some features that make it less useful for larger projects. | ||
+ | |||
'''''About IDEs:''''' | '''''About IDEs:''''' | ||
− | IDEs are Integrated Development Environments. They are a code editor and a compiler all in one. They are very useful for larger projects | + | IDEs are Integrated Development Environments. They are a code editor and a compiler all in one. They are very useful for larger projects but can be overkill for smaller projects. IDEs are also very resource intensive and can slow down your computer. I would recommend using a code editor for now and when you are ready to start using C# you can look into IDEs. |
=Making the folder structure= | =Making the folder structure= | ||
− | '''''There are mod templates available for quick setup | + | '''''There are mod templates available for quick setup however it is recommended to create the folder structure manually at least once to get a better understanding of how mods work.''''' |
− | To start making a mod | + | To start making a mod we need to create a folder for the mod. This folder will contain all the files and folders that make up the mod. to keep things organized we will create a folder in Rimworlds mod local folder. this is located at: <br/><pre>(RimWorldInstallFolder)/Mods/</pre> |
− | '''Note: | + | '''''Note: it is not recommended to put your mod in the steam mods folder''''' |
− | + | ||
− | < | + | ==Creating the about file== |
+ | Now lets make an About folder inside the mod folder. This folder will contain information about the mod and the mods preview image. | ||
+ | |||
+ | Inside the About folder, we will create a file called About.xml. This file will contain information about the mod. inside the file, we will add the following code: <br/> | ||
− | |||
− | |||
− | |||
<pre> | <pre> | ||
− | <?xml version="1.0" encoding="UTF-8"?> <!-- Comments in XML look like this --> | + | <?xml version="1.0" encoding="UTF-8"?> <!-- Comments in XML look like this--> |
</pre> | </pre> | ||
− | This is the first line of every XML file. | + | <br/> |
− | now we will add the following code to the file: | + | This is the first line of every XML file. it tells the computer that this is an XML file and what encoding to use. (get used to seeing this line in every XML file you make) <br/> |
+ | now we will add the following code to the file: <br/> | ||
<pre> | <pre> | ||
<ModMetaData> | <ModMetaData> | ||
− | <name>Mod Name Here</name> <!-- This is the name of the mod --> | + | <name>Mod Name Here</name> <!-- This is the name of the mod --> |
<author>Your Name Here</author> | <author>Your Name Here</author> | ||
<packageId>yourName.ModName</packageId> <!-- It is best to use this format--> | <packageId>yourName.ModName</packageId> <!-- It is best to use this format--> | ||
− | <description> | + | <description>Super Cool Mod</description> <!-- Be Creative The description is what people will see when they look at your mod --> |
<supportedVersions> | <supportedVersions> | ||
− | + | <li>1.4</li> | |
− | </supportedVersions> <!-- This is the version of | + | </supportedVersions> <!-- This is the version of Rimworld that the mod is compatible with --> |
</ModMetaData> <!-- be sure to close all tags you open --> | </ModMetaData> <!-- be sure to close all tags you open --> | ||
</pre> | </pre> | ||
− | '''''XML is picky about spacing, formatting, and Capitalization. | + | <br/> |
− | Now save the file and close it. '''Note: the name of the file must be exactly "About.xml"''' | + | '''''XML is picky about spacing, formatting, and Capitalization. if you get an error when loading your mod it is most likely because of a typo or missing tag''''' <br/> |
− | + | Now save the file and close it. <br/> | |
− | '''''When adding a preview image to your mod you must name the image "Preview.png" and place it in the About folder | + | '''''Note: the name of the file must be exactly "About.xml"''''' |
+ | open RimPy and sort by local mods. you should see your mod listed. if you click on it you should see the information you entered in the About.xml file. <br/> | ||
+ | |||
+ | '''''When adding a preview image to your mod you must name the image "Preview.png" and place it in the About folder the image should be 512x512 pixels and must be under 1mb''''' | ||
==Creating the other folder== | ==Creating the other folder== | ||
− | Now let's make a Def's folder inside the mod folder. This folder will contain all the XML files that define the content the mod will add.<br> | + | Now let's make a Def's folder inside the mod folder. This folder will contain all the XML files that define the content the mod will add. <br/> |
− | + | start by creating a folder called "Defs" inside the mod folder, inside the Defs folder create a file called "ThingDefs.xml" <br/> | |
− | let's also create a folder called "Textures" inside the mod folder. this folder will contain all the images that will be used in the mod.<br> | + | in the root of the mod folder create a folder called "Patchs". this folder will contain XML files that will be used to patch existing content in the game. inside the Patchs folder create a file called "ThingDefs_Patch.xml" <br/> |
− | + | let's also create a folder called "Textures" inside the mod folder. this folder will contain all the images that will be used in the mod. <br/> | |
+ | |||
+ | your mod folder should now look like this: <br/> | ||
<pre> | <pre> | ||
ModName | ModName | ||
Line 76: | Line 85: | ||
Defs | Defs | ||
ThingDefs.xml | ThingDefs.xml | ||
+ | Patchs | ||
+ | ThingDefs_Patch.xml | ||
Textures | Textures | ||
</pre> | </pre> | ||
=Adding content to the mod= | =Adding content to the mod= | ||
− | Now that we have the basic folder structure set up | + | Now that we have the basic folder structure set up we can start adding content to the mod. |
+ | ==Adding a new item== | ||
+ | Let's start by adding a new item to the game. open the "ThingDefs.xml" file and add the following code: <br/> | ||
− | + | <pre> | |
− | |||
− | <pre> | ||
<?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||
</pre> | </pre> | ||
− | + | Remember this is the first line of every XML file. | |
+ | <br/> | ||
+ | |||
<pre> | <pre> | ||
<Defs> | <Defs> | ||
Line 103: | Line 116: | ||
<Beauty>2</Beauty> | <Beauty>2</Beauty> | ||
</statBases> | </statBases> | ||
+ | |||
</ThingDef> | </ThingDef> | ||
</Defs> | </Defs> | ||
</pre> | </pre> | ||
− | Now save the file and close it. In RimPy enable the mod and start the game. | + | Now save the file and close it. In RimPy enable the mod and start the game. In Settings under general enable Development Mode. |
+ | Now on the main menu, there should be a new button called "Dev quicktest", This will start a new game on a test map. Once the game has loaded open the Debug menu, in the Debug menu click on the "Spawn Thing" button. In the "Spawn Thing" menu type in the def name of the item you just added. Click on the item then click anywhere on the map to spawn it. | ||
+ | <br/> | ||
+ | Congratulations you have just added your first item to the game. [[File:empty_item.png|200px|thumb|right|You have now added a new item to the game.]] | ||
==Adding a texture to the item== | ==Adding a texture to the item== | ||
− | While we have added an item to the game currently | + | While we have added an item to the game currently it has no texture. and looks ugly. to fix this we will add a texture to the item. to start we will need to add a texture to the mod. for now, let's grab a texture from the Rimworld wiki (this means the image will be the correct size and format). |
− | Here's what your texture folder should look like: | + | Here's what your texture folder should look like: <br/> |
<pre> | <pre> | ||
Textures | Textures | ||
Line 118: | Line 135: | ||
Resource.png | Resource.png | ||
</pre> | </pre> | ||
− | It is best to organize your textures into folders that match the folder structure of the game. | + | It is best to organize your textures into folders that match the folder structure of the game. after you have added your texture to the mod folder open the "ThingDefs.xml" file and add the following code to your items ThingDef: |
+ | <br/> | ||
<pre> | <pre> | ||
<graphicData> | <graphicData> | ||
Line 125: | Line 143: | ||
</graphicData> | </graphicData> | ||
</pre> | </pre> | ||
− | + | Note how you don't add the file extension to the texture path. <br/> | |
Now that looks much better! [[File:Adding_Textures.png|200px|thumb|right|Look at that lovely item]] | Now that looks much better! [[File:Adding_Textures.png|200px|thumb|right|Look at that lovely item]] | ||
− | + | If you consider yourself an artist you can make your own textures (you won't be getting a how-to from me). <br/> | |
− | |||
− | |||
− | |||
− | |||
− | |||
==Adding more complex properties== | ==Adding more complex properties== | ||
− | Now that we have added a new item to the game | + | Now that we have added a new item to the game we can add some more features to it. to start we will make the item rot. open the "ThingDefs.xml" file and add the following code to your items ThingDef: <br/> |
<pre> | <pre> | ||
<comps> | <comps> | ||
− | + | <li Class="CompProperties_Rottable"> | |
− | <li Class="CompProperties_Rottable" | ||
<daysToRotStart>2</daysToRotStart> <!-- This is the number of days it takes for the item to start rotting --> | <daysToRotStart>2</daysToRotStart> <!-- This is the number of days it takes for the item to start rotting --> | ||
− | <daysToDessicated>3</daysToDessicated> <!-- This is the number of days it takes for the item to start | + | <daysToDessicated>3</daysToDessicated> <!-- This is the number of days it takes for the item to start dessicating --> |
</li> | </li> | ||
</comps> | </comps> | ||
</pre> | </pre> | ||
− | + | the best way to learn how to add more features to your items is to look at the existing items in the game. you can find the XML files for the existing items in the RimWorld install folder located at: <br/> | |
<pre> | <pre> | ||
− | steamapps/common/RimWorld/Data/Core (Or | + | steamapps/common/RimWorld/Data/Core(Or whatever DLC you have)/Defs/ |
</pre> | </pre> | ||
− | + | <br/> | |
− | |||
=GitHub files= | =GitHub files= | ||
− | + | All the files made in this tutorial can be found [https://github.com/Burgess12/RimWorld-Mod-Tutorials here] on GitHub. this allows you to download the files and use them as a reference when making your own mods. | |
+ | |||
GitHub is a great tool for sharing code and is especially useful when you are ready to start programming in C#. | GitHub is a great tool for sharing code and is especially useful when you are ready to start programming in C#. | ||
=Next steps= | =Next steps= | ||
− | After | + | After you have completed this tutorial you should have a basic understanding of how to make a mod for RimWorld. now you can start adding more features to your mod. the next step is adding a recipe, weapon, and trait to the mod. |
[[Category:Modding tutorials]] | [[Category:Modding tutorials]] |