Getting started
A KCD:MP server is one program that the players’ games connect to. It runs one game mode - the rules of that server: where players spawn, what the chat and the commands do, who may hurt whom, what stands in the world. A game mode is a script or a plugin you write; the server calls it when something happens (a player joins, dies, types a command) and the script calls the server back (send a message, move a player, spawn a horse). A mode may also have a client script: its own half that runs inside each player’s game, for the things only the player’s screen can show.
| Piece | What it is | Written in |
|---|---|---|
| The server | the dedicated server program, a folder you run on Windows or Linux: server.toml, the game modes, the data it keeps |
- |
| A game mode | the rules of one server; one per server, reloaded without a restart | Lua or C# |
| A client script | the mode’s half on the player’s game: a marker, a sound, a bit of UI, a value read from the game; sent to the players by the server | Lua |
| The world data | the level’s tables, terrain, navigation mesh and collision geometry, exported from your own copy of the game | - |
The server works out of the box: the two modes that ship with it, freeroam.lua and duel_arena.lua, are complete servers,
and a mode that defines nothing is a valid mode - the server spawns everyone at its default point and answers its own chat
commands. Everything on these pages is what you add.
The pages, in order
Section titled “The pages, in order”- Setting up - the server folder, the first run, joining it, picking a mode, giving the server the game’s data, your editor. Step by step, whatever language you script in.
- AI assistants - this documentation as plain text and as language-server definitions, and a
CLAUDE.mdthat starts a game-mode project with a coding agent. - Server configuration - every key of
server.toml, with its default. - Guides - one job per page: exporting the game’s tables, the terrain, the navigation mesh and the collision geometry from your game; putting a server on the public list.
- The API for your language: Lua (the server and the client side, every callback and function on its own page) or C# (the same server API as typed interfaces).
- The reference - the game’s lists: every item, soul, buff, mesh, preset, animation clip, door and container, by the keys the functions take.
Conventions
Section titled “Conventions”The same everywhere, whatever the language:
- metres in the level’s world space, as the game’s own console reports positions;
zbelow0when spawning or teleporting means “on the terrain”; - degrees for a yaw,
0= facing +Y, counter-clockwise; 0xRRGGBBAAcolours -0xFF0000FFis opaque red;- milliseconds for times and timers; the world clock in hours (
13.5= 13:30); - a player is a
pid(0to the slot count minus one, reused after a disconnect); a world entity - a horse, a pickup, a prop, an NPC actor, a dog - is anid, unique while it lives; - the keys of game things - items, souls, buffs, meshes - are an id, a name or a GUID from the reference;
a call given an unknown key fails quietly (
nil,false) and the server log says why.
