Open michalwitwicki opened 2 months ago
https://gitlab.com/exe.pub/luffa/-/blob/master/src/models/ladders.rs?ref_type=heads#L353
That's how the xdf.gg/rating system is implimented in Rust. It's a much better system for this sort of thing (I've used the XDWC system on a different game, and the scores are wild unless people have a similar number of map finishes)
This PR is still a Work In Progress
This PR introduces a system to calculate player ratings using Python and the Polars framework. Polars is written in Rust and is highly efficient due to its parallelized computations, making it very fast. On my 2015 laptop (4 threads @ 2.3GHz, 8GB RAM), the calculations take about 1.2 seconds. However, one downside is the time it takes to upload the computed table into MySQL, which takes around 30 seconds on my machine.
Currently, the Python script runs every two minutes, but this interval can be easily adjusted.
The final
player_ratings
are calculated separately for eachphysics + mode
category through three stages:map_score
for each record in the databaseweighted_map_scores
for each recordweighted_map_scores
for each playerThe algorithm used to calculate map_score is adapted from Xonotic DWC:
I’ve made minor adjustments to better fit our environment, which includes many maps.
To calculate
weighted_map_scores
, I first sort themap_scores
for each player in eachphysics + mode
category and assign an index to each. The highestmap_score
is assigned index1
, the next one index2
, and so on. Theweighted_map_scores
are calculated using the following formula:The lower a
map_score
is, the less impact it has on the finalplayer_rating
so players won't be discouraged to submit new records out of fear lowering their rankings.The player's final rating is determined by summing up all
weighted_map_scores
within the relevant category. Maps with fewer than 5 records are not factored into theplayer_rating
.Please note that the above formulas are placeholders and could be improved or even replaced. I welcome any suggestions! I know @neyoneit wanted to try this system, but I don’t fully understand it. If someone could translate it into pseudocode, I may be able to implement it.
Additionally, there are a lot of maps that should not contribute to
player_ratings
at all, for various reasons, such as:A system for excluding such maps is already implemented, but we first need to identify which maps fall into these categories.
What Is left to do in this PR: