Competitive Pokémon AI

Competitive Pokémon AI

Welcome to the world of Pokémon! These games have been a staple in people’s childhood, and maybe still are nowadays. The franchise attracts such a wide audience: From collecting every Pokémon to becoming the ultimate Pokémon trainer, it is no surprise that so many people have fallen in love with these creatures.

It is not so weird to think that, given that most games are about battling trainers, a big portion of the audience likes to test their skills on other players. This community of competitive battlers have developed simulation software and ranking systems so that it is possible to differentiate the masters from the trainers. Because of this, it has made a name for itself among the giants of 1v1 strategy games, like chess and Go.

However, there is one thing that makes competitive Pokémon stand out from other 1v1 competitive games: there are no bots. AI has been a great tool for learning and improving in chess and Go, but why is that not the case for Pokémon?

Why is it so difficult?

The reason why AI works so well in chess and Go is that both games are perfect information games. This means that all players are completely informed of all features. For example in chess, both players can see all of the pieces on the board at all times. For computers, the world of perfect information is a Valhalla; since everything is known, they can easily calculate the best possible move.

This is the main problem for AI in Pokémon. There is a significant amount of imperfect information in this game. It can be best compared to Poker: As a player, you don’t know what hand your opponent has, thus there is rarely a ‘perfect’ move.

To try to put it into perspective, it is important to know the basics of Pokémon’s battle mechanics. A battle consists of one, two, or even three Pokémon on each side of the field. Additionally, there are Pokémon in reserve, which can be switched in. For each of these Pokémon, the player can choose its item, ability, four moves, and a ‘spread’, that determines which statistic is increased or decreased further. At the start of each game, these things are unknown to the opponent.

Both players act simultaneously during a turn, so they both have to predict what the opponent will do. They can either choose one of the four moves from their current Pokémon on the field or switch it out for another Pokémon in their reserve.

Currently, there are over 1000 Pokémon, 300 abilities, 1500 usable items, and 900 moves. This means that it is nearly impossible to determine a Pokémon’s set from the start.

Additionally, research has shown that looking deeper into a game tree does not necessarily increase the quality of a decision, which is called ‘game tree pathology’. [5] This is especially the case for Pokémon. Every turn, you not only need to predict the move of the opponent but also always guess the hidden information and take the random number generator (RNG) into account. This is why infinitely looking ahead will hurt decision-making.

Even if there is an AI that manages to master the current meta, it will most likely stumble down the ladder because of the ever-changing meta. Every year, new Pokémon, items, abilities, and moves get introduced to the game. This is hell for AI, since playing in a format, where it does not know half of the things, makes it a lot less successful, as it determines its choices on its old environment.

Has it been done before?

There have been numerous attempts to create a bot that can successfully win against the top players in Pokémon. The first few attempts used AI models that were known to be successful in games like chess but were unsuccessful in Pokémon battles, like MinMax and Q-Learning. [2][6][7] Sarantinos gives three main reasons why these models failed to be successful: [3]

  1. The battle mechanics are very complicated, thus the total number of possible game states is enormous, a lot bigger than Go’s 10172 possible states, as seen before.
  2. Training neural networks using past battles will result in inaccurate decisions, as every Pokémon battle can be set in a unique environment and will seldom be the same.
  3. Since moves have accuracy, RNG plays a vital role in the game. The same move can have different outcomes. Using traditional reinforcement learning, where points are awarded for each successful outcome would not be optimal.

With these ideas in mind, Sarantinos created his own AI agent, Athena. It managed to reach the 33rd spot in the world, which AI has not been able to achieve since.

Another quite popular AI is called ‘Future Sight’, which is a play on words, as there is a move called Future Sight in the games and it explains how the AI functions; by looking ahead. This AI almost managed to get itself into the top 500 of the world. However, this model is a bit different from Athena. The Athena AI only played the ‘Random Battles’ format. This format gives both players a random team. Future Sight on the other hand played some of the most popular format battles where you need to build a team on your own, which it also did itself. According to the author, it was not anything fancy, but it still managed to build a balanced team based on current popular teams.

Future Sight also had an interesting ‘feature’ where the bot supposedly would play to its opponent’s skill level, as it had a 50% win rate across all levels of play. This might be considered a bug, though it could be really useful as a practise bot for someone’s respective ‘rank’. Not only that; integrating this method into official Pokémon games may make them a lot more enjoyable for more experienced players.

A reason for this AI’s popularity is that the creator developed an extension, where players can see the probability of winning for every move. You can see an example in Figure 1.

Even if there is an AI that manages to master the current meta, it will most likely stumble down the ladder because of the ever-changing meta. Every year, new Pokémon, items, abilities, and moves get introduced to the game. This is hell for AI, since playing in a format, where it does not know half of the things, makes it a lot less successful, as it determines its choices on its old environment.

As you can see there, clicking U-turn for the Cinderace has the best probability of getting that player to win. This model ended up being extremely accurate; it was able to accurately predict the winner of the match 81% of the time. Sadly, the extension has not been updated since 2021 and does not work on the current popular formats.

How can we make them better?

We have realised that it is incredibly difficult to create an AI for a game that has imperfect information, introduces new features every year, and is extremely complex. Despite this, Pokémon nerds have been able to get exceptionally far in creating a competent computer-controller Pokémon trainer. Will we eventually have helpful practice bots like chess, or do we still have to wait for new technologies in the future to be able to create such a tool?

References

[1] https://www.pokemonbattlepredictor.com/FSAI/how-fsai-works
[2] https://www.um.edu.mt/library/oar/handle/123456789/115294
[3] https://arxiv.org/pdf/2212.13338.pdf
[4] https://cs230.stanford.edu/projects_spring_2022/reports/127608668.pdf
[5] https://www.sciencedirect.com/science/article/pii/S0004370210001402
[6] https://varunramesh.net/content/documents/cs221-final-report.pdf
[7] https://web.stanford.edu/class/aa228/reports/2018/final151.pdf
[8] https://aiteambuilder.com/