In order for the numbers and calculations on this site to be verified, improved and reused if needed, this page lists the formulas on which the calculations used by Goptimiz and the methodology used are based.
It is also an opportunity to explain how and why these formulas are used.
The data used by Goptimiz comes from 2 sources:
- The GAME_MASTER. This file contains most of the information needed to run the site. A script scans the GAME_MASTER and automatically loads the information it contains. The script is run everytime a new version of the GAME_MASTER is available.
- Manual input. The translations, eggs kilometers, availability of Pokémons and legacy movesets are added by hand.
Using combat simulations results in very accurate results (unlike rankings that use spreadsheets). Simulations allow to take all the possible parameters into account (dodging, combat timing, interactions between fighters ...) and they allow to carry out millions of different fights (8 340 165 simulations in total), which makes the results more reliable.
All possible battle combinations are tested: each Pokémon species with each possible moveset is simulated, both as attacker and defender. For the attackers, simulations are also made without using their charged moves, which makes it possible to know how good a Pokémon is in attack if it does not use its charged move.
Goptimiz fight simulations are based on all known parameters of gym fighting:
- Both Pokémons are level 40 with perfect IV (best/worst case scenario).
- The fight lasts 99 seconds or stops when one of the two opponents faints.
- Defending Pokémons have their HP doubled.
- A Pokémon can store up to 100 energy.
- The defending Pokémon waits after each attack (between 1.5 and 2.5 seconds in game, set at 2 seconds during the simulations).
- The defender starts the fight with a double quick attack. The second quick attack starts at 1 second (even if the first attack is not over), and it does not count in its cooldowns.
- The attacker dodges all charged moves in the most optimized way possible. Damage from the charged move is reduced by 75%, and the dodge lasts 500ms.
- A Pokémon gains 0.5 energy each time it takes 1 point of damage (rounded up).
- Some moves, like Transform, have specific effects.
- The defending Pokémon uses its charged move about 50% of the time when available.
As in game, the simulations use a one-place queue system for the different actions of the Pokémon.
Although there is no solid evidence that defending Pokémons also use a queuing system, simulations also use this system for defenders. When a defender has enough energy to use his charged move, the script adds it to the queue and uses it either immediately (if his queue is empty) or after his next action (if there is already an action in progress). This system allows to obtain results similar to what one sees in game: the defending Pokémon uses its charged move about 50% of the time.
Feel free to share your research on this subject.
What makes a good attacker ?
- The role of an attacker is to defeat the defending Pokémon. This is why we attack gyms. The most important thing to consider is if the Pokémon has won the fight or not.
- The duration of the fight. The more powerful the attacker, the shorter the fight. This indirectly takes into account the DPS of the attacker. Relying solely on the DPS would make the results less accurate (it would not consider everything that revolves around the DPS).
- The damage taken by the attacker. Winning a fight is good; winning a fight without losing too much HP is better. Although less important, it is necessary to take into account the state of the health bar of the attacker at the end of the fight.
What makes a good defender ?
The best case scenario is that the defender wins the fight. This prevents the attacker from taking the gym.
If the defender loses the fight, it must at least prevent the attacker from easily taking the gym. For this, two variables must be taken into account:
- The duration of the fight. The longer the fight, the more the defending Pokémon has resisted efficiently. Taking down the gym will take a lot of time to the attacker, which could also discourage him from continuing.
- Damage dealt by the defending Pokémon. Even if you lose the fight, you can put the opponent Pokémon in a weak position. He will find it harder to win the following fights (and again, it might discourage him from continuing). Also, if a player has used all his potions and revives against your Pokémon, he can not continue to attack the gym with his most powerful Pokémon.
- The fight duration (
Time). This duration is expressed in percentages between 0% and 100%: 0% if the combat lasted 0 seconds (which never happens), 100% if the combat lasted 99 seconds.
- Damage dealt by the attacker (
Dmgatt). Damage is expressed as a percentage of the defender's maximum HP. 0% if the defender has not taken any damage, 100% if the defender has lost all its HP.
- Damage dealt by the defender (
Dmgdef). Damage is expressed as a percentage of the attacker's maximum HP. 0% if the attacker has not taken any damage, 100% if the attacker has lost all its HP.
From these variables, we can calculate the score obtained by each of the opponents:
- For the attacking Pokémon :
Dmg att + (1 - Time) - (0.5 × Dmg def)
- For the defending Pokémon :
(1 - Dmg att) + Time + (0.5 × Dmg def)
These results (scores) are expressed in percentages (between 0% and 100%). The higher the percentage, the better the Pokémon did during the fight.
For some calculations, the script removes 100% from the score of the Pokémon which lost the fight in order to assign a negative value to its score. For these "non-standard" scores, the value is therefore between -100% and 100%.
These formulas allow weak Pokémon to have a small impact on rankings, while powerful Pokémons will have a much greater impact on overall results. Therefore, Goptimiz indirectly takes into account the fact that the best Pokémon are used more than the others.
In order to calculate the offensive score of each moveset of a Pokémon (which is displayed on the individual pages of the Pokémon and on the Pokédex page), the script averages all the standard scores obtained by this moveset in the simulations or This Pokémon was the attacker.
In order to calculate the defensive score of each moveset of a Pokémon (which is displayed on the individual pages of the Pokémon and on the Pokédex page), the script averages all the standard scores obtained by this moveset in the simulations or This Pokémon was the defender.
The best defenders page takes the best defensive moveset of the 40 best defenders and ranks them according to their score.
Each Pokémon's counters
In order to calculate the best counters against a Pokémon (which is displayed on the individual Pokémon pages and on the best counters page), the script averages the scores obtained by all attackers against that Pokémon. In the case where this average is negative, this means that the attacker with this moveset does not counter the defending Pokémon. In this case, this value is not taken into account in the ranking. All movesets of the defending Pokémon are grouped, but all movesets of the attackers are taken separately. Thus, one does not need to know the moveset of a defender to know which attacker to use.
The best attackers page is based on the best counters page. From the top 5 counters against each Pokémon, the script proceeds as follows :
- For each defender an attacker counters, multiply the score obtained by the attacker with the average defensive scores of the defender. The new score is therefore weighted by the defensive power of its opponents. This gives an advantage to the Pokémons that counter the best defenders.
- Make the sum of the weighted scores obtained by the attacker.
- Count how many defenders the attacker counters.
- Apply the following formula :
sum_of_scores / sqrt(number_of_countered_pokemons). That gives us a final score. The square root used allows to take into account how many Pokémons the attacker can counter, without giving it too much importance. It is good to counter a lot of Pokémons, but it is better to counter them efficiently.
- The Pokémons are then sorted according to the final score obtained.
The best attackers displayed are therefore the Pokémons that have obtained the best results against the most possible Pokémon (with an advantage for those who counter the best defenders).
In order to generate the best prestigers page, the script takes each possible defender and simulates fights against all the possible attackers, with the attacker's level lowered until its CP get under 50% of the defender's CP.
For each possible moveset of every possible attacker, we keep the worst score obtained against each defending Pokémon. This allows to use to anticipate the worst case scenario while using prestigers.
The next steps and the ranking behave similarly to the best counters for each Pokémon.
Some bonus informations:
- The images used by Goptimiz have been retrieved from TheSilphRoad for the Pokémon images and here for the logos of the 3 teams displayed in the IV calculator. Thank you !
- Information about the mechanics of the game and other aspects of Pokémon Go comes largely from Reddit, mainly the TheSilphRoad sub.
- Besides the enormous participation of the Pokémon Go community, without whom nothing would have been possible, Goptimiz is the work of one person (Hi!).
- Unlike many developpers, I'm not fueled with coffee + pizza, but tea + french fries (not at the same time, though). I'm a fan of Trainer Tips and I'm passionate about artificial life (neural networks, machine learning, emergence ...). In game, I chose to join team Mystic (but I'm not sectarian, Pokémon Go is above all about friendship and sharing).
- On the technical side, Goptimiz uses Twitter Bootstrap, jQuery and a home-made framework (as well as the database).
- The adds displayed on Goptimiz are used to pay the costs of hosting the site and the tea necessary for the proper functioning of its administrator. Do not hesitate to use a add blocker (I personally use uBlock Origin).