I was curious about how people make AI to play games. Does anyone know of the AI used to play these games? What allows the AI to see/click the screen in real-time? Even just direction on what libraries for such tasks would be helpful. I can't imagine game developers make an API for creating bots in their games like browsers use with selenium.


1 Answer 1


Bot development is more about 'hacking' than AI in a way that in the very first place you need to read and (over) write game data which you are not supposed to (and thereby potentially violating the Terms and Conditions - so be aware of that). The AI part is fairly simple for most hack/bot applications that I can think of.

Read data

To read game data you can for example:

  • use an assembly code debugger like Ollydbg to locate relevant data in the memory, e.g. amount of gold
  • Observe graphical objects being rendered, e.g. a unit being drawn
  • Intercept network packages containing all kinds of game information, e.g. a unit appearing on your screen

Write data

In a similar way there are multiple ways to write data:

  • overwrite game data in memory
  • Use the Windows API SendInput() function to emulate keyboard inputs
  • Use the Windows API SendMessage() function to send messages to the game
  • Manipulate network traffic

These lists are not comprehensive but to give you an idea of how it is being done.

AI-wise an A* algorithm for example can be deployed to do path finding.

If you are interested in the topic I suggest to read 'Game Hacking' by Nick Cano. The book provides a good introduction.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .