Skip to content

Your first Mod

Raffaele Picca edited this page Oct 10, 2023 · 17 revisions

Table of Contents


Introduction

In this guide, we're going to explore the process of setting up a project for modding. Specifically, we're adding a "Drillbert Sleep Indicator" to the game's user interface after decompiling and importing Dome Keeper into the Godot Engine. For a glimpse of the finished mod, you can find it here.

domekeeper_mod_drillbert_sleep_indicator

Understanding Godot Engine & GDScript

Before diving into mod creation, familiarize yourself with GDScript and Godot if you're new to both. Here are a few resources to kickstart your learning:

Working with GDScript Mod Loader

Dome Keeper utilizes the GDScript Mod Loader for mod loading, management, and interaction. Its documentation provides in-depth guidance on the required file structure, available API methods, and more. Be sure to familiarize yourself with the following documentation pages:

Enabling Mods in the Local Project

To allow Dome Keeper to load mods when testing the game locally, you need to enable a specific setting. Navigate to the res://addons/mod_loader/options/profiles/current.tres file in Godot's File System and double-click it.

wiki_first_mod_1

⚠️ Ensure the Enable Mods checkbox is checked in the Inspector (usually in the top right).

Creating a New Mod

Let's dive into creating a new mod. Start by generating a set of necessary files and directories as per the GDScript Mod Loader docs.

File Structure

The correct file and folder structure for a mod appears as follows:

res://
└───mods-unpacked
    └───Author-ModName
        ├───mod_main.gd
        └───manifest.json

We advise creating the folders within Godot. For the main mod folder name (Author-ModName), choose something short and unique. With these two files and the folder name, the Mod Loader will identify your mod.

manifest.json

The manifest.json file stores crucial information about the mod. Here's an example of what this file might look like:

{
	"name": "DrillbertSleepIndicator",
	"namespace": "Raffa",
	"version_number": "1.0.0",
	"description": "Adds a Drillbert Sleep warning indicator to the game's UI.",
	"website_url": "https://",
	"dependencies": [],
	"extra": {
		"godot": {
			"incompatibilities": [],
			"authors": ["Raffaele Picca"],
			"compatible_mod_loader_version": ["3.0.0"],
			"compatible_game_version": ["2.6"],
			"config_defaults": {}
		}
	}
}

mod_main.gd

This file represents the primary code for the mod, written in GDScript. For more guidance on GDScript, visit the Godot Engine docs.

The example below is a starter code setup. It's easily expandable and specific to Dome Keeper:

extends Node

const MYMODNAME_LOG = "Raffa-DrillbertSleepIndicator"

func _init():
	ModLoaderLog.info("Init", MYMODNAME_LOG)

func _ready():
	ModLoaderLog.info("Done", MYMODNAME_LOG)
	add_to_group("mod_init")

func modInit():
	pass

Testing the Mod

After setting up the directory and the two files, you can now test your new mod in the game! Start the project and click on modding in the main menu. If all is correctly set up, your new mod should appear in the list:

wiki_first_mod_2

Next Step

✨ Once you have successfully tested your mod, proceed to the Game Investigation section for further development.