Game Engine Analysis 10

zhaozj2021-02-16  54

Game Engine Analysis 10

Original author: Jake Simpson Translator: to the sea Email: GameWorldChina@myway.com

Part 10 Artificial Intelligence and Navigation (Path Discovery)

Artificial Intelligence (AI)

We have used the other nine chapters to introduce the game engine, and now let us go deep into the very interesting and important artificial intelligence theme. Artificial intelligence is now changing one of the most important game development fields that is second only to game engine rendering capabilities, it is true. Until for approximately two and a half years ago, the game seems to be mainly considering how many polygons you can render, how beautiful is your eyes, and ... How is the chest of Laura ... Since we are now able to render very Real breasts, the center begins to transfer to us in facts doing anything in those polygons (ie, playing games). Because it gives you the actual play of the game's stimulus and participating in the game world, artificial intelligence is very important in this field.

Artificial intelligence includes all things, from which new bricks decide in Tetris (this largely knowledge of an additional generator), until the creation of group-based strategy games, these games and you interact, and actually Learn to you when you play. Artificial intelligence contains many rules, if you (as a game developer) does not spend enough time to make it work correctly, it will bite a bite on your ass. So let us talk about what rules? This way you can better understand the artificial intelligence system is really how complicated. In order to avoid legal disputes, we will use a hypothetical game rather than a real game as an example.

Suppose there is a bad part in our game living in the 3D world, doing their things, and if you make their normal order they will resist you (players). What is the first thing you have to decide is what they are doing? What are they guarding? In the inspection? Playing a party? Do you buy food groceries? Is it finishing bed? The baseline for establishing a behavior is one of the work of the game developer. Once this is this, you have a total of NPC (non-player roles) or computer-controlled 'people' to restore things, and the player should be able to be completed.

Once we know what an NPC role needs to do - such as it is guarding a door, and in this area, the NPC must have 'World Consciousness'. Game designers need to determine how NPC's artificial intelligence will see the world, and its knowledge range. Will you just say "Computer knows everything going on"? This is often considered a bad thing, because it is very obvious that the computer can see and hear something you can't see and hear, this is treated in cheating. Not an interesting experience. Or you will simulate his horizons so that he can only react with things he can see? When there is a wall appearing, there is a problem, because you start entering the 'tracking' routines I mentioned in the ninth section, see if NPC is trying to respond to people blocked by the wall. This is an obvious artificial intelligence problem, but this even more complicated when it comes to the door and the window.

This is still more complicated when you start adding auditory awareness for the AI ​​stimulus routine. However, this conscious is one of the key "little things", which makes the imaginary game world seem to be more realistic, or can remove suspected suspense. If you have encountered such a thing, please raise your hand: You will fight with an NPC in the gun battle, eliminating an NPC, you walk around the corner and encountered another NPC still keeping his default behavior mode, not realized Just happened. Now, the gun is a noisy thing, the gun war may have clearly reminded a "listening" NPC in progress. Avoiding this skill is to find an effective way to determine whether the distance of the sound source (that is, your weapon is transmitted) is close to NPC to hear. Next is a decision-making routine. What kind of behavior you try to achieve when our patrol NPC characters can be heard but can't see something? Do he look for it? Ignore it? How do you decide what is an important voice, should he go or not to investigate? As you can see, this will become very complicated. There are many ways to build code that handles these things, but it is usually a good idea to create a system that does not work for all NPCs for all NPCs, which is based on text files outside the game engine. The attribute established in the middle. This does not require the programmer to change the AI ​​for a given role, and if you make changes to the game code, it will automatically apply it to all roles immediately, which is a good thing in most cases.

Other world awareness problems will come out, such as this situation, two guards are standing next to each other, and you have done one with sniper weapons, and another thing standing is completely unwanted. Furthermore, the details of compliance with the real world behavior are the difference between a good game and a great game.

Let us say that you have already prepared all the stimulus - you have scanned the world, deciding that NPC should respond to some things in progress - he heard the player's role sound - and you (game developer) I decided what he should do to this - he will go to investigate. What is more complicated now. How did he leave the present position and reach the place he thinks to make a sound, and will not think about the usual number of fools to run into the wall, come to the furniture? Continue to see ...

About the correct path --- World Navigation

Fast and accurate world navigation (also called path - discovery) has recently become a gaming developer's holy cup. It is very difficult to make it feel very difficult. You need geographic knowledge of local world - the edge of the wall, steps, cliffs, and buildings. You also need knowledge of objects in the world - such as furniture, cars, especially others. The real final factor is the problem, and we will return to this.

World navigation is usually divided into two fields, world navigation and local navigation. Both actually only range from the scope, but most of the programmers treat them, because this is easy to handle. The world navigation routine handles understanding rooms, doors, and general geography, and calculates a path to the player or role from the A point in the world. "It will let you arrive from a point", this is a very easy to say, isn't it? It is easy to say, but it is difficult to do. Understanding the world is a very complex issue, I have seen many solutions. Quakeiii's robot complies with the previously processed map, general statement, using the original map. The preparation instrument detects ground elements, marked by map builders, and built a simplified map that only uses the world. The robot does not care about the wall, because they never approach them, just like they follow the maps, it has been designed to be constructed inside the wall.

Other methods build some small nodes in the map itself, AI can follow them. These nodes are typically built inside each other, there is a connection from a node to all other nodes, the character AI can "see ', so you make sure that moving from a node to another node when AI Will not try to cross the wall. If there is a door or landing, you can use these nodes to encode the path information, so NPC can use the appropriate behavior - wait for the elevator, open a door, or jump from another. This is actually the system used by hereticii, and the system used by Raven in their other games. About this theme, 3D Realms Jess Crable, now working for Duke Nukem Forever, if it is said:

"Navigation is a huge challenge in many ways, mainly when there is a lot of things that are happening and some non-planned things, such as obstacles. In order to avoid and (or) navigation (for example, Like another AI), AI needs to know what happened around it. Compare another huge challenge is a real sense. If Ai is expressing some things that players see in real life, such as a person Or a dog, let it look more difficult to look realistic. "

Then it is local navigation. We may have a path to let our NPC from him in the world, move to what he thinks to hear the sound, but you can't blindly follow this execution and expect to look good results. This nature is tended to be very specific to a given purpose. When you run from a room to another room from a room, it is very good, but if you try to guide him through a huge room, the path node method is easy to eventually get some strange discovery path. These paths are not dynamic. Because they are prepared in advance, they are not easy to take into account any dynamic changes in the world. The table may have been moved, the chair is destroyed, the wall is devastated, of course, people will move. This is where local navigation is different from the world navigation. It must consider local world and navigation NPC is crossing inside. It must know the surrounding environment, what can be selected, and decide which one to choose.

The biggest problem in local navigation is the other NPC. Given a specific routine for discovery paths, if you have more than one NPC in the same general area, they all try to reach the same location in the world, and the result is that they are very easy to have the same path. Then they tried to travel along this path, and the results were encountered together, then spend all the time attempting will be separated from each other, and once they succeeded, they tried to reach the target again, and then we saw the same thing again. All this looks very stupid, this is not the effect of most people want. So there is a need for some changes in path discovery to avoid this situation, requiring some code that properly handles avoidance. There is a lot of algorithms that can help solve this situation.

Artificial intelligence and role animation problem

Of course, when the character walks yourself walking in the world, you must fully decide what animation you want roles play. It sounds no light weight? no. About this theme, Raven's Chris Reed-Soldier of Fortuneii uses the current person in charge of the AI ​​system named Lich - if it is said:

"I can tell you at the moment, we have the greatest difficulties in smooth moving. Trying to make five characters in a multi-hill's long grass jungle is a very difficult problem. Let the underlying system are perfect Important, because unless the role is at a lower level (avoiding walls, appropriate animation) looks truth, they cannot effectively express any higher-level decision intelligence. Because this separate reason, the movement of animation and underlying is the most Important and most difficult to implement. It does need to perfect. "

So we have let our character arrive at the B point from the point. He has cross the world, avoiding obstacles on the way, playing correctly, now reaching here. He saw you. What are you doing next? It is obvious that more decisions are made. He will shoot you. awesome. You respond to shooting. What is it now? When he tried to escape, now you have experienced the same thing again. In order to make these situations look convincing, you have seen a lot of problems that must be handled here. If you create your AI to use a behavior without animation to make NPC, this can be mixed. Some AI in Soldier Of Fortune is such an example. They were accused, because the bad guys did not respond to stimuli in an appropriate manner. When they obviously should do this, the enemy NPC does not sweep, or does not escape. Some questions is that they did not shoot the animation of the enemy NPC, or let them go back, because of the problem of space. Therefore, all the greatest AI codes in the world can solve this problem. This is an important thing to consider.

Want to know the difficulty of hidden? Look at all the descriptions in front, then try to apply it to a set of NPCs, these NPCs must speak, set their goals, communicate with each other, but do not hinder each other. Once you do this, try those code, as the player's teammates do these, but don't hinder him in the gun battle. It is complicated now. Then this is fun. This is the most difficult part. Raven's Chris Reed About Ai 'Feeling' Some Comments:

"I think feedback is a great question of AI. If the character is not responding to the changes in the environment around him, the real feeling of the game is completely broken. This has many obvious examples (hearing the sound of guns, see the companion Hit ...), as well as some more subtle things (when two people look at each other and borders). Players are willing to accept some bloody and predictable, but these things are easy to bring the game to real life "

And JESS CRABLE is:

"Balance is very important ... how much fun will be important to players, but there are other problems to balance. Gamers often say they want to see more real artificial intelligence in the game. However, too many real I feel the fun of fun. There must be a good balance between the two. Variations and random is also important - behavioral changes, and maintain a certain degree of unpredictability within the trusted range. "

Game rules and natural games

In all of our descriptions of AI, we use the fps way. There is more than one AI. We have already described to deal with a set of rules of 3D world. Ai is far more than this. The best AI is actually very simple. It is a set of rules, and the player must respond to the rules of the response (or start) action.

A professional term called "naturally occurring game" should be processed here. Naturally happened games in nature created the rules that will be observed, which will cause the game programmer to not foreseen.

For example, chess is considered to be a natural game. There is a set of rules, but the game can fall into a situation that various programmers cannot handle in individual way. You can't code rules for each possible chess situation. It is very clear that gamers will not always face the same game scene each time. To a certain extent, the game situation in progress will change according to his actions. Black and white is a perfect example of this situation, like the SIMS - the game has its own rules, but how you use and adjust and they are your own business. In fact, you create games in the process of playing games, rather than playing the game designer / programmer already defined the route.

It is possible to mix rule-based, naturally occurring games and FPS environments. The behavior of some of the Marine Corps soldiers in Half Life is to do this - pressing firepower and flanking attacks are dynamically complete from the set rules. It looks dynamic, and it is like this. However, only one set of rules in the world of FPS is often insufficient. Geometric and other AI often be able to defeat simple rules, which makes it more difficult to stay correct and still interesting. So there are some sympathy for those poor AI programmers. It is not easy for their work. Ok, there is another chapter below, just there is only one chapter. In the final chapter, we will discuss the top display, menu system, game customization and configuration, game engine copyright and construction, and finally the game "MODS".

转载请注明原文地址:https://www.9cbs.com/read-22024.html

New Post(0)