Difference between revisions of "Modding Tutorials/Testing mods"

From RimWorld Wiki
Jump to navigation Jump to search
(Created, WIP)
 
(Addition of Brrainz debugging tool (info here on rimworld discord: https://discord.com/channels/214523379766525963/215496692047413249/1029376906900029491))
 
(12 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 +
{{BackToTutorials}}
 +
<br/>
 +
 
In this tutorial we will look into testing our mods.<br/><br/>
 
In this tutorial we will look into testing our mods.<br/><br/>
  
Line 10: Line 13:
  
 
===Development mode===
 
===Development mode===
 
 
To use this mode, you need to activate it:<br/>
 
To use this mode, you need to activate it:<br/>
  
# Run Rimworld;
+
# Run RimWorld;
 
# Press the "Options" button in the main menu;
 
# Press the "Options" button in the main menu;
 
# Under Gameplay, the middle column, tick "Development mode".<br/><br/>
 
# Under Gameplay, the middle column, tick "Development mode".<br/><br/>
 
===God mode===
 
  
 
Now that Development mode is activated, create a new world and colony and test your mod:<br/>
 
Now that Development mode is activated, create a new world and colony and test your mod:<br/>
  
 
# Create world;
 
# Create world;
# Create a colony, probably on Free Build difficulty;
+
# Create a colony;
 
# The following icons: [[File:DevelopmentMode.png|link=]] .. can now be found in the top-right;
 
# The following icons: [[File:DevelopmentMode.png|link=]] .. can now be found in the top-right;
 
## [[File:DebugLog.png|link=]] '''Open the debug log''' = Clicking this opens the debug log;
 
## [[File:DebugLog.png|link=]] '''Open the debug log''' = Clicking this opens the debug log;
## [[File:PackageEditor.png|link=]] '''Open the package editor''' = Opens the package editor, which allows you to remove Sounds and Hair;
+
## [[File:PackageEditor.png|link=]] '''Open the package editor''' = Opens the package editor, which allows you to preview and modify [[Modding Tutorials/Sounds|Sounds]] and Hair (Is not available for mod use as of 1.0);
 
## [[File:ViewSettings.png|link=]] '''Open the view settings''' = Allows you to activate graphic overlays and cheats like Fast Research;
 
## [[File:ViewSettings.png|link=]] '''Open the view settings''' = Allows you to activate graphic overlays and cheats like Fast Research;
 
## [[File:Debug.png|link=]] '''Open debug actions menu''' = This menu allows you to do all sorts of things;
 
## [[File:Debug.png|link=]] '''Open debug actions menu''' = This menu allows you to do all sorts of things;
Line 39: Line 39:
 
## [[File:ErrorLog_False.png|link=]] '''Pause the game when an error is logged''' = Toggles exactly what it says.<br/><br/>
 
## [[File:ErrorLog_False.png|link=]] '''Pause the game when an error is logged''' = Toggles exactly what it says.<br/><br/>
  
=Testing XML content=
+
===Using Debugger===
 +
Code of RimWorld is run and supported by a Mono runtime. A modified version of Mono is used by Unity that RimWorld builds on. Its repository can be found here: https://github.com/thardie/mono.
 +
 
 +
A step by step tutorial is available at https://github.com/Mhburg/AwsomeInventory/wiki/How-to-debug-RimWorld-from-Visual-Studio
 +
 
 +
Brrainz is working on a source level debugging tool for Rimworld Modding available at https://github.com/pardeike/RimWorld4Debugging
 +
 
 +
=Testing specific content=
 +
 
 +
===Equipment===
 +
 
 +
To test guns you'll want to [[Modding Tutorials/Testing mods#Development mode|enable Development mode]] and spawn in the guns you want to test using Debug Actions Menu -> Tools - Spawning -> Spawn weapons.<br/>
 +
 
 +
Apparel works in the same way, but you don't spawn it in via Spawn weapons.<br/><br/>
 +
 
 +
===Animals===
 +
 
 +
Once again, using Development mode spawn in pawns using Tools - Spawning -> Spawn pawns.<br/><br/>
 +
 
 +
===Raiders===
 +
 
 +
If your mod adds new weapons, you'll want to see how often raiders spawn with them. Start a raid using the Debug Actions Menu -> Incidents.<br/><br/>
 +
 
 +
===Incidents===
 +
 
 +
Incident mods can be tested using Debug Actions Menu -> Incidents. To get a sense for the regular threat scale and other data like the population intent: View settings -> Write storyteller. You'll find the data output in the Debug inspector (magnifying glass).<br/><br/>
 +
 
 +
===Jobs===
 +
 
 +
You can toggle job logging by using Actions Menu -> Tools - Pawns -> Toggle job logging. Note that this doesn't log all JobGivers, only if they return a job. Some Jobgivers may still do something without returning a job. Looking at you, JobGiver_DropUnusedInventory, Ruiner of Sleep and Waster of Hours. Also useful: View settings -> Draw Pawn Debug (for seeing destinations/reservations).<br/><br/>
 +
 
 +
===Lords===
 +
 
 +
* View settings -> Draw Duties (for seeing what each pawn does)
 +
* View settings -> Draw Lords (for seeing what the Lord does)
 +
* View settings -> Log Lord Toil Transitions (for reading what transitions happen)<br/><br/>
 +
 
 +
=Tips for testing=
 +
Read the README.txt.
 +
 
 +
==Quickstart==
 +
For testing, you can start the game into a tiny (fast-loading) map with one click by running the game with the -quicktest command line parameter. For example:
 +
 
 +
        C:/RimWorld/RimWorld.exe -quicktest
 +
 
 +
or on Mac
 +
 
 +
        /Users/Username/Library/Application\ Support/Steam/SteamApps/common/RimWorld/RimWorldMac.app/Contents/MacOS/RimWorldMac -quicktest
 +
 
 +
You can make a shortcut to the game which does this.
 +
 
 +
If a savefile called autostart.rws is present, the game will load that.
 +
 
 +
==Save data==
 +
You can override the save data folder. This is useful, for example, if you want to install the game on a USB stick so you can plug and play it from anywhere.
 +
To do this, add this to the end of the command line used to launch the game:
 +
 
 +
        -savedatafolder=C:/Path/To/The/Folder
 +
 
 +
So it'll look something like this:
 +
 
 +
        C:/RimWorld/RimWorld.exe -savedatafolder=C:/Path/To/The/Folder
 +
 
 +
If you don't start the path with anything, it'll be relative to the game's root folder. So you could do this, to have the game save data in a folder called SaveData in its own root folder:
 +
 
 +
        -savedatafolder=SaveData
 +
 
 +
Be sure the game is running with permission to modify the folder. It may not work properly if, for example, you run the game under default permissions on its own install folder.
 +
 
 +
You can combine the -savedatafolder with the -quicktest argument for a clean modding environment.
  
 +
==Mod tools==
 +
There are mods which can make testing and modding in general easier. As of 1.0, the most well-known is probably [https://github.com/UnlimitedHugs/RimworldHugsLib/ HugsLib]. It offers a more elaborate quick-start function, and a configurable hotkey to restart the game. Other mods are [https://github.com/Jaxe-Dev/PublisherPlus Publisher Plus by Jaxe], [https://github.com/alextd/RimWorld-TDBug TDBug by AlexTD/Uuugggg] and [https://github.com/RimWorld-CCL-Reborn/4M-Mehni-s-Misc-Modifications/ 4M Mehni's Misc Modifications by Mehni]. If that isn't enough, write your own tool! The most useful tools are those that give you info about how the game works.
  
  
 
[[Category:Modding tutorials]]
 
[[Category:Modding tutorials]]

Latest revision as of 19:58, 23 October 2022

Modding Tutorials

In this tutorial we will look into testing our mods.

What you'll learn[edit]

You'll learn several methods to test your mods.

Debug modes[edit]

While testing your mods you might want to spawn in weapons, activate events or damage colonists, etcetera. This can be achieved using the game's Development mode.

Development mode[edit]

To use this mode, you need to activate it:

  1. Run RimWorld;
  2. Press the "Options" button in the main menu;
  3. Under Gameplay, the middle column, tick "Development mode".

Now that Development mode is activated, create a new world and colony and test your mod:

  1. Create world;
  2. Create a colony;
  3. The following icons: DevelopmentMode.png .. can now be found in the top-right;
    1. DebugLog.png Open the debug log = Clicking this opens the debug log;
    2. PackageEditor.png Open the package editor = Opens the package editor, which allows you to preview and modify Sounds and Hair (Is not available for mod use as of 1.0);
    3. ViewSettings.png Open the view settings = Allows you to activate graphic overlays and cheats like Fast Research;
    4. Debug.png Open debug actions menu = This menu allows you to do all sorts of things;
      1. Incidents allows you to spawn in raids or execute incidents;
      2. Actions - Misc contains a few buttons that complete research, continue the in-game tutorial, etcetera;
      3. Tools - General contains explosions and damaging things, snow actions, plant growth and some more advanced AI visualizations;
      4. Tools - Pawns holds tools which alter Pawn appearance, levels, health and jobs;
      5. Tools - Spawning allows you to spawn Pawns, Items in different stack sizes, Terrain and Filth;
      6. Autotests contains some stress tests like spawning in an entire colony in different stages, burning everything and killing lots of pawns at once.
    5. Debug.png Open debug logging menu = Contains buttons which log parts of the game in the Debug Log;
    6. Inspector.png Open the inspector = Gives a lot more information when hovering over things;
    7. GodMode.png Toggle god mode = Toggles God mode, which allows you to build things without cost;
    8. ErrorLog False.png Pause the game when an error is logged = Toggles exactly what it says.

Using Debugger[edit]

Code of RimWorld is run and supported by a Mono runtime. A modified version of Mono is used by Unity that RimWorld builds on. Its repository can be found here: https://github.com/thardie/mono.

A step by step tutorial is available at https://github.com/Mhburg/AwsomeInventory/wiki/How-to-debug-RimWorld-from-Visual-Studio

Brrainz is working on a source level debugging tool for Rimworld Modding available at https://github.com/pardeike/RimWorld4Debugging

Testing specific content[edit]

Equipment[edit]

To test guns you'll want to enable Development mode and spawn in the guns you want to test using Debug Actions Menu -> Tools - Spawning -> Spawn weapons.

Apparel works in the same way, but you don't spawn it in via Spawn weapons.

Animals[edit]

Once again, using Development mode spawn in pawns using Tools - Spawning -> Spawn pawns.

Raiders[edit]

If your mod adds new weapons, you'll want to see how often raiders spawn with them. Start a raid using the Debug Actions Menu -> Incidents.

Incidents[edit]

Incident mods can be tested using Debug Actions Menu -> Incidents. To get a sense for the regular threat scale and other data like the population intent: View settings -> Write storyteller. You'll find the data output in the Debug inspector (magnifying glass).

Jobs[edit]

You can toggle job logging by using Actions Menu -> Tools - Pawns -> Toggle job logging. Note that this doesn't log all JobGivers, only if they return a job. Some Jobgivers may still do something without returning a job. Looking at you, JobGiver_DropUnusedInventory, Ruiner of Sleep and Waster of Hours. Also useful: View settings -> Draw Pawn Debug (for seeing destinations/reservations).

Lords[edit]

  • View settings -> Draw Duties (for seeing what each pawn does)
  • View settings -> Draw Lords (for seeing what the Lord does)
  • View settings -> Log Lord Toil Transitions (for reading what transitions happen)

Tips for testing[edit]

Read the README.txt.

Quickstart[edit]

For testing, you can start the game into a tiny (fast-loading) map with one click by running the game with the -quicktest command line parameter. For example:

       C:/RimWorld/RimWorld.exe -quicktest

or on Mac

       /Users/Username/Library/Application\ Support/Steam/SteamApps/common/RimWorld/RimWorldMac.app/Contents/MacOS/RimWorldMac -quicktest

You can make a shortcut to the game which does this.

If a savefile called autostart.rws is present, the game will load that.

Save data[edit]

You can override the save data folder. This is useful, for example, if you want to install the game on a USB stick so you can plug and play it from anywhere. To do this, add this to the end of the command line used to launch the game:

       -savedatafolder=C:/Path/To/The/Folder

So it'll look something like this:

       C:/RimWorld/RimWorld.exe -savedatafolder=C:/Path/To/The/Folder

If you don't start the path with anything, it'll be relative to the game's root folder. So you could do this, to have the game save data in a folder called SaveData in its own root folder:

       -savedatafolder=SaveData

Be sure the game is running with permission to modify the folder. It may not work properly if, for example, you run the game under default permissions on its own install folder.

You can combine the -savedatafolder with the -quicktest argument for a clean modding environment.

Mod tools[edit]

There are mods which can make testing and modding in general easier. As of 1.0, the most well-known is probably HugsLib. It offers a more elaborate quick-start function, and a configurable hotkey to restart the game. Other mods are Publisher Plus by Jaxe, TDBug by AlexTD/Uuugggg and 4M Mehni's Misc Modifications by Mehni. If that isn't enough, write your own tool! The most useful tools are those that give you info about how the game works.