Keeping stats in UT2004

This is the first entry into what is hopefully going to be a series of posts detailing some of my side projects. These posts are meant to be written mostly for myself to document what I'm spending my time on such as to not forget what I spend my time doing.

This initial post will be about a not-so-small project I started in the midst of the summer just passed. The project is a log parser and player statistics database for Unreal Tournament 2004 servers. It is written in Ruby and generates HTML pages. The initial reason for starting work on this project was a desire to work with log parsing and the Active Record pattern (of which I have become quite a fan.) Another reason was that Unreal Tournament 2004 is a genuinely fun game that runs on most computers (note to self: Write tooling for Midtown Madness 2 at some point).

The log parsing part of the program reads individual logs output by the game server at the end of each match. Each log contains a sequence of timestamped events that are parsed and counted by the program. After this step, there is a somewhat native Ruby-object representation of each frag, death, player and weapon in the program. These data are then stored in a database using ActiveRecord of Ruby on Rails fame. As of now, only logs output by the OLStats plugin can be parsed and the only database it has been tested with is SQLite3. In theory, all database management systems supported by the ActiveRecord gem should be compatible.

After the data have been stored in the database, they can be rendered in HTML tables on a set of interlinked, fairly bare-bones static HTML pages. The styling and layout of these pages are heavily inspired by OLStats and ULStatsDB. Currently, the only pages generated are the summary of all the data and the match detail pages (which are quite bare-bones). The player names link to individual player pages but these are not yet rendered, although I have an idea of what they could look like.

What's next

The next steps in the development of this project will most likely be:

  • Create basic pages for each player
  • Make sure that log parsing is working as it is supposed to
  • Add more details to each match (e.g. time-line of frags)
  • Add charts if possible (Gnuplot, matplotlib?) (might be advanced)
  • Additional helper scripts to ease ingestion of logs (no duplicate log-ingestion etc.)

Links

Screenshot(s)

Below is a screenshot of an example of a rendered summary page of data. A live version of the reports generated by the program can be found here.

Screenshot of rendered HTML page

Installing UT2004

If you want to install UT2004 on a modern computer (this is 2017 after all), I have written a guide accessible right here.