
It's fun (and pretty easy) to 'break' these games by scripting in movements that could never be accomplished by a human. A common construct involves exploiting human speed limitations to force you into a less than optimal solution. The joys of this fast approach are such that once you get familiar with what the computer can easily 'see', you'll begin to view games slightly differently. Automating a specific game function can be done in a few short lines of code, and a full-fledged, start-to-finish bot (for a simple game) can be cranked out in a few hours. With this approach we lose a bit of refined detail and control, but make up for it in shortened dev time and ease of use. We'll rely on Computer Vision-esque techniques and Windows API calls to gather needed information and generate movement.

Rather than making a program that sits between the client and server injecting code (like a Quake or C/S bot), our bot will sit purely on the 'outside'. The approach we're going to take is likely slightly different than what most would expect when they think of a bot. This tutorial is written to gave a basic introduction to the process of building bots that play browser-based games. We'll use a few games as examples along the way.īy the way, if you want to take a shortcut, you can find plenty of browser-based game templates to work from on Envato Market. I suggest Paint.NET as an excellent free option, but any program with rulers that display their measurements in pixels can be used.

The final tool we'll need is a decent paint program. More information on adjusting Path Variables may be found here. Should you begin receiving any Import Error messages after installation, you'll probably need to manually adjust your Environment Variables. However in practice this doesn't always happen. You'll need to download and install the following libraries:Īll of the above have self installers Running them will automatically install the modules into your \lib\site-packages directory and, in theory, adjust your pythonPath accordingly. There may be Mac or Linux equivalents, but we won't be covering them in this tutorial.

Some of the code and libraries are Windows-specific. They provide a nice Python wrapping to a bunch of low-level C code which greatly eases the process and speed of bot scripting. This tutorial, and all the code within it, requires that a few additional Python libraries be installed.
