Install and run a server
Go from nothing to standing in your own local server running the default gamemode, then change it and reload.
This page takes you from an empty machine to a local server running the default gamemode, with you standing in it. It takes about ten minutes the first time.
What you need
Section titled “What you need”| What | Why | Needed to |
|---|---|---|
| Kingdom Come: Deliverance II | The client runs inside the game. A Steam, GOG or any other copy works | Join a server |
| A KCDC release | The launcher, the client and the dedicated server for Windows and Linux | Run anything |
| Node.js 22 or newer, with npm | Installs dependencies and runs the TypeScript compiler | Build the default gamemode or any TypeScript resource |
| An editor | Visual Studio Code autocompletes the whole API in a TypeScript resource | Writing code |
1. Get a release
Section titled “1. Get a release”A release is one archive. Unpack it anywhere, not inside the game folder (nothing is ever copied there):
KCDC/ client/ KCDCLauncher.exe and the mod itself server/ KCDCServer.exe for Windows, with its own resources/ server-linux/ KCDCServer for Linux, with its own resources/ resources/ the default gamemode on its own, to edit or upload README.txtEach server folder reads resources from the resources/ folder next to its binary. The top-level
resources/ is a spare copy for hosting elsewhere; the guides use the one inside server/.
2. Install Node.js and npm
Section titled “2. Install Node.js and npm”- Install Node.js 22 or newer. The LTS installer is fine.
- Open a new terminal.
node --versionshould printv22or later, andnpm --versionshould print a version number.
The 1.6.6 default game mode and optional playground use npm and include a
package-lock.json. They do not require pnpm or Corepack. Your own resources
can use the package manager you prefer.
3. Build the gamemode
Section titled “3. Build the gamemode”A release ships the gamemode as TypeScript source. Until you build it, the server starts but answers no commands.
npm cinpm run buildnpm ci installs the locked compiler and API declarations,
@kingdomsconnected/types at your release’s
version. npm run build compiles the server and client halves as two programs.
You now have dist/server/index.js (what the server runs)
and dist/client/index.js (what every player’s game runs). Use TypeScript explains
the setup.
The mafiahub block in package.json tells the server which files to run and send to players; see
Resource manifest and lifecycle.
4. Start the server
Section titled “4. Start the server”From the server/ folder:
.\KCDCServer.exe./KCDCServerThe first start writes a server.json with every setting and its default. Look for the gamemode’s two
lines in the log (the command count varies):
[kcdc-gamemode] debug panel answering; clients open it with F4 or /ui[kcdc-gamemode] ready with 20 commandsThe server uses UDP 27015 and TCP 27016; a server on your own machine needs nothing opened. See Ports.
5. Join it
Section titled “5. Join it”- If your copy of the game is on Steam, start Steam.
- Run
client/KCDCLauncher.exe. The game starts with the multiplayer menu. - Choose Quick connect. It connects to
127.0.0.1on port 27015, where your server listens.
The launcher finds the game on its own the first time:
| Your copy | What the launcher does |
|---|---|
| Steam, with Steam running | Asks Steam where the game is installed. Nothing to pick |
| Microsoft Store / Xbox app (PC Game Pass) | Detects the installed package after trying Steam |
| GOG or a copy not detected automatically | Opens a file dialog. Pick GOG’s Bin\Win64MasterMasterGogPGO\KingdomCome.exe or Steam’s Bin\Win64MasterMasterSteamPGO\KingdomCome.exe |
The launcher saves the game path in client/KCDC_launcher.json, so later launches use
the same copy. A manually selected executable takes precedence over automatic store
detection. Delete that file to choose again. The launcher also registers kcdc://
links for the current Windows user on startup.
The game loads the level named in server.json, and the gamemode greets you in chat.
6. Try some commands
Section titled “6. Try some commands”Open chat with T:
| Type | What happens |
|---|---|
/help |
Lists every command the gamemode registers |
/horse |
Spawns a horse in front of you |
/world hour 21 |
Moves the shared clock to nine in the evening, for everyone |
/dialogue |
Opens a sample conversation in the game’s dialogue list |
/quest give errand "Deliver the letter" |
Writes a quest into everyone’s journal |
Press F4 for the debug panel: live stats, the world clock, who is connected and a command box. Esc hands the keyboard back to the game while the panel stays open.
7. Change something and reload
Section titled “7. Change something and reload”-
Keep both compilers watching your changes:
In server/resources/kcdc-gamemode/ npm run dev -
Edit
src/server/index.ts, for example the welcome line in theplayerSpawnedhandler. -
In the server console (the server’s window, not game chat), reload the resource:
Server console ensure kcdc-gamemodeensurereloads a running resource from disk and pushes new client files to everyone connected. Reconnect to see the new welcome.
npm run dev watches both halves in one terminal. It recompiles files but
does not reload the running resource; use ensure after a successful compile.
Press Ctrl+C to stop both watchers. Use npm test to build both halves
and run the game mode’s automated tests. The separate npm run watch and
npm run watch:client commands remain available.
Compilation followed by ensure works for your own resources too.
Console commands
lists the others, such as stop, start and refresh.
Troubleshooting
Section titled “Troubleshooting”error TS2304: Cannot find name 'Player' (and hundreds like it)
The compiler cannot find the declarations. Run npm ci in the game mode
folder first, then build again.
The build fails on a few specific methods
Your declarations and your release are different versions. Check that @kingdomsconnected/types in
the game mode’s package.json is your release’s version. Use the matching
release’s package files and run npm ci again. If you deliberately edit
dependencies, run npm install to update the lockfile before building.
The server starts, but commands do nothing
With no compiled gamemode, nothing listens for commands, so /help is silently ignored. Check that
resources/kcdc-gamemode/dist/server/index.js exists, and look in the server log for a
kcdc-gamemode line near startup: a missing file or a script error is reported there.
npm: command not found
Install Node.js with npm selected, then open a new terminal so its updated PATH is available.
The launcher cannot find the game
With a Steam copy, start Steam before the launcher, which asks Steam where the game is installed.
The launcher next tries the installed Microsoft Store / Xbox app
package. If it still asks, pick KingdomCome.exe in the dialog: Steam uses
Bin\Win64MasterMasterSteamPGO\ and GOG uses Bin\Win64MasterMasterGogPGO\
under the game folder. Cancelling the dialog closes the launcher.
If the game moved, or you picked the wrong copy, delete KCDC_launcher.json next to the launcher and
it will ask again.
Related
Section titled “Related”- Write your first resource: the next step, a resource of your own next to the gamemode.
- Let players connect: the server browser and remote hosts.
- Run a dedicated server: arguments, ports and console commands.
- server.json settings: every setting the first start wrote.