Run a dedicated server
Start KCDCServer on Windows or Linux, open its ports, pass command-line arguments and use its console.
KCDCServer hosts the session, holds the authoritative world state and runs
your resources. It is the same program on your desk and on a rented machine.
To get the default gamemode running locally for the first time, follow
Install and run a server instead.
./KCDCServer.\KCDCServer.exeStart it from its own folder: it reads server.json and resources/ from
the working directory, not from next to the binary. The first start writes a
server.json with every default. The server accepts players once the log
shows:
KCDC Server successfully startedStop it with Ctrl+C, quit in the console, or SIGTERM. All three run
the same shutdown, so resources get their resourceStop handlers.
What is in the server folder
Section titled “What is in the server folder”| Folder | Contents |
|---|---|
server/ (Windows) |
KCDCServer.exe, libnode.dll, crashpad_handler.exe, resources/ |
server-linux/ |
KCDCServer, libnode.so.*, crashpad_handler, resources/ |
The server carries its own JavaScript runtime in libnode, so the host needs
no Node.js. On Linux it also links against the system’s libcurl, OpenSSL 3,
zlib and libstdc++ (on Ubuntu 24.04: libcurl4t64, libssl3t64, zlib1g,
libstdc++6, as in the official container image).
Build resources on any machine and copy the folder, dist/ included, to the
server.
| Port | Protocol | What it carries |
|---|---|---|
| 27015 | UDP | The game session: connection, replication, resource and custom asset downloads, voice |
| 27016 | TCP | HTTP endpoints, including a status document at / |
Nothing listens on TCP 27015. Change the ports with --port and --apiport,
or port and apiport in server.json. To let players in
from outside, see Let players connect.
Check that a server is up without starting the game:
curl http://your.server.address:27016/It answers with JSON: mod name and version, game port, max_players and the
replicated mod settings such as the level.
Player limit
Section titled “Player limit”A session holds at most 512 players. The cap is compiled in: maxplayers
can lower it, but a larger value is clamped to 512 at boot with a warning.
Command-line arguments
Section titled “Command-line arguments”Options override the matching server.json key for one run and are never
written back:
./KCDCServer --port 28015 --apiport 28016 --config second.jsonOptions and overrides lists every option, which source wins, and how to change common behaviours.
Resources and chat commands
Section titled “Resources and chat commands”Every folder under resources/ with a valid package.json is a resource,
started at boot (Resources).
The server itself answers no chat commands: /help, /tp and the rest come
from kcdc-gamemode. Without it players still connect and play, but
commands do nothing. Plain chat is relayed to everyone by default either way
(Chat and /commands).
Console commands
Section titled “Console commands”The server reads operator commands from standard input: its terminal, or a
hosting panel’s console tab. help in the console goes to the server;
/help in game goes to your resources.
ensure my-resource| Verb | What it does |
|---|---|
start <resource> |
Start a stopped resource |
stop <resource> |
Stop a running resource |
stop |
With no argument, shut the server down |
restart <resource> |
Reload a running resource. Refuses if it is not running |
ensure <resource> |
Reload the resource if running, start it if not |
refresh |
Register new folders in resources/, stopped |
refreshall |
refresh, then reload every running resource |
quit |
Shut the server down |
status |
Print server name, address and player count |
help |
List every verb |
<resource> is the name in its package.json, normally the folder name.
Reload a resource
Section titled “Reload a resource”A reload runs the resource’s resourceStop handlers, removes its listeners
and timers, forgets its cached modules, re-reads package.json and starts
it again. Resources that depend on it restart with it.
Players stay connected: they receive the changed client files and restart
the client half in place. Scripts and tooling usually want ensure, which
also works when the resource is not running.
Add a resource while the server runs
Section titled “Add a resource while the server runs”start only knows resources found so far. Scan for a newly copied folder
first; refresh never starts anything itself:
refreshstart my-new-resourceIn a container the console needs stdin and a terminal attached; see Docker and panels.
Files the server writes
Section titled “Files the server writes”Everything lives in the working directory: server.json, resources/,
logs/, .packages/ and crash data. Back up the whole folder, hidden files
included. Options and overrides
says what each one is.
Related
Section titled “Related”- Options and overrides: every option and setting, and which one wins.
- server.json settings: every key, the level and required DLCs.
- Let players connect: port forwarding and what to send players.
- Docker and panels: the official image.
- Write your first resource: the edit, build,
ensureloop.