
Almost thirty years ago I was working on my first commercial project:
Steve Davis World Snooker , one of the first billiards games in which there was a computer player. The artificial intelligence created by me was very simple. The computer simply chose the ball with the largest “cost” that could be pushed into the pocket, and scored it.
Since he knew the exact position of all the balls, it was very easy for him to hit each time. But this was only suitable for the highest level of complexity, and for the easy mode, I simply added to the artificial intelligence a random angular deviation upon impact.
')
By the end of the project, the customer informed us that the AI was “too good.” I was puzzled. I decided that he wanted the computer to be a little less accurate in expert mode. That's why I did it. But after that, I heard complaints about decreased accuracy, and at the same time, the AI remained too good.
Finally, customers visited our office and personally showed what they had in mind. Gradually it turned out that in fact they considered the “easy” regime to be a problem.
They liked that the computer often missed, but they thought his positional game was too good. It turned out that the computer constantly puts the white ball in a comfortable position, or in a safe, or advantageous position relative to another ball. They wanted to change that.
The problem was that the AI had no positional game! The final position of the white ball was actually completely random. The AI simply counted where the cue-ball should hit the desired ball in order to hammer it into the pocket.
Then he hit the ball in this direction with a speed proportional to the desired distance, taking into account the angle and a certain accuracy factor. The position of the white ball after the strike was never calculated, and quite often it turned out to be in the pocket.
So what was the problem? Why did the customers think that the AI was “too good”, if in fact it was completely random?

People tend to animate computer opponents. We think that the computer performs the thinking process, as was the person in a similar situation.
We see that the ball stops in a favorable position and we believe that the computer planned this way.
This effect is complemented by the ability of the computer to score balls from anywhere, that is, all positions are equally beneficial for the computer.
Therefore, he can drive the ball behind the ball, not caring about the positional game at all. A person cannot score balls with each hit, so the player assumes that the computer uses positional play.
Design or code?
Is this a design or code issue? To a certain extent, this depends on the type of game and on whether AI-controlled opponents should intentionally imitate a person in the same situation as the player.
In a one-on-one game, for example, in billiards, chess, or poker, AI decisions are very deterministic at the level of pure code. In the game “one against all”, for example, in FPS, it is usually expected that opponents will be weaker than a person.
In the end, you are in a situation in which one person fights with endless hordes of enemies. In other genres, in particular, racing games, the player confronts his opponents equal to him. Here, the expected level of AI is somewhere between the AI of chess and FPS.
The more computer AI must imitate the behavior of a living person, the more this task is assigned to the programmer. Most AI chess games created by programmers. Game designers are more focused on the presentation.
In FPS, the code is usually much simpler than in AI chess. It has path finding algorithms, state transitions and basic behaviors.
The main part of the behavioral content is created by game designers, usually in the form of scripts. In addition, designers are responsible for coding actions, goals, and reactions that mimic human behavior.
One on one!
In some one-on-one games, such as chess and billiards, the computer has a big advantage over the player. Modern chess programs, for example, Fritz, are much stronger than almost all computer players.
In billiards, a computer can be programmed so that it never misses. However, people want to play with an opponent that matches their skills, so there are usually several AI levels chosen by the player in the game.
The simplest way to add stupidity in AI is to reduce the number of calculations that it is allowed to perform. Chess AI when choosing a course usually performs billions of calculations. The more calculations he does (and the more time he spends), the (usually) it will be better to play the computer. If you reduce the number of calculations performed, the computer will play worse.
The problem with this approach is that it reduces the realism of computer players. By reducing the amount of computation, the AI starts making incredibly stupid mistakes. So stupid that no man will make them. The artificial nature of the game becomes apparent and destroys the illusion of confrontation with a real opponent.
Do not forget what we want to achieve: we want people to get an interesting gameplay. Regardless of the type of game, we want the player to feel the difficulty, so that if he wins, he has a feeling of achievement. We need to create the feeling that players are fighting against someone who really wants to beat them.
By reducing the amount of computation, we create an AI that tries to win, but is so limited that it leads to unrealistic gameplay. But do the players really care what happens in the logic of the game? What if we do not cut AI, let him instead play at full strength, but can deliberately “merge” the game?
Intentional loss
In sports, “draining” a game means that one of the parties makes a series of intentional mistakes that look natural but lead to loss. This behavior is very much condemned by the players and fans, because it is assumed that the competition takes place between two equal rivals, or at least two rivals who are equally keen to win.
But in computer games it is impossible to find an equal opponent. They are a struggle of people and cars. One of the parties has the advantage of billions of calculations per second, the second has a human brain with enormous possibilities of parallelism.
Any equality here will be an illusion, and we want to strengthen and maintain this illusion with the help of intentional mistakes and artificial stupidity.
In order for the game to be interesting, the computer must intentionally lose. When you defeat a computer, it is an illusion. The computer allows you to win. We just want him to give us a win, but so that it feels interesting.
AI programmers need to get used to this thought. We manipulate the game, create artificial stupidity, fake stupidity. But we do not prejudge the outcome of the game.
We do not set up the AI so that it loses; rather, we give the player a reasonable chance of winning. If a person plays poorly, the AI can win, but the player will at least feel that he almost won a strong opponent, and will be ready for another game.
Hidden handicaps
Computer chess expert Steven Lopez (see list of references) says that it is acceptable in a game between people when a high-class player gives a much weaker advantage at the beginning of the game by removing some of his pieces from the board.
When the game starts, an experienced player and novice will still play at the level of their skill, but the game is more balanced. The master does not need to play "stupid" to give the beginner a chance.
However, people who play against the computer do not like it when they are given such an advantage, and they prefer to play the whole board against the AI at about their level.
Fritz programmers have found such a solution: the AI independently creates such situations that a person (after some thought) can use to gain an advantage in position or figures. After the player has such an advantage, the AI continues to play, seeking to win.
In this case, AI in no way becomes more “stupid”. Anyway, in fact, a little more computation with more complexity is performed.
The goal of the AI is not to “strive to win the game,” but “to act as if you are trying to win, but to give a person an advantage of one pawn, and then strive to win.” AI must be smarter to appear less intelligent.
AI in poker
When I programmed AI for Left Field's
World Series of Poker , AI calculations were essentially the same for all levels of difficulty.
Based on well-known cards, the computer calculated the odds of winning, and estimated the strength of the opponent’s hand based on the history of the bets. Then the odds were used to calculate the level of profitability on the basis of which the decision was made (to fold, answer or raise the bet).
There are many special rules and exceptions, but in general this is all. Artificial players performed the same complex calculations, simulated tens of thousands of layouts to calculate profitability.
It was only after the completion of these calculations that differentiation was made. At this stage, the strong players chose their best move, and the weak AI made intentional mistakes.
For a weak poker AI, a deliberate mistake consists of finding out what needs to be done, and then not doing it, but at the same time you should strive not to look silly.
For example, if a live player raises a bet a lot, but the AI knows that there is a 75 percent chance that he has the strongest hand, then it will be a deliberate mistake to fold. The probability is high that AI can win, but we pretend the behavior of a weak player, and weak players often fold at a high rate when they are not sure of their chances.
Conversely, weak live players often respond when their chances are low. This is a natural behavior, and it allows us to reduce the power of a computer player. However, he will not look artificially stupid.

Such intentional errors were implemented in a probabilistic way. Imitating the stupidity of the AI did not always pass, when it seemed that the live player was bluffing, he simply had a greater likelihood of this.
This approach worked very well in poker, a game with a high degree of randomness, because the player could never understand in each particular situation that the AI actually made a mistake.
Since the AI still performed the entire set of calculations, he never made inhumanly stupid mistakes. The level of artificial stupidity was introduced by increased recklessness, which allowed weak and medium players to enjoy the game.
Artificial inaccuracy
In billiards and shooters, computer AI has absolute accuracy. The AI in a shooter up to a billionth part of an inch knows where the player is and can get a squirrel in the eye at a distance of five kilometers. The same is true in billiards: the AI knows the position of each ball and can calculate the final position of all the balls before impact.
When I created an AI for snooker, he could precisely pitch the ball into the hole from two sides and almost always could score the maximum number of points (except when he pushed the white ball into the pocket because of the lack of positional play).
It was obvious that it was not interesting to play against such an opponent, so even at the highest levels it was necessary to reduce the accuracy and limit the number of strikes against the board.
Simply reducing the accuracy of AI is not always the best way to improve gameplay. As I learned from the example of the “positional game” in snooker, random results in favor of the computer are perceived as intended. If the ball stops in a good position or the poker AI successfully responds and wins on the last card, then this is perceived as dishonesty or even a scam.
Therefore, instead of reducing the accuracy, I proposed to increase it. In order to provide an interesting and dynamic gameplay, AI must manipulate and create situations that a player can take advantage of.
In billiards you need to make a non-random blow, at which it is unknown where the cue-ball will stop. The AI must deliberately miss the pocket and make the ball stop where the player can make a good hit.
In a shooter, enemies should not just jump out of their blind spots, sometimes they should open when a player is close to them and moves in their direction. They must “accidentally” be substituted by the line of his fire in order to make the game more interesting.
Lucky draw
It is not interesting to play against the ideal opponent. But in the victory over the "cripple" is also nothing exciting. To create a more interesting gameplay, we need to introduce the concept of artificial stupidity and deliberate mistakes.
Intentional mistakes look like mistakes from the AI, but in fact are carefully calculated ways to “drain” the game to make it more fun for the player. At the same time, competitiveness does not go anywhere, because the player still needs a certain level of skill.
For a programmer, adding intentional errors is always more difficult than simply reducing the accuracy of AI, but it does provide players with a more enjoyable gameplay.
Bibliography
Liden, Lars. “Artificial Stupidity: The Art of Intentional Mistakes,” in AI Game Programming Wisdom 2, Charles River Media, 2004.
http://lars.liden.cc/Publications/Downloads/2003_AIWisdom.pdfLopez, Steven. Intelligent Mistakes, Chessbase News, 2005.
http://www.chessbase.com/newsdetail.asp?newsid=2579