SimpleStats

Expand and mod your server.
Post Reply
User avatar
macsforme
General
General
Posts: 2069
Joined: Wed Mar 01, 2006 5:43 am

SimpleStats

Post by macsforme »

Author: Constitution
Description: Keeps track of and announces high and low scores.
Min. Version: 2.0.10

This plugin will track high and low scores on a per-player basis, and report notable records. When given a filename as a parameter, the plugin will load scores from and save scores to this file. The loading syntax is:

Code: Select all

/loadplugin /path/to/SimpleStats.so,/path/to/scores_file.txt
(Same thing for -loadplugin, if loaded by bzfs on startup.) This allows for a lot of different ways to use the plugin. For instance, you can use one scores file for your server, use one scores file and reset it every month, use one scores file for your rotation server, use a scores file for each map in your rotation server, use no score file (so you start from scratch each game), etc.

Players can request a list of the top ten high or low scorers, or request scores for a specific player. For instance:

Code: Select all

/highscore
    [SERVER->] High scores list
    [SERVER->] ================
    [SERVER->] enigma           81
    [SERVER->] VTX Man          74
    [SERVER->] Constitution             65
    [SERVER->] orbit            55
    [SERVER->] Warinthestar             35
    [SERVER->] Hamgreen         34
    [SERVER->] Florida Fighter          19
    [SERVER->] The Vet          18
    [SERVER->] Fusilier         18
    [SERVER->] sigonasr2                17

Code: Select all

/lowscore
    [SERVER->] Low scores list
    [SERVER->] ===============
    [SERVER->] beahen_|deep              -78
    [SERVER->] helen_keller            -68
    [SERVER->] MichaelKNR              -68
    [SERVER->] the_Whomper             -31
    [SERVER->] Nhiack          -28
    [SERVER->] KP_OZ           -27
    [SERVER->] ss              -25
    [SERVER->] aRabbid         -23
    [SERVER->] Logbottom               -23
    [SERVER->] Man Bear Pig            -20

Code: Select all

/highscore Warinthestar
    [SERVER->] Player Warinthestar has a high score of 6.
Examples of announcements:

Code: Select all

    SERVER: Warinthestar just tied sigonasr2's high score record of 2!
    SERVER: SkaterGOD/DOOD23 just tied Warinthestar's high score record of 1!
    SERVER: Consolations to sigonasr2, who just tied hamburger ham's low score record of -4.
    SERVER: Bitter consolations to sigonasr2, who just beat hamburger ham's low score record of -4.
    SERVER: Warinthestar continues the sheer domination.
For more details, please see the README file. Many thanks to sigonasr2, whodaman?, Warinthestar, and others for testing. Please post any bug reports or suggestions here.

November 23, 2007 - Updated to version 1.1
Security change: Pass config file not filename as first parameter (thanks to Optic Delusion for pointing it out, and to Thumper for the code). Spree sounds are now played when new records are set (thanks to Optic Delusion for the idea).

August 10, 2009 - Updated to version 1.2
Spree sounds caused crashes on some older 2.0 clients which breaks compatibility, so they have been removed until a version of BZFlag is released that fully supports custom plugin sounds.
Attachments
SimpleStats-1.2.zip
Source, Readme, and License
(21.05 KiB) Downloaded 302 times
Last edited by macsforme on Mon Aug 10, 2009 4:49 pm, edited 3 times in total.
User avatar
macsforme
General
General
Posts: 2069
Joined: Wed Mar 01, 2006 5:43 am

Post by macsforme »

Updated to version 1.1.
User avatar
macsforme
General
General
Posts: 2069
Joined: Wed Mar 01, 2006 5:43 am

Re: SimpleStats

Post by macsforme »

Updated to version 1.2.
User avatar
zaphod
Sergeant
Sergeant
Posts: 352
Joined: Sun Jan 23, 2005 3:20 pm
Location: beteigeuze-system
Contact:

Re: SimpleStats

Post by zaphod »

THANKS! great job! going to test it right away!



.
.
.
.
Image
User avatar
zaphod
Sergeant
Sergeant
Posts: 352
Joined: Sun Jan 23, 2005 3:20 pm
Location: beteigeuze-system
Contact:

Re: SimpleStats

Post by zaphod »

thanks again Constitution! up&running smoothly!
Constitution wrote:For instance, you can use one scores file for your server, use one scores file and reset it every month, use one scores file for your rotation server, use a scores file for each map in your rotation server, use no score file (so you start from scratch each game), etc.
I need a little help here to build some *serious* stats in the long-term!
I could not figured out based on the README how do I -loadplugin with bzfs if I would like to have these 3 separate score_files?
> 1 score-file for all running maps (server)
> 1 score-file for all running maps (with monthly reset)
> 1 score-file for each map

could you please give me a hint how the -loadplugin in the config.conf should look like?
BIG thanks in advance!



.
.
.
.
Image
User avatar
macsforme
General
General
Posts: 2069
Joined: Wed Mar 01, 2006 5:43 am

Re: SimpleStats

Post by macsforme »

zaphod wrote:
Constitution wrote:For instance, you can use one scores file for your server, use one scores file and reset it every month, use one scores file for your rotation server, use a scores file for each map in your rotation server, use no score file (so you start from scratch each game), etc.
I need a little help here to build some *serious* stats in the long-term!
I could not figured out based on the README how do I -loadplugin with bzfs if I would like to have these 3 separate score_files?
> 1 score-file for all running maps (server)
> 1 score-file for all running maps (with monthly reset)
> 1 score-file for each map

could you please give me a hint how the -loadplugin in the config.conf should look like?
SimpleStats isn't designed to use more than one score file at once. Those options are all ways you can set it up, but only using one at a time. It may be possible to modify the plugin and then load it multiple times, but the custom slash commands should only report scores from one plugin.
User avatar
zaphod
Sergeant
Sergeant
Posts: 352
Joined: Sun Jan 23, 2005 3:20 pm
Location: beteigeuze-system
Contact:

Re: SimpleStats

Post by zaphod »

ok ::: thanks!
anyway good plugin and players like it!




.
.
.
.
Image
User avatar
zaphod
Sergeant
Sergeant
Posts: 352
Joined: Sun Jan 23, 2005 3:20 pm
Location: beteigeuze-system
Contact:

Re: SimpleStats

Post by zaphod »

now using your plugin for a short while, I would have (only!) 2 suggestions to improve this great plugin!

> finding a way to save/store and being able to reload the scores_file.txt
After each restart of the server/map, the scores are gone!

> when your not in the position it might be funny, but the guys that fight for the low-scores and getting the server-message like:
"Bitter consolations to x's, who just beat y's low score record of -10."
"Heartfelt consolations to xs, who just beat the low score record"
"x continues to sink lower."

it might be a little to rough (plus most players are commenting on it) and could be replaced by something more "motivating"?!
It does not "invite" newbies coming back to play and they might take it "personally"?!



.
.
.
.
Image
User avatar
macsforme
General
General
Posts: 2069
Joined: Wed Mar 01, 2006 5:43 am

Re: SimpleStats

Post by macsforme »

It already has the capability to save the scores to a file. Read the README file and set up a configuration file specifying where to save the scores. For instance, my "plugins.conf" reads like this:

Code: Select all

[SimpleStats]
	StatFile = /bzflag/servers/divi/zion/scores.txt
That tells the plugin where to save the scores. Then when I load the plugin, I specify the path to plugins.conf, like this:

Code: Select all

-loadplugin /bzflag/builds/2.0.x/lib/SimpleStats.so,/bzflag/servers/divi/zion/plugins.conf
As for the other messages, I am open to suggestions for changes.
User avatar
Starski
Private First Class
Private First Class
Posts: 93
Joined: Sun Jan 06, 2008 6:01 pm
Location: Florida

Re: SimpleStats

Post by Starski »

thanks Constitiution
"You cannot shake hands with a clenched fist"
-Gandhi

FKA Danji

Bad Company -> http://www.guleague.org/Teams/?profile=1001
SkindupTruk
Private First Class
Private First Class
Posts: 19
Joined: Fri Apr 11, 2008 10:17 pm

Re: SimpleStats

Post by SkindupTruk »

just a note to say this plugin is exactly what I needed - THX! :)

i got it to work under 2.99 by renaming a bunch of the bzfsAPI calls and pointing to a different plugins_*.h file. would you mind if i put up the new files I have so far that work under 2.99?

now that it works, I'd like to expand on the idea and write another "event log" file in addition to the existing high scores log.

any C++ code or comments would be appreciated. the plugin already has a lot of the calls i will need so it's a great start.

the columns I'd like to try:

year,month,day,hour,min,sec | killername | killerflag | killerscore | victimname | victimflag | victimscore

eg.

Code: Select all

20100206133055 | player1 | WG | 2 | player2 | ST | -2
20100206133114 | player1 | WG | 3 | player2 | OO | -3
20100206133205 | player1 | WG | 4 | player2 | NONE | -4
...
I have 2 ideas what to do with such a file by post processing in a spreadsheet (or maybe do it all inside the plugin and dump daily stats):

1. Create a player-flag kill matrix, so that you could see who killed who (you actually already get this in the game) but also break it down by flag. so it tells you your best and worst attacking and defending flags, and also who is best and worst attacking and defending with each flag. ie. a pivot table.
2. Create a x-y plot of score vs time.

the data you feed into such plots could be simply filtered in a spreadsheet by a range of one day, one month, one year etc.
User avatar
macsforme
General
General
Posts: 2069
Joined: Wed Mar 01, 2006 5:43 am

Re: SimpleStats

Post by macsforme »

I have no objections to modifications being posted. The code is released under the terms of the LGPL, which allows for such modifications.

As for the more detailed player stats, there have been many efforts to create such a stats system. One of the simpler ways of gathering data is joining a bzadmin bot that reports all kills, and directing the output to a file (or a parser, if you are so inclined). Alternatively, you could create a plugin that replicates this same functionality (I actually created one at one point, but it had a conflict with the SimpleStats plugin that would cause a crash, which I never figured out how to fix). This data could then be fed into a system of your choice. One such system I used to use is bzstats, although it appears to have been abandoned for some time.
User avatar
allejo
Breaker of Builds
Breaker of Builds
Posts: 809
Joined: Sun Feb 17, 2008 10:01 pm
Location: /dev/null
Contact:

Re: SimpleStats

Post by allejo »

Constitution wrote:I have no objections to modifications being posted. The code is released under the terms of the LGPL, which allows for such modifications.
Good to hear. Here's SimpleStats for BZFlag 2.4 :)
Attachments
SimpleStats.cpp
BZFlag 2.4
(20.46 KiB) Downloaded 174 times
Post Reply