Page 1 of 2

DemoStats

Posted: Sun Jun 04, 2006 10:00 am
by NRGizeR
And yet another in the line of useful/useless q2 java utils :)

This one is a command line tool (and will stay a command line tool, if no-one other than me wants to write a gui for it...) and will calculate the stats from just the demo. This could be useful f.ex. when you would want to find an action filled demo where you were the fraggod number 1.

The application can be downloaded here: http://www.nrgizer.com/apps/DemoStats.jar

and the syntax would be as follows:

Code: Select all

java -jar DemoStats.jar a_quake2_demo.dm2 another_demo_if_you_want.dm2 a_third.dm2 and_so_on.dm2
Since this is pure java, it will work on all platforms that are supported by java as long as you have a 1.4.2 JVM installed. If you don't have a JVM, you can get it from here: http://java.sun.com/j2se/1.4.2/download.html (You want J2SE v 1.4.2_12 JRE).

An example output of this program could look like this:

Code: Select all

nrgizer@sybarite:~/code/demostats> java -jar DemoStats.jar 2006-06-04_11-43-33_rooftops.dm2

Parsing 2006-06-04_11-43-33_rooftops.dm2...
General---------------
Seconds played:   1179
FPM:              1.6315789
DPM:              0.7368421
Frags total:      31
Deaths total:     14
Kills total:      31
Max Velocity:     1291
Jumps total:      223
Crouches total:   86
Rounds played:    30
Distance moved:   159595
Bandages used:    4

Awards-----------------
Impressive:       1
Accuracy:         1
Excellent:        0

Kills per weapon-------
MK23:             2
Akimbo:           0
MP5:              0
M4:               28
M3:               0
Hand Cannon:      0
SSG:              0
Knife:            1
Grenade:          0
Kick:             0
Punch:            0
Drop:             0
Please let me know if you find instances when the stats are wrong. I found a few calculation bugs already, but as always, there are probably some more in there.

Enjoy,
-NRGizeR

Posted: Sun Jun 04, 2006 1:01 pm
by Stric
Kills per weapon doesnt work for me, dunno i tried 35 protocol demos only I guess.

Keep up the good work m8!

Posted: Sun Jun 04, 2006 2:09 pm
by NRGizeR
Could you send a protocol 35 demo to nrgizer.fi at gmail.com? I don't have any of those... however, from what I remember of what I read back when I wrote demoplotter, protocol 35 demos should work too... it's weird that the weapon stats don't work if the rest of it does though...

I could try to bugfix a bit if you send me a demo that doesn't work though :)

Posted: Mon Jun 05, 2006 2:58 am
by NRGizeR
Uncle- wrote:Kills per weapon doesnt work for me, dunno i tried 35 protocol demos only I guess.

Keep up the good work m8!
Argh, I should have thought of that. The problem isn't the demo, it's your nick :) ^stric^. I use a regular expression to match the kill messages, and in a regular expression ^ means the beginning of a line. This in turn means that none of the expressions match the line that they should, and no weapon kill stats are calculated.

I'll try to look at this when I get home and see if I can fix it somehow. Thanks for the heads up and the demo :)

Posted: Mon Jun 05, 2006 3:53 am
by Stric
:shocker: hehehe :hop:

Posted: Mon Jun 05, 2006 4:37 am
by NRGizeR
Argh... well as it turns out I fucked up :) everyone using [], {}, $, ^, () or \ in their nicks are pretty much screwed :D I missed this since I (or any of the other guys that tested it) don't have any of those in their nicks. All those characters have special meanings in reg. exps, and thus it won't match the kill messages correctly...

/me pats himself on the back 8) O_o

It's on my todo-list

Posted: Mon Jun 05, 2006 12:40 pm
by NRGizeR
OK, I should have it sorted now, at least your demo, stric, passes the test now. Just download the .jar file again, a new version has replaced the old one:

http://www.abo.fi/~cbjorkel/apps/DemoStats.jar

If I get inspired some day, I might add more useless stats as well, there's lots of fun stuff that that could be extracted from demos :)

Please post here if you find more problems/bugs, thanks :)

-NRG

Posted: Mon Jun 05, 2006 2:33 pm
by Stric
O_o Aint working :hop:

Posted: Mon Jun 05, 2006 3:04 pm
by NRGizeR
Uncle- wrote:O_o Aint working :hop:
how / what / when? I just tried that demo you sent and it worked for me :(

Code: Select all

Parsing 2006-05-21_12-27-43_teamjungle-knife.dm2...
General---------------
Seconds played:   291
FPM:              2.5
DPM:              1.0
Frags total:      10
Deaths total:     4
Kills total:      10
Max Velocity:     739
Jumps total:      77
Crouches total:   7
Rounds played:    7
Distance moved:   49625
Bandages used:    0

Awards-----------------
Impressive:       1
Accuracy:         0
Excellent:        0

Kills per weapon-------
MK23:             2
Akimbo:           0
MP5:              0
M4:               0
M3:               0
Hand Cannon:      0
SSG:              5
Knife:            2
Grenade:          0
Kick:             1
Punch:            0
Drop:             0

Posted: Mon Jun 05, 2006 3:48 pm
by Stric
I'm sure it doesnt work and yes its the same demo :> Maybe you didnt update file on the site? :D

Code: Select all

tgt@tgt:~/Downloads$ wget http://www.abo.fi/~cbjorkel/apps/DemoStats.jar
--22:47:16--  http://www.abo.fi/~cbjorkel/apps/DemoStats.jar
           => `DemoStats.jar'
Resolving www.abo.fi... 130.232.213.59
Connecting to www.abo.fi|130.232.213.59|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14,049 (14K) [application/java-archive]

100%[=============================================================================================>] 14,049        86.13K/s

22:47:17 (86.05 KB/s) - `DemoStats.jar' saved [14049/14049]

tgt@tgt:~/Downloads$ java -jar DemoStats.jar 2006-05-21_12-27-43_teamjungle-knife.dm2

Parsing 2006-05-21_12-27-43_teamjungle-knife.dm2...
General---------------
Seconds played:   291
FPM:              2.5
DPM:              1.0
Frags total:      10
Deaths total:     4
Kills total:      10
Max Velocity:     739
Jumps total:      77
Crouches total:   7
Rounds played:    7
Distance moved:   49625
Bandages used:    0

Awards-----------------
Impressive:       1
Accuracy:         0
Excellent:        0

Kills per weapon-------
MK23:             0
Akimbo:           0
MP5:              0
M4:               0
M3:               0
Hand Cannon:      0
SSG:              0
Knife:            0
Grenade:          0
Kick:             0
Punch:            0
Drop:             0
:hop:

Posted: Mon Jun 05, 2006 4:45 pm
by NRGizeR
It's on the server...

try java -jar DemoStats.jar

that is, without the demos as arguments... It should print the version, and the version on the server, that I got this working with, is version 0.41, is that what you get as well?

Posted: Mon Jun 05, 2006 6:03 pm
by SchORpiO
LOL :santa:

Posted: Mon Jun 05, 2006 7:39 pm
by Stric

Code: Select all

tgt@tgt:~/Downloads$ java -jar DemoStats.jar

DemoStats 0.41 - by NRGizeR
---------------------------------
Usage: java DemoStats <q2demo(s)>

O_o

Posted: Tue Jun 06, 2006 2:19 am
by NRGizeR
that's really weird... the only thing I can think of is that it's a codepage issue... what codepage does your system use? I use and wrote that in unicode, so it might be a problem with matching the chars if your system doesn't. I would have thought that java wouldn't have codepage issues (f.ex. being handled automagically by the JVM) but this might not be the case...
SchORpiO wrote:LOL :santa:
You registered to say that..? nice...

Posted: Tue Jun 06, 2006 11:52 am
by NRGizeR
IRC wrote:<Stric> NRGizeR, wow
<Stric> it works
Listen to the great uncle :) I'm really not sure what caused this problem (since it seemed to be a built in java method that behaved differently on different systems...) but it's fixed now, I wrote my own replace function instead and now it functions the way it should... hopefully it works for everyone else now as well :)