D2X-XL Tracker Services
Internal Tracker
Introduction
The best the original Descent 2 could offer in terms of multiplayer networking was the IPX protocol, which doesn't lend itself easily to other environments than a LAN and requires additional software like KALI to be able to play multiplayer games over the internet.
After implementing peer-to-peer UDP/IP networking in D2X-XL, the next logical step was to implement tracker code to make it easier to find a D2X-XL game host and join UDP/IP multiplayer matches.
Tracker Basics
A tracker is simply a software running on some server that allows game hosts to register with their IP address and that keeps a list of registered game hosts that can be downloaded by game clients. In the case of D2X-XL, the game clients will subsequently use the IP addresses from the server list to directly connect to the game hosts and display the games offered there.
User Interface
The easiest way to add tracker functionality to D2X-XL was to use its built in game server
browser. Of course, this brings some limitations, like the ability to only see 12 game servers.
Given today's popularity of D2, I have decided to stick with this limit for the time being.
Details
- The tracker communicates via UDP/IP.
- D2X-XL supports up to 85 trackers and up to 85 game hosts.
- A game host will re-register every 20 seconds at all trackers known to it.
- A game client will download game host lists every 3 seconds from all trackers known to it and subsequently refresh its game list.
Game Host List Format
- The game host list data packet has a total length of 512 bytes.
- Valid game host entries in the game host list must start with the first entry.
- The game host list must not contain invalid (empty) entries between the first and last valid entry in the game host
list (think of it as 'densely packed').
'S' (1 Byte)
<number of game hosts in the list> (1 Byte)
<first game host's ip:port> (6 Bytes, port in network order)
...
<last game host's ip:port> (6 Bytes, port in network order)
Tracker Registration Request Format
- The tracker will use the source address (ip:port) of the registration request as game host address.
'S' (1 Byte)
Note that the tracker will not send a response to the game host registering.
Game List Download Request Format
- The tracker will send its complete game host list as specified above to the sender of the request.
'R' (1 Byte)
Adding Trackers To D2X-XL
Trackers can be added to D2X-XL by adding parameters to the d2x.ini file residing in the Descent 2 folder. (if there is no such file, create a new text file with that name there).
First you need to specify how many trackers you want to set with the switch
-
-tracker_num <# of trackers>
Then define each tracker with the switch
- -tracker<number> <ip>:<port>
This could look like the following:
-
-num_trackers 3
-tracker1 123.45.67.89:9424
-tracker2 166.99.137.32:9424
-tracker3 220.131.37.18:9424
D2X-XL will set one hard-coded tracker at program start. That tracker currently is hosted on my virtual server. You can turn off usage of the hard coded tracker by specifying
- -internal_tracker 0
in d2x.ini.
Tracker Code
You can find a complete tracker program created by VEX-Munk and written in Perl in the D2X-XL zip file
that is available for download on this site. Surprisingly enough, it goes with the name d2tracker.pl.
Testing Trackers
To find out whether a tracker is actually available, you can start two instances of D2X-XL and have one be a game host and the other a client; this works even if both instances run on the same machine. Make sure to run them in windowed mode. You will also need to give the client instance a port number that is different from the one the host is using (default is 28342). If the client instance sees the host in the game list after a short while, the tracker is available.


