Jump to content

[BF4] Stats webpage for XpKiller's Stats Logger Plugin


tyger07

Recommended Posts

Originally Posted by ty_ger07*:

 

I love your commit message lol

 

Also, you should look into angularjs. You could probably clear out all the cluttered html in the PHP scripts and return json for single page app. Wouldn't be a bad improvement. I got lost trying to see if I can setup a angualrjs version of your app. I gave up after an hour.

Apparently, I must lack the vision. What does angularjs provide other than hours of rewriting for the same user experience?
* Restored post. It could be that the author is no longer active.
Link to comment
  • Replies 1.7k
  • Created
  • Last Reply

Originally Posted by Prophet731*:

 

Umm...

 

The purpose of the chat log is to be able to see the chat messages. So, that isn't a very viable option, is it?

I meant take it out of the WHERE clause. You can still keep it in the SELECT. Also to make it speedier you could have a checkbox where the user can choose to filter those specific messages out or not.

 

Apparently, I must lack the vision. What does angularjs provide other than hours of rewriting for the same user experience?

AngularJS is just a framework for the front end so you could put most of your logic to show or hide html into the user side therefor cleaning up your code server side for easier management. Re-writing it would take some time, not disputing that, but it would just benefit code maintainability and you could probably write less in a few areas. Again its just a suggestion to make it more fancy in some areas.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

Update released:

 

- Optimizations in load time

- Missing weapon images corrected

 

 

Note: The chat log will no longer filter out server spam, commo rose, etc for load time reasons. I will leave that up to the server owner to keep that stuff out of their chat log, if they wish, using regex in XpKiller's plugin and/or by removing it from their database from time to time.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by dyn*:

 

I don't have before and after exact numbers, but the whole stats package just feels faster. I was routinely seeing +15 seconds for page generation (as stated by bottom of page) and now we're down to under 2 seconds for the main page and then under 5 seconds just browsing around.

 

Nicely done! Can't wait to see any further improvements. Thank you.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Chelrid*:

 

** Deutsch **

Hi,

 

folgender Sachverhalt:

 

2 Gameserver, bei 2 verschiedenen Hostern. Für jeden Server eine eigene Datenbank. Beide Hoster ermöglichen keinen Kontakt zum jeweils anderen Hoster.

 

Somit müsste ich für beide Server die Stats Seite 2x erstellen. Oder kann ich auch beide Datenbanken mit einer Config abfragen?

 

**Google translated English**

Hi,

 

the following facts:

 

2 game servers in 2 different hosters. For each server its own database. Both Hoster allow no contact with each other hosters.

 

So I would create for both the Server Stats Page 2x. Or can I check both databases with a config?

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Chelrid*:

 

You would need to create two separate stats pages -- one for each server -- or customize config/config.php and common/connect.php to connect to two different databases.

I can't php.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

Update released!

http://tyger07.github.io/BF4-Server-Stats

 

Demo:

http://open-web-community.com/bf4sta...tats/index.php

 

Change:

- Top 20 players are cached for performance reasons

 

 

 

NOTE: For those who are curious, these are the caching procedures:

 

Player Rank in individual servers (score, kills, kdr, hsr): recalculated and cache updated after 12 hours. I didn't use XpKiller's default score and kill rank and instead recalculate it simply because XpKiller's rank doesn't have a second sort-by which causes people with the same kills or same score to randomly swap ranks. Mine sorts by player name as secondary sort in case their kills or score are the same between two players which makes everything jive instead of appearing slightly random.

 

Player Rank in Combined Servers (score rank in signature image): recalculated and cache updated after 12 hours

 

Combined Server total players (used in server list, server stats, leaderboard pagination, global rank [out of # players]): recalculated and cache updated after 12 hours

 

Total Chat messages (pagination to find last page): recalculated and cache updated after 1 hour

 

Top 20 Leaderboard (only the first 20 to make default pages load fast): recalculated and cache updated after 12 hours

 

 

Additional Notes

Caching means that the cached data will not be completely correct 100% of the time like it used to be prior to caching. But it is very unlikely that anyone would notice a small statistical difference.

 

If you are the first user to view a page before it is cached or the first person to view a page when it comes due to be recached, you will experience the old slow loading experience due to everything being recalculated.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

Before I commit to this work, I need to know if there is interest.

 

Features of proposed stats database cleanup script (with options to include or exclude each of the following actions when you run the script):

Delete blank chat log rows

Delete commo rose messages from chat log

Delete server spam from chat log

Delete chat messages which start with !, @, or /

Delete chat messages which are over X number of days/weeks/months old

Delete player data if players have no score, kills, or deaths in their stats record

Delete chat messages from players with no score, kills, or deaths

Recalculate ranks and total players in server stats after deleting the above players from the database

 

Thank you!

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Prophet731*:

 

Before I commit to this work, I need to know if there is interest.

 

Features of proposed stats database cleanup script:

Delete blank chat log rows

Delete commo rose messages from chat lot

Delete server spam from chat log

Delete chat messages which start with !, @, or /.

Delete player data if players have no score, kills, or deaths in their stats record.

Delete chat messages from players with no score, kills, or deaths.

Recalculate total players after deleting the above players from the database.

 

Thank you!

You could just provide the scripts to do this and have the user run them if they so desire. Doing a this query shouldn't take very long. Code:
SELECT COUNT(PlayerID) AS Total FROM tbl_playerdata;
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

You could just provide the scripts to do this and have the user run them if they so desire. Doing a this query shouldn't take very long. Code:

SELECT COUNT(PlayerID) AS Total FROM tbl_playerdata;
We are all capable of doing anything we set our minds to, but not all are interested in doing the messy work. I don't think the majority of users know how to log into their database or execute queries.

 

Additionally, some of the above proposed functions cannot be executed in a single query. They will either require multiple queries of different tables with different steps taken depending on circumstances and/or require multiple queries repeated in steps due to processing time incurred if it were attempted in mass which would run up against database processing time restrictions resulting in a timeout of the query at some random point part-way through.

 

It should also be noted that your query will not work (at least not in a useful way) since it does not take into account GameID or ServerID.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by dyn*:

 

I am very impressed how your project has developed over the past year. It went from having to manually edit a config file for each server & longer load times to now simply one config file which can be moved from install to install and caching enabled!

 

We're now at:

server compiled page in 1.658 seconds

 

And loading from page to page feels pretty snappy!

 

To answer your question, I'm not sure about the best way to go about cleaning the database. It would be very convenient to periodically clear out the really old data and also the spam; just don't know the best way to accomplish there. Not sure if having it be a part of your stats page would be best or perhaps if perhaps an add on or it's own 'thing'? I would worry about having a user / admin accidentally change the settings and delete data that should not be deleted. But would tools like you mentioned be useful? I do think so.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

I would definitely include a password (whatever your database password is) with brute force hack protection (cool-down period after incorrect password entry). I was thinking it would be another file in another folder. But maybe it should be its own thing.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Prophet731*:

 

We are all capable of doing anything we set our minds to, but not all are interested in doing the messy work. I don't think the majority of users know how to log into their database or execute queries.

 

Additionally, some of the above proposed functions cannot be executed in a single query. They will either require multiple queries of different tables with different steps taken depending on circumstances and/or require multiple queries repeated in steps due to processing time incurred if it were attempted in mass which would run up against database processing time restrictions resulting in a timeout of the query at some random point part-way through.

 

It should also be noted that your query will not work (at least not in a useful way) since it does not take into account GameID or ServerID.

Well I was saying just create the SQL files that perform these functions and not make it something part of the software. That way it can just be ran as standalone. You could add in some sort of admin side to perform maintenance tasks that the user can start. Then you can just call file_get_contents() and execute that SQL right away with whatever function mysqli uses for raw queries. Probably the one that will take the most time would be the chatlog cleanup. I know some users don't exactly know how to log into their database but im sure they can find out how by going to their hosting companies faq on how to access it.

 

As for the queries the chatlog one would be simple as you can do something like this. On larger databases this could take a long time to finish. Took 15 minutes to add a column to the table with our 4.5GB worth of chatlogs.

 

Code:

DELETE FROM `tbl_chatlog` 
WHERE
    `logMessage` = ''
    OR `logMessage` LIKE 'ID_CHAT_%'
    OR `logMessage` LIKE '!%'
    OR `logMessage` LIKE '@%'
    OR `logMessage` LIKE '/%'
    OR `logSoldierName` = 'Server';
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

Well I was saying just create the SQL files that perform these functions and not make it something part of the software. That way it can just be ran as standalone. You could add in some sort of admin side to perform maintenance tasks that the user can start. Then you can just call file_get_contents() and execute that SQL right away with whatever function mysqli uses for raw queries. Probably the one that will take the most time would be the chatlog cleanup. I know some users don't exactly know how to log into their database but im sure they can find out how by going to their hosting companies faq on how to access it.

 

As for the queries the chatlog one would be simple as you can do something like this. On larger databases this could take a long time to finish. Took 15 minutes to add a column to the table with our 4.5GB worth of chatlogs.

 

Code:

DELETE FROM `tbl_chatlog` 
WHERE
    `logMessage` = ''
    OR `logMessage` LIKE 'ID_CHAT_%'
    OR `logMessage` LIKE '!%'
    OR `logMessage` LIKE '@%'
    OR `logMessage` LIKE '/%'
    OR `logSoldierName` = 'Server';
I don't like file_get_contents. But that's a different subject.

 

I have never had large databases to test with, but in my testing, it takes a lot longer to check if players have no stats in any servers and, if so, delete their player data and stats data. Just my donated 300 MB database took about 30 minutes to perform that function in 5000 row chunks. It really depends on the server of course. Who can possibly predict someone elses' server performance and database size? It might be biting off more than I can chew.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Prophet731*:

 

I have always been afraid of file_get_contents and am afraid of requiring others to set up their server to allow the use of something I don't think is wise. But that's a different subject.

 

I have never had large databases to test with, but in my testing, it takes a lot longer to check if players have no stats in any servers and, if so, delete their player data and stats data. Just my donated 300 MB database took about 30 minutes to perform that function in 5000 row chunks. It really depends on the server of course. Who can possibly predict someone elses' server performance and database size? It might be biting off more than I can chew.

file_get_contents is pretty standard. In my app I have some custom sql files that are stored in a folder. All I need to do to run them is reference a path and load the sql file. PHP has changed a lot of the past few years for the better of course.

 

Code:

$results = DB::statement( file_get_contents( storage_path() . '/sql/some_sql_code.sql' ) );
What software are you using for your DB testing? XAMPP or WAMP? I'm assuming you're testing locally. In my experience i've noticed that the mysql setup isn't always the best with those software so it could be mis configuration causing performance problems then the actual sql being ran. I could throw that DB you have on my VPS and give you some creds to it to perform some testing on. DB is configured with plenty of RAM and CPU power.

 

This querys ran for ~2 seconds and return the player count for each server and each game.

 

Code:

SELECT 
    tbl_server.ServerName,
    tbl_games.Name AS Game,
    COUNT(tbl_playerdata.PlayerID) AS total
FROM
    tbl_playerdata
        INNER JOIN
    tbl_server_player ON tbl_playerdata.PlayerID = tbl_server_player.PlayerID
        INNER JOIN
    tbl_server ON tbl_server_player.ServerID = tbl_server.ServerID
        INNER JOIN
    tbl_games ON tbl_server.GameID = tbl_games.GameID
GROUP BY tbl_server.GameID , tbl_server_player.ServerID;


SELECT 
    tbl_games.Name AS Game,
    COUNT(tbl_playerdata.PlayerID) AS total
FROM
    tbl_playerdata
        INNER JOIN
    tbl_games ON tbl_playerdata.GameID = tbl_games.GameID
GROUP BY tbl_playerdata.GameID
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

Those queries took 0.3 to 0.4 seconds on my database. But "my" borrowed copy of someone elses' database is only 300 MB with "80316" (players according to your query); so faster than your GBs and GBs of data.

 

Interestingly, there are actually 77839 combined players (not 80316) because 2477 of them are more than one server and counted as duplicates. I find this query to be accurate, although 3 times slower.

 

Code:

SELECT COUNT(DISTINCT tpd.`PlayerID`) AS count, tg.`Name` AS game
FROM  `tbl_playerdata` tpd
INNER JOIN `tbl_server_player` tsp ON tsp.`PlayerID` = tpd.`PlayerID`
INNER JOIN `tbl_playerstats` tps ON tps.`StatsID` = tsp.`StatsID`
INNER JOIN `tbl_games` tg ON tg.`GameID` = tpd.`GameID`
GROUP BY tg.`GameID`
I am using GoDaddy Shared Linux Hosting.

http://toolbar.netcraft.com/site_rep...-community.com

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Prophet731*:

 

Those queries took 0.3 to 0.4 seconds on my database. But "my" borrowed copy of someone elses' database is only 300 MB with "80316" (players according to your query); so faster than your GBs and GBs of data.

 

Interestingly, there are actually 77839 combined players (not 80316) because 2477 of them are more than one server and counted as duplicates. I find this query to be accurate, although 3 times slower.

 

Code:

SELECT COUNT(DISTINCT tpd.`PlayerID`) AS count, tg.`Name` AS game
FROM  `tbl_playerdata` tpd
INNER JOIN `tbl_server_player` tsp ON tsp.`PlayerID` = tpd.`PlayerID`
INNER JOIN `tbl_playerstats` tps ON tps.`StatsID` = tsp.`StatsID`
INNER JOIN `tbl_games` tg ON tg.`GameID` = tpd.`GameID`
GROUP BY tg.`GameID`
I am using GoDaddy Shared Linux Hosting.

http://toolbar.netcraft.com/site_rep...-community.com

Each player id is unique. The reason why yours is slower is because of the join on tbl_server_player. Essentially, you looking for players who have stats while my is looking for how many players there are for each game. So your query is right for returning how many players actually have stats while mine is returning how many players (with/without stats) there are. Your query took 9.11 seconds to run on our database.

 

The stats logger and adkats add players to the tbl_playerdata table regardless of stats because it also contains the PB and EA GUID.

 

Screenshot of the results showing yours vs mine.

 

Posted Image

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

I should add a player search tab to the leaderboard where you can enter the player's name and it will find their place on the leaderboard and stats without searching for that player's full stats page/profile.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

Each player id is unique. The reason why yours is slower is because of the join on tbl_server_player. Essentially, you looking for players who have stats while my is looking for how many players there are for each game. So your query is right for returning how many players actually have stats while mine is returning how many players (with/without stats) there are. Your query took 9.11 seconds to run on our database.

 

The stats logger and adkats add players to the tbl_playerdata table regardless of stats because it also contains the PB and EA GUID.

 

Screenshot of the results showing yours vs mine.

 

Posted Image

That does not seem to be true. Look at my combined server stats leaderboard and paginate to the last pages. You will find thousands of players have no stats values but are still counted. There is something about the playerid to statsid conversion which makes your count incorrect by excluding statsid. I used to find total players by your method, but it didn't work because the last tens of pagination pages returned no results.

 

In a perfect world, all playerids should have a statsid because they joined a server in order to have their playerdata recorded and therefore the table_server should have a statsid conversion to a 0 stats row. Unfortunately, there are thousands of players who do not fit that scenario.

 

Because the query is slow, I cache the result for 12 hours. Since the leaderboard is top to bottom by default and that is all anyone cares about, it doesn't matter that the bottom players with 0's aren't shown due to cache count and live count mis-match.

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Prophet731*:

 

That does not seem to be true. Look at my combined server stats leaderboard and paginate to the last pages. You will find thousands of players have no stats but are still counted. There is something about the playerid to statsid conversion which makes your count incorrect. I used to find total players by your method, but it didn't work because the last tens of pagination pages returned no results.

Some players won't be added to the tbl_server_player unless they have stats to be assigned a statsid. This would happen if the player joins but then leaves very quickly (game crashes, internet connection loss, etc..).
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

Some players won't be added to the tbl_server_player unless they have stats to be assigned a statsid. This would happen if the player joins but then leaves very quickly (game crashes, internet connection loss, etc..).

Well, regardless, I can only count players who have both a playerid AND a statsid otherwise the pagination doesn't work and error messages are displayed. So, unfortunately, I need to use the slow query and cache it. One of my recent updates made sure all queries took into account game id, server id, and stats id. In the update notes, it stated that stats are now more accurate but queries are slower. I needed to do this in order to calculate the correct ranks and not see error messages on the last pagination pages, stats signature images, and player stats pages.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Prophet731*:

 

Well, regardless, I can only count players who have both a playerid AND a statsid otherwise the pagination doesn't work and error messages are displayed. So, unfortunately, I need to use the slow query and cache it. One of my recent updates made sure all queries took into account game id, server id, and stats id. In the update notes, it stated that stats are now more accurate but queries are slower. I needed to do this in order to calculate the correct ranks and not see error messages on the last pagination pages, stats signature images, and player stats pages.

Understandable. Pagination is always a pain.
* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by Hutchew*:

 

Couldn't you just exclude players with stats less than x ( perhaps total score less than 25000)? That would reduce the total # of pages returned. Then if they looked for themselves, give them a generic " you don't exist. Play more to get stats".

 

Lol, just thinking out loud, thought I would share my ramblings.

 

 

 

Hutchew

* Restored post. It could be that the author is no longer active.
Link to comment

Originally Posted by ty_ger07*:

 

Couldn't you just exclude players with stats less than x ( perhaps total score less than 25000)? That would reduce the total # of pages returned. Then if they looked for themselves, give them a generic " you don't exist. Play more to get stats".

 

Lol, just thinking out loud, thought I would share my ramblings.

 

 

 

Hutchew

Performance wise, it would make no difference; maybe even slower (haven't tested). Your suggestion still requires checking their stats id in order to check their score and that is where the performance bottleneck is. Bigger databases will be slower. Working on an acceptable way to remove players and information from the database -- which you guys agree should be removed -- would be a performance booster to some degree depending on the ratio of removed versus not removed. The leaner the database is, the faster it will be. But, you may not want to remove too much for various reasons which will decrease the performance benefit of the removal function.

 

If I knew that 100% of user's databases have removed player ids which have no stats id, I could use the query which is 3 to 5 times faster. Unfortunately, even if I release the script which removes those worthless dead weights, I can't be sure that the script was run and am stuck using the slow accurate script.

* Restored post. It could be that the author is no longer active.
Link to comment

Archived

This topic is now archived and is closed to further replies.




  • Our picks

    • Game Server Hosting:

      We're happy to announce that EZRCON will branch out into the game server provider scene. This is a big step for us so please having patience if something doesn't go right in this area. Now, what makes us different compared to other providers? Well, we're going with the idea of having a scaleable server hosting and providing more control in how you set up your server. For example, in Minecraft, you have the ability to control how many CPU cores you wish your server to have access to, how much RAM you want to use, how much disk space you want to use. This type of control can't be offered in a single service package so you're able to configure a custom package the way you want it.

      You can see all the available games here. Currently, we have the following games available.

      Valheim (From $1.50 USD)


      Rust (From $3.20 USD)


      Minecraft (Basic) (From $4.00 USD)


      Call of Duty 4X (From $7.00 USD)


      OpenTTD (From $4.00 USD)


      Squad (From $9.00 USD)


      Insurgency: Sandstorm (From $6.40 USD)


      Changes to US-East:

      Starting in January 2022, we will be moving to a different provider that has better support, better infrastructure, and better connectivity. We've noticed that the connection/routes to this location are not ideal and it's been hard getting support to correct this. Our contract for our two servers ends in March/April respectively. If you currently have servers in this location you will be migrated over to the new provider. We'll have more details when the time comes closer to January. The new location for this change will be based out of Atlanta, GA. If you have any questions/concerns please open a ticket and we'll do our best to answer them.
      • 5 replies
    • Hello All,

      I wanted to give an update to how EZRCON is doing. As of today we have 56 active customers using the services offered. I'm glad its doing so well and it hasn't been 1 year yet. To those that have services with EZRCON, I hope the service is doing well and if not please let us know so that we can improve it where possible. We've done quite a few changes behind the scenes to improve the performance hopefully. 

      We'll be launching a new location for hosting procon layers in either Los Angeles, USA or Chicago, IL. Still being decided on where the placement should be but these two locations are not set in stone yet. We would like to get feedback on where we should have a new location for hosting the Procon Layers, which you can do by replying to this topic. A poll will be created where people can vote on which location they would like to see.

      We're also looking for some suggestions on what else you would like to see for hosting provider options. So please let us know your thoughts on this matter.
      • 4 replies
    • Added ability to disable the new API check for player country info


      Updated GeoIP database file


      Removed usage sending stats


      Added EZRCON ad banner



      If you are upgrading then you may need to add these two lines to your existing installation in the file procon.cfg. To enable these options just change False to True.

      procon.private.options.UseGeoIpFileOnly False
      procon.private.options.BlockRssFeedNews False



       
      • 2 replies
    • I wanted I let you know that I am starting to build out the foundation for the hosting services that I talked about here. The pricing model I was originally going for wasn't going to be suitable for how I want to build it. So instead I decided to offer each service as it's own product instead of a package deal. In the future, hopefully, I will be able to do this and offer discounts to those that choose it.

      Here is how the pricing is laid out for each service as well as information about each. This is as of 7/12/2020.

      Single MySQL database (up to 30 GB) is $10 USD per month.



      If you go over the 30 GB usage for the database then each additional gigabyte is charged at $0.10 USD each billing cycle. If you're under 30GB you don't need to worry about this.


      Databases are replicated across 3 zones (regions) for redundancy. One (1) on the east coast of the USA, One (1) in Frankfurt, and One (1) in Singapore. Depending on the demand, this would grow to more regions.


      Databases will also be backed up daily and retained for 7 days.




      Procon Layer will be $2 USD per month.


      Each layer will only allow one (1) game server connection. The reason behind this is for performance.


      Each layer will also come with all available plugins installed by default. This is to help facilitate faster deployments and get you up and running quickly.


      Each layer will automatically restart if Procon crashes. 


      Each layer will also automatically restart daily at midnight to make sure it stays in tip-top shape.


      Custom plugins can be installed by submitting a support ticket.




      Battlefield Admin Control Panel (BFACP) will be $5 USD per month


      As I am still working on building version 3 of the software, I will be installing the last version I did. Once I complete version 3 it will automatically be upgraded for you.





      All these services will be managed by me so you don't have to worry about the technical side of things to get up and going.

      If you would like to see how much it would cost for the services, I made a calculator that you can use. It can be found here https://ezrcon.com/calculator.html

       
      • 11 replies
    • I have pushed out a new minor release which updates the geodata pull (flags in the playerlisting). This should be way more accurate now. As always, please let me know if any problems show up.

       
      • 9 replies
×
×
  • Create New...

Important Information

Please review our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.