The Elo rating system was created as a better chess rating system but is now used in other games as well. In it performance can’t be directly calculated but can be inferred from wins, draws and losses of other players. The rating given will depend on the rating of the player played against. Firstly the expected result of the game is calculated using players and opponents skill level:

    \[ E_A = \frac{1}{(1 + 10(R_B - R_A) / 400)} \]

R_A is player A’s skill level and R_B  is player B’s skill level. This will be a number between 1 and 0 and reflects the probability of player A winning. If R_A  and R_A  are reversed in the equation, player B’s probability of winning can be obtained. Adding the two probabilities together will also equal one. After a game or series of games, the players’ new rating can be calculated with:

    \[ R'_A = R_A + K(S_A - E_A) \]

R'_A is the players’ new result. R_A is the players existing result. E_A as from before is the expected result and S_A is the actual result of the match. The difference in the predicted and actual outcome is then subject to what is sometimes called the K-value. This is the maximum amount the players rating can change per game. In chess the most popular values used for K are 16 for masters and 32 for less skilled players. Here is an example to show a perceived weaker player winning against a higher skilled opponent given the values of 1119 for player A and 1507 for player B:

    \[ E_A= \frac{1}{(1+10(1507- 1119)/400)} \]

    \[ E_A = 0.096 \]

    \[ R'_A = 1119 + 32(1 - 0.096) \]

    \[ R'_A = 1147 \]

Player A jumped by 28 as this was an unexpected result. If player A had lost like predicted the rating jumps would not be as extreme.The United States Chess Federation uses its own rating system. The K-value in this system is based on how many games the players’ level is based on (N_e) and how many games they have played in the tournament (m):

    \[ K = \frac{800}{(N_e + m)} \]

This seems the better approach of calculating the value as it is more dynamic at calculating the games played. The game Halo Wars uses the Elo rating system for assigning difficulties when you play against the AI. Their version is modified to generate numbers somewhere under 200. Ensemble Studios who made the game never did announce the limit of the rating so it is only an assumption.


I wanted to go through a few of the rating systems that I have researched for my Dynamic Difficulty Game and show off how some of these systems are implemented. I’ll split these up into multiple posts so they will be easy to find from the search and you won’t have to sift through systems you’re not interested in. So I thought I would kick it off with a popular one that is used by millions of people everyday:

Microsoft has implemented a way in which people can play against other people of similar skill level in online games. They detect how well a player performs in a game and it is calculated into a number on the scale of 1 to 50. The algorithm used is a Bayesian algorithm (Works out the probability given what it believes) and was designed to fix flaws in the Elo rating system. The rating system keeps a record of a players skill and when player finishes a game, the record is updated along with how sure the system is with its’ prediction.

The players’ skill is represented in a normal distribution with the mean value of μ (defined player skill) and a variance of σ (how sure the system is with its prediction). Therefore N(x) can be interpreted as the probability that a players skill is x. Players start with μ = 25 and σ = 25 / 3: μ increases with a win and decreases with a loss and σ will always decrease. The amount by which the update will apply will vary depending on how surprising the outcome of the game is. Bigger updates will happen if a perceived better player looses to a perceived less skilful player. If the game was unbalanced say by not having the same number on each team, the updates will be much smaller.

The rank displayed for the player is a conservative estimate as the system is extremely sure that their actual skill is much higher. The formula used is:

R = μ – 3 × σ

As this can be used in an arbitrary scale like the 0 to 50 Microsoft uses players can start with the rank 0:

 R = 25 – 3 × (25/3) = 0

If a player looses one of their first games it will result in a large σ loss along with their μ loss can actually lead to an increase in rank.

For further reading you can check out the Microsoft page on TrueSkill™:

Or if you really want to get into it, you can check out the paper that was published on TrueSkill™:

Herbrich, R. Minka, T. and Graepel, T. (2007) A Bayesian Skill Rating System. MIT Press, 1-8.

So a lot of people want to be able to use Xbox Live data on their own gaming websites. I went about making one for my gaming community to use. In it people can opt in their Gamertags. Information on these Gamertags will be stored periodically showing if they are online, what they are playing and other profile information like Gamerscore and Bio. Originally this system was using the API that provided but that has since shut down. This system now uses an API found at: Note that the original method allowed the public to gain a small access to the official Microsoft Xbox Live API. The new method is screen scraping the information from the site and Microsoft doesn’t like that but hasn’t actively been enforcing any requests to stop. I’m going to go through a few parts of the code to help give others an idea what they can do to get started on their own system.

You can view the final working version here:

Getting started

In simple terms the code takes a list of gamertags and finds out that online status of each gamertag along with other information like games they have played and gamerscore. All of the grabbed data is stored in a database table on the server.

I first started out by making a list of gamertags for the program to use. Now instead of using a set list I opted for a seperate php file that will seach a forums member list and return the gamertags of particular member groups. Once it has selected these gamertags it places them into a list for grabbing data for them.

$conn = @mysql_connect("localhost","--Username--","--Password--")
or die ( "Err:Conn" );

$rs2 = @mysql_select_db( "--Database--" , $conn )
or die("Err:Db2"); #Connects to database

$sql1 ="INSERT INTO clangamertags (gamertag) SELECT
phpbb_profile_fields_data.pf_gamertag FROM phpbb_users,
phpbb_profile_fields_data WHERE phpbb_users.group_id != 1474 AND
phpbb_users.group_id != 1471 AND phpbb_users.group_id != 1470 AND
phpbb_profile_fields_data.user_id = phpbb_users.user_id AND
phpbb_profile_fields_data.pf_gamertag !=''";
$sql3="TRUNCATE clangamertags";

#Clear list of gamertags
$rs2 = mysql_query( $sql3,$conn );
#Select all gamertags to be searched and add to cleared table
$rs2 = mysql_query( $sql1,$conn );


Welcome to my site. I’ve created this site so that I can show off all the work I have done in regards to programming and also share an insight into their developments through blog postings. There are many things in these projects that took extensive googling and trawling through the MSDN to find answers to so hopefully I will be able to teach someone something and cut down their searching time. I also hope to increase my own knowledge of these subject areas as being able to teach someone something correctly means that you have definitely learnt how to do it.

In this blog you’ll find it extremely apparent that I have a degree in Computer Games Programming and not English Language. I will try, however to make it at least readable. :P

Things you’ll find in this blog

Game coding in C++ (Most probably something to do with the GP2X to begin with.)

Windows programming in C++ (Level editors using Windows Forms.)

Game coding in C# (My dynamic difficulty game was programmed in C# XNA and I hope to show off another project I am working on that will be expanding what I have done in that game.)

Windows programming in C# (This will relate to the making of the level editor for my new game in XNA.)

Windows Phone 7 Programming (Yes, even I am jumping in there to see what I can try and make on this excellent expanding market.)

PHP Programming (Just some odds and ends that I have made in PHP.)


Seems like a good enough list so it looks like I need to get onto the part where I deliver the promised content.