NAME

Games::Quake::Stats - Perl module for compiling basic Quake game statistics

SYNOPSIS

use Games::Quake::Stats;

EXAMPLE

 use strict;
 use Games::Quake::Stats;
 
 # NOTE: 
 # 
 # This example supposes you want to use this modele in a CGI setting.
 #
 #
 # If you configure your quake-server to write a fraglog in the directory 
 # where the quake-server is run, you can create a symbolic link from the
 # fraglog file to the file: /var/www/cgi-bin/fraglog.log (if that is where this
 # CGI application will reside).  This code will then read the statistics data
 # from the *actual* file, while the quake-server deals only with a symbolically
 # linked file.
 #
 my $quake_stats = Stats->new(_frag_log => "/var/www/cgi-bin/fraglog.log",
			      _stats_graph => "/var/www/html/stats/chart.jpg",
			      _skill_graph => "/var/www/html/stats/skill.jpg");
					   


 # create graphs					   
 $quake_stats->generate_stats_graph();
 $quake_stats->generate_skill_graph();


 # If you are using this code as a CGI response:
 print "Content-type: text/html\r\n\r\n";    

 # Usually create graphs before calling this (as this example did above)
 $quake_stats->generate_html("http://192.168.85.100/stats/");

 exit (0);

DESCRIPTION

This module provides simple mechanisms for collecting and displaying game statisitics for the Quake, Quake2, Quake2world, and Quake 3 games. It works by reading the fraglog file created by Quake servers.

You can specify the fraglog file when the object is constructed, the module compiles statistics for each player that appears in the log.

The Games::Quake::Stats module can create simple bar charts showing the relative statistics of each player, and can generate textual and pre-formed HTML output (HTML output shows the graphs created).

METHODS

new()

my $stats = Games::Quake::Stats->new(_frag_log => "/var/www/cgi-bin/fraglog.log",
                                     _stats_graph => "/var/www/html/stats/chart.jpg",
                                     _skill_graph => "/var/www/html/stats/skill.jpg");

initialize()

$stats->initialize($log_filename);

Initializes the Stats object with a frag log filename.

generate_stats_graph()

$stats->generate_skills_graph($graph_filename);

Generate JPG graph file displaying player statistics.

generate_skills_graph()

$stats->generate_skills_graph($graph_filename);

Generate JPG graph file displaying player skill levels.

generate_html()

$stats->generate_html($base_url);

Generate HTML output using $base_url as the base URL for any images (such as the graphs you create with generate_stats_graph() and generate_skills_graph().

generate_text()

Generate textual statistics output.

BUGS AND LIMITATIONS

Unfortunately, at the moment the JPG graph generation can only accomodate about 10 or so players, due to a limitation on the number of colors for the bars in the chart. This will hopefully be addressed in a future release.

DEPENDENCIES

Games::Quake::Player, GD::Graph::hbars, GD::Graph::colour

EXPORT

None by default.

SEE ALSO

The Quake2World game website, mantained by developer jdolan: www.quake2world.net. Or if you use IRC, try the #quetoo channel on irc.freenode.net.

AUTHOR

Matthias Beebe, <matthiasbeebe@gmail.com<gt>

COPYRIGHT AND LICENSE

Copyright (C) 2009 by Matthias Beebe

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.