Project for reverse engineering the game Dig or Die. It includes:
- BepInEx plugins to improve game's experience.
- Documentation of the internal structure of the game.
- Reverse engineering of world simulation algorithm.
- Tool for working with save files.
All available plugins can be found in plugins/ folder.
Each plugin contains a REAMDE.md describing what it does.
Checkout the Wiki page for documentation for game internals and other.
Firstly, you need to install BepInEx, which is a patcher/plug-in framework. You can follow instructions specified in Automatic BepInEx Installation or Manually Install BepInEx. Then Download plugin .dll.
Open PowerShell.
- Start menu method:
- Right-click on the start menu.
- Choose
Windows PowerShell(for Windows 10) orTerminal(for Windows 11).
- Search and launch method:
- Press the Windows key.
- Type
PowerShellorTerminal(for Windows 11). - Left-click
Windows PowerShellmatch to launch PowerShell.
Copy the following command, paste it into PowerShell console and press Enter.
irm "https://raw.githubusercontent.com/ddmitv/dig-or-die-mods/main/Install-BepInEx.ps1" | iexIf you encountered an error, please follow provided instructions in error message, or, manually install BepInEx.
You can follow the official BepInEx installation guide, but the following instructions are specialized for Dig or Die.
- Download BepInEx
Get the 32-bit (x86) Windows BepInEx version 5.4.23 or newer from the BepInEx GitHub releases.
Tip
For example, the file name should look like BepInEx_win_x86_5.4.23.3.zip.
- Install BepInEx
Extract the downloaded.zipcontents into your game directory whereDigOrDie.exeis located.
Tip
In Steam: right-click the game, select Manage >, and left-click Browse local files >, it will open the directory where game's files are located.
Optionally, back up your game by copying the entire Dig Or Die folder elsewhere before extracting.
Note
After you extracted the archive, the game folder should contain files like winhttp.dll, doorstop_config.ini and a new folder BepInEx with original DigOrDie.exe.
-
First Launch
Run the game through Steam. Directly running executableDigOrDie.exewon't work. -
Initial Setup
Wait until theBepInEx/configfolder and other ones appears, then close the game.
Note
The game will always show black screen, don't wait until it starts.
- BepInEx Configuration
OpenBepInEx/config/BepInEx.cfgin text editor and find near the end:Change[Preloader.Entrypoint] ## The local filename of the assembly to target. # Setting type: String # Default value: UnityEngine.dll Assembly = UnityEngine.dll ## The name of the type in the entrypoint assembly to search for the entrypoint method. # Setting type: String # Default value: Application Type = Application ## The name of the method in the specified entrypoint assembly and type to hook and load Chainloader from. # Setting type: String # Default value: .cctor Method = .cctor
Type = ApplicationtoType = MonoBehaviour.
Tip
Recommended to enable the console by locating and changing the following settings accordingly:
[Logging.Console]
## Enables showing a console for log output.
# Setting type: Boolean
# Default value: false
Enabled = trueAfter enabling, with the game start a console window with logging information will appear.
You can download these from Github Releases page (or compile them yourself, see Building Plugins).
Place plugin .dll (e.g. precise_clock.dll) into Dig or Die/BepInEx/plugins folder.
Run the game through Steam. Plugins should now be active.
Note
For troubleshooting:
- Check
Dig or Die/DigOrDie_Data/output_log.txt - Visit BepInEx Troubleshooting page.
Many plugins have their configuration files you can edit under BepInEx/config.
The appropriate configuration file appears after the plugin that it's associated is used first time when starting a game.
To reset configuration to default delete the configuration file and next time the game is started the plugin will recreate it.
Note
Usually, the plugin reads settings inside config file at startup. You need to modify them before the game is started, or restart the game to apply them.
However, some plugins also can dynamically read them without need for restarting the game. It's usually said in plugin's documentation when it does that.
- Configuration Manager. Easy plugin configuration editing via in-game GUI.
BepInEx.DebugDemystify Exceptions. Basically clearer exception messages in logs.- Runtime Unity Editor. In-game inspector and debugging tools.
-
To uninstall/disable specific plugin:
Delete its.dllfromBepInEx/pluginsfolder. -
To fully uninstall BepInEx:
Delete these files/folders:BepInEx/winhttp.dlldoorstop_config.ini.doorstop_versionchangelog.txt
Note
Recommended to also verify integrity of game files through Steam.
Right-click the game, left-click Properties..., find section Installed Files, click button Verify integrity of game files.
- To temporary disable mods:
Renamewinhttp.dlltowinhttp.dll.off. Rename back to re-enable.
- .NET SDK (should support C# 12.0)
Note
Set the environment variable DIG_OR_DIE_PATH to your Dig or Die installation path to automatically deploy built plugins to BepInEx\plugins.
Tip
You can download Visual Studio at https://visualstudio.microsoft.com/downloads
Open the plugins/ directory (where all plugin source code is located).
The plugin's directory should contain a .csproj file that you need to open with Visual Studio.
You can build the current plugin with Ctrl+B or Build > {plugin name}.
Open a terminal in the repository root and run:
dotnet build plugins/{plugin name}Add -c Release to build with Release configuration.
Download save-tool.exe from Github Releases page (or compile it yourself).
The save-tool is a command line utility for compressing and decompressing save files.
You need to run it through command line. To list all available options use --help.
Caution
Careless modification of save file could result in the file being corrupted.
Note
Functionality of ImHex and dod-save.hexpat pattern are limited. Some parts of save files are read-only or unavailable.
For example, you can't edit the parameters, add new elements to list and modify world data when using this method.
-
Install ImHex and read about Pattern Editor.
-
Find the needed
.savefile:
They are located inC:\Users\%USERNAME%\Documents\Dig or Die\{your steam id}\Saves\{world name}\. -
Use
save-toolto decompress a save file:
Runsave-tool.exe -d {path to .save file}. The file with extension.uncompressed-saveshould appear where.savefile is located. -
Open the resulted
.uncompressed-savefile in ImHex. -
Open or drag-and-drop the pattern file
dod-save.hexpatin repository root folder into ImHex. -
Execute pattern in Pattern editor view.
-
Modify whatever data you want in Pattern Data view or directly in Hex editor and save it.
-
Use
save-toolto compress back the modified uncompressed save file:
Runsave-tool.exe -c {path to .uncompressed-save file}. This will create a backup of old save and replace the original.savefile. -
Open your save file in game.