Game Investigation - DomeKeeperMods/Docs GitHub Wiki
Table of Contents
Introduction
If you want to mod the base game, the first step typically involves investigating the vanilla game to find a suitable place to "hook" into. This guide will take you through the necessary steps.
Searching Code
A powerful tool for identifying the right code snippets is Find in Files. You can access this in the Script Editor (top center or CTRL+F3), Search > Find in Files. Alternatively, CTRL+Shift+F will open the same Find in Files dialog.
To illustrate, let's search for Drillbert, which is the aspect we want to mod.
The search results are displayed in the bottom center of the Godot Engine.
💡 Tip: Click on results to navigate directly to the corresponding code.
Among the results, the script we need is Drillbot.gd.
Searching in the File System
As an alternative to the above, you can also find specific Dome Keeper content using the File System tab. The Dome Keeper project has a logical structure that makes it relatively easy to locate the content you want to mod.
In the res://content folder, you will find different content categories. In this case, we're looking for the Gadget : Drillbert.
Close, but not quite. It turns out drillbert is called drillbot in the project's folder structure!
🦖 Fun Fact: Drillbert was originally intended to be a drilling robot (Drillbot). But the concept changed to make it a living creature - a move inspired by Anne's and Renè's child being in a dinosaur phase. So, Drillbot evolved into Drillbert, a dinosaur-like creature with a love for drilling.
💡 Tip: Use the File System tab's search function to look for specific keywords.
Finding a Good Hook
A typical modding requirement is the need to "hook" into existing code. You might need to monitor when certain events occur, track changes, or access existing data.
Dome Keeper has some distinct systems that drive much of the game's logic. You can find more about them in the Dome Keeper Systems section of the wiki.
Returning to our Drillbert mod: in the drillbot folder, we need to open the Drillbot.gd file and find a suitable place to hook our mod into. Let's open the script and investigate. One way to identify what we need is to search the script for certain keywords. Press CTRL+F or Search > Find and enter sleep.
From the resulting lines, we quickly locate a jackpot: a method named goToSleep.
func goToSleep():
setState(State.SLEEPING)
normalMode()
animation("liedown")
remainingSleepTime = Data.of("drillbot.sleeptime") * GameWorld.getTimeBetweenWaves()
Here, Drillbert transitions to the sleep state, making this an ideal place for our mod to get the information it needs.
Conclusion
Various methods exist to sift through the game's code and assets to find what you need. This step is often the first in the modding process and can be the most time-consuming.
Next Step
✨ Now that you've found a place to hook your mod, proceed to the next step: Extending Code.