Source code for a helper tool that hot-reloads a DDNet server map and manages backups.
- Language: C++ (single binary)
- Main:
ddnet_control.cpp - Icon/Resources:
ddnet_control.rc(usesImage/ddnet_loader.ico) - Registry scripts (user-scope):
registry/ - Tools:
tools/(e.g.,convert_ico.pyfor multi-size ICO generation) - Web UI assets (optional):
web/
Windows with MSVC (VS 2022 Build Tools):
compile.batOn success: ddnet_control.exe is produced; see build.log.
Double-click a .map file (after association), or run from CLI to load a map and hot-reload:
ddnet_control.exe "C:\\Users\\<you>\\AppData\\Roaming\\DDNet\\maps\\mapsfortest\\Tutorial.map"Behavior (high level):
- Detect current server map via
sv_map. - Ensure
%APPDATA%/DDNet/mapsstructure (andbackups/). - Copy new map into DDNet maps (LINEAR2) if needed.
- Manage
lastmapname.txtto decide backup/restore behavior. - Replace working
current_map.map(LINEAR3) and sendhot_reload.
Scripts are user-scope only, safe to run without admin:
- Remove .map association and residues:
registry\remove_map_association_current_user.bat
- Associate
.mapto this build:registry\setup_map_association_current_user.bat
If Explorer icons look stale, restart Windows Explorer or clear the icon cache:
ie4uinit.exe -ClearIconCache- EXE embeds
Image/ddnet_loader.icoviaddnet_control.rc. - If needed, generate a multi-size ICO:
Then update
venv\Scripts\python.exe tools\convert_ico.py Image\ddnet_loader.ico Image\ddnet_loader_fixed.ico
ddnet_control.rcto use the fixed icon and rebuild.
ddnet_control.exe talks to the local DDNet server over the external console (econ) TCP socket on 127.0.0.1:8303. It does not use the in-game RCON channel — sv_rcon_password is irrelevant here. The password it sends is ec_password.
The password is resolved at runtime, in this order (first non-empty wins):
DDNETCONTROL_ECON_PASSWORDenvironment variable.econ_password=<value>in addnet_control.cfgfile placed next toddnet_control.exe.ec_password "<value>"from%APPDATA%\DDNet\autoexec_server.cfg(DDNet's USERDIR autoexec — overrides anythingexec'd from it).ec_password "<value>"from the runningDDNet-Server.exe'sdata/myServerConfig.cfg.ec_password "<value>"from the runningDDNet-Server.exe'sdata/autoexec_server.cfg.- Hardcoded fallback
test123(aWARNINGis logged so you notice).
Within a single cfg file, the last ec_password line wins, matching DDNet's "later command overrides" semantics. The chosen source is logged to ddnet_control.log (the password value itself is never logged).
If your server uses a non-default ec_password, you don't need to recompile — set DDNETCONTROL_ECON_PASSWORD or drop a ddnet_control.cfg next to the EXE:
# ddnet_control.cfg (next to ddnet_control.exe)
econ_password=your-password-hereHost/port are still 127.0.0.1:8303 in the binary (matches DDNet's default ec_port/ec_bindaddr).
- Logs:
ddnet_control.log(andbuild.logfor builds). Default location is%APPDATA%\DDNet\maps\ddnet_control.log(the EXE's working directory when launched via.mapdouble-click). - See
scratchpad.mdfor current test plan and status.
MIT (or your preferred license).