Were to find .dll files for rimworld?

Started by daxter154, December 13, 2017, 12:52:57 PM

Previous topic - Next topic

daxter154

I'm trying to make a mod that adds a new plant that spreads on its own rapidly and deals damage when walked on. I read here that iLspy can be used to look into the .dll files, but I can't seem to find them (windows). Anybody know where they are held or if there is any good documentation on their functions?

neitsa

#1
Quote from: daxter154 on December 13, 2017, 12:52:57 PM
I read here that iLspy can be used to look into the .dll files, but I can't seem to find them (windows). Anybody know where they are held or if there is any good documentation on their functions?

If from steam: right click on Rimworld in your game library > Properties > Local files > Browse Local file

Once you are in the game directory, go to "\RimWorldWin_Data\Managed". The core library of the game is "Assembly-CSharp.dll" (this is the one you want to put on ILSpy).

For ILSpy, be sure to use the Zenthar release available here: https://github.com/Zhentar/ILSpy/releases/
You might also want to try DnSpy: https://github.com/0xd4d/dnSpy

Quote from: daxter154 on December 13, 2017, 12:52:57 PM
Anybody know where they are held or if there is any good documentation on their functions?

Not that I know of. I think most C# modders start by looking around in the code and try to make some sense of it (I started like that). If you get stuck, be sure to ask question here or on the discord server, the RimWorld modding community is very friendly.

If you think you know some mods that are close to your idea, you might also try to look at them.

Also, (just a hint I don't pretend it works for everyone): Don't try to overthink your mod if you start from scratch: start with a very simple idea and try to aggregate on that base concept (e.g in your case: how do I add my own plant? how do I deal damage with something? how do I deal damage with something when a pawn walk on it?, etc.)

edit: just remembered that there's a wiki page about the modding basics here: http://rimworldwiki.com/wiki/Modding_Tutorials

CannibarRechter

Retired programmer here. For the most part the RimWorld internals are pretty good, because the team uses "literate programming," by which I mean they write methods/functions that express what they do. For example, "KillPawn()." I'm not at my desk to confirm that this is literally a RimWorld method, but this is exactly the type of code you'll be looking at. So RW is pretty easy to read if you are a programmer. IMO.
CR All Mods and Tools Download Link
CR Total Texture Overhaul : Gives RimWorld a Natural Feel
CR Moddable: make RimWorld more moddable.
CR CompFX: display dynamic effects over RimWorld objects

Fluffy (l2032)

@CannibarRechter; yep, and that's further aided by C# being quite a verbose and descriptive language in itself. It's usually trivial to determine what a piece of code is supposed to do, and a bit of digging into references with ILSpy will give you a clear picture about most systems.

Some bits of the code are a bit mangled by the compiler, notably iterator blocks (Zenthar's ILSpy helps a lot with those), and some specific methods; e.g. the code that generates the right-click context menu. If you ask nicely and can show that you've made an effort, you can also ask the developers to send you particular bits of original source code. That will be documented, and not mangled by the compilation/decompilation process. This should be a last resort though!

RawCode

don't use Zenthar or use it in IL mode if you are going to implement code injections, syntax sugar not exists at runtime and trying to inject into sugar method will fail.

Fluffy (l2032)

yeah, that's definitely true, but for the love of god, don't go meddling with IL until you've at least got the basics of C# and RimWorld modding down.

Telling someone who asked for the location of the dlls to only use IL mode when doing transpilers is like telling a child who asks where power comes from to be careful when operating a nuclear power plant. Yes, it's obviously true, but it's also completely irrelevant.