📜 ⬆️ ⬇️

Artificial intelligence in flight simulators

image

The articles and interviews devoted to the creation of games, quite often referred to the term "artificial intelligence" or AI. As a rule, such descriptions are limited to phrases like “realistic AI” or “advanced AI”. However, for the simulator, namely, the simulator will be discussed below, the AI ​​plays a role no less than the physical model of the aircraft.


')
First, a little history and general concepts. It should be noted that the fundamental differences in the device AI of different aircraft simulators are quite difficult to find, since the optimal methods for solving such problems have been known for a long time and have been used everywhere. AI pilot, as well as any other AI "driver technical means" - this is the so-called "state machine". The entire volume of tasks solved by AI is divided into so many basic modes (states), in which the behavior of AI in each mode can be described by its rather simple algorithm with the minimum number of conventions. For a pilot from World War II, this is about 20-30 “states” such as “taxiing on the airfield”, “take-off”, “flight to the point”, “flight after the lead”, “search, selection and distribution of air targets”, “entry attack air target "," attack air target "and so on.

Each “state” also has a set of conditions — when an input and a set of parameters for an output occur.
Inside each "state" there is an algorithm for controlling the aircraft, its systems and weapons. It depends on a number of external conditions. For example, in the “land attack attack” state, there are five main decision-making levels:
The AI ​​builds a flight path and a graph of the change in speed along it, depending on its position, as well as the position of the ground target.
The AI ​​controls the control stick, the pedals and the throttle depending on the deviation from the constructed trajectory and the set speed, taking into account the current speed and height, as well as the characteristics of the aircraft.

The AI ​​continues to assess the situation around itself and, in the event of a threat or premature disappearance of the target, as well as the appearance of more priority targets, it leaves the “state of approach” and moves to the state that will best suit the current situation.

The AI ​​continues to monitor the teams coming from the mission’s script system, and if a new team arrives, it will stop executing the attack and go to the state corresponding to the execution of the newly received command.
AI monitors the state of the aircraft. For example, if the rest of the fuel or weapon does not allow it to continue the attack, then it will exit this state and go to the “return to base state”.

As noted above, this approach is applied to one degree or another in virtually all airfares. In this regard, the question arises - if we compare different projects, why then is the difference in the general logic of what AI does in the game so noticeable? As usual, "the devil is in the details." The general approach to the architecture of AI “settled down” in the industry many years ago and is not much different in different projects. However, the internal decision-making algorithms within these “states”, as well as the conditions for switching between the states in each project, are made differently, and it is this level of AI implementation that determines the differences between the aircraft AI behavior in different projects.

AI aircraft in Rise of Flight (RoF).

AI for the project RoF, basically, was made in the image and likeness of predecessors. However, we needed to introduce some kind of zest that would distinguish our AI from others for the better.

The AI ​​in the RoF controls the same plane as the player controls, without simplifying the physical model. It is pleasant for the user that the AI ​​planes, as well as the player’s aircraft, move “as if they were alive”, and they also behaved plausibly during takeoff / landing, maneuvering and upon receiving damage. The player does not feel that “the AI ​​twists me because it flies along the rails,” and vice versa, does not feel that “it is too easy to twist the AI ​​because it flies using a simplified physical model.” Everything is fair, and the players felt it.
Special emphasis was placed on an integrated approach to the logic of the “state of search, selection and distribution of air targets”. The selection algorithm was made very extensive, with many additional conditions. They are aimed at increasing the influence of the air situation around the AI ​​aircraft, at making decisions on the selection of targets and their distribution among the followers.

image

I would like to dwell in more detail on the second feature of our AI. On the algorithm for selecting air targets. First, we began by drawing up an expert assessment of how goals were selected in life. And both for an experienced pilot, and for a beginner. To do this, we invited a couple of well-deserved players in the IL-2: Stormtrooper and historical consultant. For several hours they were interrogated with predilection about which factors of the air combat situation influence the choice of target and how they do it. It is clear that the main problem in this case is the choice of a “point of reference”, a measure, with which all other factors of the combat situation could be compared. With such a comparison one could already compare them with each other.

As such an evaluation criterion, the approach time was chosen. Then followed a series of questions, for example: “Imagine, expert, here are two goals before you. Before the interception of one, you need to fly a minute, and to the second - two minutes (one minute more), but the second is faster (that is, more dangerous). As far as it should be faster, so that, despite the fact that it is further, you (or a real pilot) would still attack a more distant, but faster target. ” To which the expert replied, "well ... I would fly to attack a faster target, which is a minute farther away than a slower target, if the difference in target speeds were more than 100 km / h." Thus, we obtained a comparison of the importance of the difference in target speeds and the difference in interception time. Further, in the same way, comparisons of priorities were drawn up with respect to the interception time for all other parameters, including:

- Difference of maximum target speeds at their current altitudes.
- Difference of maximum targets climb rate at their current altitudes.
- Difference heights of goals.
- The difference in the number of other enemy aircraft in the target area.
- Difference in class of targets (fighter, scout, bomber).

Having processed the expert assessment of several people in a standard way, having corrected these estimates for different levels of AI complexity, we obtained a standard method of sorting the goals according to their priority. If we take that the difference in the time of interception of 60 seconds gives +1 in the piggy bank of the “priority of the target”, then the difference of 120 seconds will give +2. An expert comparison suggests that if 60 seconds is +1, then the difference in maximum speeds of 100 km / h is also +1, and the difference of 50 km / h is +0.5. And so on in all respects.
Next, the target is selected from the list of all visible AI-pilot targets: first, those that fall under the filtering conditions are excluded:

- Targets that will take too long to intercept (because of the long range, or because of their great height, or because they are very high-speed)
- Targets around which there are so much more enemy fighters than allied fighters around a player’s aircraft. Thus, the fight with them is suicidal (this condition mainly affects the AI-aces).
- Targets higher than the maximum flight altitude of the AI-pilot.
- Targets significantly higher than the AI-pilot, which have a significantly higher climb rate.

After filtering "unpromising" goals, they are sorted by priority. To do this, each goal that passes the filter is taken and compared with all other goals for all the above-mentioned expert parameters. The sum of the parameters is a comparison of the priority between a pair of goals. Then for each goal all pair estimates for those pairs in which she participates are summed up. Next, the goals are sorted by the final amount, from most to less.

Thus, we have a list of goals, sorted by their priority. Next, you need to assign the target slave. This logic depends on the level of AI and on the number of targets. The high-level AI leader, with superiority in numbers and height, will send only a part of the followers into battle, and he himself with the rest will cover them at high altitude, in case additional enemies appear. The low-level AI leader will simply send one aircraft of his group to each target, starting with the priority ones. A high-level AI leader will send at least two aircraft to the target. Well, and so on.

AI-slaves also monitor the situation. Even when attacking the target designated by the leader, in the event of the appearance of another opponent who poses a serious threat to the slave himself, they will switch to a new target. The followers also monitor the situation around the leader - if he is in danger from opponents who are not assigned to attack, they will switch to the attack of these enemies in order to cover the leader. Slaves stop attacking the designated target if they are too far away from the leader during the attack, and return to it.
As a result, RoF received the logic of target selection by the AI ​​leader of the link that is closest to the actual practice of air combat among all the analogues presented at that time. Moreover, this logic turned out to be transparent and easily corrected, simply by changing the values ​​of the above “paired parameters”. In addition, RoF implements many interesting features of the behavior of AI: anti-aircraft maneuvers, a system for recording the visibility of a target, taking into account illumination, closure by clouds, and spotlights. At the same time, the illumination of the target is also influenced by the sources of light on the target itself, such as aeronautical lights, machine gun fires, fires.
It should be noted that some users perceived some of these "features" for bugs. For example, when the AI ​​leader of a player’s link did not want to attack a significantly superior enemy force. In this case, the AI ​​leader simply did not want to get involved in a fight in which he and his link are unlikely to survive. Take another situation where the AI ​​leader did not want to attack the scout, going right over the head of the player’s link, at high altitude. In fact, the AI ​​leader just figured that the time to climb to this intelligence officer is so great that by the time this happens, he will most likely fly into his territory. In these cases, we had to explain that “this is just an approximate model of behavior, high-level AI pilots are not stupid and try not to get involved in adventures”. Although, of course, with such a high level of AI complexity as in RoF, the problems could not be avoided. We systematically isolated and corrected them. I would like to say a special thank you to Alexander Petryaev, an AI programmer who created the software architecture and code, that for 4 and a half years they have served in the RoF project, which will also serve for many years as the basis for the AI ​​pilots in the new project of the IL-2: Stormtrooper ".

AI aircraft in the "Battle of Stalingrad" (BZS).

It should be noted that the AI ​​of the pilot in RoF was originally developed with a long-range view on the aircraft of the Second World War. With minimal changes, AI RoF could also be used in the IL-2: BzS. However, we decided that another step forward in this area was necessary and we chose the point where such changes, in our opinion, would be most needed. In RoF, in designing and developing AI, we focused on the logic of searching and selecting targets, and in BZS, we decided to focus on combat maneuvering while conducting close air combat. In RoF, in a "state of attack of an air target", AI fighters actually always perform one universal maneuver - they turn on the target in the shortest 3-dimensional arc, wherever the enemy is (behind, to the right, above, below). For the First World War, this approach was justified for the reason that the air combat on the aircraft of that period is very compact, fleeting. Turning time is very small, maneuvering occurs at speeds sometimes less than 100 km / h and it is very difficult to decompose it into “maneuvers”.
However, during the Second World War, the picture of air confrontation is radically different: the battle became more ambitious, the distances between aircraft during maneuvering were much longer, much higher than speed, much longer the turnaround time. In this situation, the structuring of maneuvering combat becomes more obvious, it becomes possible to formalize this structuring. This task was undertaken by our new AI programmer, Ilya aka "naryv" Steshov. I must say that, first of all, he started fine-tuning and debugging AI in the RoF project. All the changes that have occurred in the AI ​​this spring are his merit and the result of his activities. In addition, experts were drawn up to draw up the terms of reference, who gave advice on combat maneuvering issues - what maneuvers were used, when they were used, how the pilot level affected the use of certain maneuvers, what were the conditions for starting and stopping maneuvers. Having received an expert assessment, we chose the following way to solve the problem: “the state of attack of the air target” became the “macro level” that opens up inside the “state machine” of the lower level. Each maneuver melee air combat was designed as a separate "state" of this new low-level machine. At the same time, the logic of the “macro state of attack of the air target” continued to function with all the conditions of entry and exit, which made it possible to make this innovation within the framework of the RoF AI architecture without significant labor for architectural changes in the upper level of the state machine, as well as the rest of the AI ​​logic. What are the maneuvers and when applying the AI ​​fighter in melee in BZS:

- "Revolving and shooting." This is the main mode, generally similar to the targeting algorithm used in RoF. It is used when the target is close to the aiming line and you need to tighten it and shoot.
- "Candle". The plane dramatically goes up at maximum engine operation. It is used to save energy when there is a large excess in speed when the opponent “slips”. Translates the speed of the aircraft in height.
- "Half Loop". The aircraft performs half of the Nesterov Loop. The purpose of the application is the same as that of the “Candle”.
- "Hill". The plane gains height in a straight, rather steep trajectory (but not vertical). It is used when a target “slips” at a moderate speed excess. In the case when the attack was made from the side or "in the forehead." The purpose of the application is again the same - to save energy by converting speed to altitude.
- "Fighting spread." The plane gains altitude in a steep spiral with a loss of speed. The purpose of the application is the same as that of the Gorki, but it can also be used after an attack on the target from behind.
- "Rising spiral". The plane performs a turn at the maximum gas in the direction of the target, at a constant speed and with climb. It is used in cases when, in the course of an attack, the target is higher than more than 100–200 meters and to the side of us (not at the heading).
- “Downward spiral”. The plane performs a turn at the maximum gas in the direction of the target with a decrease and a set speed. It is used when the target is lower than more than 100-200 meters and to the side of us (not on the course). It can also be used to attempt to throw the enemy off the tail with an adequate height reserve, since in descending spirals very high and prolonged overloads develop.
- "Forced U-turn". The aircraft performs a turn in the horizontal plane at the maximum gas and overload. It is used when the target is at approximately the same height as our plane, to the side of us, but in the forward hemisphere.
- "Bend". The aircraft performs a turn in the horizontal plane at the maximum gas, overloading maintaining a constant optimal speed of the turn. It is used in all other cases.
- "High Yo-Yo". When performing a "turn", the plane slightly reduces the list for a short time, slightly gaining height due to some loss of speed. This is a sub-mode maneuver "turn". It is used when, at the beginning of the turn, the speed turned out to be significantly higher than the optimum, and, in order not to waste energy in vain, this speed translates into a height advantage.
- "Low Yo-Yo". The plane during the "turn" slightly increases the list for a short time, gaining speed slightly due to the loss of height. This, in turn, allows you to quickly accelerate the turn on the target by increasing the overload. This sub-mode of the “turn” maneuver is used when the angle to the target does not change for a long time (when planes cannot bypass each other in a bend).
- "Coup". The aircraft "turns back" and performs the second half of the "Nesterov Loop" with maximum overload at the maximum gas. It is used when it is necessary to throw the enemy off the tail and there is an adequate supply of height.
- "Slip." The plane rejects the rudder, continuing flight in a straight line. It is used to create a false impression of the direction of flight for an enemy who is aiming and shooting from a distance.
- “Scissors”. . , , - , .
— « ». - «» . . -.
— « ». - , . , .

image

, , , - :

— . , (, , ).
— , - : - ; , . , , .
— , , , - .
— «», , .
— , , . , - .
— - , Ju-87 -2 .
— . - , .

:

— - /.
— - .
— - , , : , , , , , , , , , , .

, . , . RoF . , , . - .
- : « »? – , , - -. «» «» -. « », , , . , , – «» -.
, , - . . – , . . Join now!

«Han» , «-2 : ».

Source: https://habr.com/ru/post/211655/


All Articles