Skip to content

Exporting the game's tables

The server judges every hit itself - the attacker’s weapon against the armour on the part it struck - and resolves the keys a game mode and the chat commands use: an item by name, a horse breed by name, a buff by its class. Both need the game’s own tables, which the server does not have. data/combat/items.json is that export: the weapon and armour numbers and the lists of items, souls, buffs, consumables, weapon presets and prop meshes, read straight from the game’s files.

With it:

  • a hit does what the game’s tables say it does ([combat] attack_scale, armour_pivot and the rest scale it - the combat model);
  • items, souls, buffs and meshes answer to their names and ids as well as their GUIDs - /give shortswordBroad, /horse Horse2, GivePlayerBuff(pid, "potion_marigold_decoction"), /prop barrel_a - with the English names too (/give duelling longsword);
  • the server owns potions, drink and the buffs it claims, and knows what each consumable does.

Without it the server takes the damage the players’ games report (clamped by [combat] max_claim_damage) and knows items, souls and buffs by their GUIDs only. It says so at start: combat tables: ... not usable or nothing at all.

On the machine that has the game, run tools/KcdMp.ExportTables.exe from the Windows server folder - double-click it, or from a terminal. It finds the game through Steam (or asks for the folder in a dialog), reads the game’s tables, the English names and the object files, and writes data/combat/items.json into the server folder in a few seconds; the last lines say what it counted and where the file went. The game does not start.

KcdMp.ExportTables [--game <folder>] [--out <file>] [--no-names] [--no-meshes]

--game names the game’s folder when Steam does not; --out writes elsewhere; --no-names leaves the English names out (/give by English name stops working); --no-meshes skips the object files (a few seconds faster, no props by name). --help prints the same.

The tool puts the file where the server reads it. For a server on Linux, copy it into that server’s data folder - the one that holds the player records - as combat/items.json. The configuration names it:

[combat]
tables = "data/combat/items.json"

The server log confirms it at start: combat tables: data/combat/items.json (... weapons, ... armour pieces): damage from the tables.

The reference lists on this site - items, souls, buffs, meshes and the rest - are the same export of the same game build, so their numeric ids are the ones your server resolves. An id is a row number of a name-sorted export: the same for one game build, shifted by a game patch that adds things. Keep the name or the GUID in a game mode and in anything else durable; use the id at the chat line.

One export per game build: after a game update, export again, and the server picks the new file up at its next start.