Jump to content

How to program a Microsoft Trueskill Function in PHP?


Jaxel

Recommended Posts

I'm trying to put together a function that will update the trueskill scores for a player in a 2 player (1v1) system. However, I've been perusing the Microsoft Research Article and I am thoroughly confused as I am not a mathematician. Basically a player has two values that calculate their ranking:

 

$player['m'] (mu) : estimated average ranking score

$player['s'] (sigma): standard deviation from average

 

equations.jpg

 

I assume I would use some sort of function such as:

function calcTrueSkill(&$winner, &$loser)
{
$winner['m'] = $winner['m'] + (pow($winner['s'],2)/c) * (v*(($winner['m']-$loser['m'])/c,e/c));
$loser['m']	 = $loser['m']  -  (pow($loser['s'],2)/c) * (v*(($winner['m']-$loser['m'])/c,e/c));

$winner['s'] = sqrt($winner['s'] * (1 - (pow($winner['s'],2)/pow(c,2)) * (w*(($winner['m']-$loser['m'])/c,e/c))));
$loser['s'] = sqrt($loser['s'] * (1 - (pow($loser['s'],2)/pow(c,2)) * (w*(($winner['m']-$loser['m'])/c,e/c))));

c = sqrt((2 * pow(b,2)) + pow($winner['s'],2) + pow($loser['s'],2));
}

 

Unfortunately, as I said before, I am not a mathematician and this stuff confuses me...

 

What is V?

What is C?

What is E?

What is B?

 

Would anyone mind helping me to get this function working?

What is V?

 

v is a function they do not define, but which they've plotted for varying values of ε (epsilon).

 

What is C?

 

c is defined in the image you inserted in your post:

 

[math]c^2 = 2\beta^2+\sigma^2_{winner}+\sigma^2_{loser} \Rightarrow c = \sqrt{2\beta^2+\sigma^2_{winner}+\sigma^2_{loser}}[/math]

 

What is E?

 

ε is what they call a "draw margin" and it depends on the game mode. So it's a constant that is set by you.

 

What is B?

 

β2 (beta) is "the variance of the performance around the skill of each player" as mentioned in the article.

 

Oh yes, also forgot... what are those COMMAS in the calculations? And are the brackets [ ] any different from parenthesis ( ) ?

 

v and w are functions of two variables, so the comma separates the first from the second. Here is another example of a such function: f(x,y) = x+y

 

There is no difference between the square brackets and parentheses here. When you nest parentheses it can sometimes be difficult to read and see where they end, so you might sometimes choose to alternate them.

Uhh... alright... maybe that answered my questions... but didn't really help me.

 

function calcTrueSkill(&$win, &$los)
{
$wM1 = $win['mean'];
$wS1 = $win['sdev'];
$wM2 = $wM1 * $wM1;
$wS2 = $wS1 * $wS1;

$lM1 = $los['mean'];
$lS1 = $los['sdev'];
$lM2 = $lM1 * $lM1;
$lS2 = $lS1 * $lS1;

$b2 = B * B;
$c2 = $b2 + $wS2 + $lS2;
$c1 = sqrt($c2);
$t1 = ($wM1 - $lM1) / $c1;

$wMn = $wM1 + ($wS2 / $c1) * v($t1, e/$c1);
$wSn = $lM1 + ($lS2 / $c1) * v($t1, e/$c1);
$lMn = sqrt($wS2 * (1 - ($wS2 / $c2) * w($t1, e/$c1)));
$lSn = sqrt($lS2 * (1 - ($lS2 / $c2) * w($t1, e/$c1)));

$win['mean'] = $WmN;
$win['sdev'] = $WsN;
$los['mean'] = $LmN;
$los['sdev'] = $LsN;
}

 

I'm still suck at what I'm supposed to be doing for "v", "w", "B" and "e"...

  • 2 months later...

I am also trying to figure out how to implement this in PHP.

 

have you read this article (http://www.moserware.com/2010/03/computing-your-skill.html) about the TrueSkill Algorythm and the coresponding Paper (PDF -> http://dl.dropbox.com/u/1083108/Moserware/Skill/The%20Math%20Behind%20TrueSkill.pdf)?

 

Also still struggling to understand all of it, but still pretty interesting :).

Maybe this helps a little and you could notify us if you had any success with it.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.