RankingDatabase

class colosseumrl.matchmaking.RankingDatabase.RankingDatabase(database_file: str)[source]

Primary class for managing the SQL database storing all of the players usernames, password, and rankings.

class LoginResult

Numerated results after attempting a login.

get(username: str) -> (<class 'str'>, <class 'str'>, <class 'float'>, <class 'float'>)[source]

Get all data associated with a particular user.

Parameters

username (str) – Username of the player you’re getting info for

Returns

  • username (str) – The stored username again

  • password (str) – The password hash for the user

  • ranking_mean (float) – The point estimate of the players ranking

  • ranking_confidence (float) – The variance of the players ranking.

get_multi(*args) → [(<class 'str'>, <class 'str'>, <class 'float'>, <class 'float'>)][source]

Generalization of get to allow for multiple user lookups at once.

Parameters

args (str) – Usernames as star args.

Returns

  • List of stored information for each player

  • username (str) – The stored username again

  • password (str) – The password hash for the user

  • ranking_mean (float) – The point estimate of the players ranking

  • ranking_confidence (float) – The variance of the players ranking.

login(username: str, password: str) → colosseumrl.matchmaking.RankingDatabase.LoginResult[source]

Perform a login check for a player. This will verify the password, ensure only one session for each player, and prevent two people with the same name from connecting.

Parameters
  • username (str) – The username of the player.

  • password (str) – The password hash of the player.

Returns

The outcome of the login attempt

Return type

LoginResult

See also

colosseumrl.matchmaking.RankingDatabase.LoginResults()

logoff(username: str) → None[source]

Remove a player from the login queue

Parameters

username (str) – The player that is logging off.

set(username: str, password: str) → None[source]

Create a new entry in the database for a user.

Parameters
  • username (str) – The username of the player.

  • password (str) – The password hash of the player.

update_ranking(match_ranking: Dict[str, int]) → None[source]

Update the rankings of all players in a match.

Parameters

match_ranking (Dict[str, int]) – A dictionary mapping each username for each player to. A lower ranking implies that the player did better, with a ranking of 0 usually implying that that player won the game.