Hacker News new | ask | show | jobs
by chaz 4602 days ago
In 2009, when Farmville was the New Hotness, I checked it out to see what all the fuss was. After all, it was rumored to be minting $1 million per day. Soon after, I saw that a lot of my friends were playing. Girlfriends were getting boyfriends to tend their crops for them while at work. They were very scrupulous with the design of their farm and tending their crops. But I wanted to just be at the top of the leaderboard.

Unlike later games, it was possible to keep leveling up and making money by farming only instead of inviting friends. Plow fields, plant crops, and then harvest them hours later -- repeat as fast and as frequently as you can. TONS of tedious clicking. Of course, I wanted to automate it, and I wasn't alone. Searching around, I found a Perl script that someone had written and I adapted it for my PC.

I just fired up Farmville, and here's what my farm looks like: http://i.imgur.com/nrtkitJ.jpg. It's almost all crops (maximize $) and it requires the farmer to be trapped within hay bales. Otherwise, he walks to where you're clicking and can sometimes get in the way of the click. It would mess up every now and then, but was fairly reliable -- just run the script and let it do its thing for a few minutes. The trick was to flip the game into full screen mode, zoom all the way out, start at a known (x, y) position on your screen's resolution, and then loop through all crop positions by incrementing/decrementing (x, y). Only slightly tricky because of the isometric view and avoiding clicking on some non-crop positions. Picking the right crop was important too, to maximize yield. I just wanted to do two runs a day: first thing in the morning and then in the evening when I got home from work.

I moved up fairly quickly and quit when I beat all of my friends. Got some jeers from those who thought I was actually playing Farmville so much, but had a few requests for said script ...

3 comments

http://www.sikuli.org Is my GOTO GUI scripting language for game scripting. Graphic templates are fuzzy matched. Actual scripts are python. Inbuilt OCR. I can do that kinda thing very fast. Its really awesome and put of MIT
Cool. I used AutoIt for similar stuff:

http://www.autoitscript.com/site/autoit/

Scripting is some dialect of BASIC and also has OCR.

Don't advertise that on the forums!

P.s. I have to say that as an MVP ;)

Militarised Volcano Police?
Just doing my bit.
You just keep nuking that lava into jail where it belongs. People said it would never work, that you just couldn't police volcano eruptions with the threat of massive nuclear retaliation, but they don't say that anymore, do they? Not since they all died in the giant radioactive caldera, anyway.
Or if it's a similar game on a set-top box / console, use http://stb-tester.com (aka Sikuli for set-top boxes). :-)
Hopefully this gets some attention so people start to work on all the issues it has.
oh wow, that is pretty damn amazing.
I ended up coding my own version of something like this, with I think a few enhancements to make my life much easier.

First, I assumed the crops were laid out in a grid without any offsets. This then allowed me to define the grid in a 2d array and mark squares to skip over very easily.

Second, rather than assuming that my cursor is starting at some spot on the screen that I had to keep duplicating, I just start the cursor over the first farm plot.

Third, I actually never move the cursor to a new farm plot position. Instead, I scroll the screen and replace the cursor where it started.

I had exactly the same experience, using autohotkey, and blogged about it at the time http://teh.oarsum.com/posts/cheating_and_game_design.html.

(tl;dr: if it's easy to script your game and win, your game design is busted)