# Aoe2 DE Elo Calculator

Team 1 Team 2
Initial Ratings
Algorithm 1 (+0)
1016 (+16) 984 (-16)
Algorithm 2 (+0)
1016 (+16) 984 (-16)
Algorithm 3 (+0)
1016 (+16) 984 (-16)

## Explanation of Algorithms.

### Elo Basics

Let $\mathrm{elo}_A$ and $\mathrm{elo}_B$ be the Elo ratings of players $A$ and $B$. Elo is intended to model the probability that $A$ wins against $B$. This "Elo win probability" is computed using a logistic function $\mathrm{win\_prob}(\mathrm{elo}_A, \mathrm{elo}_B) = \genfrac{}{}{}{0}{1}{1 + 10^{(\mathrm{elo}_B - \mathrm{elo}_A) / 400}}.$ Here the $x$-axis is the difference in Elo. It has a positive value when player $A$ is higher rated and a negative value when player $B$ is higher rated. The values $10$ and $400$ are chosen so that a player with $400$ more Elo is $10$ times more likely to win. For example, if $A$ has $1000$ Elo and $B$ has $1400$ Elo, then \begin{align*} \mathrm{win\_prob}(1000, 1400) &= \genfrac{}{}{}{0}{1}{1 + 10^{(1400 - 1000) / 400}} = \genfrac{}{}{}{0}{1}{1 + 10^{400 / 400}} = \frac{1}{11},\\ \mathrm{win\_prob}(1400, 1000) &= \genfrac{}{}{}{0}{1}{1 + 10^{(1000-1400)/400}} = \genfrac{}{}{}{0}{1}{1 + 10^{-400/400}} = \frac{1}{1 + (1/10)} = \frac{10}{11}. \end{align*}

At the end of a game, a player's new Elo is calculated using their old Elo, the outcome of the game, and their win probability. Player $A$'s Elo is updated as $\mathrm{elo}_A' = \mathrm{round} \Big( \mathrm{elo}_A + 32 \big( \mathrm{score}(A) - \mathrm{win\_prob}(\mathrm{elo}_A, \mathrm{elo}_B) \big) \Big).$ Here $\mathrm{score}(A)$ is the outcome of the game from $A$'s point of view, with $\mathrm{score}(A) = 1$ when $A$ wins and $\mathrm{score}(A) = 0$ when $A$ loses. Since $\mathrm{win\_prob}$ returns a value between $0$ and $1$, the quantity $\mathrm{score}(A) - \mathrm{win\_prob}(\mathrm{elo}_A, \mathrm{elo}_B)$ is positive when $A$ wins and negative when $A$ loses. If $A$ is likely to win and ends up winning, this value is close to zero. But if $A$ is unlikely to win and still ends up winning, this value is close to one. Next, $32$ is the "$K$-factor," which is a scale used to determine how many points are won or lost. And finally, the value $\mathrm{elo}_A'$ is rounded to the nearest integer.

### Team Game Elo

For team games, the Elo computation is a bit more complex. In our examples, let's have player $A$ on Team $1$, with the opposing players on Team $2$. DE has used three different algorithms for calculating the updated Elo for player $A$. They all perform an update of the form $\mathrm{elo}_A' = \mathrm{round}\Big(\mathrm{elo}_A + 32 \big(\mathrm{score}(A) - \mathrm{win\_prob}(X, Y)\big)\Big).$ But they use different values for $X$ and $Y$. $\begin{array}{ccc} \mathrm{Algo} & X & Y \\ \hline 1. & \mathrm{elo}_A & \mathrm{max}(\mathrm{Team}\,2)\\ 2. & \mathrm{avg}(\mathrm{Team}\,1) & \mathrm{avg}(\mathrm{Team}\,2)\\ 3. & \mathrm{elo}_A & \mathrm{avg}(\mathrm{Team}\,2) \end {array}$ Voobly uses algorithm $2$, but with two differences. First, there is always a gain or loss of $1$ point—no game results in a change of $0$ Elo. And second, the rating is distributed evenly among the team members. For example, suppose 8 players all start with 1600 Elo. Then, instead of players each gaining or losing $16$ points, their ratings each change by $4$ points. Voobly has a calculator for demonstrating its Elo changes.