The first successes of a complex game bot

(Invitation to a joint open source project)

Why do people write game bots? - There are many possible reasons, one of them, of course, is the purely academic interest in solving the complex AI problem. In the literature on the philosophy of CS and the philosophy of mathematics, programming has been repeatedly compared with mountaineering. It is hard to say who was the first to make such a comparison. In our opinion, it is very suitable for our case, therefore, at the risk of appearing not original, we still make the statement: writing a non-trivial bot for a programmer is a challenge like climbing a peak for a climber. The more inaccessible the peak, the stronger the desire to conquer it. Therefore, first of all, you need to choose a truly worthy peak in an interesting mountain range. One of these arrays with many complex peaks that have not yet been conquered by anyone is the game "Space Rangers 2 HD: Revolution (KP2) - continuation of the series of games “ Space Rangers ” (KP). Experts in the gaming industry do not need to present games in this series, since this is one of the rather rare cases of computer centenarians: the first game in the series developed by the Russian studio Elemental games, was published by 1C in 2002. Interesting story of this game series is well reflected in the Wikipedia article devoted to these games, so we will not repeat here. we only note that now the development, support and sovershens Vovan KR2 studio is engaged in SNK Games is- .

It is no coincidence (and certainly not for empty advertising) that we mentioned the developer, since the choice of an object for botany depends on his attitude in many respects. Many developers have a very negative attitude not only to bots, but even to third-party modifications (mods) of their games, distance themselves from user-players, reducing support to purely formal answers to a narrow circle of frequently asked questions, such as “my game does not start”. Moreover, the answers on the hotline are usually given by specially hired operators who are not highly qualified, who are not busy in the development of the game and who do not know it from the inside. As for updates, if they come out, then with purely cosmetic changes. Feedback "user-developer" almost does not work. Radical ideas such as improving the balance of the game in such cases are usually ignored. In the case of KP2, the picture is completely opposite. The game is updated periodically, with each update containing major improvements. Major developers supporta forum where anyone can get a first-hand answer on the device of the game (in particular, on the algorithms used) and express their opinion. On this forum, you can find and download many third-party mods, and developers develop interfaces that facilitate modding, publish documentation on these interfaces in the public domain and answer questions arising from modders. We see the same benevolent attitude among developers and to botanical construction. Largely thanks to this, by now two simple bots have been made, which are very popular among users: a bot for generating starting galactic maps and analysis of a dump of the current game progress SRHDDumpReader (author of Burning Daylight) and the bot for the generation of spacecraft hulls SR2HDShipbuilder , made by the author of this article. Currently, we (together with tactic ) are working on another bot SR2HDPascalBot , intended for passing planetary battles (robot battles). We will talk more about this bot in more detail, but first we will say a few words about the subject area, that is, about planetary battles.

image

Planetary battles (PB) are separate small tasks in the main game, which, however, can be selected from the list without going through the main game. Tasks are performed in real time with the possibility of pauses, but without the possibility of intermediate saves. Each task has its own map of the game world, which is an arena (for example, an island with mountainous and lowland landscapes), where the battle between player’s robots and robots of one or three enemy parties takes place (they also fight with each other). The goal is to destroy all enemy robots. Usually, each side (including the player) has a base on which, with a sufficient number of resources, one or several robots can be built from modules. The range of modules includes various types of weapons (rocket launcher, machine gun, flamethrower, etc.), movement devices (wheeled chassis, crawler-mounted chassis, on an air cushion, etc.), as well as different robot housings that allow you to install a different number of weapon systems, and some other modules. The production of different modules requires a different amount of resources. Resources include: titanium, electronic circuits, energy sources and plasma. Resources are produced by factories. In order to capture an object (plant or base), you need to bring your robot in contact with a special platform at this object. The limit of the number of robots that can be built at a given moment depends on the number of bases and plants owned by the party. There are many more rules that we omitted in this short description, since they seem insignificant to understand the general principle. and some other modules. The production of different modules requires a different amount of resources. Resources include: titanium, electronic circuits, energy sources and plasma. Resources are produced by factories. In order to capture an object (plant or base), you need to bring your robot in contact with a special platform at this object. The limit of the number of robots that can be built at a given moment depends on the number of bases and plants owned by the party. There are many more rules that we omitted in this short description, since they seem insignificant to understand the general principle. and some other modules. The production of different modules requires a different amount of resources. Resources include: titanium, electronic circuits, energy sources and plasma. Resources are produced by factories. In order to capture an object (plant or base), you need to bring your robot in contact with a special platform at this object. The limit of the number of robots that can be built at a given moment depends on the number of bases and plants owned by the party. There are many more rules that we omitted in this short description, since they seem insignificant to understand the general principle. To capture an object (plant or base), you need to bring your robot in contact with a special platform at this object. The limit of the number of robots that can be built at a given moment depends on the number of bases and plants owned by the party. There are many more rules that we omitted in this short description, since they seem insignificant to understand the general principle. To capture an object (plant or base), you need to bring your robot in contact with a special platform at this object. The limit of the number of robots that can be built at a given moment depends on the number of bases and plants owned by the party. There are many more rules that we omitted in this short description, since they seem insignificant to understand the general principle.

The task of the SR2HDPascalBot game bot is to automatically maintain the PB in order to win. To solve this problem, on the selected PB map it is necessary to describe the map parameters and bot actions in a special script - there is a script for each map. T.O. One of the components of our bot is a script interpreter. Another obvious part is the pattern recognition system, which allows the bot to get information about the momentary situation in the game world from a screenshot. And the third standard part for game bots is the imitation of user commands, i.e. keyboard and mouse emulation. As an interpreter, we used the free Pascal P5 interpreter, which is a modification of Wirthowski Pascal P4. Pascal P5 is written in Pascal and, in principle, should have the ability to self-compile, but we do not have the task of spinning Pascal from scratch, so we translated the source code of the interpreter into the Pascal Delphi-7 OO, making a simple IDE with a GUI and using the standard Windows API. Special functions for scripts (for example, the function of imitating the left mouse button click) are described in the interpreter as predefined, similar to the standard ones (for example, writeln, odd). The project is at the initial stage, and we managed to get preliminary results from only two PB cards. Our bot passes the first simplest (training) map, always winning, in the second more complex map it sometimes wins. Interestingly, the bot passes the first map in less than five minutes, while the author of this article spends 6-10 minutes on its passage. The best result for the second map was the result of 5 wins out of 10 attempts. Unfortunately, it did not play. The bot spends up to an hour on the second map, so instead of wasting time on larger tests to obtain reproducible results, we decided to focus on improving both the script for this map and the bot itself. As one would expect, writing a bot in draft form was much easier than good scripts for it. We decided to focus our efforts on improving both the script for this map and the bot itself. As one would expect, writing a bot in draft form was much easier than good scripts for it. We decided to focus our efforts on improving both the script for this map and the bot itself. As one would expect, writing a bot in draft form was much easier than good scripts for it.

image

So, there is a large amount of work, including purely experimental, research in the field of AI, and with such small forces as now — only two people — it is unlikely to be successfully completed. Among the fans of the game КР2 there are a lot of professional programmers, and in the hope of them we have already placed an invitation to take part in this project. In this article, we are addressing specialists who might not have heard of this game, but would like to participate in solving a really difficult task for a game bot. In our opinion, KP2 is such a successful and interesting model of a certain virtual universe that it is worth the time to thoroughly familiarize yourself with this model. But we do not set as our goal the propaganda of this game. A complex and interesting bot can be made for any game suitable for this, without particularly delving into the game itself.
Source code .

Also popular now: