Hello!
Recently, I've been working on a personal project. Or rather, I've been building a substantial amount on an old one.
To give some context, I was previously a competitive Pokemon player in the VGC division. Having competed at Worlds, I've had the opportunity to learn much about the game and talk to top players about certain tools that can help with their gameplay. Pokemon is such a diverse and unique game. In a game like chess, you'll always have full knowledge of the board position. At every moment, you know what your opponent's pieces are, what they can do, and where they're located. In Pokemon, however, you only know which 6 Pokemon are in their team. You have no knowledge from team preview about what 4 moves each of them carry, their item, how they are trained, etc.
As such, team building is a very difficult process for both new and seasoned players. It is a common practice to scout what teams are popular during the season for inspiration and to know what you're going to be facing.
Currently, the most popular online service is Pokemon Showdown, a simulator to play draft games against other players without the time-consuming process of getting those Pokemon in your game. However, it is a pain to search replays for team usage. There is no efficient method to seeing the Top 500 teams without manually inputting the username from the ladder into the replay search.
With this problem, I came up with the first iteration of a script that would save the results of the Top 100 matches to a CSV file. With some Python knowledge at hand, I understood my script would:
Recently, I've been working on a personal project. Or rather, I've been building a substantial amount on an old one.
To give some context, I was previously a competitive Pokemon player in the VGC division. Having competed at Worlds, I've had the opportunity to learn much about the game and talk to top players about certain tools that can help with their gameplay. Pokemon is such a diverse and unique game. In a game like chess, you'll always have full knowledge of the board position. At every moment, you know what your opponent's pieces are, what they can do, and where they're located. In Pokemon, however, you only know which 6 Pokemon are in their team. You have no knowledge from team preview about what 4 moves each of them carry, their item, how they are trained, etc.
As such, team building is a very difficult process for both new and seasoned players. It is a common practice to scout what teams are popular during the season for inspiration and to know what you're going to be facing.
Currently, the most popular online service is Pokemon Showdown, a simulator to play draft games against other players without the time-consuming process of getting those Pokemon in your game. However, it is a pain to search replays for team usage. There is no efficient method to seeing the Top 500 teams without manually inputting the username from the ladder into the replay search.
With this problem, I came up with the first iteration of a script that would save the results of the Top 100 matches to a CSV file. With some Python knowledge at hand, I understood my script would:
- Retrieve the Top 100 users of the VGC format
- Search all replays of the user
- Find the most recent VGC format replay
- Parse for the team between the 2 players
- Save the team to a CSV file
The script utilized the Requests package to find the Top 100 players. A simple enough task that could be accomplished easily with the help of BeautifulSoup to parse the page.
The interesting part came from finding replays of the users. I initially thought it wasn't possible to search for users by using a GET request, since the URL didn't change upon entering a search. Where I expected a search query with parameters, there was none to be found. To work around this, I used Selenium drivers to automate the search and parsing. Same goes for the replay found to parse the team. Through using two drivers (one for user replays, one for user team), I was able to properly save my results. However, this method came with 3 major problems:
- It was slow. Very slow. Selenium is used for automated web browser testing. It wasn't build for what I'm using it for. Through testing, it scaled very poorly with the number of users I wanted. It took over 10 minutes for 100 teams, which is acceptable but not ideal.
- It was prone to crashing. Since Selenium is simply simulating clicks by looking for properties of elements you want to interact with, it can easily crash when it can't find an element. Selenium might be told "Look for the button and click it" but if the button hasn't rendered, it'll crash and I'll be left without any results. This was a major problem. Moving forwards, I had to address this as I couldn't have something prone to crashing when I wasn't monitoring the script.
- I was scheduling it to run on my local machine using the Windows Task Scheduler. This meant I had to manually also upload the CSV to a Google Drive folder. The script running also meant I had to have my machine on at all times and that it'd be significantly slower while running the script. Either way, running this on my local machine was not the solution.
Nonetheless, the script was well received by the few players I shared it with. They appreciated how easy it was to see all the teams in one place, giving them insight into the metagame snapshot days at a time. Following the project, I abandoned it since my friends were done competing for the VGC season and I had finished competing in my last VGC tournament (NA Internationals 2019) without any motivation to continue playing.
Although my time as a competitive player is over, I'm glad to have been part of the community. I've learned so much from competing in this silly game. Even being able to say that The Pokemon Company paid me to play at Nationals and competing at Worlds is something 8-year-old Kelvin would've been amazed to hear. Now, I hope to develop tools for the community to improve accessibility for both new and old players alike. That's where I can find value with this game. It's what motivated me to make the Chrome Extension which translates Japanese teams to English when I had just learned JavaScript. With the development of VGCStats and the prominence of r/VGC, I hope to contribute as much as I can to help in my free time. If you want to see any projects developed, please let me know!
Comments
Post a Comment