wavelength 1.0.0
Loading...
Searching...
No Matches
RatingStat Class Reference

The rating of one player of an online game, and the results that rate the player afterwards. More...

#include <ratingstat.h>

Public Member Functions

void Set (const NetLaunchpadPlayer *pPlayer)
 Copy the identifier, the rating, and the record of a player of the session.
int Rating () const
 Report the rating without the bonus of a player past the first games.
bool IsProvisional () const
 Report whether the player has played fewer than kProvisionalGames games.
void Rate (int nId, const std::vector< RatingStat > *pStats)
 Rate a player from the scores of a game.
int GetGames () const
int GetId () const
int GetOpponents () const
int GetPoints () const
int GetRating () const
void SetScore (int nScore)
float GetWins () const

Static Public Member Functions

static float Outcome (int nScore, int nOpponentScore)
 Report the outcome of a game for a player.
static float ExpectedScore (int nDifference)
 Report the score a player expects against an opponent from the difference of the ratings.
static float RatingDifference (float fScore)
 Report the difference of ratings that makes a player expect a score, inverting ExpectedScore() by interpolation.

Static Public Attributes

static constexpr int kProvisionalGames = 16
 The games below which a player's rating comes from the average of the opponents.
static constexpr int kDifferenceCount = 51
 The number of entries of sDifferences.
static int sDifferences [kDifferenceCount]
 The differences of ratings that make a player expect scores of 0.5, 0.51, and so on to 1.

Detailed Description

The rating of one player of an online game, and the results that rate the player afterwards.

The RTTI includes the name, which the type information of the standard library vector of the type records. The record is 0x1c bytes. A rating at least 1000000 marks a player who has played the first games, and Rating() takes the bonus off.

Member Function Documentation

◆ Set()

void RatingStat::Set ( const NetLaunchpadPlayer * pPlayer)

Copy the identifier, the rating, and the record of a player of the session.

Parameters
pPlayerThe player.
Ghidra address:
NTSC-U/C: 0x0026aaa0
Ghidra address:
PAL: 0x00274630

◆ Rating()

int RatingStat::Rating ( ) const

Report the rating without the bonus of a player past the first games.

Returns
10000 for a player with no games, otherwise the rating less 1000000 when that is not negative, otherwise the rating.
Ghidra address:
NTSC-U/C: 0x0026aa28
Ghidra address:
PAL: 0x002745b8

◆ IsProvisional()

bool RatingStat::IsProvisional ( ) const

Report whether the player has played fewer than kProvisionalGames games.

Returns
Whether the rating is still provisional.
Ghidra address:
NTSC-U/C: 0x0026aa58
Ghidra address:
PAL: 0x002745e8

◆ Rate()

void RatingStat::Rate ( int nId,
const std::vector< RatingStat > * pStats )

Rate a player from the scores of a game.

The routine copies the stats of the player into this one, rates the player against every other player, and clamps the rating from 0 to 90000 before it adds the bonus of a player past the first games. A provisional rating averages the opponents' ratings and moves them by the share of games won. Another rating moves by an Elo step against each opponent.

Parameters
nIdThe player.
pStatsThe stats of every player of the game, with their scores.
Ghidra address:
NTSC-U/C: 0x0026ab10
Ghidra address:
PAL: 0x002746a0

◆ Outcome()

float RatingStat::Outcome ( int nScore,
int nOpponentScore )
static

Report the outcome of a game for a player.

Parameters
nScoreThe player's score.
nOpponentScoreThe opponent's score.
Returns
1 for a win, 0.5 for a draw, and 0 for a loss.
Ghidra address:
NTSC-U/C: 0x0026aad8
Ghidra address:
PAL: 0x00274668

◆ ExpectedScore()

float RatingStat::ExpectedScore ( int nDifference)
static

Report the score a player expects against an opponent from the difference of the ratings.

Parameters
nDifferenceThe player's rating less the opponent's.
Returns
The expected score, 0 to 1.
Ghidra address:
NTSC-U/C: 0x0026aef8
Ghidra address:
PAL: 0x00274a88

◆ RatingDifference()

float RatingStat::RatingDifference ( float fScore)
static

Report the difference of ratings that makes a player expect a score, inverting ExpectedScore() by interpolation.

Parameters
fScoreThe score.
Returns
The difference.
Ghidra address:
NTSC-U/C: 0x0026afc8
Ghidra address:
PAL: 0x00274b58

◆ GetGames()

int RatingStat::GetGames ( ) const
inline
Returns
The games counted, as RatingRecord::mGames.

◆ GetId()

int RatingStat::GetId ( ) const
inline
Returns
The player's identifier in the session.

◆ GetOpponents()

int RatingStat::GetOpponents ( ) const
inline
Returns
The sum of the opponents' weights, as RatingRecord::mOpponents.

◆ GetPoints()

int RatingStat::GetPoints ( ) const
inline
Returns
The weighted sum of the opponents' ratings, as RatingRecord::mPoints.

◆ GetRating()

int RatingStat::GetRating ( ) const
inline
Returns
The rating, as LobbyPlayer::mRating.

◆ SetScore()

void RatingStat::SetScore ( int nScore)
inline
Parameters
nScoreThe score of the game being rated.

◆ GetWins()

float RatingStat::GetWins ( ) const
inline
Returns
The games won, as RatingRecord::mWins.

Member Data Documentation

◆ kProvisionalGames

int RatingStat::kProvisionalGames = 16
staticconstexpr

The games below which a player's rating comes from the average of the opponents.

◆ kDifferenceCount

int RatingStat::kDifferenceCount = 51
staticconstexpr

The number of entries of sDifferences.

◆ sDifferences

int RatingStat::sDifferences[kDifferenceCount]
static

The differences of ratings that make a player expect scores of 0.5, 0.51, and so on to 1.

Ghidra address:
NTSC-U/C: 0x003b0bd8
Ghidra address:
PAL: 0x0042faa8

The documentation for this class was generated from the following file: