Decompiling the game
Warning
PLEASE DO NOT SHARE EXTRACTED/DECOMPILED ASSETS PUBLICLY
Decompiling the game is the best way to learn about how certain features are implemented. This guide will teach you how to use various tools to read the code of Stacklands. The code is compiled into assemblies, and can easily be extracted.
Choosing a decompiler
There are various C# decompilers, each with their own benefits, though since the core feature set is largely similar, the choice often comes down to preference.
ILSpy (windows only) / AvaloniaILSpy (cross-platform)
The rest of the guide will focus on ILSpy, but you can find all the showcased features in other tools.
Decompiling the code
Open the GameScripts.dll file in ILSpy by either dragging it onto the window or finding it in
File > Open. The DLL file is found in <Path to Stacklands>/Stacklands_Data/Managed. If you
are interested in other code, see the File guide section.
After opening the DLL, it will appear in the panel on the left. Click GameScripts and - to
view the list of classes. You can click on any of them to view its code.
Exporting the code
You may export the code to get better integration with certain editors such as VSCode. This is
a completely optional step. Right click GameScripts and select Save Code, then create
a folder where the code will be exported.
File guide
The DLL files are found in <Path to Stacklands>/Stacklands_Data/Managed.
|
Contains all of the gameplay related code |
|
Contains the code of the localization system |