Modlock lets you write the logic of a Deadlock custom game mode by hand,
in TypeScript, JavaScript, Luau, Python or Go, and the game server runs your
mod in a WebAssembly sandbox. Every language's library makes its calls to the
game as messages from one protobuf schema, so each language gets the same
events and calls. modlock publish uploads mods to hyperline.gg, the default
platform for custom games.
import { command } from 'modlock'
command('hello', (player) => {
player.chat('Hello from TypeScript!')
})Early development. APIs may change without notice between any two releases. TypeScript, JavaScript, Luau, Python and Go mods, the
modlockcommand line andmodlock publishall work today.
The only program you need is the modlock command. Install it by running the
line for your computer.
Windows, in PowerShell:
irm https://raw.githubusercontent.com/paralin/modlock/master/install.ps1 | iexmacOS or Linux, in a terminal:
curl -fsSL https://raw.githubusercontent.com/paralin/modlock/master/install.sh | shOr install it with npm on any of them, into a project or globally:
npm install --save-dev @modlock/modlock
npx modlock new my-modYou need nothing else for a TypeScript, JavaScript, Luau or Python mod, and a
Go mod also needs Go. The
install page explains how to
download modlock by hand and what to do when your terminal cannot find it.
Then make a mod and run it:
modlock new
cd my-mod
modlock devmodlock new asks for the mod's name and its language. modlock dev builds the
mod, starts a local server and launches Deadlock through Steam to join it. Each
time you save, it rebuilds the mod and replaces the running one. The
starter mod replies to /hello in chat, and
Your first mod walks
through the rest.
Complete game modes to start from include arena in
TypeScript, bounty in Luau and race in
Go, all in the examples directory.
The documentation is at paralin.github.io/modlock. Every sample there comes in TypeScript, Luau, Python and Go, and once you choose your language, every page shows its samples in it.
| Section | Holds |
|---|---|
| Start | Install, your first mod, a tutorial and the examples. |
| Languages | What is particular to TypeScript, Luau, Python and Go. |
| Guides | One page for each thing a mod does: events, players, timers, the world. |
| Mechanics | Whole mechanics to start from: a countdown, kill scoring, a hill, a race. |
| Reference | The command line, the manifest and publishing. |
| Internals | The protocol, the framework, building from source and native plugins. |
The site's source is in docs, and running bun install and
bun run dev there serves it locally. Complete mods to read and run are in examples.
- Safe to share. A mod runs in a Wasmtime sandbox inside the server, where
it can reach only the calls the schema declares. Those calls let it read and
write its own files, but it has no network access and no environment
variables. When a mod crashes, loops forever or allocates past its limit, the
server stops that mod, logs why and keeps the match running. A slow event
still finishes, and the players see a warning in chat. Any player can restart
a stopped or slow mod with
/restartmod. - Any language. You can write a mod in any language that compiles to WebAssembly, using a small library for that language.
- Built once. The server looks up each field and input a mod uses by name, so a mod built before a game update still works after it.
- Fast. Wasmtime compiles mods to machine code with Cranelift. The server calls a mod inside the game frame and waits for its answer, so the mod can claim a command or change that frame before the game moves on.
Thanks to the Deadlock modding community, whose research made this possible. See ATTRIBUTION.md.
MIT. See LICENSE.