Pokemon Artificial Intelligence Is Smarter Than You

Pokemon Artificial Intellegence

Who out there hasn’t angrily thrown a game controller across the room after continually getting killed by some stupid game-controlled villain? That is such a bummer! You probably wished there was some way to ‘just get past that point’. To take a step in that direction, [Ben] created an Artificial Intelligence program that will win at Pokemon Blue for Game Boy Advance.

The game is run in a Game Boy Advance emulator known as Visual Boy Tracer, which itself is a modified version of the most common GBA emulator, Visual Boy Advance. What sets Visual Boy Advance apart from the rest is that it has a memory dump feature which allows the user to send both the RAM and the ROM out of the emulator. The RAM holds all values currently needed by the emulator, this includes everything from text arrow flash times to details about currently battling Pokemon to the players position in the currently loaded map. The memory dump feature is key to allow the AI to understand what is happening in the game.

Pokemon Artificial Intellegence

The AI code is written in python and uses the pywin32 add-on that includes the Win32 API. The Win32 API allows the programs to interface with Windows, specifically simulating key presses. The AI uses these simulated key presses to interact with the emulator rather than building the emulator into the AI code. The AI Agent has two key goals: navigate the map to each new trainer and defeat each trainer with out loosing a Pokemon. These goals require separate modes, a ‘search’ mode and a ‘battle’ mode.

The search mode is the most basic form of AI, it’s a Reaction Agent. Reaction Agents simply react to what they can see at that particular time. In this case the agent is programmed to find the location next to the trainer. By knowing where it is and where it needs to go, the AI sends a simulated keystroke to move the player to the appropriate position. When in position, the AI will ‘challenge’ the trainer.

When in battle mode, the AI has a little bit more work to do. It starts by calculating the potential battle damage for all combinations of opposition Pokemons VS each of its own Pokemon. The AI then runs through a decision tree that dictates what decisions to make. For example, the decisions relating to health are higher in the decision tree and the AI will decide to heal a weak Pokemon before assessing any attacks. This ensures that no Pokemons are defeated.

Even if you are not a Pokemon fan you have to agree that this is an amazing exercise in DIY Artificial Intelligence. Check out the video to see this project in action.

12 thoughts on “Pokemon Artificial Intelligence Is Smarter Than You

  1. There’s a difference between AI and VI, also “navigate the map to each new trainer and defeat each trainer with out >loosing< a Pokemon" is going to be quite hard ;) unless he programmed it to win without ever throwing a pokeball.

  2. AFAIK this is a VI, it doesn’t learn. It goes through a set of instructions based on available data. An AI will collate the data and, itself, find meaning and action regardless of initial programming.

    My own VI “Lydia” acts on predefined and custom input too: http://www.rosefalk.dk/stuff/temp/lydia/ but that doesn’t make her an AI.

    I get flashbacks to my full team of lvl 100 pokemon and full 151 pokedex, ahh… that’s a long time ago. Those new pokemon can get off my lawn.

    This would actually be a nice way to autolevel without having to burn through the +200 hours needed to get down to business.

  3. “Pokemon Blue for Game Boy Advance.”

    Technically, Pokemon Blue was for Game Boy with Game Boy Color enhancements. Looks like they’re just running it on Visual Boy Tracer instead of ~shudders~ NO$GMB.

  4. Needs some work, why would you use submission which takes recoil and wastes PP when any other move would have KOd Dewgong who was asleep btw.
    and why is it so slow?

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.