Game AI Overview

1. Features of game AI

With breakthroughs in technologies such as deep learning, modern artificial intelligence technology has made rapid progress, and has made progress in many aspects such as natural language processing, machine translation, and image recognition, and has affected real life.

If Go is also regarded as a game, then the famous AlphaGo series of artificial intelligence has already reflected the relatively high level of artificial intelligence in Go projects. In addition, there are also some artificial intelligences that have achieved good results in economic video games.

Conceptually, game AI does not refer to this type of AI.

Video games have included computer-controlled enemy characters since their early days, but well-designed game AI is relatively rare in the early history of video games. One of the widely popular works is the famous "Pac-Man".

 In the "Pac-Man" game, the player acts as Pac-Man and moves in a flat maze. The goal is to go through all the positions in the maze and eat all the beans. The enemy will organize the player, and Pac-Man will fail once when he is touched by the enemy.

In this game, the designer has made many types of AI, and the behavior logic of each enemy is different. For example, some enemies will roam randomly, some enemies will chase Pac-Man's current location along the shortest path, some enemies will target in front of Pac-Man, and some enemies will target beside or behind Pac-Man. Multiple enemies with different behavioral logics act at the same time, forcing players to constantly observe, make quick decisions and take action. While enemies always follow a certain logic, the situation changes all the time due to different enemy speeds, different level designs, and different player behaviors. Therefore, although the enemy's behavior pattern is the same, each game will give players a new experience.

In principle, surrounding Pac-Man with 4 enemies is not very difficult. For example, when Pac-Man enters some local areas with few exits, let the enemy characters guard several exits separately, and it will be difficult for players to find a way to break through. So why don't game developers consider design from the perspective of "how to completely trap players"? Obviously, if the enemies were really smart enough, the game wouldn't be as fascinating, just as it's unlikely that anyone would enjoy playing Go with AlphaGo all the time.

After understanding this example and comparing it with artificial intelligence in a broad sense, it is easy to understand what the main goal of game AI is, and the difference between it and artificial intelligence in a general sense.

Usually the goal of artificial intelligence is to solve specific problems . Whether it's speech recognition, image recognition, or machine translation, these kinds of problems have specific goals. Regardless of whether the results obtained by AI are correct or not, there is at least one definite answer or a relatively definite answer.

The goal of game AI is to allow computer characters to interact effectively with players , encourage players to actively try and explore, express the designer's ideas and concepts, and finally allow players to manage a certain experience and gain something. In other words, the core of game AI is not "intelligence", but "fun".

If fun and experience are the main purpose, then our understanding of game AI will be clearer.

2. Commonly used AI technologies

Due to the different core goals, the techniques commonly used to design game AI are also different. The most basic and commonly used method for game AI development is FSM (Finite State Machine).

FSM is essentially mechanized program logic, which can be realized with only the most basic branch statements. The difficulty of designing FSM lies in designing state transition diagrams for requirements and designing precise conditions for transitioning from one state to another. Only with a clear state transition diagram, it is possible to describe the rules with clear code.

In addition, in heavy AI games (such as football or realistic simulation games), Behavior Tree (Behavior Tree) is also a commonly used AI architecture method, and understanding the design ideas of Behavior Tree still requires state machine thinking as a foreshadowing.

3. Levels of AI

When people think about problems, their thinking is "layered". For example, in the game "Pac-Man", the player must observe the map at the beginning of the game to confirm the positions of the protagonist and enemies; , enter the direction command to let the protagonist move along the road and move in the expected direction. When the positions of the enemy and the protagonist change, the process from observation, decision-making to specific operation needs to be repeated again. Each process may be very short, after all, game masters are used to this kind of quick observation, decision-making and action.

The same is true for game AI. Generally speaking, a slightly intelligent AI character has two levels of "ideas" for decision-making and action. If there is only one level of thinking, the behavior will become extremely single.

The level of thinking is often not directly proportional to the difficulty of becoming. For example, the operation of AI characters to judge the current situation and switch the current state seems very advanced, but it is not difficult to implement. While low-level behaviors, such as moving to a suitable location along the map, this basic pathfinding behavior involves multiple complex algorithms.

General automatic pathfinding and moving algorithm, designed search algorithm, triangulation (handling obstacles in the scene), path optimization and dynamic obstacle avoidance and other algorithms, and there will be a lot of details in various specific scenes. deal with. It is quite difficult to implement a navigation system by yourself. Fortunately, Unity has provided a relatively complete navigation system. Designing game AI can start with learning the navigation system.

Guess you like

Origin blog.csdn.net/m0_63024355/article/details/132718514