Skip to Content
Modlock

Open source · MIT · WebAssembly

Custom game modes for Deadlock, in a language you already know.

Write a mod in TypeScript, Luau, Python or Go, and the game server runs it in a WebAssembly sandbox. While you work, modlock dev reloads the mod each time you save.

Show samples in

Each language's library has the same events and calls, so you can pick the language you know. This mod replies when a player types /hello in chat:

import { command } from 'modlock'

command('hello', (player) => {
  player.chat('Hello from TypeScript!')
})
local modlock = require("@modlock")

modlock.command("hello", function(player)
	player:chat("Hello from Luau!")
end)
import modlock


@modlock.command("hello")
def hello(player: modlock.Player, args: str) -> None:
    player.chat("Hello from Python!")
package main

import "github.com/paralin/modlock/mod"

func init() {
	mod.Command("hello", func(p mod.Player, args string) {
		_ = p.Chat("Hello from Go!")
	})
}

func main() {}

Early development

You can write, run and publish mods in TypeScript, JavaScript, Luau, Python and Go today, but the library may still change between releases.

Where to go

Why WebAssembly

Safe to share

Each mod runs in a Wasmtime sandbox, where it can reach only its own files and never the network. When a mod crashes or hangs, the server stops that mod and the match goes on.

Any language

You can write a mod in any language that compiles to WebAssembly.

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

The server calls each mod inside the game's own frame, and Wasmtime runs its WebAssembly as machine code.

Community

Questions, ideas or a mod to show off? Join the Discord. Modlock is open source under the MIT license, on GitHub.

On this page