Nexuiz scores tracker web frontend

Discuss anything to do with Nexuiz here.

Moderators: Nexuiz Moderators, Moderators

Sun Nov 04, 2007 1:48 am

Sun Nov 04, 2007 2:27 am

  • server.log provides a lot more information than scores.log, so I vote server.log. Also, there is an option that outputs the scores.log information after every match to console but I haven't checked if it writes to the server.log as well. If it does, that'll be great.

    I'd like to start with code snippets, build some sort of framework or logic we can all agree on / understand.

    I'd like to get this all into a mysql database but I'm not really the guy for that. My buddy said something about using a fifo file to capture the information before it's written to the server.log.


    Edit:
    Has anyone written a server.log parser yet?
    User avatar
    [-z-]
    Site Admin and Nexuiz Ninja
     
    Posts: 1794
    Joined: Mon Nov 13, 2006 12:20 am
    Location: Florida

Sun Nov 04, 2007 4:36 am

  • [-z-] wrote:Has anyone written a server.log parser yet?

    I wrote a scores.log parser in javascript. It actually performs pretty well. Server.log I haven't yet though. What I'd aim to do is provide both a javascript and non-javascript frontend. Dojo easily allows us to do both.

    I'm great with mysql+php. If we take that route though I'd suggest using models big time (google 'MVC' if you don't know what a model is).

    I'd take a look at http://stats.enemyterritory.com/ for an idea of what we could do. maybe add/subtract features based on the gamemode played.

    tonight I just threw some snipplets in the /dojo/scores folder. Add some stuff in if you want.

    Edit: I just committed a bunch of stuff that we can implement.
    User avatar
    Psychcf
    Forum addon
     
    Posts: 1554
    Joined: Sun Dec 03, 2006 11:38 pm
    Location: NY, USA

Sun Nov 04, 2007 1:43 pm

  • [TSA] Psychiccyberfreak wrote:I wrote a scores.log parser in javascript.


    Parsing with javascript seems like the wrong way to do it, we should parse with a server-side script and insert it into a mysql database. We'll have to come up with some sort of schema we can agree on.

    I'm great with mysql+php. If we take that route though I'd suggest using models big time (google 'MVC' if you don't know what a model is).


    Are you familiar with Code Igniter? I have some experience with this framework.

    I'd take a look at http://stats.enemyterritory.com/ for an idea of what we could do. maybe add/subtract features based on the gamemode played.


    Yeah man, I was thinking about taking it a step further and making a our own 'halo like' statistics, creating 'levels' based upon certain statistics.


    tonight I just threw some snipplets in the /dojo/scores folder. Add some stuff in if you want.

    Edit: I just committed a bunch of stuff that we can implement.


    I'll check this out
    User avatar
    [-z-]
    Site Admin and Nexuiz Ninja
     
    Posts: 1794
    Joined: Mon Nov 13, 2006 12:20 am
    Location: Florida

Sun Nov 04, 2007 3:36 pm

  • I have seen code igniter, but I have not played with it. I've played with django though. (I did the mapping contest site with that)

    I agree that we should parse it into a mysql schema. Then we can convert it over to json for the ajax client, or if there is no javascript on the client we can do php scripting.

    BTW: where did all the other guys in that thread go?
    Last edited by Psychcf on Sun Nov 04, 2007 3:37 pm, edited 1 time in total.
    User avatar
    Psychcf
    Forum addon
     
    Posts: 1554
    Joined: Sun Dec 03, 2006 11:38 pm
    Location: NY, USA

Sun Nov 04, 2007 3:37 pm

  • [TSA] Psychiccyberfreak wrote:I have seen code igniter, but I have not played with it. I've played with django though. (I did the mapping contest site with that)

    where did all the other guys in that thread go?


    O.o I'm not very good with python... and for portability, I suggest we use a php based framework.


    Also, have a look at nexuiz/Docs/eventlog.txt, it contains the schema for the server.log that we're going to be parsing.
    User avatar
    [-z-]
    Site Admin and Nexuiz Ninja
     
    Posts: 1794
    Joined: Mon Nov 13, 2006 12:20 am
    Location: Florida

Mon Nov 05, 2007 12:20 am

  • I'm glad this getting some momentum :)

    Wish I were a bit better at coding, I'd be glad to hop in.
    cat /dev/urandom > /dev/mem
    John Galt
    Alien
     
    Posts: 166
    Joined: Thu Jul 19, 2007 9:20 pm
    Location: Washington, DC

Mon Nov 05, 2007 10:51 am

  • @z: anything written to the console is written to the log file. But there's also an option to write a seprate file for each that only contains the eventlog entries. Using that would be easier and faster since there a lot less data to parse...

    And you should probably make the log file parser a separate script written in python/ruby/perl/whatever that can be run by a cronjob, that way the parser could be used by other projects, too. It would be awesome if that script could either use mysql or sqlite, that way you don't always need to use a full blown mysql server...
    User avatar
    KadaverJack
    Site admin and forum addon
     
    Posts: 1102
    Joined: Tue Feb 28, 2006 9:42 pm

Mon Nov 05, 2007 1:11 pm

  • KadaverJack wrote:And you should probably make the log file parser a separate script written in python/ruby/perl/whatever that can be run by a cronjob, that way the parser could be used by other projects, too. It would be awesome if that script could either use mysql or sqlite, that way you don't always need to use a full blown mysql server...


    What about using a FIFO file as a middle man? This avoids a cron job and gives inserts the data into the database immediately and cuts down on the parsing overhead.

    This is not my specialty, this is what my friend was planning on doing... if someone feels more comfortable in this area, please, take the lead :).
    User avatar
    [-z-]
    Site Admin and Nexuiz Ninja
     
    Posts: 1794
    Joined: Mon Nov 13, 2006 12:20 am
    Location: Florida

Mon Nov 05, 2007 1:33 pm

  • [-z-] wrote:What about using a FIFO file as a middle man? This avoids a cron job and gives inserts the data into the database immediately and cuts down on the parsing overhead.

    Create a fifo ~/.nexuiz/data/fifo and set "log_file fifo" on the server and use that as input for the parser, no changes needed... However it would be nice if the parser supports both, parisng a server log/console output and multiple eventlog files. However using the new (>2.3) log_dest_udp feature might be a better way to get the console output...
    I haven't used sql so far, but if i find the time i might give it a shot... (learning sql is on my todo list anyway)
    User avatar
    KadaverJack
    Site admin and forum addon
     
    Posts: 1102
    Joined: Tue Feb 28, 2006 9:42 pm

Tue Nov 06, 2007 1:23 am

  • What's the option to write out the eventlog, Kadaver?
    cat /dev/urandom > /dev/mem
    John Galt
    Alien
     
    Posts: 166
    Joined: Thu Jul 19, 2007 9:20 pm
    Location: Washington, DC

Tue Nov 06, 2007 2:20 am

  • I haven't forgotten this, I'm just trying to wrap up some other projects first... have too many open. I suppose the next step is to break up tasks a little bit.

    Some tasks:
    - create the database schema
    - create log parser (preferably php)
    - design the front end

    I specialize in graphics xhtml/css so I feel l would be most utilized doing the frontend but I will definitely have a hand in the backend as I've been known to write a script or two in my day :)

    [TSA] Psychiccyberfreak, is there any task you'd prefer?
    User avatar
    [-z-]
    Site Admin and Nexuiz Ninja
     
    Posts: 1794
    Joined: Mon Nov 13, 2006 12:20 am
    Location: Florida

Tue Nov 06, 2007 2:23 am

Tue Nov 06, 2007 2:59 am

  • [TSA] Psychiccyberfreak wrote:I'm super cool with ajax so I'd like to do the ajax frontend.


    Would you like me to do the xhtml/css?

    We really need to get the variables first though, so we need to write that parser script.

    I'll give it a shot tomorrow but I would like someone else to do the fifo to the mysql database as I feel I could be utilized elsewhere in this project.
    User avatar
    [-z-]
    Site Admin and Nexuiz Ninja
     
    Posts: 1794
    Joined: Mon Nov 13, 2006 12:20 am
    Location: Florida

Tue Nov 06, 2007 10:42 am

  • John Galt wrote:What's the option to write out the eventlog, Kadaver?

    see Docs/eventlog.txt
    User avatar
    KadaverJack
    Site admin and forum addon
     
    Posts: 1102
    Joined: Tue Feb 28, 2006 9:42 pm

Wed Nov 07, 2007 9:38 pm

  • So I am the buddy that [-z-] keeps referring to.

    I have some schema setup for storing the stats information. I also began writing a parser for the scores.log in PHP. However I have been swamped at work with a (*clench all orifices*) exchange service migration so I didn't get to finish. I also saw that simply parsing the scores .log file was not going to cut it for keeping decent statistics.

    I would like to take the reins on writing the parser for server.log. I'll get the SVN checked out and review the eventlog documentation tonight, hopefully to start writing a top down/spec document on it all.

    If you want to find either -z- or myself for collaborating on things, we're online 24/7 in #nexuiz.ninjaz on quakenet.
    dragzZz
    Newbie
     
    Posts: 1
    Joined: Wed Nov 07, 2007 9:29 pm

Thu Nov 08, 2007 12:06 am

  • I just wrote a really kick ass model system for my web desktop. I advise that we use it, it works great with existing schemas.

    I'll add it to the repo in just a sec.
    User avatar
    Psychcf
    Forum addon
     
    Posts: 1554
    Joined: Sun Dec 03, 2006 11:38 pm
    Location: NY, USA

Mon Nov 26, 2007 4:16 pm

  • Just curious if anyone has dug into this any more :)
    cat /dev/urandom > /dev/mem
    John Galt
    Alien
     
    Posts: 166
    Joined: Thu Jul 19, 2007 9:20 pm
    Location: Washington, DC

Mon Nov 26, 2007 4:17 pm

  • Let me just finish up some things on NN and I will get on it. I'd say ~1-2 weeks.
    User avatar
    [-z-]
    Site Admin and Nexuiz Ninja
     
    Posts: 1794
    Joined: Mon Nov 13, 2006 12:20 am
    Location: Florida

Mon Nov 26, 2007 8:29 pm

  • Cool [-Z-] -- I'm not trying to criticize slow movement, was just honestly curious at whether there had been more going on behind the scenes :)
    cat /dev/urandom > /dev/mem
    John Galt
    Alien
     
    Posts: 166
    Joined: Thu Jul 19, 2007 9:20 pm
    Location: Washington, DC

Mon Nov 26, 2007 10:25 pm

  • John Galt wrote:Cool [-Z-] -- I'm not trying to criticize slow movement, was just honestly curious at whether there had been more going on behind the scenes :)


    I'll start a page in the Nexuiz Ninjaz development wiki when I get to cracking on it. I had a lot of work work today, so I didn't even have time for regular NN stuff... but hey, hobbies second, food first :D

    P.S. Can you send me login information for the training server?
    User avatar
    [-z-]
    Site Admin and Nexuiz Ninja
     
    Posts: 1794
    Joined: Mon Nov 13, 2006 12:20 am
    Location: Florida

Sun Feb 24, 2008 12:01 am

  • Color coded for easier reading.

    Code: Select all
    <?
    // Eventlog Parser by -z- of www.nexuizninjaz.com | Last Updated 02/23/08
    // -----------------------------------------------------------------------------------
    //
    // This Class Parses all possible outputs as denoted by eventlog.txt
    //

    // team colors:
       // 1 = No Team (Domination)
       // 5 = Red Team
       // 14 = Blue Team
       // 10 = Pink Team
       // 13 = Yellow Team

    // Weapon Itemstring:
       // <weaponid><flags>
       // or
       // <weaponid><flags>|<runes>

    // where flags can contain:
       // F = player carries the flag
       // S = player has strength
       // I = player has the shield
       // T = player is typing (console, menu or chat)
       
    // and weapon IDs are:
       // 1 = Shotgun
       // 2 = Uzi
       // 4 = Mortar
       // 8 = Electro
       // 16 = Crylink
       // 32 = Nex
       // 64 = Hagar
       // 128 = Rocket Launcher
       // 4096 = Laser

    // runes/curses are stored as a bit mask with the following values:
       // 1 = Strength
       // 2 = Defense
       // 4 = Regeneration
       // 8 = Speed
       // 16 = Vampire
       // 8192 = Weakness
       // 16384 = Vulnerability
       // 32768 = Venom
       // 65536 = Slow
       // 131072 = Empathy

    // death type:
    // either a weapon ID (see above), or one of:
       // 10000 = fallen to death
       // 10001 = telefragged
       // 10002 = drowned
       // 10003 = killed by a trap / fallen into the void
       // 10004 = lava
       // 10005 = slime
       // 10006 = console kill
       // 10007 = (MinstaGib) out of ammo
       // 10008 = swamp
       // 10009 = team change
       // 10010 = auto team change
       // 10011 = camping protection
       // 10012 = player became too fast (should never happen)

       
       
       
       
    // Set some test strings
    $s_join_player = ":join:10:player:-z-";
    $s_join_bot = ":join:5:bot:[BOT]Acidic";
    $s_part = ":part:5";
    $s_team = ":team:3:14";
    $s_kill_frag = ":kill:frag:1:2:type=4:items=4:victimitems=128F";
    $s_kill_tk = ":kill:tk:2:4:type=4:items=2:victimitems=S";
    $s_kill_suicide = ":kill:suicide:2:4:type=4:items=1:victimitems=14S";
    $s_kill_accident = ":kill:accident:2:4:type=4:items=4096:victimitems=32S";
    $s_ctf_steal = ":ctf:steal:14:1";
    $s_ctf_dropped = ":ctf:dropped:5:2";
    $s_ctf_pickup = ":ctf:pickup:14:4";
    $s_ctf_capture = ":ctf:capture:14:4";
    $s_ctf_return = ":ctf:return:5:2";
    $s_ctf_returned = ":ctf:returned:5:4";
    ?>

    <h3>Joins</h3>
    <h4>Player</h4>
    <pre><?var_dump(isJoin($s_join_player));?></pre>
    <h4>Bot</h4>
    <pre><?var_dump(isJoin($s_join_bot));?></pre>
    <h4>False</h4>
    <pre><?var_dump(isJoin($s_part));?></pre>

    <h3>Part</h3>
    <h4>True</h4>
    <pre><?var_dump(isPart($s_part));?></pre>
    <h4>False</h4>
    <pre><?var_dump(isPart($s_join_player));?></pre>

    <h3>Team</h3>
    <h4>True</h4>
    <pre><?var_dump(isTeam($s_team));?></pre>
    <h4>False</h4>
    <pre><?var_dump(isTeam($s_join_player));?></pre>

    <h3>Kill</h3>
    <h4>Frag</h4>
    <pre><?var_dump(isKill($s_kill_frag));?></pre>
    <h4>TK</h4>
    <pre><?var_dump(isKill($s_kill_tk));?></pre>
    <h4>Suicide</h4>
    <pre><?var_dump(isKill($s_kill_suicide));?></pre>
    <h4>Accident</h4>
    <pre><?var_dump(isKill($s_kill_accident));?></pre>
    <h4>False</h4>
    <pre><?var_dump(isKill($s_join_player));?></pre>

    <h3>CTF</h3>
    <h4>Steal</h4>
    <pre><?var_dump(isCTF($s_ctf_steal));?></pre>
    <h4>Dropped</h4>
    <pre><?var_dump(isCTF($s_ctf_dropped));?></pre>
    <h4>Pickup</h4>
    <pre><?var_dump(isCTF($s_ctf_pickup));?></pre>
    <h4>Capture</h4>
    <pre><?var_dump(isCTF($s_ctf_capture));?></pre>
    <h4>Return</h4>
    <pre><?var_dump(isCTF($s_ctf_return));?></pre>
    <h4>Returned</h4>
    <pre><?var_dump(isCTF($s_ctf_returned));?></pre>
    <h4>False</h4>
    <pre><?var_dump(isCTF($s_join_player));?></pre>

    <?

    // True returns - array(id,type,nick)
    function isJoin($string) {
       // Is it a join?
       $isJoin = (substr($string,1,4) == "join") ? TRUE : FALSE;
       // Yes, parse the ID, Type and Nickname
       if ($isJoin) {
          $joinData = explode(":",substr($string,6));
       }
       return ($isJoin) ? $joinData : FALSE;
    }

    // True returns - $id
    function isPart($string) {
       // Is it a part?
       $isPart = (substr($string,1,4) == "part") ? TRUE : FALSE;
       // Yes, parse the ID
       if ($isPart) {
          $partData = substr($string,6);
       }
       return ($isPart) ? $partData : FALSE;
    }

    // True returns - aray(id,team)
    function isTeam($string) {
       // Is it a team?
       $isTeam = (substr($string,1,4) == "team") ? TRUE : FALSE;
       // Yes, parse the ID, Team ID
       if ($isTeam) {
          $teamData = explode(":",substr($string,6));
       }
       return ($isTeam) ? $teamData : FALSE;
    }

    // True returns - array(type, killer id, victim id, type, items of killer, items of victim)
    function isKill($string) {
       // Is it a kill?
       $isKill = (substr($string,1,4) == "kill") ? TRUE : FALSE;
       // Yes, parse the type, killer id, victim id, type, items of killer, items of victim
       if ($isKill) {
          $killData = explode(":",substr($string,6));
          // it parses with type=#, items=#, vicitimitems=# for some reason I don't understand, I fix that here.
          $killData[3] = substr($killData[3],5);
          $killData[4] = substr($killData[4],6);
          $killData[5] = substr($killData[5],12);
       }
       return ($isKill) ? $killData : FALSE;
    }

    // True returns - array(type, killer id, victim id, type, items of killer, items of victim)
    function isCTF($string) {
       // Is it a ctf?
       $isCTF = (substr($string,1,3) == "ctf") ? TRUE : FALSE;
       // Yes, parse the type, flag color, player id
       if ($isCTF) {
          $ctfData = explode(":",substr($string,5));
       }
       return ($isCTF) ? $ctfData : FALSE;
    }

    ?>


    Is this helpful to anyone?
    User avatar
    [-z-]
    Site Admin and Nexuiz Ninja
     
    Posts: 1794
    Joined: Mon Nov 13, 2006 12:20 am
    Location: Florida



Return to Nexuiz - General Discussion




Information
  • Who is online
  • Users browsing this forum: No registered users and 1 guest