D2X - Tracker Services

In-Game 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

    '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)

  • 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').

Tracker Registration Request Format

    'S' (1 Byte)

  • The tracker will use the source address (ip:port) of the registration request as game host address.

  • Note that the tracker will not send a response to the game host registering.

Game List Download Request Format

    'R' (1 Byte)

  • The tracker will send its complete game host list as specified above to the sender of the request.


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 82.165.136.196: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.

 

XML Game Info

D2X-XL supports external game info queries. It will respond to such queries with XML formatted game information.


Queries

Querying XML game information from D2X-XL game hosts is a two step process:

1. Querying available game hosts from D2X-XL trackers
2. Querying XML game info from each game host returned by the trackers

To query XML game info from a game host, a zero-terminated string with the contents "FDescent Game Info Request" must be sent to the game host via UDP (the double quotes must not be sent).

D2X-XL will only send up to one XML game info reply per second. Requests coming in faster are dropped.


Syntax

XML game info has the following syntax:

<?xml version="1.0"?>
<GameInfo>

    <Server
      Type={"D2X-XL" | "DXX-Rebirth"}
      Version="program version" />
      Extensions={"none"|"basic"|"critical"} />

    <Descent>
      <Host Name="hostname" />
      <Mission
        Type={"D1" | "D2" | "D2X"}
        Name="mission name"
        Level="level no"
        Difficulty="difficulty level" />
      <Players
        Current="number of players"
        Max="max. number of players" />
      <Mode
        Type={"Coop" | "Anarchy" | "Robo Anarchy" | "CTF" | "Hoard" | "CTF+" | "Monsterball" | "Entropy"}
        Team={"0"|"1"}
        Robots={"0"|"1"} />
      <Status>{"Forming" | "Open" | "Restricted" | "Closed" | "Full"}</Status>
    </Descent>

    <Extensions>
      <GraphicsFx
        Shadows={"0"|"1"}
        Smoke={"0"|"1"}
        Lightning={"0"|"1"} />
      <WeaponFx
        LightTrails={"0"|"1"}
        Tracers={"0"|"1"} />
      <ShipFx
        Shield={"0"|"1"}
        Damage={"0"|"1"}
        Weapons={"0"|"1"}<
        GatlingSpeedup={"0"|"1"} />
      <HUD
        TargetInd={"0"|"1"}
        DamageInd={"0"|"1"}
        LockInd={"0"|"1"} />
      <RADAR
        Players={"0"|"1"}
        Powerups={"0"|"1"}
        Robots={"0"|"1"}
        HUD={"0"|"1"} />
      <Controls
        Mouselook={"0"|"1"}
        FastPitch={"0"|"1"} />
      <GamePlay
        Cheats={"0"|"1"}
        Darkness={"0"|"1"}
        SmokeGrenades={"0"|"1"}
        FusionRamp={"0"|"1"}
        FriendlyFire={"0"|"1"}
        Suicide={"0"|"1"}
        KillMissiles={"0"|"1"}
        TriFusion={"0"|"1"}
        BetterShakers={"0"|"1"}
        HitBoxes={"0"|"1"} />
    </Extensions>
</GameInfo>


Legend


(Only items that aren't self-explanatory are described here)

Difficulty

  • only available for games with robots

Mode

  • team: Game is a team game
  • robots: Level contains robots (coop, robot anarchy)

Status

  • Forming: Game hasn't started yet, host is waiting for players in the player browser
  • Open: Game in progress, everybody can join
  • Restricted: Like open, but host can reject applicants
  • Closed: Game in progress, joining not possible
  • Full: No room for more players

Server

  • Name and version of the program providing the game server.

Extensions

  • The extensions area describes the state of any extensions a particular agent provides and their impact on gameplay.

State

  • The effect of any extensions that are enabled:
    • none: No D2X-XL extensions are enabled
    • basic: Only D2X-XL extensions that aren't gameplay critical are enabled
    • critical: gameplay critical D2X-XL extensions are enabled

GraphicsFx

  • Smoke: Missiles and Gatling shots have smoke trails

WeaponFx

  • LightTrails: Energy shots draw light trails after them
  • Tracers: Gatling guns produce visible tracers (and smoke fx, see GraphicsFx)

ShipFx

  • Shield: A shield around player ships lights up when the ship has been hit
  • Damage: Damaged player ships start to smoke
  • Weapons: The currently equipped weapons are shown on player ships
  • GatlingSpeedup: Gatling guns do not immediately start to fire (definitely more challenging)

HUD

  • TargetInd: target indicators (brackets around other objects) are shown
  • DamageInd: damage indicators displaying the remaining shield of other objects is shown
  • LockInd: when a homing weapon is equipped, the target of that weapon is marked

RADAR

  • Players: show other players on automap
  • Powerups: show powerups on automap
  • Robots: show robots on automap
  • HUD: show the heads-up RADAR

Controls

  • Mouselook: very fast reaction to mouse movements
  • FastPitch: vertical turning (nose up/down) twice as fast as usual

GamePlay

  • Cheats: cheat codes are enabled
  • Darkness: levels are only lit by headlights and weapons
  • SmokeGrenades: players have smoke grenades instead of proximity mines
  • FusionRamp: Fusion cannon power is increased
  • FriendlyFire: players can damage other players on the same team and in coop
  • Suicide: Players can (accidentally) kill themselves
  • KillMissiles: Missiles can be shot down with the Omega cannon
  • TriFusion: Players can equip three Fusion cannons (only when using heavy bombers)
  • Better Shakers: Shaker bomblets home in better
  • HitBoxes: Enhanced collision detection (targets are harder to hit)