About 1 Vs 1 Battles

PVP IV’s battle simulator shows the turn-by-turn outcome(s) of a battle between two Pokemon in Pokemon Go. In the zero-shield scenario, it guarantees that both Pokemon pick charged moves that maximize their damage output, and use them at a time that minimizes the opponent’s damage output – i.e. not giving the other Pokemon free energy from its fast moves.

In battles involving one or more shields, moves and damage are still optimized, but each time a Pokemon uses a move there are two possible scenarios (shielded or unshielded), so there will often be multiple fully optimized outcomes because failed baits are considered optimized in some cases. CMP ties can also create multiple optimized outcomes.

The best overall outcome(s) meeting the constraints specified in this article are guaranteed to be included in the simulator’s results, but more outcomes may be included as well. Additional results – including some that may not meet these guarantees – are shown in a separate filtered section. More details about the types of results are provided below.

Note that there are some exceptions to these guarantees:

  • Ordering: If two possible outcomes use the same moves in a different order, only one outcome is shown.
  • Moves with stat-altering effects: These moves would take an unreasonably long time to fully simulate. Although the simulator does its best to show useful results for battles with stat-altering effects, there are no guarantees about how optimized or complete they are.
    • Note that if an effect is random, it’s not activated. This is because most random effects have a low chance (10-20%) of being activated, and shouldn’t be relied on.
    • It is guaranteed that a Pokemon will use all the energy it can before it faints.
  • Bugs: These might pop up at any time, and can be reported by contacting me.

Lag Turns

The simulator also outputs “lag turns” for shielding scenarios that are a guaranteed win or guaranteed loss. Lag turns is defined as the number of turns it would take for the Pokemon that always loses to win if its opponent stopped attacking one turn before it won.

You can use lag turns to understand how easy the result in a simulator will be to reproduce in real battles. Matchups with fewer lag turns are more likely to swing based on a variety of factors including initial differences in damage or energy, poor charge move timing, IVs, bugs, and/or lag.

Note that lag turns are not always fully representative of how close a match can be. For example, a Pokemon in a simulation might use a weak but cheap charge move to unload its energy before it faints, which will increase its lag turns if its other move could KO more quickly. Similarly, even if the winning Pokemon can safely bait without risking a loss, lag turns are computed based on the case where it doesn’t bait.

Filtered Results & Safe Baits

Sometimes, a Pokemon can win a matchup without baiting but loses if it attempts to bait and the opponent doesn’t shield the weaker move. In this case, matchups where the Pokemon unsuccessfully baits too many times are not shown, and instead put in a separate filtered section. This section may also include other results not related to baiting, depending on what other scenarios the simulator tries when computing results.

Note that successful baits are usually still shown even if the Pokemon can’t bait unsuccessfully because it’s possible the opponent won’t shield the stronger charge move before using their shields.

Result Labels (Best, Worst, Safe)

There are three labels that can be shown for each Pokemon in each result.

  • Best: Everything goes right for the Pokemon – it baits successfully and wins CMP (if applicable).
  • Safe: The Pokemon minimizes the amount of unpredictability it faces. It either uses only its cheaper move or always has its expensive move shielded.
  • Worst: The Pokemon baits unsuccessfully as many times as it safely can. Random effects are not activated.

Sometimes the same label is used for multiple results because each result is split on CMP ties, or because these types may overlap; for example, Registeel doesn’t need to use Focus Blast against Azumarill and also doesn’t benefit from getting it shielded, so its best, safe, and worst matchups against Azumarill all involve it using only Flash Cannon. Similarly, if no shields are involved then no baits are needed, so the only possible difference is CMP ties.

Under the Hood

PVP IV’s simulator is very complex, with many intertwined parts. Because of this, it can take a few seconds to simulate a battle on iOS, and sometimes a few minutes on Android (which is not as optimized for heavy computation as iOS). In general, battles that take a lot of turns and battles with stat-altering effects take the longest to simulate. All of the simulation is done on your device, so it even works offline!

Critical to the simulator’s accuracy is that it doesn’t make any assumptions about which moves should be used, or when. To describe it simply, it produces results by executing a lot of different battles between the two Pokemon and comparing all them to determine which are best for both Pokemon involved.

To get more in-depth, there are five levels to the simulator, with each level adding complexity to – but also improving the output of – the previous one. The following section describes each level, starting with the simplest one.

Level 1: Execution

At the lowest level, Execution takes a turn-by-turn list of moves and applies their effects to the Pokemon in the battle until one of them faints.

Level 2: Timing

Timing takes an ordered list of charge moves and determines the turn where each should be used, filling the remaining turns with fast moves. This forms the full turn-by-turn list of moves used during Execution. It takes the following factors into consideration:

  • Whether the Pokemon has enough energy to use the charge move.
  • Whether the opponent is in the middle of a fast move, and whether it would be possible to attack at the end of a fast move instead.
    • For example, if a charge move is used on the second turn of an opponent’s four-turn fast move, their move essentially becomes a two-turn fast move. This would not be considered optimized if it’s avoidable.
  • Whether the move has a negative effect that may make it preferable to wait to use the move until maxing out on energy or nearing the end of the battle.
  • Whether the above two optimizations might cause the match to extend longer than necessary, or cause a Pokemon to faint with enough energy to have used a charge move (getting this right often requires multiple iterations of trial and error).

Level 3: Queueing

Queueing determines which charged moves each Pokemon should use during the match, and the order and frequency that it should use them. This forms the full list of charge moves used during Timing. This is done by providing various move combinations to Timing and analyzing the results until there is enough data to be certain which Pokemon will win, which move combination will cause it to win by the largest margin, and what moves the other Pokemon can use to deal the most damage before fainting.

This is one of the most complex parts of the algorithm, but it can be simply described as a more-or-less brute force approach that considers all possible charge move combinations, with some major optimizations to avoid an exponential runtime.

Level 4: Splitting

Splitting pre-loads the Queueing algorithm with various specific scenarios given a certain number of shields for each Pokemon, e.g. baited and succeeded, baited and failed n times, never baited, etc. It then analyzes each scenario to determine if any should be filtered based on the following criteria:

  • If using one move more than a certain number of times (starting with 0) never offers any benefit over using the other move, filter all scenarios using that move more than that number of times.
  • If a Pokemon is guaranteed to win using only one move, but can lose by using the other move, filter all scenarios using the latter move, even if using that move sometimes provides a benefit over not using it.
    • Note that because of ordering, this usually only causes the losing scenarios to be filtered and not the winning ones. For example, Azumarill can beat Registeel in 2 vs 2 shields by using only Hydro Pump, but loses if an Ice Beam goes unshielded. However, IB(S)-IB(S)-HP is still included in the results because if Registeel lets the first Hydro Pump go unshielded, Azumarill can safely use Ice Beam to win the matchup because it only needed to land one unshielded Hydro Pump to win.

The above algorithm is enough to determine the best and worst case outcomes for each Pokemon, but Splitting also pre-loads other canned scenarios that I’ve personally found to be useful for understanding a matchup.

Level 5: Boxing

Boxing simply runs Splitting over all possible shielding scenarios, creating the 3×3 matrix of results shown for each battle.

Hopefully this article has helped you understand what the PVP IV battle simulator does and how it does it. Feel free to get in touch with any additional questions. And if you don’t have PVP IV yet, you can get it on the App Store or Play Store!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: