Trying to implement Microsoft's TrueSkill/Elo rating

I’m trying to efficiently create a rating system, similar to TrueSkill. I’m trying to use this as it can support multiplayer games, instead of the Elo rating system. The problem I am having with TrueSkill is the maths behind it, and implementing that into Roblox.

My current setup is, each player starts on 1000 points (like the Elo system) They have to play 5 games to then get a proper ‘ranking’ based on their points after those 5 games.

Next process was how much points to hand out to each player, based on their points, plus their oppositions points.

So this would get the team that lost total points.

local LosingTeamTotal = 0

for _, player in pairs(Player:GetPlayers()) do
    if player.TeamColor ~= WinningColor then
        LosingTeamTotal = LosingTeamTotal + player.RankPoints
    end
end

Then I’d have to do the same for the winning team

local WinningTeamTotal = 0

for _, player in pairs(Player:GetPlayers()) do
    if player.TeamColor == WinningColor then
        WinningTeamTotal = WinningTeamTotal + player.RankPoints
    end
end

Then I’d divide each of those numbers by the amount of players on either team
(let’s just say I put all the players on the losing team in a table, same for the winning team (haven’t done it above, but you get the idea)

local LosingAverage = LosingTeamTotal / #LosingTeamPlayers -- Amount of losing players
local WinningAverage = WinningTeamTotal / #WinningTeamPlayers -- Amount of winning players

Now the hard part of giving each player the appropriate points. I’m not sure how to give each player the correct amount of points, as each player would get different amounts of points based on their own rating and whether or not they lost.

Tried reading a few articles on this subject and almost all contain large equations with greek symbols everywhere, which I can’t just use in Roblox :sweat_smile: and my math is at a level where I can do BIMDAS but that’s about the extent of my knowledge :sweat_smile: XD

If there is a better way of doing this kinda stuff then I’d love to hear about it! :smiley:

1 Like

If you gave each player an ‘objective’ or ‘contribution’ value, you could use that to determine how much each player receives.

For instance, an AFK’r would receive 0% contribution points, as they did nothing for the entire game.

I implemented TrueSkill in Roblox a couple of years ago just for fun, and never did anything with it. I’m not amazing at math, but I found a version online in C# I think it was, and translated it to lua. So the code works, but I couldn’t really answer any questions about it because I wrote it so long ago, and I don’t really understand the complex math. I’m happy to give you the code, but it’s a few modules of decent length, so I guess i’ll send it to you via msg. TrueSkill is also patented by microsoft as far as I can remember, so I guess just use the code as a learning resource or something.

That would mean there’s no way for you to lose your rank. Point isn’t to just be get highest rank and be done, you have to keep playing to maintain that rank, and there’s risk of going down ranks.

You can calculate lost rank when the player joins. If a certain amount of time has pressed, deduct points.

Also, i thought this was a per-round thing, my bad.

ideally you would want points gained by players on one team to equal the points lost by the other team. so you don’t get point saturation or depletion
so that the point economy remains at 1000*#players in game

you will want that total points lost/won modified by match balance

  • was #of players even
  • was the average rating of each team within acceptable margin

uneven matches reflect less on score than ‘even’ matches
unless better team loses then rewards would be larger, etc

after finding that you can divide it among teams based on merit

  • player rating vs opposing team rating average
  • contribution % of player

such that players that carry teams get more for wins and lose less for losses
players playing against clearly better people wont be docked as much for losing against them

if you do this right your points/player will remain indicative of performance
and you can curve your ranks
lowest 50% are bronze
next 25% are silver
next 12.5% are gold
next 7.5% are diamond
next 4% are platinum
top 1% are masters

this basic method doesn’t have a safeguard for a few elite players from stealing all the points from winning all the time, might want a cap on points or heavy depreciation of rewards

p.s. didnt read about trueskill its late and i don’t wanna remember math right now. but this is a place to start that seems adaptable into newer implementations of ranks. a place to start

p.p.s due to potential skewing of points you want to use medians not means to find ranking, <median of whole is lower 50%, <median of upper 50% etc

I see in your related post in development discussion that you can’t find a lua version of TrueSkill. I’m not sure if you missed it, but I sent you the lua version of TrueSkill that I created to your private messages, as I mentioned in my post above. It doesn’t have great documentation, but using that and the information available online I think you should be able to work it out.