(Also check out my other hacks)
Hacking Pokemon Go- Farming 12k EXP while I sleep
Pokemon Go is a huge success right now and people are fighting to gain levels. I didn’t have much time to play Pokemon Go, so I knew I had to do something If I was gonna get to level 20 before the end of my life. Programming the game to play itself was probably my best bet. I played the game for about an hour or two and looked for any potential sources of redundancy. Essentially, I was looking for any part of the game that could be automatized. The game boils down into 3 parts: catching pokemon, fighting gyms, and visiting pokestops. I recognized early on that pokestops were the key.
The basic mechanism of a pokestop is as follows: Click the pokestop, swipe across the screen to spin the pokestop image, leave the pokestop screen, collect 50 experience. The pokestop then becomes inactive for 5 minutes.
First I needed to get Pokemon Go on a PC so I could do my farming off of my phone (if my phone was being used by this hack all day, it would not be much use to me). This link describes how to emulate a Cell phone onto a PC, spoof the GPS signal, and run Pokemon Go on a PC. I set my GPS location to Central Park in New York City with a random crawl distance of 100 meters. This means that my player will randomly move around within a 100 yard radius. This helps me get a lot of pokestops… this area is full of them. After I got Pokemon Go and the GPS running smoothy on my PC I loaded up Matlab so I could begin to do analysis on the game.
|Raw Image||Filter for Blue||Identify Centroids|
I took an image of the game (first picture). This one is pretty busy, lots going on and lots of lures. Fortunately, the color of the Pokestops is different than most other parts of the game. I applied a threshold that only looked for blue; voila, now I have the second image. Take a Look at the second image, the Pokestop is a large collection of red pixels. I counted how many pixels were in each red shape in the picture and found that the pokestop is actually the largest shape in the image. If I calculate the centroid of the largest shape in that image I find that it is located directly in the center of the Pokestop (see the green dot in the third image). Now I know the location of a pokestop. I repeated this analysis for many pokestops until I fine tuned my parameters to maximize performance. Sometimes it would click a pokemon, or miss a pokestop, or click a gym… but I wrote code to handle all of these scenarios, as you will see later.
Interfacing with the game
The simplest way, off the top of my head, to make my program interface with the game was via the computer mouse. With the mouse I can “swipe” and “tap” by clicking and dragging across areas of the screen. I utilized a java package that enables mouse control within matlab. I preprogrammed a swipe motion and determined the location of the exit button on the pokestop screen (the location of buttons on the screen never changes, so I only have to set their location at the beginning). I then created a loop:
Step 1: Take image of screen
Step 2: Identify location of pokestop
Step 3: Tap location of pokestop
Step 4: Wait 1 second
Step 5: Swipe across screen
Step 6: Wait 1 second
Step 7: Tap the exit button on the pokestop
Step 8: Wait 1 second
Step 9: Rotate the view by swiping across the screen
Step 10: Return to step 1
This was sufficient enough to detect pokestops and farm them, but sometimes the game would stop responding (errors with the emulator), the servers would go down, or I would get trapped in a battle and the program did not know how to escape. In order to account for these errors I developed various “error detection” methods that allowed me to verify what screen I was on, so that I might take appropriate action. I also programmed in “scheduled restarts” every 20 minutes to refresh the game in case it was having an undetected issue or an error occurred. On average, when the servers are working perfectly I am able to farm about 1 pokestop per minute. This rounds out to about 12k EXP every 8 hours.
It took my program about 4.5 days to get from level 1 to level 20. Then I connected the account to my phone and reaped all the benefits of being high level.
Below is a video where I show the “configuration” stage that occurs when the program is first set up and than a few minutes of it running on its own.
For code and help getting set up, email me at email@example.com
2 thoughts on “Hacking Pokemon Go- Farming 12k EXP while I sleep”
Ok, I’m going to have to try this too!