Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

132 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KCD2MP

Experimental multiplayer for Kingdom Come: Deliverance II.

Warning

KCD2MP v0.0.9 is a prototype, not a production-ready multiplayer mod. Expect breaking changes, incomplete world simulation, compatibility limits, and loss of multiplayer-world data while development continues. Use test saves and keep backups of anything important.

Project status

Current version 0.0.9
Development stage Prototype / technical preview
Networking Direct IP, dedicated authoritative server
Platform Windows x64
Supported game Steam build 23914554, game version 1.5
Supported WHGame 1308617_856

KCD2MP uses one project version across the client, server, build metadata, and network handshake. During the prototype phase, clients and servers must run the exact same KCD2MP version. There is no separate user-facing "protocol version". See CHANGELOG.md for version history.

What works in v0.0.9

  • Direct-IP client/server connection with authentication and reconnect support
  • Persistent server sessions and player profiles
  • Remote-player spawning, movement, appearance, equipment, and weapon state
  • Native inventory and equipment reconciliation with rollback
  • Server-authoritative doors and loot containers
  • Supported containers: regular chests, cart chests, stash corpses, bird nests, and destructible stashes
  • Server-authoritative dropped items, pickup ownership, and restart persistence
  • Shared time-of-day, time scale, and weather
  • Independent human- and animal-NPC isolation controls
  • Signature and Address Library validation before native hooks are enabled

NPC world synchronization, quests, dialogue state, combat AI, and complete cooperative world progression are not implemented yet. Native NPCs can be isolated, but they are not currently replicated as shared server entities.

The detailed implementation status and current limits are documented in docs/multiplayer.md.

Architecture

KCD2MP keeps its two runtime boundaries separate:

  • d3d12.dll provides the mod-loader and ImGui frontend.
  • dinput8.dll hosts KCSE.
  • KCD2MPKCSEClient.dll owns the in-game multiplayer client and native game integration.
  • KCD2MPServer.exe is a standalone dedicated server and does not load KCD2.

The project is based on KCD2ModLoader and ReturnOfModdingBase. It pins F02K/libKCD2 and F02K/Address-Library-For-KCSE as vendor dependencies.

Native engine access is capability-gated. A client join verifies the game build, KCSE/libKCD2 runtime, Address Library identity, required native features, content fingerprint, and KCD2MP version before entering the world. Runtime objects never cross the frontend/client ABI boundary.

Build and deploy

Requirements:

  • Windows 10 or Windows 11
  • Python 3.9 or newer
  • CMake
  • Visual Studio with the MSVC x64 C++ workload

Initialize the pinned vendor repositories after cloning:

powershell -ExecutionPolicy Bypass -File tools/init_vendor.ps1

Run build.bat from the repository root. On first launch, the build tool creates an isolated .venv-build environment and installs its pinned Python dependencies.

The terminal UI can:

  • build Debug or optimized Release artifacts with symbols;
  • run native, protocol, server, networking, and deployment tests;
  • discover the Steam installation or remember a manual game path;
  • audit the installed WHGame.dll before deployment;
  • validate and deploy the pinned Steam/GOG/Epic Address Library tables; and
  • deploy both loaders and the KCSE client plugin.

Every successful build also creates a clean package tree under out/package/<debug|release>/:

client/   install-ready game tree and KCD2MP-Client-v0.0.9.zip
server/   dedicated server, configuration, data, symbols, and audit tool
tests/    test executables and their symbols only
SHA256SUMS.txt

The client ZIP starts with KingdomComeDeliverance2/ and mirrors the same relative paths used by Build & Deploy. It can therefore be extracted directly into the Steam steamapps/common directory. See Build and release packaging for the exact layout and standalone packaging command.

Build & Deploy never starts or stops the game. Close KCD2 before deployment so Windows can replace the runtime DLLs.

Dedicated server

Copy server.toml.example to server.toml, select the sandbox level_id, and start the server:

KCD2MPServer.exe server.toml

The common retail world IDs are:

  • 2 — Trosky region (trosecko)
  • 3 — Kuttenberg region (kutnohorsko)
  • 4 — Monastery (klaster)

The server listens on UDP port 27020 by default. Allow and forward that port only when hosting outside the LAN.

Persistent session data, player profiles, synchronized world objects, and dropped items are stored below world_directory. Writes use temporary sibling files followed by atomic replacement. Native save files are never uploaded to or read by the dedicated server.

Available server commands include status, players, kick, say, profile claim, dummy spawn, dummy remove, entities, time, timescale, weather, stop, and help.

dummy spawn [name] creates a non-persistent simulated player from the current starter profile. Equipped starter items use the normal remote-equipment path. After a two-second spawn warm-up and short input buffers, the server sends brief walk and turn inputs through ordinary transform snapshots. Translation stays at the authoritative spawn point: the native client locomotion controller must move and animate the actor, and every stop re-anchors it. This safely exercises the same animation path as real player input without letting a test dummy wander off terrain. Native weapon actions are excluded until their runtime path is verified.

Joining from the game

  1. Start KCD2 and choose Multiplayer in the main menu or pause menu.
  2. Select Server, Name, or Password to edit the value. Confirm with Enter, cancel with Escape, and paste with Ctrl+V.
  3. Choose Connect. No savegame is required: from the title screen the server bootstrap starts KCD2's native New Game path directly in the configured level. From the pause menu, an already loaded matching level is adopted.

The in-game UI follows KCD2's current g_language setting. Editable UTF-8 translations are installed in <game-root>\mods\KCD2MP\Lang\; English is the fallback when no file exists for the selected game language.

The client waits for NewGame, PreDataLoaded, DataLoaded, the target wh_sys_BaseLevelId, the local actor, and the native capability probe before it applies the multiplayer profile and sends WorldReady. A different active level is rejected until synchronized live travel is enabled. Failed native prerequisites time out with a concrete loading phase instead of forcing the loading screen away.

Manual installation

For manual deployment:

  1. Copy d3d12_.dll beside KingdomCome.exe and rename it to d3d12.dll.
  2. Copy KCSE's dinput8.dll beside KingdomCome.exe.
  3. Copy KCD2MPKCSEClient.dll to <game-root>\mods\KCD2MP\KCSE\Plugins\.
  4. Copy the matching Address Library table to <game-root>\KCSE\addresslib\.
  5. Copy data\lang\*.lang to <game-root>\mods\KCD2MP\Lang\.

The default Steam binary directory is:

KingdomComeDeliverance2\Bin\Win64MasterMasterSteamPGO

To uninstall the runtime, remove or rename d3d12.dll, dinput8.dll, and mods\KCD2MP\KCSE\Plugins\KCD2MPKCSEClient.dll.

Diagnostics and testing

Debug and Release builds expose an output-only diagnostic console. Successful startup reports the detected PE fingerprint, signature validation, and enabled hooks. The build tool can run the same signature audit without starting KCD2.

Automated coverage includes protocol validation, server lifecycle and persistence, player profiles, identity storage, remote avatars, container and door conflicts, dropped-item ownership, environment state, native capability gates, deployment behavior, and Address Library coverage.

In-game multi-client soak tests, save-directory comparison, fault injection, and full NPC/quest simulation remain manual or future work.

Additional documentation

Existing mod-loader features

The inherited modding layer also provides Lua plugin loading and hot reload, Dear ImGui Lua bindings, FMOD integration, ASI loading, XML merging, and debug inspection tools. The example plugin is in examples/plugins/KCD2MP-TestMod.

About

Kingdom Come: Deliverance II Multiplayer Mod

Topics

Resources

Stars

6 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages