Module skillratings::trueskill

source ·
Expand description

The TrueSkill rating algorithm, developed by Microsoft for Halo 3.
Used in the Halo games, the Forza Games, Tom Clancy’s: Rainbow Six Siege, and most Xbox Live games.

Developed specifically for online games with multiple teams and multiple players.

Caution: TrueSkill is patented. If you have a commercial project, it is recommended to use another algorithm included here.

TrueSkill uses a normal distribution with a skill rating (μ) and an uncertainty value (σ) to represent a players skill level, similar to Glicko and Glicko-2. TrueSkill is good at assessing a player’s skill level quickly. The amount of matches needed depends on the game mode, as follows (The actual numbers may vary):

Match typeMatches needed
1 Player vs 1 Player12
4 Players vs 4 Players46
8 Players vs 8 Players91

Whereas other algorithms might need more matches in the same circumstances.

The drawback is that the calculations are complex, and thus players may find it unintuitive in certain scenarios.
For example, players might gain rank(s) when losing a match due to the uncertainty value decreasing.

Quickstart

This is the most basic example on how to use the TrueSkill Module.
Please take a look at the functions below to see more advanced use cases.

use skillratings::{
    trueskill::{trueskill, TrueSkillConfig, TrueSkillRating},
    Outcomes,
};

// Initialise a new player rating with a rating of 25, and an uncertainty of 25/3 ≈ 8.33.
let player_one = TrueSkillRating::new();

// Or you can initialise it with your own values of course.
// Imagine these numbers being pulled from a database.
let (some_rating, some_uncertainty) = (34.2, 2.3);
let player_two = TrueSkillRating {
    rating: some_rating,
    uncertainty: some_uncertainty,
};

// The outcome of the match is from the perspective of player one.
let outcome = Outcomes::WIN;

// The config allows you to specify certain values in the TrueSkill calculation.
// We set the draw probability to 0.05 (5%) instead of the default 0.1 (10%).
// This means that in our game, draws will be very rare to occur.
// Change this value to reflect the outcomes of your game.
// For example in chess, it might be a good idea to increase this value.
// For more information on how to customise the config,
// please check out the TrueSkillConfig struct.
let config = TrueSkillConfig {
    draw_probability: 0.05,
    ..Default::default()
};

// The trueskill function will calculate the new ratings for both players and return them.
let (new_player_one, new_player_two) = trueskill(&player_one, &player_two, &outcome, &config);

More Information

Structs

Functions

  • Calculates the expected outcome of two players based on TrueSkill.
  • Calculates the expected outcome of a player in a rating period or tournament.
  • Calculates the expected outcome of two teams based on TrueSkill.
  • Gets the conservatively estimated rank of a player using their rating and deviation.
  • Gets the quality of the match, which is equal to the probability that the match will end in a draw. The higher the Value, the better the quality of the match.
  • Gets the quality of the match, which is equal to the probability that the match will end in a draw. The higher the Value, the better the quality of the match.
  • Calculates the TrueSkillRatings of two players based on their old ratings, uncertainties, and the outcome of the game.
  • Calculates a TrueSkillRating in a non-traditional way using a rating period, for compatibility with the other algorithms.
  • Calculates the TrueSkillRating of two teams based on their ratings, uncertainties, and the outcome of the game.