Project_Detail
All_Projects

OpenUT2k4MasterServer

Open source UT2004 master server compatible with GameSpy enctype 2 / openspy.net protocol

View on GitHub
README.md

OpenUT2k4MasterServer

An open source master server for Unreal Tournament 2004, compatible with the GameSpy enctype 2 protocol used by openspy.net.

Built by reverse engineering the utmaster.openspy.net protocol from packet captures and the UT2004 IpDrv.dll binary via Ghidra.

Features

  • TCP master server on port 28902 — handles game client server list queries and game server uplinks
  • UDP heartbeat listeners on ports 27900 and 28902 — receives server heartbeats
  • HTTP management API on port 8090 — register servers and view status
  • MOTD/news support — game client News tab populates with server messages
  • Automatic server registration — game servers uplink via TCP, master detects port/gametype/name from refresh data

Protocol

Game Client Query (TCP 28902)

Client                          Master
  |                               |
  |<-------- challenge -----------|
  |-------- auth (hashes) ------->|
  |<-------- APPROVED ------------|
  |-------- verification -------->|
  |<-------- VERIFIED ------------|
  |--- request (0x00=all/0x01=motd/0x02=filtered) -->|
  |<--- server list / motd -------|

Game Server Uplink (TCP 28902)

Server                          Master
  |                               |
  |<-------- challenge -----------|
  |-------- auth (UE binary) ---->|
  |<-------- APPROVED ------------|
  |-------- state2 dwords ------->|
  |<-- continue/heartbeat mode ---|
  |-- state3 (revision, info) --->|
  | (connection kept alive)       |
  |-- refresh (name/port/etc) --->|  (fires after ~60s)

Binary format matches openspy.net exactly — server list entries, MOTD responses, and GameSpy challenge/response all verified against packet captures.

Quick Start

# Build
go build -o masterserver.exe ./cmd/masterserver/

# Run (all flags optional)
./masterserver.exe -tcp=28902 -udp=28902,27900 -http=8090 -timeout=300s

Registering Servers

Via HTTP API:

http://localhost:8090/register?ip=1.2.3.4&port=7777&query_port=7778

View registered servers:

http://localhost:8090/

Automatic: Configure your UT2004 server to uplink to this master:

[IpDrv.MasterServerUplink]
DoUplink=True
UplinkToGamespy=True
ServerBehindNAT=False
; Point to your master server:
MasterServerAddress=your-ip-here
MasterServerPort=28902

Configuration

Flag Default Description
-tcp 28902 TCP master server port
-udp 28902,27900 UDP heartbeat ports (comma-separated)
-http 8090 HTTP management API port
-timeout 300s Server heartbeat timeout

Notes

  • UT2004 categorizes 127.0.0.1 servers under the LAN tab, not Internet. Use your network IP for Internet tab visibility.
  • The News tab uses the MOTD protocol (client request type 0x01 after VERIFIED). The response format uses GameSpy color codes (\x1b\xff\xff\xff prefix).
  • Server uplink initially registers with a default port. After ~60 seconds, the server sends a refresh packet containing the actual server name, port, and gametype.

License

MIT — use freely, modify, distribute.