Answer the question
In order to leave comments, you need to log in
How do they write bots for games (or for programs with an interface)?
Hello.
I'm interested in the question of how bots are written for games (even the simplest ones) or for programs (which have an interface).
I'm interested in the principle itself. Here's how to make the bot climb sites - this is understandable (just follow the links and that's it).
But as in applications, I don’t understand at all (does the program really just move the mouse and click on the buttons instead of a person?)
Ps Better in python.
Thanks in advance!
Answer the question
In order to leave comments, you need to log in
Have you seen python bots?
https://msdn.microsoft.com/en-us/library/windows/d...
and Spy++
The sea of information on Habré alone habrahabr.ru/search/?q=%5B%D0%B1%D0%BE%D1%82%5D&ta...
I’ll add on my own that the main methods are
1) the simplest clear way is to search for the desired element on the screen and clicking on the screen , or clicking on the specified coordinates. I mainly use this method, since the interference in the game is minimal - it does not need to be broken, for online games there is less chance of getting a ban. Suitable for simple games, mostly those that are 2D turn based.
Google sending mouse and keyboard events to the JS of your choice (java robots for example).
Cons - the game must be constantly open on the screen and have focus (you can solve it by running the game with the bot in a virtual machine).
2) for online games -study of the protocol for data exchange with the server . you need to study where the data is sent / where the data is received from and in what format. write a program that emulates the game client. very good way - for very interactive games - maximum speed. The method is quite complicated, you need to reverse the protocol (google wireshark) and possibly the application itself (google disassembly / decompilation). If the game is browser-based, then everything can be simpler - requests and responses can be viewed in the browser console. A very promising way - a visual client is not required - you can make an army of bots and place them on servers - most likely they will consume a little memory and processor and the possibilities are impressive.
3) for desktop games - patching the memory of a running game. options from simple types - change points / money in the game (artmoney) this is mainly for non-online games, and to very complex ones - change the address of a system function call - for example, the directx drawing function - that is, we change the call address to our function (recently there was a series Unfortunately, I did not find any articles on this topic quickly). Or as a variation - decompiling the game - changing the logic - compiling (google everything related to cracking, creating keygens). This variant requires a fairly high qualification, an understanding of how the game works. Also games can have protection against it.
By the way , understanding how games / programs work is one of the main things in this matter.. Therefore, first of all, you should deal with understanding how a particular game works, and then think at what stage you can intervene in its logic in order to achieve the desired effect. Also study the means of testing games / applications - with the help of them you can also achieve good results with little bloodshed.
Yuri wrote very well how to do it correctly and, unfortunately, Python is not at all helpful here.
Other answers also gave good links to specialized programs that are easy to learn.
For those who are not afraid, I would like to add that there are other ways that do not require ultra skills. So, for example, the now popular topic " Robotics process automation ", almost any software dedicated to this topic is well suited for creating bots, albeit not the most advanced ones and with shitty speed. Their interface is usually tailored to the user and programming skills are not much needed.
Another level, again a simpler way - something in between points (1) and (2) proposed by Yuriis the use of libraries for testing and/or automation. So selenium, although not too easy to learn, is not as dreary as, for example, using wireshark. For desktop applications, there are a lot of automation libraries for win32api, qt and other GUIs. Libraries are needed for implementation, various software like Spy ++ for finding bindings in windows, etc.
Returning to the question about Python , both selenium and libraries for automating desktop applications are available in Python, Ruby, and other scripting languages. In general, automation is available in almost any language. Resources will undoubtedly be consumed, but the complexity of development and the entry threshold are much lower.
And, the most important thing in this process is creativity and non-standard approach. As you master it, you will be able to move on to much more complex tools, and having figured out, for example, the working methods of popular GUIs, you may someday get to disassembly, you definitely shouldn’t start with it!
As a transition point, like using ghostbrowser and node.js instead of selenium.
I hope my answer has encouraged newbies, dispelled the fog of insurmountable complexity, and provided a somewhat simplified entry into the object area.
They write the capabilities of the bot and then a set of rules by which the bot decides what to do in a certain situation.
habrahabr.ru/post/241553
For this, there are special sharpened programs for creating bots.
For example , Cybor . You can program a bot in it, or you can create a bot without programming in a visual editor (drawing cubes and connecting them with logical lines)
. Cybor has all the necessary, easy-to-use functions for finding the right objects in the game, mouse and keyboard emulation. It even knows how to recognize hand-drawn text and translate it from real text and numbers.
An example of a bot scheme in the visual editor looks like this
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question