Guide:Getting Started

From House of the Dying Sun Modding Wiki
(Redirected from Getting Started)
Jump to navigation Jump to search

What to know

The game is an x86 Unity 5 application. This information will be relevant for installing BepInEx, especially the architecture; x86 apps are only compatible with x86 libraries.

Game setup

If you want to start modding, you have two options:

  1. Thunderstore installation
  2. Direct BepInEx installation

The former is a modding database, so there already exist mods for it there. Setup is already taken care of here, and it makes updating existing mods and libraries easier.

The latter is a little more involved, and while a mod manager is advised, it can be easier on quickly loading plugins.

Thunderstore Installation

Installing a mod manager

You can use the Thunderstore Mod Manager or r2modman. They function similarly, so either works.

Simply install the mod manager, then select "House of the Dying Sun." Make this your default game if you installed this only for the game. Open the default profile (a new one works too), and then install "BepInExPack_HOTDS."

Direct BepInEx Installation

Adding BepInEx

Follow this guide; be sure to install the x86 version, otherwise BepInEx will not be loaded. If you did this correctly, winhttp.dll and doorstop_config.ini should be in the same folder as dyingsun.exe, and only a folder named "core" in BepInEx. Run the game, and new folders should appear inside BepInEx if everything has happened correctly. If you see a black screen and nothing happens, don't worry; we will fix this in the configuring section. Close the game now that everything has generated.


Now that BepInEx has loaded, it has generated new folders in BepInEx, as well as a new config file at BepInEx/config/BepInEx.cfg. Open this file with any text editor, find the section "Preload.EntryPoint," then find the Type variable. Change this from Application to MonoBehaviour--this makes it compatible with Unity 5.

Optionally, if you want a console to appear, find the section "Logging.Console" and set "Enabled" to true.

Save the file and close it. The game should now begin properly.

Setting up a project

With the game now set up, we can make a C# project for building libraries. There are two ways that this can be done: either the original way, or the new and quick way.

Before you begin

You will need .NET Framework 3.5 installed on your PC. If you have not, you may download it from here:

The quick way

Creating a project

Open the place you want to create the project in, and in the address bar of file explorer, type in "cmd" to open Command Prompt.

If this is your first time making a BepInEx project like this, run the following command to install the NuGet package:

dotnet new install BepInEx.Templates --nuget-source

You may move on to the next command otherwise.

Now run the following command:

dotnet new bepinex5plugin -n TestPlugin -T net35 -U 5.4.6

Note: If you're getting an error related to "Object reference not set to an instance of an object," install .NET 7 and follow these steps to resolve the issue.

We can now close cmd, and right-click the new TestPlugin folder. Open with your editor of choice.

Adding libraries

Unlike the original way, we only have to focus on importing one library. Right-click on Dependencies (under the C# project) and select "Add Assembly Reference...". Click on the "Browse..." button, and go to the game's directory. In dyingsun_Data/Managed, add Assembly-CSharp.dll and then click OK.

The original way

Creating a project

With Visual Studio, create a new project, and filter the results to "C#" for language, "Windows" for platform, and "Library" for project type. Select "class library," then click next. Name this project however you want, and put it wherever you want. When the project is created, double-click on the C# project (ProjectName.csproj in Windows Explorer), and change the text inside <TargetFramework> to net3.5.

Adding libraries

NOTE: If you installed BepInEx with one of the two listed mod managers, your mods will be in the data folder. Said folder can be found in %appdata% (C:/Users/your-name/AppData/Roaming), where r2modman's is in r2modmanPlus-local and TMM's is in Thunderstore Mod Manager\DataFolder. From there, go to HOTDS/profiles/Default, and there will be BepInEx.

Create a new folder in your project called "libs." Go back to the game's directory, and in dyingsun_Data/Managed, copy Assembly-CSharp.dll and UnityEngine.dll (as well as UnityEngine.UI.dll if you need it) into the library folder you just created. In BepInEx/core, also copy 0Harmony.dll and BepInEx.dll (other DLLs can be added if needed) into it. Now, to reference them in Solution Explorer, right-click on Dependencies (under the C# project) and select "Add Assembly Reference..." to open a new menu. Click on the "Browse..." button, then add the DLLs from your libs folder. Your project should now be ready to go.

See also