Gotta Model ‘Em All? Teaching AI to Be a Pokémon® Master
Fans of the long-running Pokémon® game series know that the in-game Pokémon battles are optimized to be a thrilling challenge… for seven-year-olds. Climbing your way through the Pokémon League to be the very best, like no one ever was, is advertised as a test of strategy, skill, and your deep and loving bonds with your ‘mons. In reality, it’s little more than a glorified game of rock-paper-scissors. The computer sent out a fire-type Pokémon? Drown it with a water-type. Rinse and repeat your way through the entire 24-year catalog of games.
Which is why battling against a fellow human can be such a shock. It turns out that Pokémon is surprisingly complex—the computer is just hopelessly bad at its own game. Talk to the real-world champions who compete in tournaments, and you’ll quickly find yourself down a rabbit hole of stats, movesets, items, special abilities, IVs, EVs, and more. Over on the main competitive forum, dedicated fans maintain separate pages detailing and debating the best strategic use for each of the nearly 900 Pokémon that have been released to date.
Why are the in-game battles such a joke, then? Part of the answer, of course, is that these games are targeted primarily at seven-year-olds. But teaching an AI to play Pokémon with any real skill is also difficult from a technical perspective. Still, researchers have successfully trained AI to defeat human opponents at chess, Go, and Mario; Pokémon battles shouldn’t be beyond the realm of the possible.
Over on Towards Data Science, intrepid Pokéfan Caleb Lewis has been taking steps toward this goal. There’s a wide constellation of choices and considerations that go into selecting a good strategic move each turn in a Pokémon battle. To simplify matters, Lewis focused on creating an initial model called Poke-Agent that could at least master type effectiveness (the rock-paper-scissors aspect).
Lewis’s process involved a variant of reinforcement learning known as Q-learning. This technique makes use of information about the state of the battle (say, what Pokémon Poke-Agent is using, what Pokémon its opponent is using, and how much health each combatant has left) and the action taken based on that state (in this case, which move to use). For any given pairing of a state and an action, the model assigns a Q-value to indicate how good a choice the action was for that state. The Q-value is then updated based on the results achieved (i.e., was the battle won or lost).
With this setup, Lewis gave Poke-Agent a Squirtle, set it against a Charmander, and let the model figure the rest out. Initially, the moves Poke-Agent chose were random, but somewhere around the fiftieth battle it began to realize that Water Gun worked wonders against its fire-type opponent, and the rest was history.
This is only scratching the surface of what it would take for AI to defeat a human trainer, but with time, data science, and training, artificial intelligence may yet become a Pokémon champion.
In the meantime, neural networks have already shown themselves capable of coming up with new Pokémon designs… as long as you don’t mind a few nightmares, that is.