Pokemon Showdown AI Bot

Status
Not open for further replies.
#1
Hello all Pokemon Showdown users,

My username is onmabd, and I have been actively using Pokemon Showdown because I think it is an amazing website.

About 6 months ago, I started a project to build an artificial intelligence bot for Pokemon Showdown that would play the game and make smart decisions and potentially compete with humans. I also wanted the bot to be usable by every user of Pokemon Showdown to help improve their own skills or to experiment with different teams.

A lot of work has been done and I think it’s ready for an alpha-stage release! I can’t guarantee it will work on your computer, but if you have the latest Windows and latest Chrome or Firefox, it will probably work. That being said, I would really, really appreciate that if you find any bugs or have any feedback to email me at pokemonshowdownbot@gmail.com or post an issue on the Github repo. I will definitely continue to work on this project and improve its stability and add more features.

How to install:
  1. Download the appropriate .zip file corresponding to your operating system from: https://github.com/vasumv/pokemon_ai/releases/tag/0.0.1
  2. Unzip the .zip file.
How to use:
  1. Run the showdownbot.exe (for Windows)/showdownbot (for Linux). It should open a tab in your default browser with a GUI for using the bot.
  2. Specify your username/password and which browser you want to use. Make sure you have the browser you have selected installed on your computer. Note: phantomjs does not need to be installed, but is VERY SLOW on Windows.
  3. You can add your own teams by specifying them in a text file in the teams/ folder inside the showdownai folder. Otherwise, you can copy the text directly into the GUI (Team from text). There are also default teams available.
  4. Specify the number of games(iterations) you want the bot to play.
  5. Optionally, you challenge a user who is online in the Lobby of Showdown. Specify that user if you would like to challenge.
  6. Click the Play button! This should open a browser window if you selected Chrome or Firefox. The bot should log on as you, create a team, and start playing on the ladder/challenge a user.
Important Notes:
  • Usernames and passwords are sent in PLAINTEXT, so make sure you’re using the bot on a safe network or you’re using a disposable password.
  • Usernames must be registered and have an associated password to log in.
  • Right now, the bot only works with the OU tier, but future releases will expand that to more tiers.

  • You may run multiple bots at once, but make sure they each have different usernames.

  • The bot can take a long time to “think”, depending on the speed of your computer. On average, I see it take from 10 seconds to a minute to decide on a move. However, it will get faster at making decisions the longer the match goes on.

  • Crashes will periodically occur. You will see this when the bot forfeits or runs out of time to make the decision. Right now there’s no easy way to see the crash log, but that will come in a future release.
How to contribute:

The project is fully open-source on Github at https://github.com/vasumv/pokemon_ai/ and is implemented entirely in Python 2.7. If you have ideas or bugfixes, feel free to create issues and create pull requests.

How does it work?

The bot uses the minimax algorithm. This algorithm will simulate all of the user’s actions and all of the opponent’s actions, resulting in a state of the game that will be evaluated with a score showing how well the user is doing. Then, the algorithm will choose the best action for the user in order to minimize the losses.

The problem with using minimax on Pokemon Showdown games is that we need to know all of the opponent’s moves beforehand. We obviously know which Pokemon he can switch into, but we are unsure of what moves each of the six Pokemon have until they make those moves. So, in order to use minimax, we must make a prediction of what moves the other Pokemon has, just like we do as humans. To do this, I downloaded about 11,000 battle logs from replays.pokemonshowdown.com of the top 500 users of the OU and UU ladders and created a graph: each node was a move and an edge corresponded to the number of times it co-occurred with another move (node). Now, I have a bot that will predict what the moves of the other team are based on what moves it has seen and the battle logs it has parsed.

I ran the bot on the OU ladder for about 200 games, and it is shown to play by about the standard of an average Showdown player(~1300-1350).

tl;dr

Check out this bot that will play Pokemon Showdown like a human would! Use it to train yourself if you’re a beginner or test out new teams!
 
Last edited:
#4
Hey onmabad! I think this is awesome work. Achieving an average rating is great.

For my own bots, I've also been considering using replays as 'training' data and seeing what I can accomplish. Sounds like we had some similar approaches.

I've been working on a project that is basically a battle arena for Pokemon bots. Once I get a little further along, I'ma check out your source code and see if I can get your AI to interface with mine. I noticed you haven't updated the code for ~2 months, so maybe you feel like I do and need someone to compete against to keep you motivated :)
 

Tiksi

witch of the cosmos
is a Battle Server Moderator
#12
Since the poster of this thread was last seen in 2015 and the last previous posts were in 2016, I’m afraid it’s reasonably safe to say that your question will remain unanswered.

Locking this thread.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top