Creating a Plugin
A general tutorial for creating a Hogwarp plugin. Version: 0.8.0 beta 2
Last updated
A general tutorial for creating a Hogwarp plugin. Version: 0.8.0 beta 2
Last updated
In Visual Studio, create a new project, select Class Library
, then click Next.
On the next page, give the project the name of your choice and click Next. In this example we use Tutorial.
Click Create
.
You should now be in Visual Studio with a basic class.
In the solution explorer, expand your project and right click on dependencies, then click Add Project Reference...
A window will open, click on Browse...
Go to the HogWarp install location, then in the Server folder and select HogWarpSdk.dll
.
Click on Add
. Then Ok
.
The server mods need to respect a special naming convention to be loaded correctly.
When attempting to load a mod, the server will look for the ModName.Plugin
class, where ModName
is the name you chose when creating your project.
Create a Plugin.cs
file in your solution and fill out the required fields.
For now, we leave PostLoad
and Shutdown
empty, as we don't need them here.
If you choose this folder structure for you project:
Hogwarp->Server->Server->YourPluginName
You can of course alter this path to your likings if you know how to do so.
You can add the following PropertyGroup into your csproj file:
If you have done this and build your mod it should have generated the folders and files for you.
The files should now be in your Hogwarp->Server->Mods
folder.
Now build your mod, you will see a path to a DLL being produced, browse to this location.
You must now copy the DLL so that you get something like Server/Mods/ModName/ModName.dll.
For example with the "Tutorial" plugin the path will be Server/Mods/Tutorial/Tutorial.dll
If you now launch the server you should see your plugin gets loaded correctly:
Picking net8.0 as your Target Framework is very important. Make sure you have installed the .NET SDK 8.0 from