Ant Zucaro [Sat, 25 Aug 2012 12:17:04 +0000 (08:17 -0400)]
Add player badge batch job (via zykure).
The player badge batch job uses cairo to generate a summary
image of the given player's statistics. It can be run
periodically to maintain the "freshness" of the data. The
tricky thing with this batch job is getting cairo working
within the virtualenv - one has to install it in the machine
and then symbolically link to the ENV. This is obviously not
ideal, but it does work.
Many thanks to zykure for this well-designed image!
Ant Zucaro [Thu, 23 Aug 2012 11:40:51 +0000 (07:40 -0400)]
Wait for precondition checks before beginning the DB transaction.
SQLA's DBSession implicitly starts a PG transaction. When this
happens before the precondition checks (blank game, verified req, etc)
then an unneccesary transaction is started. Delay grabbing a new
DBSession until AFTER these checks are done prevents these useless
transactions from occurring. This means we should see little to
no ROLLBACK transactions in Munin once this is in place.
Ant Zucaro [Wed, 1 Aug 2012 11:52:19 +0000 (07:52 -0400)]
Use score-scaling Elo for non-duels.
Scale S according to the real scorefactor in non-duel games.
This eliminates the effects of people switching to the winning
or losing team at the very last second. This also avoids a
"winner take all" in DM mode, where most people would lose points.
Additionally, all players are compared to everyone else, not just
those on their own team. This makes it more fair anyway - no
averages are done over the opponent team only. You now have to
perform better overall to get more points.
Ant Zucaro [Wed, 25 Jul 2012 12:32:20 +0000 (08:32 -0400)]
Use traditional (win-based) Elo instead of score-based.
Using traditional Elo instead of score-based Elo eliminates a lot of
confusion and drama surrounding losing points when winning and
gaining points when losing. I think this is a better reflection of
what we're after - the highest ranking players have won the most.
This has an intended side-effect of encouraging ALL players to
play more, because even pros have no penalties by playing newer
players.
Ant Zucaro [Sat, 21 Jul 2012 01:59:10 +0000 (21:59 -0400)]
Don't dock Elo points if the player won.
After much debate I've included this enhancement. It prevents
losing Elo points if you've won the game. While this makes the
algorithm not *true* Elo, it prevents the negative perception
in the community. People were turning off their tracking for
fear of losing Elo points even if they won, and this hopefully
will fix that situation.
Ant Zucaro [Sat, 21 Jul 2012 00:58:02 +0000 (20:58 -0400)]
Remove +/- points display on scoreboard.
I've decided not to show the +/- elo_deltas on the scoreboard
because they are individual measures. They thus belong on a
given player's info page instead. The player_info view is the
future destination of this data (not implemented yet).
Also, I'm preventing duel matches from being processed as both
duel and dm matches. Duel really is a mode of its own, even if
Xonotic doesn't have a dedicated mode for it.
Ant Zucaro [Sat, 7 Jul 2012 01:45:23 +0000 (21:45 -0400)]
Basic support for batch processes.
Badges is the first batch process supported. It basically
sets up the pyramid environment, then iterates over the
player base and generates static HTML files showing their
high-level stats. That static HTML is then converted into
a PNG for use in forum signatures. A bash wrapper is
needed to drive the whole process via cron.
Ant Zucaro [Sat, 30 Jun 2012 10:49:07 +0000 (06:49 -0400)]
Allow player view functions to be imported.
Prefixing the real data functions with '_' prevents
them from being imported by outside applications.
At first I thought this was a feature, then I realized
that there is really no harm to exposing them if needed.
Such a need developed for player badges, so I'm exposing
the views here. More will follow.
Ant Zucaro [Wed, 20 Jun 2012 14:17:10 +0000 (10:17 -0400)]
Add elo delta tracking.
An elo delta is the amount by which a player's elo goes up
or down per match. This is useful for tracking purposes
and competitions.
The decimal formatting here is a bit hacky, and I don't like it,
but Mako refuses to do a proper format string on a decimal.Decimal.
This is even thought on the interactive command line it works! Argh.
Ant Zucaro [Mon, 18 Jun 2012 00:10:20 +0000 (20:10 -0400)]
Add favorite map support.
This commit adds a line item to the player_info page
showing the player's favorite map. This is the map
the player has played the most in the past 90 days.
A link to the map_info page of that map in included.
Ant Zucaro [Sat, 16 Jun 2012 13:44:21 +0000 (09:44 -0400)]
Integrate the damage efficiency graph in player_info.
It isn't complete yet, but it is much better than before, where
new players would have a blank graph. Now it checks that the
given player has *any* accuracy or damage based weapon usage
and shows the graph accordingly. If the player does not have
five games of either, the appropriate graph doesn't show.
The incomplete part is that I'm not setting the default
weapon to show (nex and rocket launcher). If a player plays,
say, 10 games avoiding the rocket launcher then it will still
show a blank graph b/c the rocket launcher is the default dmg
weapon shown. This will be fixed, I just need to find a good way.
Ant Zucaro [Fri, 15 Jun 2012 13:39:25 +0000 (09:39 -0400)]
Add a damage efficiency view structure.
Allow tracking of damage efficiency as well. Damage efficiency I'll
define as the amount of damage you do per hit. The higher, the
better! This is appropriate for all splash-damage weapons. Spam shots
are not included on purpose (unless they hit, of course) after
conversations with the competitive community; spam shots usually miss
and are intended for blocking routes or catching your opponent while
they are out of your direct line of sight.
Ant Zucaro [Wed, 16 May 2012 02:37:38 +0000 (22:37 -0400)]
Add initial support for JSON on map_index view.
This commit adds initial JSON support to the map_index view.
I am giving each model class a to_dict function that returns
a select number of its instance variables back in the form of
a dictionary, which can then be returned directly by a JSON
renderer. I'm not sure if this is the right way to go, but
it works for now.
I've also ripped out the main "data-calling" piece of each
view callable into a separate function so that the JSON-
enabled view callable can use it. The non-JSON one just
returns the result of that function, while the JSON one
massages the data to be able to make it fit better for
API-like consumption.
Ant Zucaro [Mon, 14 May 2012 20:55:51 +0000 (16:55 -0400)]
Make pagination a GET parameter, not part of the URL.
It was not the best idea to add the 'page' displayed to be an actual
part of the URL. It should be a GET parameter instead, which jives
a little better with my understanding of REST-like resources. This
changes all paginated views to use a GET parameter and also limits
results returned to 10 per page for performance and viewability
reasons.
Ant Zucaro [Mon, 14 May 2012 16:55:49 +0000 (12:55 -0400)]
Do not die if missing revision metadata.
The Xonotic revision metadata comes as a part of the 'R'
line in the POST. Although it isn't required, server was dying
when it was missing. I made it optional now, defaulting
that field to "unkown" when it isn't present. Note: DTG
brought this issue into the light, as they custom compile
their Xonotic, and they omit #ifdef'ing WARPZONE, which
is what prints the 'R' line in stats.
Ant Zucaro [Mon, 30 Apr 2012 01:47:58 +0000 (21:47 -0400)]
Add a toggle-able accuracy selector to the player info page.
You can choose which weapon to show accuracy stats for. The only weapons shown are those that the player has used in 5 or more games in the past 90 days. This is still a work in progress, as I don't have labels or nice hovers for the datapoints. :(
Ant Zucaro [Sun, 29 Apr 2012 16:10:14 +0000 (12:10 -0400)]
Initial version of ajax-updating of the accuracy graph.
The accuracy view needs to be changed to accommodate clicking on weapons where not enough data is supplied. Right now it results in a JS error that halts all further updates to the graph.
Don't throw an error if the number of duel ranks found is < 10.
I was using '-' as a filler in such cases, and was populating four values into a tuple. The template expected three, so in situations when I had to fall back on the filler values, I was providing one too many, leading to 'too many values to unpack' upon loading up the main page.
Ant Zucaro [Tue, 17 Apr 2012 00:39:39 +0000 (20:39 -0400)]
Adds an accuracy graph and removes the overall accuracy table.
In retrospect the accuracy/damage table was a cop-out. It doesn't really show anything useful, it was just easy to display query-wise. Meanwhile I've been told time and time again that nex accuracy is the only thing that people are truly looking at as a measure of their accuracy, so that is what this commit does in graphical form. Other useful things will come later, but likely not in a tabular format again.
Ant Zucaro [Sun, 15 Apr 2012 11:42:11 +0000 (07:42 -0400)]
Add some kill ratio and win percentage, clean up recent games.
Added the kill ratio and win percentage to the first section along with a breakdown of how I got them. Also cleaned up the recent games section so it looks more like what is on all of the other "leaderboard" pages, which people should expect. I removed the overall stats section altogether, as 99% of the time people are looking after what is currently provided (e.g. flag carrier kills = rather unimportant in the grand scheme of things).
Ant Zucaro [Tue, 27 Mar 2012 21:23:53 +0000 (17:23 -0400)]
Add Google Analytics support.
Stats has been operational for almost six months now, yet I don't have a clue of how many people are using/visiting the site on a daily basis. It's time to fix that! GA support will be tracked up to the xonstat address at gmail.com.
Ant Zucaro [Tue, 20 Mar 2012 11:07:23 +0000 (07:07 -0400)]
Huge performance boost for the DB queries on the home page.
The queries on the home page weren't bound by dates (which are indexed) or limited by the number of rows returned (despite the tables being a fixed size there). Adding these two filters on each of the queries makes the home page fly. The dates are done w/ a BETWEEN clause, while the limit on the queries is done w/ a normal LIMIT statement. The result takes the page from 3.5s average load time to about 400ms. :D :D :D
Ant Zucaro [Sun, 18 Mar 2012 20:07:03 +0000 (16:07 -0400)]
Cap RGB value darkness by first converting to HSL, then applying threshold.
RGB values that were too dark to read against a black background are now viewable. This is done by converting the RGB values (from the hex values provided) to HSL, then moving any L (lightness) values beyond a certain threshold back. Finally they are converted back to RGB for display. In practice all this really does is to lighten the dark colors without changing their hue or saturation values (e.g. black becomes gray).
Thanks go to dmazary for helping me with this and working through the various bugs I found. Thanks, Dave!
David Mazary [Fri, 16 Mar 2012 15:14:36 +0000 (12:14 -0300)]
Idea about classifying text as light or dark so css styling could increase contrast for dark text. This looks interesting: http://css-tricks.com/adding-stroke-to-web-text/ Maybe using that trick with an electric-blue text outline for dark text.
Ant Zucaro [Thu, 15 Mar 2012 11:16:08 +0000 (07:16 -0400)]
Add an itemized breakdown of the games played by a player.
This is so we can see how many of each type of game type that the player has played. It will look like <total games played> (<number of games played> <game type cd>).
Ant Zucaro [Wed, 14 Mar 2012 02:19:59 +0000 (22:19 -0400)]
Honor cl_allow_uid2name 0 when cl_allow_uidtracking is 1.
In an attempt to display better nick information I've overwritten the provided nick (in this case none) w/ what was on the player record. This is wrong - if uid2name is 0, thus leading to no nick provided, that means I should show "Anonymous Player". This ends up being a little silly when uidtracking is 1, because a person can just click on the "Anonymous Player" link to see who was actually playing :D.