Decryption Game Team AI

Source: Internet
Author: User

Many people ask the game AI what to do? With the variety of game types, non-MMO or card game more and more, the demand for AI is also more and more strong. And on the market on the book of AI, the article found on the Internet, also flow in a few words of understanding, theoretical routines, and some simple DEMO, from the real project gap is far away, can not be linked to a line, but can not really fall into the code.

China has really done game ai less and less, rambling people a lot, really do project few people, because the main domestic MMO mainly, RTS less, sports games less, and from the difficulty of AI, it should be: MMO < FPS < RTS < sports. As a person who has actually developed AI, give us a science, what is called hard ai.

Hard game AI, not a vague neural network, using neural network is actually a black hole, the problem of a foot to the computer, think I just training it, it can solve all the problems of lazy people thinking. More than genetic algorithms and fuzzy logic, you think of the previous 8-bit machine, 16-bit machine can have more fierce confrontation of football games, basketball games, then the poor processor can do these calculations?

The hard-to-play AI is the state machine and the behavior tree. State machine is the basic skill, the behavior tree is optional (early Ai no behavior tree This thing, everyone is hard code). Most people say that there is no more, you can not write code after reading. Because the core of the three issues are not clear, namely: Hierarchical state machine , decision Support system , and team role assignment . The following is an example of the basketball AI I did earlier, briefly describe:


What is a tiered state machine?

Each character body, has three layer state machine: Basic layer state machine, behavior layer state machine, role layer state machine. Each layer of state machine solves a level of complexity and provides an interface to the upper layer, and the upper state machine implements more complex logic by setting the state of the lower state machine.

    • Basic state machine: direct control of character animation and drawing, provide basic action implementation, provide support for the upper layer.
    • Behavior state machine: To achieve decomposition action, Dodge run, straight-line movement, standing in situ, to the ball, passing, shooting ball, chasing the ball, hitting, jumping.
    • Character state machine: the implementation of more complex logic, such as anti-ejection, rebound, etc. are from the N-time linear motion + jump or hit completion.

Each layer of state machine is achieved by setting the target for the next layer of state machine to achieve control (after the target setting, the lower state machine will automatically work, the upper layer does not care about where the animation is playing, and now in the end is running is jumping), thus providing more advanced personification of the behavior of the upper level. The work of the top-level role state machine is controlled by the team AI, and the role assignment works. and behavior state machine above the state choice, such as Fall back, in the end is run to which point, shoot the ball, in the end where to jump, the path is how, then by the decision support system to provide support.

What is a decision support system?

State machine for the role of the brain, while the decision support system for the role of the eyes and ears, the common tool has a power map (influence map) and whiteboard (equivalent to different roles between the propaganda), where the power map is more commonly used, basketball game AI Force diagram can be shown in the following graphs:

Force Figure 1: A map of the defensive rebounds distance, each of which is the farthest distance minus the distance from the lattice to the backboard.

Force Figure 2: A map of the offensive rebound distance, each score is the farthest distance minus the grid to the rebound distance, after rebounding to 0

Force Figure 3: Distance from the enemy, each enemy has an impact range, within the range, the closer to the enemy, the lower the range overlap selected low.

Force Figure 4: The map is the same as all of the teammates ' target locations, and the scoring method is similar.

Power Figure 5: Map with the distance from each teammate's target location, which identifies the distance of the individual teammate's target location.

Power Figure 6: Realistic pass feasibility map, the higher the score, the more easily the ball to the grid.

Force Figure 7: Easy to place the ball out of the location map, the more easy to pass directly to the teammate's area score higher.

Power Figure 8: Comprehensive map, the above map by a certain weighted sum. The player has a legitimate target area, which facilitates the inner walk and the outside line.

Each player has a different personality, a different weight, a conservative player, a player who likes to take risks, and a different weight. These power maps are designed to provide decision support for the above three-tier state machine and team state machine.

What is a team role assignment?

Each layer of state machine sets a target for the next layer, allowing the lower layer to work automatically, and the goal of the top-level role layer is tactically guided by the team AI at the top level.

Team state machine with the current game situation to determine the current primary goal (offensive or defensive), and according to the current power map and other information, to determine the specific offensive or defensive strategy (such as the middle of the breakthrough, disk side, bottom cross, etc.), and ultimately for all the roles of the current team to assign a new task, That is, set the role layer state machine new goal, determine whether he is to do the main attack or assists, or defense or coordination. Specific how to defense, how to coordination, that is the role layer state machine things.

Topic Summary

In fact, the team AI is not so iffy, any problem is a programming modeling problem, and the most complex sports games of the AI strategy, the above has given a model, I believe you can use a little modification. Write state machine is the game AI cicatrization, if the state machine logic changes often or the size of the project after the introduction of decision-making tree to control the state machine, the program provides a series of interfaces, and then with a visual editor to change, interested people can refer to the decision tree related articles.

Probability statistics

If all of the above logic is implemented, then it is possible to assist and probability statistics to give character learning characteristics, such as statistics on the success or failure of a strategy against the opponent, to support the next decision, so as to gradually identify the opponent's weaknesses, but also to count all the user's big data, to determine a situation, choose what strategy, Capable of dealing with 60% of users.

Neural network

In the above all the logic has been implemented, you debug well, play a relatively smooth time, and then in the team role assignment place to try to use the neural network or fuzzy logic, the same is to learn big data, to introduce some of the non-controllable human components, make the game more interesting. (The EA's FIFA 20XX is known as the introduction of neural networks, and call of Duty's AI also claims to have introduced neural networks and learning mechanisms). It does make the game a little more interesting, just that.

PS: About chess and other related topics of AI, and this is not the same, because the chess card AI is to seek the best solution, using game tree and other tools to solve, interested, can refer to my other article: http://www.skywind.me/blog/archives/1029.


Decrypt game Team AI

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.