Pokémon Go Bots
This is a broad project I embarked on in March 2017. The basic problem it solves hasn’t changed, but the bots themselves have evolved a lot. This is a summary of the latest on the project, presented in a use-case–oriented way. I also wrote a history chronologically tracking my learning experience.
Current version (which I’ll be discussing): http://github.com/pyorot/abyo.
Main user-facing Discord server: http://discord.gg/AmShbxw.
The basic problem
Pokémon GO allows you to catch Pokémon, which spawn at particular positions in the real world for fixed periods. Each has qualities that affect its desirability – species, CP, IV. They are tracked by a map, LondonPogoMap, which shows the qualities, position and duration of spawns. People watching the map see the spawns and go to catch them in the real world. What we want is to eliminate watching, and replace it with useful push notifications for filtered Pokémon.
Models for solutions
The project has grown around the LondonPogoMap and Discord platforms. The latter is a messaging app that hosts the community surrounding the game, so is a natural host for an alert messaging service. We’ve explored three models so far:
-
Global public alert channels. Users subscribe to channels with Pokémon filters that cover all of London. Suitable for very rare spawns, but the vast majority of alerted spawns are unreachable to a given user, and this has worsened as the scanned London area has expanded.
-
Private radius-based custom alerts. This was the idea behind the first version. It initially required users to run code in an always-on browser, and was then converted to a subscription service whereby users send commands to bot accounts. This gives users much more relevant alerts, more easily kept up with, but the interface is very hard to design well. Users have found each one cumbersome, unintuitive, and a lot of work to customise as desired.
-
Regional public alert channels. As the game is played outside with others, communities covering local areas have flourished. Users subscribe to public channels as before, but covering only their local area, as designed by community leaders. These strike a compromise between customisability and ease-of-use that has proved popular so far.
This third option is the essence of my current bot, called Abyo.
Abyo’s design
The key ideas:
- Data (a list of spawns) is scraped and parsed into Pokémon objects, forming a stream that is filtered by the Agents.
- Channels and their filters are abstracted as Agents. These have two components:
- a dictionary of channels, linking handles to URLs;
- a filter pure-function, whose input is a Pokémon object and output is a (list of) channel handle(s) representing where it should be sent.
- Agents are loaded from files with simple syntax that can be prototyped into new ones by anyone with basic coding experience.
- Each Agent maintains a sending queue and tries to send out messages quickly and reliably, constrained by rate limits and HTTP problems.
- The whole process is looped, with logic to determine the timing of the next iteration by trying to sync with the source’s update cycle.
- The fetch, parse and filter are synchronous; every sending operation is asynchronous across Agents, and sync. within an Agent (because of rate limits).
- Notifications are designed to provide enough info at the lock-screen stage for users to decide whether to act, as often as possible.
- There’s a library of geographical routines (distance, point-in-polygon), used (a) to filter, with client-defined local-area polygons, and (b) to annotate spawns with location info (the latter using an extensive in-memory London data library).
- My general philosophy on software design: taking the time to come up with creative solutions to old problems, keeping the features and code minimal (economy of thought), and making it extremely reliable (maintenance is an abyss I prefer to avoid).
Regional Abyo as a service
I ran a free service, per the regional solution model above, whereby clients messaged me with area polygons, channel URLs for their community chat server, and requests for filters. I drew up an Agent file and added it to the live instance of Abyo on a server somebody lent me.
By the end – my data source dried up on Mar 22 2018 – I had 6 clients, and had focused my final work on Abyo around making it scalable far beyond that, with analytics and a primary focus on error handling and logging, learning from the first 2 months of running it live. It ran for a further 1.5 months without a single unhandled error. And received one testimonial!
“Thanks for the Abyo bot its amazing our whole server loves it. They’ve stopped using maps now lol. It’s exactly what we had been looking for, thanks for being patient and all the help with my questions too. Appreciate it!”