Pokémon Go Bots (History)

I’ve written the project up here as a kind of history, tracking the increasing sophistication of the apps and the things I learnt along the way. It’s lengthy, so I bolded the important bits for skimming. Project links, with initial release dates:

Percy

In the beginning, I knew nothing about JavaScript, except that you can put it in your webpage and make someone’s browser generate 100 message boxes do interactive things. I started by loading dev tools in a browser tab of the map, finding the console, looking for the data, then implementing some basic filtering logic, copy+pasting foreign JS syntax from the internet. I searched for an app to handle push notifications, found PushBullet, and copied an XmlHttpRequest from somewhere. I looped the code and the result was Percy.

The initial version was fully procedural (to the extent that there were no subroutines at all, only one main routine!). But at the time, I was pleased enough to annotate it and display it as a cool quick tool I made with no JS knowledge that might inspire someone else to try a similar thing. As I learnt more JS and more and more users started to give feedback, I made various improvements, leading to the final version, which is a very simple, elegant and self-explanatory piece of code.

The changes included:

Pyobot (Public)

Percy is very DIY; it requires copying+editing code to use and running a laptop constantly. I decided therefore to adapt it to post to public Discord channels – the management team decides what will be posted to them, and users subscribe as they wish. This was my version of Pyobot (whose code is very inelegant, owing to inter alia an old inexplicable filter syntax with a complicated flowchart that I lost and error handling that mostly doesn’t work).

This led to many new challenges:

So, though I didn’t resolve the last of these challenges, Pyobot became very popular and useful to the Pokémon GO community, and led to increased uptake of Percy for customised personal filtering. Not long afterwards…

Pyobot (by Moriakaice)

A professional web developer came along (late April), was amused by the fact that I was running a public bot on the laptop of somebody who was always on the verge of getting banned from the community, told me about Node.js and “using the right tools for the job”, ported the bot to Node and took over running it on his VPS. The same day his port was ready, laptop guy was banned, by complete coincidence.

The improvements he made escalated from there:

I was happy with how the project was going, so stepped back to work on other things, like managing the Discord server and building simple miscellaneous Discord bot tools, which introduced me to Node, Heroku and Git. These are still active now.

Abyo

As the months passed and I monitored user feedback, I became unhappy with aspects of the new Pyobot’s operation:

In the meantime, I had read a lot about programming concepts like asynchronicity in JavaScript, as well as classes and scoping, and had more experience with testing, so I was confident I was up to redesigning the public part of Pyobot, as my first complete non-improvised project. Also, somebody had volunteered a server with remote desktop access for the project. I began in November 2017.

First, I wrote locate.js. I had the idea that instead of waiting for internet APIs to tag alerts with geographical information (postcode, suburb, etc.), I should download data, process it, and use geometric algorithms to tag spawns entirely locally. Moriakaice had already done this with station data and a closest point algorithm; I extended this to suburbs (modifying the data to resolve its inaccuracy, which had bothered me since my original version of Pyobot), and found GeoJSON polygon data for postcodes and boroughs, and a point-in-polygon algorithm from the Node package Turf.js.

I released locate.js separately (with data) at first. Moriakaice implemented it in Pyobot, and the speed improvement was such that suddenly, all available data could be polled (so the 100% IV channel worked), and users of the private service could thus track whatever they wanted. Which was unexpected.

So, even though this module inadvertently resolved the biggest problem with Pyobot, I persevered with my project. These were the other improvements I made:

And the bot has been working, faster, more user-friendly and more reliable, ever since! With v1.1, I introduced a couple of cool new features:

As a result of my PiP optimisation (above), I was happy to move postcodes from post- to pre-processing. Hence, a local Discord server could simply specify a postcode to determine the region it filters for, to avoid designing a polygon.

On the coding side, I learned a lot of things:

And there are still improvements that could be made:

And that’s the story so far!