File formats of DMTG-PHP

This document provides details of how the information of Tournaments, Leagues and Teams, are stored. These files can be found in the /data directory.

1) Tournaments
1.1) Tournament Submissions

2) Leagues
2.1) League Submissions

3) Teams
 


1) Tournaments

Location: /data/tournament.dat
Format: Plain Text

This file is a collection match details for each match that exists on the tournament tree.

The first three lines of the tournament file, is used as a header, which stores the values of "Elimination Mode", "Team Mode", and "Player Count"

Each match has 6 details, these are:

  • Original Player's Name
  • Opponent's Name
  • Original Player's Frags
  • Opponent's Frags
  • Server Address
  • Match Start Time

Each detail has it's own line written in the file. Each match is a collection of these 6 lines.

 

0) Elimination Mode (Boolean)
1) Team Mode (Integer)
2) Player Count (Integer)
Header
3) Player Name
4) Opponent Name
5) Player Frags
6) Opponent Frags
7) Server Address
8) Start Time
Match 1
9) Player Name
10) Opponent Name
11) Player Frags
12) Opponent Frags
13) Server Address
14) Start Time
Match 2

Diagram: File Structure of Tournament

1.1) Tournament Submissions

Location: /data/submissions/
Format: Plain Text

The file is just 3 details of the match. Opponent, Players Frags, and Opponents Frags.
These files are on separate lines, in that order. The nickname is the filename without the extension.
When a submission is verified, it determines the submitters opponent by other means, and opens the opponents file. It verifies that the file they have submitted, has their opponent listed as the player who is submitting. This may sound complicated but it's just that. "If the opponent's opponent is me, then we're comparing the same match". When two submissions are successfully compared, the tree is updated, (scores are entered for that match only and then the Update Tree function from /code/functions/processing.php is called into action. This will determine the winners name. Finally, the submission files are deleted, to prevent future confusion about submissions.


2) Leagues

Location: /data/leagues/
Location: /data/leagueindex.txt
Location: /data/leaguedata/
Format: Plain Text

Leagues are like a mixture between teams and tournaments.
Leagues are somewhat complex, in that it is very statistical, Players need to keep track of who they play, etc. For this purpose, there are three different types of files.

The League itself
This is located in /data/leagues/ and each file is a simple list, which retains scores. For each entry in the main /data/leagues/ files, there are three figures after the name of the player. This is the cumulative total of Wins, Draws and Losses (in that order). Using these values, you can count how many matches in total a Players has completed, and how many points they have.

Match History
This is located in /data/leaguedata/ Each player/team is given their own file here. Every time they play a match, their opponents name appears in their file, along with "Home" or "Away". DMTG-PHP tries to prevent the ability to submit matches that have already been played.

League Index
There are times where DMTG-PHP needs to know what league a particular team or player is in. This list has two lines per entry, first the player/team name and then which league it has been placed into.

2.1) League Submissions

Location: data/leaguesubmissions/
Format: Plain Text

Submissions for leagues are somewhat similar for submissions in tournaments, except that a player can have more than one unverified submission at a time. Therefore, each filename needs to unique. Each filename consists of the player name, opponent name, and whether the match was away or home in the Player's perspective. The contents of these filenames are just "Player Frags" and then "Opponent Frags" on individual lines.


3) Teams

Location: /data/teams/
Location: /data/teamindex.txt
Format: Plain Text

Teams are simply a list with a header. There are two lines in the header, the first being the Team's name, the second being the Team's Colour. The lines after that, are the names of players who are in the team. The first name in this list, i.e. the third line in the file, is considered to be the team's captain. This captain is responsible for reporting the team's results.
The captain also has limited ability of the team. They can rename, re-colour and even set someone else as the captain. They cannot move players in or out of their team, or reclaim their captain-hood after they've surrendered to someone else.

The Team index file, works in the same way as the League index file does and provides the same purpose, except for the teams.


(c)2002 neur0maniak, neur0soft