King Arthur's Gold Docker Container
This Docker container runs a King Arthur's Gold dedicated server. It is built on the base image and runs Transhuman Design's official Linux dedicated server (build 2844). The server package includes all game data, maps and game modes, so you don't need to supply game files.
Quick Start
services:
kag:
image: lancommander/kingarthursgold:latest
container_name: kag
ports:
- 50301:50301/udp
- 50301:50301/tcp
volumes:
- "/data/Servers/King Arthur's Gold/CTF:/config"
environment:
KAG_SERVER_NAME: "My KAG Server"
KAG_GAME_MODE: "CTF"
KAG_RCON_PASSWORD: "changeme"
user: root
cap_add:
- SYS_ADMIN
security_opt:
- apparmor:unconfined
restart: unless-stopped
How It Starts
PostInitialization/20-InstallKAG.ps1downloadsKAG_SERVER_URLifServer/KAGdediis missing or the URL changed, checksKAG_SERVER_SHA256, unpacks the folder holdingKAGdediintoServer/and remounts the overlay.PostInitialization/30-ConfigureKAG.ps1writes the non-emptyKAG_*settings intoautoconfig.cfgand, withKAG_MAP_CYCLE, writesBase/Maps/lancommander_mapcycle.cfg. It does this throughMerged/, so both files land inOverlay/.START_EXE(/usr/local/bin/kag-server) runs./KAGdedi autostart Scripts/server_autostart.as autoconfig autoconfig.cfgfromMerged/(THD'sdedicatedserver.shcommand line), withlib/onLD_LIBRARY_PATH, underscriptso that its console output reachesdocker logsstraight away.
On start the server downloads http://update.kag2d.com/1/linux32-dedicated-release/App/version.txt to check for updates. Without internet access the check fails and the server starts anyway.
A successful start ends with:
[03:50:18] ############ GAMEMODE CTF
[03:50:18] Server created on 50301 (BUILD 4762)
...
[03:50:18] LOADING PNG MAP Maps/Official/CTF/FG_Forsaken.png
[03:50:18] Restarting rules script: Rules/CTF/Scripts/CTF.as
[03:50:18] Checking any holidays...
Configuration Options
Ports
- 50301/udp: Game (
KAG_PORT,sv_port). - 50301/tcp: TCP RCON (TCPR), only with
KAG_TCPR=true(TCPR started successfully - listening on port 50301in the log).
Environment Variables
See the README for the full table.
autoconfig.cfg
Overlay/autoconfig.cfg is yours to edit. Only the variables that have a non-empty KAG_* setting are rewritten on start, plus g_ansiconsole 0, sv_register/sv_sendminimap (from KAG_LAN) and sv_mapcycle (from KAG_MAP_CYCLE). The file uses name = value # comment lines. The package ships no autoconfig.cfg, so on the first start it holds only the hook's lines; every other variable keeps its built-in default. server_setup_info.txt and the KAG wiki describe the rest (sv_bots, sv_maxping, sv_reservedslots, security_*, ...).
Game modes and map cycles
KAG_GAME_MODE(sv_gamemode) is a folder underBase/Rules:CTF,SmallCTF,TDM,WAR,Sandbox,Challenge. Mods can add more.- With
KAG_MAP_CYCLEempty, the mode uses its ownBase/Rules/<mode>/mapcycle.cfg. KAG_MAP_CYCLEtakes paths underBase/(Maps/Official/CTF/FG_Forsaken.png) or bare file names (FG_Sinkhole.png, the first match underBase/is used). Maps that aren't found are left out with a warning. Add custom maps asOverlay/Base/Maps/<name>.png.- Set
KAG_MAP_CYCLE=keepto managesv_mapcycleyourself; the file it points at must be underBase/or a mod folder.
Remote administration
- In game: open the console (Home key) and type
/rcon /login <KAG_RCON_PASSWORD>, then prefix commands with/rcon, e.g./rcon /nextmap,/rcon /kick <name> 10. - TCPR (
KAG_TCPR=true): connect to TCP 50301, send the RCON password as the first line, then one command per line. Lines are console input:/players,/msg hello, or AngelScript such asprint(sv_name);. Withsv_tcpr_everything 1(the default) the whole console log is streamed back.
Hooks
| Hook | When |
|---|---|
PreInstallKAG / PostInstallKAG | Around the server download |
Put .ps1 scripts in config/Scripts/Hooks/<HookName>/.
Troubleshooting
SHA256 mismatch:dl.kag2d.com/kag-linux32-dedicated-release.tar.gzalways serves the newest build, and THD has published a new one. ClearKAG_SERVER_SHA256(or set the new hash) to install it, and update your clients to the same build.- Clients can't join / version mismatch: the client and server builds must match. The server is build 2844 (
App/version.txt,BUILD 4762in the log). Older clients normally update themselves on launch when they have internet access. - The server crashes (exit code 139) right after
LOADING PNG MAP, withInfinite hook recursion detected when executing void onRestartandpostgamemapvotesin the log: the map cycle has fewer than 3 maps. The end-of-match map vote needs 3, and with fewer it reloads the map inside its own restart hook until the server crashes. The hook repeats maps to padKAG_MAP_CYCLEto 3; a hand-written cycle (KAG_MAP_CYCLE=keep) needs at least 3 entries. Match not found for file .../Failed to load map cycle file: KAG only finds files that were underBase/(or an enabled mod) at startup. A cycle file in the server root isn't found.WARING: sv_register is set to 0, the server will attempt to register with the api...: printed wheneversv_registeris 0 (the default here,KAG_LAN=true). The wording is THD's; the server is not registered.Files have the same name! (rename for safety)andConfig file not found '.../Security/*.cfg'during startup: harmless; the stock package has a few duplicated maps and no security lists, which the server creates.Overlay/autoconfig.cfghas only a few lines: see autoconfig.cfg. Variables that aren't in the file use their defaults.