Welcome to TechNet Blogs Sign in | Join | Help

The Applied Games Group Blog

New stuff directly from Microsoft Research.
TrueSkill in F#

Following the publication of the F# source code for the TrueSkill Through Time paper, we have used the same inference library code to demonstrate how the original TrueSkill algorithm can be coded. In the attached source code, only the program.fs file is different to the TrueSkill through Time blog post and it builds up the factor graph for an arbitrary N-player game with an arbitrary draw probability. Both these numbers can be entered on the command line when running the resulting sample. We tried to make sure to stay as close as possible to the description on page 3 of the TrueSkill technical report.

The attached ZIP file contains the entire source code which should compile without problems with F# 1.9.3.14. You can either load the solution in Visual Studio 2008 or simply run build.bat form the command line - in either case you will end up with a trueskill.exe program.

Update: Following the release of the F# September 2008 CTP we have updated the source code to work with F# 1.9.6.2. Also, we added one of the new features of F#, namely units-of-measure, which makes the TrueSkill update invocation calls now read as follows:

    let priorMu = 25.0<SkillPoints>

    let priorSigma = priorMu / 3.0

    let priorSkills = Array.init noPlayers (fun i -> Gaussian.Create (priorMu, priorSigma))

    let (posteriorSkills, logZ) =

        NPlayerTrueSkillUpdate (0.5*priorSigma, 0.01*priorSigma, drawProb / 100.0) priorSkills

Note that one can no longer accidentally pass the variance instead of the standard deviation because the former being of type float<SkillPoints^2>. Try yourself!

Update 2: We had some feedback from Andrew Kennedy that we exploited a current "bug" in the units-of-measure code where literals (such as 1.0) can have generic units. We removed the incorrect usages and re-posted the ZIP file. 

Update 3: We extended the example to work with draws. Thanks to Chih-Jen Lin for the suggestion! 

 

Ralf Herbrich & Thore Graepel

Posted: Monday, June 16, 2008 5:25 AM by apg
Attachment(s): TrueSkill - CTP.zip

Comments

Josh Menke said:

Hey thanks guys, this is great!

# June 16, 2008 11:23 AM

Nick said:

Is it possible to go up in rank after you lose a match?

# July 28, 2008 4:34 PM

IncaWarrior said:

Very nice sample program, but it doesn't show how TrueSkill handles team games.

Any hope of seeing how this works? The details page says that teams are compared using a sum of the players, but that doesn't show how each of the players are updated after that comparison.  

Is it just a comparison of each player on the other team after that?

# August 4, 2008 6:06 PM

Aaron's Technology Musings said:

Some time ago, I speculated that F# should be the lingua-franca of BI . Well, had I done a little research,

# September 11, 2008 1:15 PM

J.Goodwin said:

Nick:

No.  Even in an absolutely lopsided situation where TrueSkill would avoid making the matchup if at all possible, the best you can do is remain at your current ranking.

For instance, run a situation where the winning player has 100 mu, and 0.1 sigma, and the losing player has 1 mu and 0.1 sigma.  In this case, the system knows pretty much definitively that these two players are a very bad match (0.0% match quality), and the losing player still won't gain anything by losing, even though he lost to a player who was much higher ranked.

The same is going to pretty much hold true in a less theoretical situation, where a very good Halo player (rank 50) who has played a lot of games (and therefore has a low sigma) plays against a freshman player (rank 25, sigma 8.333).  The lower ranked player will lose very little mu for losing the match, but won't gain any mu.  Their sigma will also not decrease very much because the match was so bad.

# November 19, 2008 4:04 PM

talk shows said:

# December 10, 2008 12:20 PM

part ptfe specialty said:

# December 10, 2008 12:20 PM

bulma undress said:

# December 10, 2008 9:48 PM

wendys nutritional information canada said:

<a href='http://lachiacn.ifrance.com/page161.html'>wendys nutritional information canada</a> <a href="http://lachiacn.ifrance.com/page161.html">wendys nutritional information canada</a> [link=http://lachiacn.ifrance.com/page161.html]wendys nutritional information canada[/link]

# December 10, 2008 9:48 PM

movie the wendell baker story said:

movie the wendell baker story [URL=http://virosaur.strefa.pl/topic930.htm]movie the wendell baker story[/URL] [url=http://virosaur.strefa.pl/topic930.htm]movie the wendell baker story[/url] [url]http://virosaur.strefa.pl/topic930.htm[/url]

# December 11, 2008 7:56 AM

what other people think said:

what other people think [URL=http://sasitkobr.ifrance.com/2008-11-30-what-other-people.html]what do you care what other people think[/URL] [url=http://sasitkobr.ifrance.com/2008-11-30-what-other-people.html]what other people think[/url] [url]http://sasitkobr.ifrance.com/2008-11-30-what-other-people.html[/url]

# December 11, 2008 7:57 AM

abilene city said:

<a href='http://timae.strefa.pl/news414.html'>city of abilene employment</a> <a href="http://timae.strefa.pl/news414.html">city of abilene tx</a> [link=http://timae.strefa.pl/news414.html]abilene city jobs[/link]

# December 11, 2008 7:57 AM

map said:

# December 11, 2008 5:11 PM

oxycontin crushed said:

<a href='http://lachiacn.ifrance.com/page384.html'>oxycontin crushed</a> <a href="http://lachiacn.ifrance.com/page384.html">oxycontin crushed</a> [link=http://lachiacn.ifrance.com/page384.html]oxycontin crushed[/link]

# December 11, 2008 5:11 PM

winamp registration key generator said:

winamp registration key generator [URL=http://wejolly.strefa.pl/winamp-registration-20081130.html]winamp registration key generator[/URL] [url=http://wejolly.strefa.pl/winamp-registration-20081130.html]winamp registration key generator[/url] [url]http://wejolly.strefa.pl/winamp-registration-20081130.html[/url]

# December 11, 2008 5:12 PM

keine lust video rammstein said:

keine lust video rammstein [URL=http://liendar.ifrance.com/page1430.html]keine lust video rammstein[/URL] [url=http://liendar.ifrance.com/page1430.html]keine lust video rammstein[/url] [url]http://liendar.ifrance.com/page1430.html[/url]

# December 12, 2008 2:08 AM

cold purple feet from adderall xr said:

<a href='http://kamada.strefa.pl/page1349.html'>cold purple feet from adderall xr</a> <a href="http://kamada.strefa.pl/page1349.html">cold purple feet from adderall xr</a> [link=http://kamada.strefa.pl/page1349.html]cold purple feet from adderall xr[/link]

# December 12, 2008 2:08 AM

map said:

# December 12, 2008 1:50 PM

aid sleep wellbutrin xl said:

aid sleep wellbutrin xl [URL=http://virosaur.strefa.pl/topic1507.htm]aid sleep wellbutrin xl[/URL] [url=http://virosaur.strefa.pl/topic1507.htm]aid sleep wellbutrin xl[/url] [url]http://virosaur.strefa.pl/topic1507.htm[/url]

# December 12, 2008 1:50 PM

en language position report said:

en language position report [URL=http://ezpascal.strefa.pl/en-language-position.htm]en language position report[/URL] [url=http://ezpascal.strefa.pl/en-language-position.htm]en language position report[/url] [url]http://ezpascal.strefa.pl/en-language-position.htm[/url]

# December 12, 2008 9:49 PM

plate tectonics said:

define plate tectonics [URL=http://tpasrnrfi.ifrance.com/page386.html]plate tectonics activity[/URL] [url=http://tpasrnrfi.ifrance.com/page386.html]continent plate tectonics theory[/url] [url]http://tpasrnrfi.ifrance.com/page386.html[/url]

# December 12, 2008 9:49 PM

movie of the year 1975 said:

<a href='http://clpatric.strefa.pl/oubocfabr-1073.html'>movie of the year 1975</a> <a href="http://clpatric.strefa.pl/oubocfabr-1073.html">movie of the year 1975</a> [link=http://clpatric.strefa.pl/oubocfabr-1073.html]movie of the year 1975[/link]

# December 13, 2008 2:57 PM

walhalla sc county said:

<a href='http://hedewayn.strefa.pl/comment-1544.htm'>walhalla sc county</a> <a href="http://hedewayn.strefa.pl/comment-1544.htm">walhalla sc county</a> [link=http://hedewayn.strefa.pl/comment-1544.htm]walhalla sc county[/link]

# December 13, 2008 2:58 PM

serenity the movie release date said:

<a href='http://lachiacn.ifrance.com/page265.html'>serenity the movie release date</a> <a href="http://lachiacn.ifrance.com/page265.html">serenity the movie release date</a> [link=http://lachiacn.ifrance.com/page265.html]serenity the movie release date[/link]

# December 13, 2008 10:02 PM

history of martin luther king said:

<a href='http://miminerv.strefa.pl/20081129-history-of-martin.html'>history of martin luther king</a> <a href="http://miminerv.strefa.pl/20081129-history-of-martin.html">history of martin luther king</a> [link=http://miminerv.strefa.pl/20081129-history-of-martin.html]history of martin luther king[/link]

# December 13, 2008 10:02 PM

page said:

# December 14, 2008 5:17 AM

process portfolio management said:

<a href='http://brqashenv.ifrance.com/news-process-portfolio-2008-11-30.html'>process portfolio management</a> <a href="http://brqashenv.ifrance.com/news-process-portfolio-2008-11-30.html">process portfolio management</a> [link=http://brqashenv.ifrance.com/news-process-portfolio-2008-11-30.html]business governance management portfolio process[/link]

# December 14, 2008 5:17 AM

bikini.dare said:

# December 14, 2008 1:13 PM

top said:

# December 14, 2008 1:13 PM

colorado revised statutes said:

colorado revised statutes [URL=http://hedewayn.strefa.pl/comment-1914.htm]colorado revised statutes[/URL] [url=http://hedewayn.strefa.pl/comment-1914.htm]colorado revised statutes[/url] [url]http://hedewayn.strefa.pl/comment-1914.htm[/url]

# December 14, 2008 8:31 PM

park audio and video altoona said:

park audio and video altoona [URL=http://sasitkobr.ifrance.com/2008-11-29-park-audio-and.html]park audio and video altoona[/URL] [url=http://sasitkobr.ifrance.com/2008-11-29-park-audio-and.html]park audio and video altoona[/url] [url]http://sasitkobr.ifrance.com/2008-11-29-park-audio-and.html[/url]

# December 14, 2008 8:32 PM

url said:

# December 15, 2008 4:45 AM

egon schiele said:

<a href='http://kamada.strefa.pl/page1969.html'>egon schiele</a> <a href="http://kamada.strefa.pl/page1969.html">egon schiele</a> [link=http://kamada.strefa.pl/page1969.html]egon schiele[/link]

# December 15, 2008 4:46 AM

lowest airfares online said:

lowest airfares online [URL=http://clpatric.strefa.pl/cnamonf-615.html]lowest airfares online[/URL] [url=http://clpatric.strefa.pl/cnamonf-615.html]lowest airfares online[/url] [url]http://clpatric.strefa.pl/cnamonf-615.html[/url]

# December 15, 2008 1:23 PM

film shorts said:

# December 15, 2008 8:36 PM

http said:

# December 15, 2008 8:36 PM

Over said:

OMG i'm playing gears 2, I get rank 4 then i played 6 matches, I won all of them and now I'm again rank 3!!

mmmm...don't trueskill estimate your skill looking the win/lost matches??

I think not, come on this system can work for many games but not for gears!!

# January 6, 2009 1:43 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

  
Enter Code Here: Required

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker