CS-Reloaded Banner
Welcome, Guest. Please Login or Register.
Download Second Map Pack!
Get more packs here

Home Help Search Login Register

CSReloaded Forums  |  Guides and FAQ  |  Articles (Moderators: Ryo-Ohki, Porter, Kaoz)  |  Topic: How HLStats and PsychoStats Work
Pages: [1] Reply Notify of replies
   Author  Topic: How HLStats and PsychoStats Work  (Read 179 times)
Porter
[Wumpa]
Board Admin
*****
Karma: +176/--88

Offline

Gender: Male
Posts: 3910

Wumpa+Porter
View Profile WWW E-Mail
How HLStats and PsychoStats Work
« on: July 18, 2003, 11:45:29 AM »
Reply with quote

There has been a lot of confusion about how the different statistics packages we have her eon CSR operate. In order to clear that up, I've written this explanation. Comments or correction are more than welcome.

HLStats
It tracks statistics in real-time. What that means is that if you kill someone in the game, you can refresh your personal stats page two seconds later and see that kill in your listing.

This is how it works: The program that runs the actual game server is called HLDS (Half-Life Dedicated Server). This program generates log files while the game is being played that describe everything that is happening. Players joining, players disconnecting, players killing other players (and what weapon they used to do it)... all of this gets output to a big text file on the HLDS machine. HLDS can also send the logs over the internet though, so that a different computer can use them.

This is what HLStats does. HLStats has a program (commonly referred to as a "daemon") that runs all the time and listens for log files being sent from your HLDS. Since the log file comes into HLStats as a stream (think RealVideo style), HLStats parses (fancy word for analyzing and breaking down data) it as it comes, and puts the information is gets out of the logs into a database. This database is completely separate from the web server (usually). This is also the only place where data gets piled up. As long as you have plenty of space for the database, you're set.

Note that no HTML pages have been generated yet! All we have is a database full of player data. That's where some special PHP scripts come in. These scripts live on your web server, and when you go to a HLStats web page, that script is what you're seeing. more specifically, you're seeing the output from the request you made of the script. If you ask for your personal player info, you'll notice some extra garbage in the URL. (Like "?mode=playerinfo&player=114") That extra garbage is telling HLStats what information to pull out of the database for you. It quite literally only grabs the information you ask for, and ignores the thousands of other players in the database.

PsychoStats
(Also referred to as "PS" here), doesn't run all the time. Instead, it waits until a certain time of day (5:30 AM on ReconGamer websites) and then parses all the text log files that HLDS has created up to this point. There is usually one log file for each map played. When the map changes,  a new log file is started. After a couple weeks, these logs start to pile up. (Right now CSR has over 250MB of log files accumulated! That a lot of plain text files!)

Anyway, every morning, PsychoStats opens each one of those files, parses the data inside all of them, and then actually creates HTML pages for each and every player. As you can imagine, this would be a huge amount of work if you used ALL the log files, and the job would keep getting bigger every day as more log files piled up. So what PS is forced to do is only worry about logs from the past two weeks in order to keep it's job small enough to finish quickly.

The downside to this is that you only get two weeks of stats, and only for the top 150 players, and that you have to wait until the tomorrow to see how well you did today. On top of that, each web page generated for an individual player is over 800KB, which means with all the extra pages PS generates, you end up with over 110MB of HTML files every morning. (The HLStats web scripts, by the way, do their work with less than 300KB worth of files.)


Anyway, ReconGamer offers PsychoStats as part of their package when you sign up. Since there is no reason not to run it, we do. There are a lot of us that prefer HLStats instead though, so we set that up too.
« Last Edit: July 18, 2003, 12:51:40 PM by Porter » Logged

[Wumpa] Porter
  --Silent, professional, lethal... sometimes.
Pages: [1] Reply Notify of replies 
CSReloaded Forums  |  Guides and FAQ  |  Articles (Moderators: Ryo-Ohki, Porter, Kaoz)  |  Topic: How HLStats and PsychoStats Work
Jump to: 

Powered by PHP CSReloaded Forums | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
Powered by MySQL
:[ Site Design by Ryo, scripts and backends by Porter and Ryo, banner by Supafly! Powered by PHP and MySQL ]:
Page created in 0.03 seconds.