how to build a bot for on-line flash game?

kirill_igum picture kirill_igum · Nov 20, 2010 · Viewed 20.9k times · Source

there are a lot of flash games that ask u to do repetitive actions. an example would be FarmVille or getting statistics on on-line poker game.

What is the best way to create an interface between what you see on the screen, a bot's algorithm and clicking of the mouse.

so basically, when i'm playing a texas hold'em on face book and if i get AA i want the bot to click all-in. if i don't get AA i want to fold. this is just an example, not the actual strategy. or another examples would be routing tasks in farmville.

so basically. it has to grab a picture of the screen. recognize patterns and convert them into an input of the algorithm. the output algorithms would be clicking on some other (may be same) patterns.

any suggestions?

Answer

Kh40tiK picture Kh40tiK · Jun 20, 2014

I have experience building a simple computer vision based bot for a online card game.

I used a crossplatform python library called autopy to handle automated mouse click and keyboard input. The bot capture screen every 0.5 sec, then convert the captured screen into a numpy array for analysis. Python has good image processing (PIL, OpenCV python binding) and machine learning utilities (scikit-learn). For simple image pattern recognition, the bot extract mean of pixel brightness over a image region to make decision. For complicated ones, OpenCV template matching and SVM classifier are being used.

The server caught my bot the first time, so I guess some there's bot detection on the server side. After I added more randomness and flexible decision making, the bot has bypassed serverside bot detection.

All took me a Saturday and I enjoyed Sunday.