A standalone template for Dusklight mods.
See the Dusklight modding documentation for the full mod API: services, hooking game functions, asset overlays, and more.
- Click "Use this template" to create a new repository for your mod.
- Edit
mod.json: set your mod'sid(reverse-DNS style, e.g.com.example.my_mod),name,author, anddescription. - Rename the target in
CMakeLists.txt(add_mod(my_mod ...)) (this names the.duskfile). - Write your mod in
src/mod.cpp. - Build locally:
cmake -B build cmake --build build
The result is build/mods/<name>.dusk. Copy it into the game's mods folder to try it:
- Windows:
%APPDATA%\TwilitRealm\Dusklight\mods - Linux:
~/.local/share/TwilitRealm/Dusklight/mods - macOS:
~/Library/Application Support/TwilitRealm/Dusklight/mods
During development, rebuild, copy and click Reload in the in-game mod manager to pick up changes.
Important
A mod built locally will only be valid for your own platform, and shouldn't be distributed. The repository will build a cross-platform bundle for distribution. See below.
Change the DUSKLIGHT_VERSION line in CMakeLists.txt to the new release tag (or commit hash) and reconfigure. The
pinned version is fetched into dusklight/ automatically. Use the dusklight/ checkout to browse game code, headers
and mod services.
Important
The Dusklight checkout is for reference only. Mods use services and hooks to interact with game code.
The included GitHub Actions workflow builds the mod for the following platforms:
- Windows (AMD64 & ARM64)
- macOS (Apple Silicon & Intel)
- iOS (Apple Silicon)
- Linux (x86_64 & aarch64)
- Android (aarch64)
It then merges the per-platform builds into a single .dusk supporting all platforms. (Artifact mod-combined)
Pushing a tag to the repository creates a GitHub release with the combined bundle.
Point the build at an existing checkout instead of fetching one:
cmake -B build -DDUSKLIGHT_DIR=~/path/to/dusklight