Page 1 of 1

Logging of "scoreless" matches

Posted: Wed Oct 05, 2011 4:05 am
by n4rkot1k
Hi there!

First of all i´d like to say that UTstatsDB (and also OLStats along with it) is a very nice tool ;)
Big thanks for that work!
But as you know.. people only post here if they encounter issues on the tool :D
so here is my "problem":

UTstatsDB seems to track "scoreless" matches for Unreal Tournament 2004.
I am using the latest OLStats- and UTstatsDB release for our server.

Matches on our server should only be logged if they are not incomplete and if there are at least two human players around. Bot stats should not be logged at all.

We use ServerBots on our server and from time to time one of us plays a match against the ServerBot.
As someone of us started a game via "ready-option" of UTcomp against a Bot, ended the game by reaching the frag limit, changed the map to another map, changed the map back again to that map on which the match was played on before, disconnected from the server, another player connects to the server later on (hours?) and plays a whole match vs. the ServerBot, the following game was logged and entered into the db: http://mkcs.clanservers.com/utstats/mat ... hp?match=4

The match seems to be completed (ended) by MicroLixx by reaching the frag limit. He was awarded a score of "10" for that match, but he has not killed any human player.. no frags were entered at all.
I think he played until he fragged the bot 10 times and then the game ended "normally" (followed by match db logging).

Im currently thinking of any way to avoid such "miss-trackings".
Perhaps you might have any suggestions here.

I hope you got my explanations :)

Greetings N4rkoT1k

Re: Logging of "scoreless" matches

Posted: Fri Oct 07, 2011 2:08 am
by n4rkot1k
I might be overreacting but I am currently working on a PHP script to delete those db-entries completely (with score-updating, pick-up-deleting, updating totals etc.). Well.. lets see how complete it will be.

This will take some time but i will post it here if i get it done


Errrm.. perhaps you got any idea on the column 'ge_event' in the table 'gevents'?
for what does the value in that column stand for?

EDIT:
I got some code to show off now. Dont get confused by table names.. I used 'mkcs_ut' as table-pre-tag.
I think the script should be called, if someone choses the 'UTstatsDB' menu button of our homepage.
Here is the code (english comments for better understandig)

Code: Select all

//get all matches (ID of the match and ID of the map that was played) with no kills $sql_get_matches = "SELECT mat.gm_num AS match_id, maps.mp_num AS map_id FROM mkcs_ut_matches mat INNER JOIN mkcs_ut_maps maps ON mat.gm_map = maps.mp_num WHERE mat.gm_kills = '0'"; $sql_get_matches_query = mysql_query($sql_get_matches); while ($matches = mysql_fetch_assoc($sql_get_matches_query)) { //empty the match id variable $match_id = ""; //set the match id variable $match_id = $matches['match_id']; //empty the map id variable $map_id = ""; //set the map id variable $map_id = $matches['map_id']; //get all players (both IDs of them) who played the match $sql_get_players = "SELECT gp_num AS player_game_id, gp_pnum AS player_true_id FROM mkcs_ut_gplayers WHERE gp_match = '$match_id'"; $sql_get_players_query = mysql_query($sql_get_players); while ($players = mysql_fetch_assoc($sql_get_players_query)) { //empty the player game id variable $players_game_id = ""; //set the player game id variable $players_game_id = $players['player_game_id']; //empty the player true id variable $players_true_id = ""; //set the player true id variable $players_true_id = $players['player_true_id']; //empty the overall score variable $player_score_in_the_match = ""; //get the overall score of players who played the match $sql_get_player_match_score = "SELECT sum(gs_score) AS player_game_score FROM mkcs_ut_gscores WHERE gs_match = '$match_id' AND gs_player = '$players_game_id'"; $sql_get_player_match_score_query = mysql_query($sql_get_player_match_score); while ($player_match_score = mysql_fetch_assoc($sql_get_player_match_score_query)) { //set the overall score variable $player_score_in_the_match = $player_match_score['player_game_score']; } //substract the overall score of players who played the match in the table 'mkcs_ut_players' $sql_update_player_score_players = "UPDATE mkcs_ut_players SET plr_score = plr_score - '$player_score_in_the_match' WHERE pnum = '$players_true_id'"; $sql_update_player_score_players_query = mysql_query($sql_update_player_score_players); //substract the overall score of players who played the match in the table 'mkcs_ut_playersgt' $sql_update_player_score_playersgt = "UPDATE mkcs_ut_playersgt SET gt_score = gt_score - '$player_score_in_the_match' WHERE gt_pnum = '$players_true_id'"; $sql_update_player_score_playersgt_query = mysql_query($sql_update_player_score_playersgt); //substract the overall score of players who played the match in the table 'mkcs_ut_totals' $sql_update_player_score_totals = "UPDATE mkcs_ut_totals SET tl_score = tl_score - '$player_score_in_the_match'"; $sql_update_player_score_totals_query = mysql_query($sql_update_player_score_totals); //substract the overall score of players who played the match in the table 'mkcs_ut_maps' $sql_update_player_score_maps = "UPDATE mkcs_ut_maps SET mp_score = mp_score - '$player_score_in_the_match' WHERE mp_num = '$map_id'"; $sql_update_player_score_maps_query = mysql_query($sql_update_player_score_maps); } /* * substract the match in the recently updated tables */ //substract the match in the table 'mkcs_ut_players' $sql_update_player_match_players = "UPDATE mkcs_ut_players SET plr_matches = plr_matches - 1 WHERE pnum = '$players_true_id'"; $sql_update_player_match_players_query = mysql_query($sql_update_player_match_players); //substract the match in the table 'mkcs_ut_playersgt' $sql_update_player_match_playersgt = "UPDATE mkcs_ut_playersgt SET gt_matches = gt_matches - 1 WHERE gt_pnum = '$players_true_id'"; $sql_update_player_match_playersgt_query = mysql_query($sql_update_player_match_playersgt); //substract the match in the table 'mkcs_ut_totals' $sql_update_player_match_totals = "UPDATE mkcs_ut_totals SET tl_matches = tl_matches - 1"; $sql_update_player_match_totals_query = mysql_query($sql_update_player_match_totals); //substract the match in the table 'mkcs_ut_maps' $sql_update_player_match_maps = "UPDATE mkcs_ut_maps SET mp_matches = mp_matches - 1 WHERE mp_num = '$map_id'"; $sql_update_player_match_maps_query = mysql_query($sql_update_player_match_maps); //delete all data from the following tables that refer to the match $sql_delete1 = "DELETE FROM mkcs_ut_connections WHERE cn_match = '$match_id'"; $sql_delete1_query = mysql_query($sql_delete1); $sql_delete2 = "DELETE FROM mkcs_ut_gbots WHERE gb_match = '$match_id'"; $sql_delete2_query = mysql_query($sql_delete2); $sql_delete3 = "DELETE FROM mkcs_ut_gchat WHERE gc_match = '$match_id'"; $sql_delete3_query = mysql_query($sql_delete3); $sql_delete4 = "DELETE FROM mkcs_ut_gevents WHERE ge_match = '$match_id'"; $sql_delete4_query = mysql_query($sql_delete4); $sql_delete5 = "DELETE FROM mkcs_ut_gitems WHERE gi_match = '$match_id'"; $sql_delete5_query = mysql_query($sql_delete5); $sql_delete6 = "DELETE FROM mkcs_ut_gkills WHERE gk_match = '$match_id'"; $sql_delete6_query = mysql_query($sql_delete6); $sql_delete7 = "DELETE FROM mkcs_ut_gplayers WHERE gp_match = '$match_id'"; $sql_delete7_query = mysql_query($sql_delete7); $sql_delete8 = "DELETE FROM mkcs_ut_gscores WHERE gs_match = '$match_id'"; $sql_delete8_query = mysql_query($sql_delete8); $sql_delete9 = "DELETE FROM mkcs_ut_gwaccuracy WHERE gwa_match = '$match_id'"; $sql_delete9_query = mysql_query($sql_delete9); $sql_delete10 = "DELETE FROM mkcs_ut_tkills WHERE tk_match = '$match_id'"; $sql_delete10_query = mysql_query($sql_delete10); //delete the actual match $sql_delete_match = "DELETE FROM mkcs_ut_matches WHERE gm_num = '$match_id'"; $sql_delete_match_query = mysql_query($sql_delete_match); }
In the end all queries get checked if they caused errors.
If they caused some, those errors will be inserted into an 'error-tracking-table' and the script will call the homepage
If everything went correct, script will call the index-page of UTstatsDB

One improvement would be to calculate all weapon-pickups and delete those as well..
Im also thinking about running the script once and after that creating a view at the admin section of UTstatsDB with a drop down menu for the matches so i can delete them one by one easily if necessary

Perhaps you got any suggestions on my thoughts here overall?
Perhaps i am doing total bullshit? :?

Any feedback is appreciated!

Re: Logging of "scoreless" matches

Posted: Mon Oct 10, 2011 12:56 pm
by Panther
It might be more worthwhile to pursue code that would check for two human players online simultaneously. Also, perhaps a time limit for a match, even if it's an hour or something might help. Those are my thoughts anyway.

Re: Logging of "scoreless" matches

Posted: Mon Oct 10, 2011 2:14 pm
by n4rkot1k
thx for your reply but i dont really get that..

how should i realize this? you got some more info on that perhaps?

Re: Logging of "scoreless" matches

Posted: Mon Oct 10, 2011 6:38 pm
by Panther
If you mean how do you set a time limit on a match, set the TimeLimit variable for your match type, such as:
[XGame.xDeathMatch]
TimeLimit=30

If you mean how to check for two human players simultaneously, well, I'd say you just need to set a flag and do a check each time someone logs in. If someone logs in while someone else is already in and the match is in session, flag it.

Re: Logging of "scoreless" matches

Posted: Tue Oct 11, 2011 11:12 am
by n4rkot1k
ok now i got a grip of what u mean exactly. thx for advice!

i will try and check that after i return from my holidays ;)
will post here if I make some progress on it..


btw:
wouldnt it still be nice to have a match-deletion-option within the admin menu of UTstatsDB?
my script would be a "first-step" for that ;)

edit:
the more i look at the db structure and tables the more i think that match-deletion is pretty hard to be implemented..
lots of things that have to be calculated, summed up, compared and substracted :(

Re: Logging of "scoreless" matches

Posted: Thu Oct 20, 2011 7:25 am
by n4rkot1k
a time limit makes no sence cause i wont know if the time limit was set correctly for each case..
also checking for online players isnt that easy so i chose to implement my script

it works fine currently and it always checks for empty matches each time someone clicks on the "UTstatsDB"-option on the homepage: http://mkcs.clanservers.com/

with a minor code change i can delete specific matches as well

if someone wants the complete script, just PM me


thanks for your hints Panther!! ;)

Re: Logging of "scoreless" matches

Posted: Sun Aug 18, 2013 12:27 am
by avihay
Hi, we use utstatsdb with the standard installation (sqllite), and we're interested in deleting specific matches.

Can you please send me the script to avihaiel <at> walla <dot> co <dot> il?


Thanks a lot