XIII is Ubisoft's 2003 shooter on Unreal Engine 2. Its stock dedicated server crashes on any map change, has no bots and no remote control. To host it properly we had to fix the server's own files. This is how, one bug at a time: the symptom, how we found it, the exact bytes we changed, and how we proved it.
The code, the patch scripts and the hashes are on GitHub: 2hours-gg/xiii-server-patch
Every 2hours.gg XIII server runs these fixes. Deploy one and try them.
The server we started from
- The server package InsideXIII hosts: version 829 from June 2011, plus a 2018 update that adds master server registration.
- The server is UCC.exe, a 32-bit Windows program. We run it headless on Linux under Wine, with no display.
- It has no RCON and no web admin. An admin can kick and ban, nothing else.
- Its query port, 7099, only answers "Pong". No player count, no map name.
One rule for every patch
- We only patch the exact file we know. Its sha256 is checked before the patch and again after it.
- Every patch keeps the file the same length: bytes are swapped in place, never inserted.
- The new file is written next to the old one, then renamed over it, so a crash cannot leave half a file.
- It runs on every boot and does nothing when the file is already patched.
- Any other file is left alone, and the feature that needs the patch stays off. With an unknown Engine.dll the server still runs, but every map change becomes a restart.
Step 1: any map change crashed the server (Engine.dll, 7 bytes)
Symptom: change the map on a running server and it dies. The log ends with:
Critical: ClearActorBindings <- ExitLevel
Critical: ExitLevel <- UGameEngine::LoadMapThese lines are the engine's own call stack: the function that failed, then who called it. We read UGameEngine::LoadMap in the machine code of Engine.dll. Its ExitLevel step assumes two things a dedicated server does not have:
- A client. It calls ClearActorBindings(Client) with Client set to NULL, then reads from it.
- An Entry level. It walks the actors of GEntry, and GEntry is NULL.
XIII loads the Entry level only when a client exists, and its own multiplayer never changes the map on a server: when a match ends it sends players back to the menu. So nobody had hit this.
The fix is two edits, 7 bytes in total:
file offset shipped patched
0x7C44D E8 6E C3 FF FF 90 90 90 90 90 NOP the ClearActorBindings call
0x7C5C6 EB 08 EB 3F jump over the GEntry loopWhy it is safe: a dedicated server has no viewports to clear, and no Entry level whose actors need keeping. The jump lands on the CollectGarbage call right after the loop, so the rest of the map change runs as before.
Proof: on our lab server all 6 modes changed map in place. The query port kept answering, and the new map answered our status command about 0.5 seconds after the change.
Engine.dll sha256 810b0c96... -> ff6183bf...Step 2: the first real player crashed it again (Engine.u, 1 byte)
Step 1 was proven with nobody connected. On 2026-11-18 the first test with a real XIII client crashed the server on its first live map change:
appError called: Cast of TcpipConnection Transient.TcpipConnection2 to Viewport failed
History: UGameEngine::SetClientTravel <- UObject::ProcessEvent <- ...Lesson: our lab players had no network connection, so they never took the path a real client takes. We wrote a small XIII network client in Python. It speaks enough of the UDP protocol to join as a real player, and answers the login challenge with the formula we read in Engine.dll. With it, the crash came back exactly.
Cause: on a map change the server tells each player to follow with ClientTravel, a function meant to run on the client. XIII declares it native static, and the engine never sends a static function over the network. So it ran on the server, where the player is a network connection, not a Viewport, and the cast failed.
This fix is in the compiled UnrealScript, not in machine code. Every compiled function stores its flags. We compared functions whose declarations we know:
GetPlayerNetworkAddress, Spawn, Destroy static native 0x00190100
Sleep not static 0x00110500
ClientTravel (file offset 222006) 0x001b3000The static bit is 0x00080000: every static native has it, Sleep does not. Clearing it changes one byte, at file offset 222008, from 0x1b to 0x13.
Why it is safe: only the server's Engine.u changes. Players keep their own Engine.u, where the function runs locally as it must.
Proof: our network client joined as admin, we changed to DM_Pal from the web console, and the server finished loading the map. The client received the travel order with the new map, and a new connection joined it.
The capture also showed that the travel URL goes to every player. Ours carried the admin password, so we moved the password into XIII.ini.
Engine.u sha256 da24040b... -> 01929636...Step 3: players followed, then fell back to the menu
On 2026-11-21 the server stayed up and players followed the change. The client joined the new map, then closed the connection itself 4.0 to 4.1 seconds later and went back to the menu.
To see why, we ran the real XIII.exe with patch 1.4.2.1, headless under Wine, and read the client's Engine.dll:
ULevel::TickNetClient old connection Closed, no failure armed
-> ReportNetFailure(5.0)
UGameEngine::ReportNetFailure deadline = now + 5 s, once
UGameEngine::Tick past the deadline -> SetClientTravel("?failed") -> menuNothing checks whether the new connection finished in the meantime. So any follow where the server closes the old connection ends in the menu 5 seconds later.
Tried and rejected on the real client: removing the players' controllers before the switch (the switch still closes their connection), and holding connections on the new map (the engine clears that setting right after loading the map).
The fix is in our own UnrealScript, with no client file touched. The server sends each player the new map, then 0.5 seconds later a second travel to the menu map. The client loads the menu map itself, which closes the old connection from its side, so no failure is armed. The pending connection lives on and joins the new map.
Proof with the real client, 3 rounds, every case still in game 60 seconds later:
change join on the new map
!map dm_banque (DM) 1.4 to 1.9 s after the command
!mode ctf (DM to CTF) 1.7 to 2.0 s after the commandPlayers see a short loading screen and the menu for a moment, then the new map.
Step 4: the third change ends the server (not patched)
A 3rd map change in one server process ends it with exit code 0, whatever the map or mode.
UGameEngine::LoadMap counts map loads. From the 4th it calls into a hidden module, decompressed in memory, with its function pointers masked. It looks like copy protection, so we left it alone and planned around it:
- Changes 1 and 2 happen live, as above.
- On change 3, everyone gets a chat warning 4 seconds before. Then the server travels into the exit.
- systemd restarts the server 2 seconds later, on the chosen map. The game reconnects players by itself: we measured about 9 seconds.
- At most 3 of these restarts per 30 minutes, which leaves room for real crashes.
Step 5: bots on a dedicated server (XIIIMP.u 1 byte, XIIIMP.dll 32 bytes)
Stock XIII bots only work on listen servers. On a dedicated server, adding a bot does nothing.
We read the compiled UnrealScript of XIIIMPGameInfo.StartMatch. It adds bots only when the game runs offline:
if ( !Level.bLonePlayer && Level.NetMode == NM_StandAlone )The == compiles to a call to native 154: byte 0x9A at file offset 98449. Native 155 is !=. One byte, 0x9A to 0x9B, and a dedicated server adds bots. Players keep their own XIIIMP.u, so their game is unaffected.
With only that, the first bot crashed the server:
Critical: Failed to find function None in BotController DM_Amos.BotController2
Critical: ABotController::execAddOrder <- UObject::ProcessEventXIIIMP.dll fills in the function names its native code calls back (AddDefaultOrders, ChangeState and more) in an exported function, XIIIMPInitNativePackage. The game client calls it. The server program never does, so on a server those names stay None.
The fix makes the DLL call it itself when it loads. The new code fits in DllMain and the padding after it, 32 bytes at file offset 0x3A90, checked with the Capstone disassembler:
11d03a90 mov eax, [esp+4] ; unchanged
11d03a94 mov [0x11d0b30c], eax ; unchanged (hInstance)
11d03a99 cmp dword ptr [esp+8], 1 ; DLL_PROCESS_ATTACH?
11d03a9e jne 11d03aa5
11d03aa0 call 11d03ab0 ; XIIIMPInitNativePackage
11d03aa5 mov eax, 1
11d03aaa ret 0xcThe one operand the loader relocates stays at the same address. XIIIMP.u is patched only after XIIIMP.dll: bots that spawn without the DLL fix would crash the server, so in that case the XIIIMP.u patch is even put back.
Proof: 3 bots in all 6 modes, whole matches played, the next match started with them again, and no Critical line in about 10 minutes. With our network client joined, bots 3 gave 1 human and 3 bots.
XIIIMP.u sha256 6f5f07f1... -> d4771d00...
XIIIMP.dll sha256 a504c2e3... -> 58ca02dc...Step 6: our own control mod (TwoHoursCtl.u)
Typing commands into the server process does nothing: UCC never reads its input. So we wrote a ServerActor in UnrealScript that runs inside the server.
- It listens on UDP port 7098 on the server box only, and obeys only messages that carry a random key made fresh at every boot. It reports status, changes the map, says a line in chat and kicks.
- It swaps in its own chat handler. A chat line that starts with ! is hidden from everyone and goes to our commands: !map, !mode, !bots, votes and rotation.
- The web console on your server card talks to the same actor, so both follow the same rules.
Compiling it was a problem of its own. The server's Core.u and Engine.u ship without their source text, and XIII's compiler needs it. So the build borrows the client toolchain from Arthur Muszynski's community patch 1.4.2.1, which every player installs. Even its IpDrv.u has no source text, so we put declaration-only stubs into a scratch copy, with a small Unreal package writer.
Nothing from the patch ships. The output is our own 8 KB package, written to the server at boot.
Step 7: the name in the server browser
We set the server name in XIII.ini, and the in-game browser still showed "XIII Server".
The master server uplink never reads XIII.ini. It takes the name from ?ServerName= in the travel URL the server starts with, and the client shows "XIII Server" when that is empty. The URL cannot contain spaces: UCC stops with "Invalid URL".
So the URL carries a name without spaces: 2hours.gg_ followed by the word of your server's address. It is the same shape as the community's own servers, like insidexiii.com_2.
DM_Amos.unr?...?ServerName=2hours.gg_<word>On 2026-11-25 our first cloud test before launch, in London, booted in 390 seconds and showed up in Online Game Service under that name. Joining, admin, !map and the web console worked there too.
What is still limited
- The 3rd map change in a row restarts the server. Players are back in about 9 seconds, but it is not seamless.
- systemd restarts the server on any exit, a crash included. The map choice is saved before every change, so it comes back on the map you picked.
- Bots join when a match starts. Raise the count in the middle of a map and the new bots arrive at the next map change.
Verify it yourself
The code, the patch scripts and the hashes are on GitHub. Each patch is a list of offsets and bytes, checked against the sha256 of the file before and after.
The installer refuses any file it does not know. Hash your own file first: if it matches "shipped", the patch applies. If it matches "patched", it is already done.
sha256sum System/Engine.dll System/Engine.u System/XIIIMP.u System/XIIIMP.dll
Engine.dll shipped 810b0c9600d06e104104f1dbf04d7989584b6d931d75e4a5ff933be598cdafdc
patched ff6183bfdbb908a0005a8dbecc7ce9fe7de11c92c8dc321780ca7fc1aa02e864
Engine.u shipped da24040b4fca0d3ec6dd92aa3b192d3ee82b25fa358170bbeded4d8432683234
patched 019296366fe36805fbf2721cb09c365dd117d42ad05a6128f2444aa21a4af7f6
XIIIMP.u shipped 6f5f07f13b5fadd61abfaf9622e8dd15f91675f36a6525d7bd14de715a2c3450
patched d4771d0002c4a324bfef6f8891958e2a3fb2c5d17b38294c2673493b69ac5e1e
XIIIMP.dll shipped a504c2e3ccbe5fbfeb92a8b33c1caa4a5490172a2c22e77a80dbbbd3fec04a9b
patched 58ca02dc8036b2390b655b917c9cdcf847086cadddda0026b1a8a1e6fe4ef35eCredits
- Opaquit’s XIII Files: home of Arthur Muszynski's community patch 1.4.2.1. Its client toolchain is what made compiling our add-on possible.
- InsideXIII: runs the master server that lists every XIII server, and hosts the server package we start from.
Deploy an XIII server by the hour
