The DredgionCOMMUNITY TEST BUILD
Developers

Dev docs

How the server is built: architecture, repositories, rules, packets, build and the test workflow. Paths are relative to each repository.

1. Architecture

Four TCP servers, all started from build/. They read gamedata/ and their *.cfg from the working directory.

ServerPortOwns
login_srv10900Nickname login (no passwords, the client runs with local auth), reconnect offer for a suspended game, redirect to the hub.
hub_srv11900The bridge (lobby map), accounts, gear and nodes, weapons, guilds, mail, achievements, parties, rooms and the pick phase.
mm_srv13900Parties, queues, matching, bot fill, room confirm, game creation. Hub and game connect to it on loopback.
game_srv12900The match: simulation, combat, AI and bots, PhysX, replication.
Server architecture and player flow The client connects to login, is sent to the hub (bridge), queues through the hub which talks to the matchmaker, is sent to the game server, and returns to the hub after the match. Game client EU client + ClientMod login_srv · 10900 nickname login, reconnect offer hub_srv · 11900 bridge, accounts, parties, pick game_srv · 12900 match simulation, bots, physics mm_srv · 13900 queues, matching, bot fill 1 login 2 bridge 4 join match 5 back to bridge 3 queue (HQ_/HN_) match found (MN_) create game (MQ_/GR_) redirect to hub

Player flow

  1. The client logs in on login. If the account has a suspended game, login offers it (SN_SuspendedToCity, then CQ_ReturnToGame leads to SN_DoConnectGameServer); otherwise SN_DoConnectChannelServer sends it to the hub.
  2. The hub loads the bridge. Queuing sends HQ_PartyCreate / HQ_PartyEnqueue to the matchmaker.
  3. The matchmaker answers MN_MatchingPartyFound; the hub shows the accept window (SQ_MatchingPartyFound). After confirms, MN_RoomCreated starts the pick phase, then MQ_CreateGame goes to the game server, which answers GR_GameCreated; the hub receives MN_MatchCreated.
  4. The hub sends SN_DoConnectGameServer with an instant key (hash of account and sortie ids); the client joins the game server.
  5. At the end, the game sends SQ_PrepareHandoverToChannel, then SN_DoConnectChannelServer back to the hub; GN_GameEnded / MN_GameEnded close the match on the matchmaker and hub.

Inter-server messages

src/common/inner_protocol.h, namespace In. Prefixes: HQ_/HN_ hub to matchmaker, GQ_/GR_/GN_ game to matchmaker, MR_/MN_/MQ_ matchmaker to hub or game (Q query, R response, N notification). These are not client packets.

Accounts

Flat files in build/accounts/, one set per nickname (progress, items, gear, weapons, stages, missions, achievements, PvP, summary, friends, settings), plus shared guild and mail files. Writes go through a temporary file and a commit (src/mxm/safe_file.cpp); the hub backs the folder up at start. Suspended games for reconnect are small records next to them. Never publish this folder.

2. Repository layout

GameServer

GameServer/ # C++ server, branch private-server ├─ AGENTS.md README.md PacketEncryption.md SkillActivation.md # rules, build, encryption notes ├─ CMakeLists.txt CMakePresets.json setup.bat ├─ src/common/ # shared by all servers │ ├─ protocol.h # every client and server packet (namespaces Cl / Sv), ~13.8k lines │ ├─ packet_validator.h # ValidatePacket<T> │ ├─ packet_serialize.h # PacketSerialize<T> for NT_LOG │ ├─ inner_protocol.h # server to server messages (namespace In) │ ├─ logger.h # LOG / WARN / NT_LOG macros │ ├─ network*.cpp # TCP sockets (Windows and Linux) │ └─ suspended_game.h # reconnect records ├─ src/mxm/ # game rules shared by hub and game │ ├─ game_content.* # loads every gamedata XML into GameXmlContent │ ├─ account_progress.* # per-account files │ ├─ nav_mesh.* # navigation mesh load and routes │ └─ achievements.* mission_progress.* pve_ranking.* summary.* safe_file.* ├─ src/servers/login/login_main.cpp # the whole login server ├─ src/servers/matchmaker/matchmaker_main.cpp # parties, queues, matching, bot fill ├─ src/servers/hub/ # the bridge │ ├─ game.cpp # hub logic, dev chat commands │ ├─ instance.cpp # rooms and pick phase │ ├─ channel.cpp coordinator.cpp # packet dispatch │ ├─ replication.cpp # outgoing packets │ └─ game_gear.cpp game_arsenal.cpp game_guild.cpp mailbox.cpp achieve_rules.* # nodes, weapons, guilds, mail, achievements └─ src/servers/game/ # the match ├─ game.cpp # game loop, map load, scenario, dev chat commands ├─ channel.cpp coordinator.cpp instance.cpp # client dispatch, matchmaker link, PvP instance ├─ replication.cpp # all SN_ / SA_ output ├─ world.cpp # actors, spawn, update ├─ world_remote.cpp # remotes: hitboxes, projectiles, shapes, child remotes ├─ world_skill.cpp # costs, stances, toggles, ultimate gauge, team vision ├─ world_status.cpp # statuses and passives ├─ world_combat.cpp # damage, defence, rage, heals, shields ├─ world_weapon.cpp # basic attacks, projectiles, lag compensation ├─ world_monster.cpp # monster aggro and death, progress, missions ├─ world_bot.cpp # server bot AI: skill scoring, evade, farming, Titan strategy ├─ world_level.cpp # in-match levels, XP, respawn delay, traits ├─ world_interaction.cpp # F interactions, level events, titan pieces, occupy ├─ world_summon.cpp world_trap.cpp world_defence.cpp world_grouping.cpp ├─ world_master_rules.h # the one table of per-master rules ├─ world_showcase.* # test bench layer └─ physics.cpp # PhysX scene

gamedata

Two kinds of data: gamedata/client/ holds copies of the EU client tables, the rest is server-side data derived from captures, the client or testers. Many files carry a source= attribute.

gamedata/ # synced to build/gamedata by the sync_gamedata target ├─ client/ # copies of EU client data (~50 XML): SKILL, skilltt, STATUS_*, REMOTE_*, CREATURE_*, WEAPON, ITEM_*, STAGELIST, BotBrainData... ├─ MonsterStats.xml MonsterAi.xml # generated from official match captures ├─ MonsterStatsEstimated.xml MonsterAiEstimated.xml # PvE fallbacks, loaded after the measured files ├─ Measured*.xml # walk cells, fire and swing nodes, bot gear and traits, from captures and probes ├─ OfficialSkillRatios.xml # per-skill power ratios sent by the official servers ├─ StageEntries.xml # which stages the Stage menu offers ├─ MapCollision.xml collision/*.physx_static # per-map colliders ├─ NavMesh/ # navigation meshes used by bots ├─ IngameLevel.xml MasterGrowth.xml MasterTraits.xml # in-match levels, growth, traits ├─ TitanTransform.xml TagStatus.xml StatusStatMods.xml StatusShield.xml └─ Design/ # level graphs extracted from the client

build/ runtime

build/ # servers run from here ├─ login_srv.exe hub_srv.exe game_srv.exe mm_srv.exe # _dbg suffix for debug builds ├─ login.cfg hub.cfg game.cfg matchmaker.cfg # missing file = compiled defaults ├─ gamedata/ ├─ accounts/ accounts_backup/ # flat account files (never share them) ├─ <server>.log <server>_nt.log # server log and packet log ├─ logs/ trace/ # dated game logs, stream dumps └─ build/release build/debug # CMake intermediates

Tools repository

Everything that is not server code lives here: labs, probes, capture tools, reverse engineering, notes. New scripts and notes never go into GameServer.

Tools/ # separate repository: tools, tests, notes ├─ human/ # clientbot_run.ps1 (main lab launcher), train_lab.ps1, restart_all.ps1, mirror.ps1, scenarios/ ├─ probe/ # Frida client probe, full_review.py, review_diff.py, detectors ├─ pcap/ # official capture decoding (mxmcap.py) and gen_*.py data generators ├─ re/ # reverse engineering: Ghidra scripts, Frida dumps, pak tools ├─ replay/ # lab.ps1, world_diff.py, official truth ├─ showcase/ # bot benches, nightly regression ├─ session/ # player session recorder, cleanup.py ├─ audit/ # spell audit ├─ cnport/ # ports masters and assets from the Chinese client ├─ clientpatch/ # xinput1_3.dll proxy that patches the client ├─ release/ # make_full.py, make_patch.py ├─ pr/ # builds upstream PR branches without lab code ├─ wiki/ # skill power wiki generator ├─ site/ # this website └─ notes/ # REPRISE.md (journal), BACKLOG.md, specs/, tester feedback

ClientMod and release

ClientMod is its own repository of client data overrides (Data/Design, Graphic, L10N, NavMesh, Sound, Ui) installed into the client folder: ported masters, skins, sounds, interface fixes. Code fixes to the packed client executable go through the xinput1_3.dll proxy in Tools/clientpatch (ship both DLLs).

Release: Tools/release/make_full.py <version> builds one zip from the local client and the built server, with the launch scripts and README of MxM_Server: start_servers.bat, stop_servers.bat, set_host_ip.bat, open_firewall.bat.

3. Rules and data-driven design

  • No comments in the code (AGENTS.md). Check diffs for // before committing.
  • Every gameplay value comes from data: client tables, skill tooltips, official captures, client reverse engineering. No invented constants; an unavoidable assumption is named as one and kept minimal.
  • Works or crashes: assert internal invariants, a server never half-works. Hostile client input is dropped.
  • Hot paths: resolve strings to enums or indexes at load time; no per-tick string compares or linear status scans. Per-master exceptions live in one table (world_master_rules.h), not in branches.
  • Avoid STL strings (EASTL fixed strings are used). Packet structs keep the client's real names.

Constant prefixes

PrefixMeaning
MEASURED_Measured on official match captures (for example a timing, an angle, a rate).
TESTER_From a veteran tester when data and captures are silent; data and captures win if they disagree.
HYP_A hypothesis: the best guess until evidence arrives. Grep for it to find what still needs proof.
CLIENT_Mirrors client behaviour found by reverse engineering.

Data files use the same idea with source= attributes (measured, tester, hypothesis); estimated monster data lives in separate *Estimated.xml files.

Layers and commits

  • Layer 1: engine and the 40 EU masters. Layer 2: masters ported from the Chinese client. Layer 3: test bench code (world_showcase.*, Dev* options), kept out of upstream PRs.
  • Commit messages in English: one line describing the behaviour against official, with the evidence.
  • Upstream PRs go to the community GameServer repository through a fork, built without lab code (Tools/pr/strip_lab_code.py). The private branch is backed up separately. Never commit raw captures.

4. Packet handling

PrefixDirectionMeaning
CQ_client → serverrequest
CN_client → servernotification
CA_client → serveranswer to a server request
SA_server → clientanswer to a CQ_
SN_server → clientnotification
SQ_server → clientserver request (accept window, handover, teleport)
ST_bothembedded sub-structure

Header: NetHeader { u16 size; u16 netID; }. Client ids are in the 600xx range (CQ_FirstHello = 60002), server ids in 62xxx (SA_FirstHello = 62002). Traffic is LEA-encrypted (see PacketEncryption.md).

Every handler follows the same three steps (AGENTS.md): ValidatePacket<T> before parsing (exact size by default, specialisations walk variable parts), then one NT_LOG with PacketSerialize<T> (every logged type needs a specialisation, the default template fails to compile), then use the values. Header-only packets skip validation but are still logged.

#define CASE(PACKET) case Cl::PACKET::NET_ID: { HandlePacket_##PACKET(...); } break
CASE(CQ_ExecuteSkill);

Example: src/servers/game/channel.cpp dispatches CQ_ExecuteSkill; the handler validates, warns and returns on a bad packet, logs it, then calls game->OnPlayerExecuteSkill. The hub uses the same pattern with HANDLE_CASE. Logging: LOG / WARN go to <server>.log, NT_LOG / NT_WARN to <server>_nt.log.

5. Build and run

Build from PowerShell with the CMake bundled with Visual Studio only. Building from Bash or with another CMake loses ninja header dependencies, and stale objects crash game_srv.
cmd /c '"<VS BuildTools>\VC\Auxiliary\Build\vcvars64.bat" >nul && cd /d <GameServer> && cmake --build build\release'
cmake --build build\release --target sync_gamedata    # data only
cmake -S <GameServer> -B <GameServer>\build\release -G Ninja -DCMAKE_BUILD_TYPE=Release   # configure

Start order: mm_srv, then hub_srv and game_srv, then login_srv (start_servers.bat or Tools/human/restart_all.ps1). The client is launched with local auth and encryption options, for example /AuthMethod:local /AutoLoginID:<name>.

Dev config flags

FileKeyEffect
game.cfgDevModeEnables the chat commands below. Release value 0.
game.cfgDevForcedMapForces the map of every game. Keep it at 0: a deathmatch map id there forces it even in Titan Ruins.
game.cfgDevObserverThe client spectates the bots.
game.cfgDevScenario, DevTruth, DevTelemetryScripted scenarios and truth/telemetry dumps for the probe.
game.cfgDevGodPlayers, DevStartLevel, DevGameTimeSecLab conveniences.
game.cfgHostIPAddress announced for the return to the hub (set by set_host_ip.bat).
hub.cfgDevMode, LobbyMapHub chat commands; bridge map (Christmas bridge in releases).
hub.cfgDevAutoQueue*, DevStageSweep, DevShowcase*, DevMirror*Automatic queue, PvE sweep and bench modes for labs.
matchmaker.cfgDevNoBotsNo bot fill (lane labs). Restore it after a test.
matchmaker.cfgTeamSize, MatchingWaitSec, SoloRoomsMatching parameters.
matchmaker.cfg / login.cfgpublic address keysWritten by set_host_ip.bat; never publish their values.

Dev chat commands (DevMode)

Game server: !tp x y [z], !god, !level n, !titan, !item idx, !killtag n, !killnear r, !ult, !vision, !loadout, !ai, !removeai, !dummyhome, !dummymortal, !clear, !portal, !wave, !enemysummon, !mongroggy. Hub: !give, !gold, !change, !rozark.

6. Tests and labs

  • Main launcher: Tools/human/clientbot_run.ps1 rewrites the cfg files, starts the four servers and the client, records the game, then restores the configs. -QueueStage 200101000 = Titan Ruins, 200020100 = 3v3, 200000100 = training room; without it, a PvE sweep. Switches: -Observer, -Probe, -Pilot, -Scenario, -Masters.
  • Training room first: targeted skill, animation and damage tests run in the training room (train_lab.ps1, generated scenarios); Titan Ruins games are the final check. Bot tests run in observer mode.
  • Reviews: Tools/probe/full_review.py <recording> runs the detectors (continuity, dashes, structures, towers, effects, hit shapes, damage against official, statuses, minion fights); review_diff.py compares with the previous recording and flags regressions.
  • Mirror tests: a human client and a bot play the same masters; mirror-* git tags mark each passed campaign.
  • References, in order of trust: official captures, client data, official videos, reverse engineering.

Official captures

Packet captures of official matches stay outside the repositories and are never committed. Tools/pcap/mxmcap.py lists and caches games by mode; payloads are decrypted in order per direction with the LEA key derived from SA_FirstHello. The gen_*.py scripts turn the measurements into the Measured*.xml, monster and skill ratio files.

Wiki and release

Tools/wiki/build_skill_ratios.py reads gamedata, protocol definitions, client strings and interface art and writes the skill wiki; make_standalone.py inlines it into one file. Tools/session/cleanup.py removes old lab captures.

7. Glossary

Master
A playable character; each has a class number (1 = Taejin...).
Tag
Swapping between your two masters during a match.
Remote
A server-spawned hit entity: hitbox, projectile or area, defined in the REMOTE tables.
Creator
A remote that spawns child remotes.
Status
A buff or debuff from the STATUS tables (statuses and passives).
skilltt
The skill tooltip table: per-rank values shown in game, also used as data.
Stance
A timed or shot-limited skill mode (for example a cannon mode).
Shirk
The dodge / survival skill slot.
Sortie
One game instance, identified by a sortie id.
Stage
A playable mode or level id from STAGELIST (200101000 = Titan Ruins).
Doc id
The id of a row in a data table (a creature, an item...).
Bridge / hub
The lobby ship between matches, run by the hub server.
In-match level
Level 1 to 18 gained during a Titan Ruins match.
Titan Shard / piece
Dropped by titans, monoliths and towers; carried back to base to unlock Titan Incarnate.
Titan's Sight
A capturable vision point in Titan Ruins.
Altar
Top and bottom lane objective that calls a Fallen Hero.
Node
Gear item equipped in node pages per master.
Augment
Weapon upgrade bought with materials.
MEASURED / TESTER / HYP
Where a value comes from: captures, a veteran tester, or a hypothesis.