Home computickets How do bots write for computer games?

How do bots write for computer games?




saw on Youtube video in which it clearly plays not a man, but bot. How is it at all possible? How can you write a bot, which will be from the screen “Take” elements, to count favorable hitting, take the speed? How are such bots written?

Answer 1, Authority 100%

Fact 1. You can use WinAPI To send keystrokes and click / mouse movements in certain coordinates.
FACT 2. You can freely dig in the RAM of foreign programs (using lower-level languages), you can listen to the game with a game server: in which all key data (player’s position and rivals) is once transmitted regularly.

So with a simple bot, nothing complicated – intercept the necessary data, such as the position of trees and a player in a computer game. Your certain algorithm defines which keys to harm at the current time where to move the mouse. Perform, and further in a circle.

Some time ago earned on bots for browser games. So my bots were personally with browser extensions written only on JS. Plus expansion in this matter is that there is a DOM tree: that is, it is very easy to get comprehensive information about the world of the game. It is also interesting that you can “command” the game window, causing any scripts in the window in the window, and in the extension space, you can connect directly from the JS DLL library, for example WinAPI.

Answer 2

In many games there are APIs for cheats.
Bot can use it, or, for example, image processing.
A virtual
can well be used in a pair.
Pressing keys. In Java, this is quite realizable:

import java.awt.robot;
Public Void PressKey (Robot Instance, Int Key) {
  Instance.Keypress (Key);
Public Void Releasekey (Robot Instance, Int Key) {
  Instance.Keyrelease (Key);

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions