Advanced Modding Guide/Decompiling

Decompiling, also referred to as reversing, is the process of taking a compiled assembly and converting it back into human-readable code. This can be done automatically for us with software such as dnSpy, dotPeek, etc.

dnSpy
This guide will cover how to use dnSpy with Outward. dnSpy is a popular, open-source decompiler.
 * Get dnSpy here
 * Drag the file  into dnSpy. This is the main Outward assembly.
 * Assembly-Csharp-firstpass.dll may also contain things you would like to use.
 * Expand the  node, these are main game classes and do not have a namespace.
 * From here, it is a process of exploration, and trial and error.

Once you have found something you would like to use, there are a few options:
 * If it's public, you can call or reference it directly from your own mod without anything fancy.
 * If it's private, you can use reflection to access it.
 * Hooks can be used to control any method, and result in minimal overhead.
 * You can make your own derived classes of the game's classes. For example, a class:  could be used to add custom effects to Skills or Items, without the need for hooks or reflection, as there are virtual methods you can easily override.

Analyzing Usage
In dnSpy, if you right-click any field, method or class, you can click "Analyze" to view how this object is used. This will allow you to see how the rest of the Assembly uses or modifies the object in question, which is especially useful when following a "breadcrumb trail" trying to find the root of something.


 * Note: If the object is referenced indirectly (such as with a Photon RPC call), it will not show up here. You will need to search the assembly for strings and enter the field/method/class name to find those uses.

Debugging Outward at Runtime
It is possible to debug Outward at runtime with dnSpy, with a bit of configuration.

See this guide or this BepInEx guide for more instructions.

You can also debug your mods in the same way.