2
Fork 0
Code Issues 1 Pull requests 2 Wiki Activity
Var Dump:
dumpVar: only available in dev mode
Mailing List
A template for building an engine plugin for Warhammer 40,000 Darktide
Find a file Use this template
2025-04-11 14:13:20 +00:00
.ci Fix pipeline 2024-08-19 13:22:44 +02:00
src Implement plugin template 2024-08-03 20:31:04 +02:00
.gitignore Implement plugin template 2024-08-03 20:31:04 +02:00
.renovaterc Add .renovaterc 2024-08-07 09:54:40 +00:00
build.rs Implement plugin template 2024-08-03 20:31:04 +02:00
Cargo.lock Update Rust crate bindgen to v0.71.1 2025-04-11 14:13:20 +00:00
Cargo.toml Update Rust crate bindgen to 0.71.0 2024-12-06 20:33:17 +00:00
Dockerfile Implement plugin template 2024-08-03 20:31:04 +02:00
Justfile Implement plugin template 2024-08-03 20:31:04 +02:00
LICENSE Implement plugin template 2024-08-03 20:31:04 +02:00
README.adoc Implement plugin template 2024-08-03 20:31:04 +02:00
rust-toolchain.toml Implement plugin template 2024-08-03 20:31:04 +02:00
rustfmt.toml Implement plugin template 2024-08-03 20:31:04 +02:00

Darktide Plugin Template

A template for building an engine plugin for Warhammer 40,000 Darktide.

Getting started

In src/lib.rs, change PLUGIN_NAME and MODULE_NAME to unique values matching your plugin. Then head to src/plugin.rs, where Plugin.setup_game, Plugin.update_game and Plugin.shutdown_game are your entry points that the engine will call. Start your plugin implementation here.

src/stingray_sdk.rs provides mappings for the engines API. A few functions are already implemented to serve as an example. You can implement more based on what you need (see LuaApi in src/plugin_api.h for whats available). If you do implement more mappings, please contribute them upstream to this template, so that others can benefit from them as well.

Your primary interface with the games Lua code should be LuaApi.add_module_function. This creates functions callable from Lua, such as DTPluginTemplate.do_something in src/plugin.rs.

Things to keep in mind

  • Printing in Rust code will not show up in the games log. You must use plugin.log (LoggingApi).

  • Panics in Rust will lead to a game crash. Using Result is good hygiene anyways.

Advanced

PluginApi contains more functions than just the three currently mapped in Plugin. If you need any of those, you will have to implement their mapping both in Plugin and in src/lib.rs like to the existing ones.

The engine also provides additional API structs beyond LoggingApi and LuaApi. A full list can be found at AutodeskGames/stingray-plugin. You will need to copy the definitions from there to src/plugin_api.h. They will likely also need adjustments, as Darktides engine has long since diverted from Autodesks version.

Building

Only cross-compiling on a Linux build machine has been tested so far. Native build on Windows likely only need the basic setup for Rust, though.

The engine requires DLLs to have a name suffix of _pluginw64_release.dll. The rest before that can be an arbitrary file name. The DLL then needs to be copied to binaries/plugins in the games installation directory.

Docker

The easiest way is using the provided Dockerfile. While it does run a Linux image, it sets up everything needed for compiling Windows DLLs, so it will work the same regardless of the host OS.

docker build -t my-project .
docker run --rm -t -v ./:/src/plugin my-project cargo build --release

(substitute my-project for a fitting name)

This Dockerfile should be suitable for CI as well.

Manual (Linux)

Prerequisites

  • A reasonably recent version of LLVM, lld & Clang

    • A symlink clang-clclang in PATH

  • cURL

  • Wine

  • Rust toolchain, MSVC target and rust-src:

    • rustup target add x86_64-pc-windows-msvc

    • rustup component add rust-src

Build

Set up Jake-Shadle/xwin. That repository contains a Docker file that can serve as an example. So does the Dockerfile here.

This includes the setup of Wine and the environmental variables to have Cargo use the Windows libraries and tools through Wine.