How to create statistics for your server - ED Forums
 


Notices

Reply
 
Thread Tools Display Modes
Old 05-19-2014, 12:08 PM   #1
xcom
Senior Member
 
xcom's Avatar
 
Join Date: Jun 2012
Posts: 1,379
Default How to create statistics for your server

Hi everyone,

I'd like to post here on how you can create a statistics page for your servers, as I know many servers want to have it.

Just for example, here is a simple statistics page we are running for the DCS Israel nowadays for the on going campaigns we are running -
http://89.163.173.82/DCS/Default.html


Now, this is fairly simple to do, although you do need to know what you are doing in order to set it up and maintain until I get time to try and automate everything.
I will not explain how to setup the infrastructure of the DB/WebServer/PHP

What you will need -

1. MySQL.
2. Apache Web Server.
3. Easy PHP 5.3.5.

*You can also use WAMP for a simpler way to have it all setup, but a complete install is more reliable.
**You can use the following website, it has an excellent guide -
http://www.sitepoint.com/php-amp-mysql-1-installation/


Setting up the environment and getting the website up -

Now that we have a Web Server working with PHP and a DB behind it, we have all we need to start creating our statistics site.

1. The first thing we should do, is create the DB (Check the previous .
2. Next step will be creating a table to use:
a. Log into your DB (Using Query Browser/SQL Yog etc..)
b. Create a table by running the following query on your DB -

Code:
CREATE TABLE `TABLENAME` --change to your tablename
(
  `Time` TIME,
  `Event` VARCHAR(255),
  `InitiatorID` INT,
  `InitiatorCoa` VARCHAR(255),
  `InitiatorGroupCat` VARCHAR(255),
  `InitiatorType` VARCHAR(255),
  `InitiatorPlayer` VARCHAR(255),
  `WeaponCat` VARCHAR(255),
  `WeaponName` VARCHAR(255),
  `TargetID` INT,
  `TargetCoa` VARCHAR(255),
  `TargetGroupCat` VARCHAR(255),
  `TargetType` VARCHAR(255),
  `TargetPlayer` VARCHAR(255)
)
3. Next, we will have to actually get information out of the game into a file and then into our DB. The first part is done automatically using a script I built:
a. Go into your mission, in the initialization script that start with the mission add the following - https://www.dropbox.com/s/uphnkbcrkr...r1.02.lua?dl=0
b. In your mission, do a trigger that runs according to whenever you want to save stats and runs the following script - https://copy.com/xgdLUv0ZfFYK
c. We now need to tell DCS to enable us the option to save a file, go into the following folder - DCS World\Scripts\ and change the marked lines to look as follows in the file - MissionScripting.lua -
Code:
do
	sanitizeModule('os')
	--sanitizeModule('io')
	--sanitizeModule('lfs')
	require = nil
	loadlib = nil
end
d. Make sure to create the folder Save_stat in your Saved Games\DCS\Logs folder.

*Example of a CSV file - https://copy.com/ipElh4ybWLpM


4. Next step, Now once you run the mission and the trigger to save stats a CSV file will be saved into Saved Games\DCS\Logs\Save_stat
That file is to be loaded to the DB using the following query -

Code:
LOAD DATA INFILE 'C:/Users/Coop/Saved Games/DCS/Logs/Save_stat/EventStat7257.201.csv'  --change to your file name and path
INTO TABLE `TABLENAME` --change to your tablename
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
IGNORE 1 LINES
5. After we have loaded the statistics information into the DB, we now have to create smart queries to take out the correct information as shown in my first example.
Here is the example of this page - http://89.163.173.82/DCS/INT/Stat_INT_18_05.php
PHP file example - https://copy.com/3ZooW1cFKGYB

This is something you will have to figure out for yourselves on how you want the page to be displayed and which data you want to be shown.

I know some of this is hard to understand, I tried to be specific and give info as I can in the limited time I have.
For any help, I'll be coming over to this thread every once in a while and try to answer questions.

I hope this is a start of many many statistic pages and whatever other ideas anyone has in regards to getting information into a webpage about a running server

Last edited by xcom; 03-09-2015 at 08:48 PM.
xcom is offline   Reply With Quote
Old 05-19-2014, 12:28 PM   #2
100KIAP_Falcon
Senior Member
 
100KIAP_Falcon's Avatar
 
Join Date: Oct 2010
Location: Република Српска
Posts: 1,208
Default

Thanks!
__________________



www: 100KIAP Virtual Shipborne Fighter Aviation Regiment
Forum: https://www.100kiap.org/forum/index.php
Discord: https://discord.gg/EGrVBHt
Teamspeak: 100kiap.teamspeak3.com

If you are a dedicated Flanker pilot, a team player ... join us !!!

100-й Корабельный Истребительный Авиационный Полк

Немој ништа силом, узми већи чекић!
100KIAP_Falcon is offline   Reply With Quote
Old 05-19-2014, 12:40 PM   #3
FLANKERATOR
Senior Member
 
FLANKERATOR's Avatar
 
Join Date: Apr 2007
Location: Bhulok
Posts: 1,724
Default

Good effort xcom. However, The real question is does DCS accurately generate logs itself? Often, kills get logged as crashes. This is good to get automated stats but you'll have to go manually through Tacview and see if there are any discrepancies with what actually happened. From my own experience, DCS does not log events accurately, especially kills. Ganaalma from the 36th squadron came up with a Tacview-based solution during SATAC 2013, then when I went through the actual recording, more than half of the kills weren't there or were saved as a crash.
__________________

We do not rise to the level of our expectations. We fall to the level of our training.
FLANKERATOR is offline   Reply With Quote
Old 05-19-2014, 01:07 PM   #4
xcom
Senior Member
 
xcom's Avatar
 
Join Date: Jun 2012
Posts: 1,379
Default

This guide is first so people would understand how they can create a website that works with a working server.

About logging kills, the script I've made writes down these handler information -
Code:
if e.id == world.event.S_EVENT_HIT 
	or e.id == world.event.S_EVENT_EJECTION
	or e.id == world.event.S_EVENT_BIRTH
	or e.id == world.event.S_EVENT_CRASH
	or e.id == world.event.S_EVENT_DEAD
	or e.id == world.event.S_EVENT_PILOT_DEAD then
S_EVENT_CRASH events are logged for information only, the following events are relevant for kills -
S_EVENT_EJECTION, S_EVENT_DEAD, S_EVENT_PILOT_DEAD.

There is inaccurate information, I've also found them myself but it is not relevant to the S_EVENT_CRASH event.
I've noticed 2 issues which I've reported -
http://forums.eagle.ru/showpost.php?...1&postcount=38

Until ED does not fix these issues, there is no real way (AFAIK) to have good QA on the data exported (especially because of duplicate records).
xcom is offline   Reply With Quote
Old 05-19-2014, 08:38 PM   #5
FLANKERATOR
Senior Member
 
FLANKERATOR's Avatar
 
Join Date: Apr 2007
Location: Bhulok
Posts: 1,724
Default

Yes, absolutely. MP logs were much more accurate in FC2, hence automated stats were implemented by many servers. I'm not sure what's causing those issues in DCS. I hope ED will fix that soon, because and I hope I'm wrong, the only way to get a proper debrief right now is to generate a Tacview file and extract relevant logs manually, a bit of a PITA I would say.
__________________

We do not rise to the level of our expectations. We fall to the level of our training.
FLANKERATOR is offline   Reply With Quote
Old 05-19-2014, 09:22 PM   #6
xcom
Senior Member
 
xcom's Avatar
 
Join Date: Jun 2012
Posts: 1,379
Default

Basically my scripts export the data correct except for both issues I indicated which are very rare, which makes this way a lot easier than going into TacView and getting logs out manually for each mission, especially in large scale missions which this is aimed for.

Regarding Tacview, You would have to check if the issues I indicated are shown as well in Tacview logs or not to be sure TacView is showing the correct information aswell.
I suggest checking in large scale missions of above 500 units.
xcom is offline   Reply With Quote
Old 05-19-2014, 09:33 PM   #7
HiJack
Veteran
 
HiJack's Avatar
 
Join Date: Jul 2009
Location: Norway
Posts: 6,977
Default

Great job xcom! Don't mind the bugs, let's hope they eventually will be fixed Also FC2 was full of bugs when it came to scoring kills.
__________________
Windows 7 64 bit FTW!
My DCS Tools:
Quick Airfield information , Better trim with the X52 Pro , Tacview Glideslopes

Spoiler:

ASUS Z97-PRO, Socket-1150
Intel® Core i7-4770K Processor overclocked to @ 4.20 GHz
32GB Corsair Dominator Platinum DDR3 2133MHz CL9 4x8GB
Sapphire Radeon TRI-X R9 390X 8GB "OC"
Samsung SSD 850PRO 1TB SSD
WD 2TB Black 3,5", SATA64MB Cache, Dual Processor, 7200RPM
Windows 7 64-bit
Philips 40" 4K LED BDM4065UC, ASUS 27” and Dell 24” screens
HiJack is offline   Reply With Quote
Old 05-20-2014, 09:00 AM   #8
FLANKERATOR
Senior Member
 
FLANKERATOR's Avatar
 
Join Date: Apr 2007
Location: Bhulok
Posts: 1,724
Default

Quote:
Originally Posted by xcom View Post
Basically my scripts export the data correct except for both issues I indicated which are very rare, which makes this way a lot easier than going into TacView and getting logs out manually for each mission, especially in large scale missions which this is aimed for.

Regarding Tacview, You would have to check if the issues I indicated are shown as well in Tacview logs or not to be sure TacView is showing the correct information aswell.
I suggest checking in large scale missions of above 500 units.
Well, I'll give your method a go next time, see how accurate the logs will be compared to the track/Tacview and report back. Thanks for your effort.
__________________

We do not rise to the level of our expectations. We fall to the level of our training.
FLANKERATOR is offline   Reply With Quote
Old 05-20-2014, 05:05 PM   #9
Gaanalma
Senior Member
 
Join Date: Feb 2011
Location: Italy
Posts: 1,419
Default

Nice!
__________________
<a href=http://www.36stormovirtuale.net/Forum/index.php?action=dlattach;topic=17112.0;attach=7646;image target=_blank>http://www.36stormovirtuale.net/Foru...ach=7646;image</a>

www.36stormovirtuale.net
Gaanalma is offline   Reply With Quote
Old 05-21-2014, 03:34 PM   #10
RIPTIDE
Senior Member
 
RIPTIDE's Avatar
 
Join Date: May 2010
Posts: 2,176
Default

Ya... I need to get up to speed on MySQL and Queries and etc etc etc. Have no idea about PHP though.
__________________
RIPTIDE is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 04:41 AM. vBulletin Skin by ForumMonkeys. Powered by vBulletin®.
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.