How to host a KCD2 multiplayer server
Run your own KCDS dedicated server, add resources and get listed in the server browser.
1. Download the server
Get KCDS-Server-linux.tar.gz from the Download page and unpack it. In Docker, use the server
image instead: see Containers.
2. Open the port
Players connect over UDP 7777. Allow it in the server's firewall and forward it on your router. In Docker,
publish it with -p 7777:7777/udp.
3. Start the server
Run ./start-server.sh. The server listens on UDP 7777 on every network interface; type commands into the
server's terminal.
./start-server.sh
4. Add resources
Every folder in resources/ whose package.json has a kcds section is started. resources/freeroam is the
example gamemode (greetings, /help, /players, /tp <id> and /horse): change it, or put your own resource
next to it. resources/dice runs the dice tables. Writing your own: see the developer guide.
5. Tune items
The server item config sets the game's own weights, prices, stats, alcohol, decay time and ammunition damage, and limits how many units a player holds. The inventory, shops and containers show the limit in their own max column.
6. Get listed
The server lists itself in the in-game server browser through the master server, master.kcdsynced.com: name, map,
players, version and address, refreshed every 15 seconds and removed when the server stops. Set these as
environment variables before ./start-server.sh, or with -e in Docker:
| Setting | What it does |
|---|---|
KCDS_SERVER_NAME | The name players see, at most 64 characters. |
KCDS_MASTER_URL=off | Keeps the server private: not listed, players join by address. |
KCDS_SERVER_PUBLIC_ADDRESS | The address players dial (host:port), for example behind a proxy. |
KCDS_HTTP_PORT | Lets resources answer HTTP requests on this TCP port. |
A server started on 127.0.0.1 is never listed unless KCDS_SERVER_PUBLIC_ADDRESS is set. Once it is listed it
shows on the server list too.