Monster Intelligent AI System detailed

Source: Internet
Author: User
Tags time interval
Technical literacy stickers) uncover the mysteries of game design------game Monster NPC AI analysis in the game, if only the player controls the character in the game world alone produces a series of behaviors, and no other can form interactive activities with the player character, produce events, players will feel very dull. At this point, if you add some characters and monsters with certain functions and intelligence in the game to interact with the players in various events, we often refer to these characters as NPC (no people control) ——— the game world with intelligent objects without the player's control. With these "smart" NPCs, the player forms a world of stories with content, which allows the player to learn the content of the game as if it were a story book or movie, and to manipulate the character to participate in the virtual world.
With NPCs in the game world, we have to give them enough "thought" to make them act, to form a world of life, which we usually address as NPC AI (the NPC's AI). NPC some wonderful ideas, the event will often make the player more pleasant experience. So the NPC's intelligent thinking is becoming more and more important in game setting and the whole AI system is becoming larger and bigger.
In this article, let us focus on the game of the Monster NPC AI system set rules and principles, so as to uncover the mystery of NPC AI.
(it is said that green can make people feel happy, OK, I know that this kind of post is usually very uninteresting to people.) But as a game enthusiast, I feel that with certain knowledge or necessary, after all, you can confidently say to others, I love games. )

1 Monster NPC AI System
The AI system for monsters should be designed primarily to consider how mobs react in active and passive situations. When the monster is active, set a warning range, if there is no target into this range, then the monster will spontaneously walk, stay and so on, or if there is a target, the monster will enter the battle state ready to attack the target; When monsters are in a passive state, it is time to consider what passive actions a monster should be given.

2 properties of the monster NPCs
Any reaction that a monster makes in an active or passive state relies on its own set of properties, which is how the AI system operates according to its various attributes. Depending on the current state of the monster NPCs, the driver generates a variety of behavioral events. In general, we summarize the attributes involved in the AI of a monster NPC into two categories:
2.1 Basic Properties
The first basic attribute we consider when setting up an AI system is the type of monster. A game is a variety of monster settings are different, when set by different types of characteristics will vary, or can say "IQ" will be different, such as: The humanoid AI is usually set very high, when hunted and beaten will be wise to choose to escape, and the animal system of the strange AI set is generally relatively low, In the same situation may choose to blindly attack until death. The second basic attribute to consider is the rank. The higher the level of the principle, the higher the AI set for it, but not the absolute. The third attribute to consider is the sex of a monster. Generally set to three gender, female, male, no gender.
2.2 AI-related combat properties
The various properties in the combat attribute are generally calculated by the formula of the specific data values, is an important indicator of the AI system determination. Analyze the basic properties of the Battle attribute: HP (health point) attribute------The strange blood value, also known as the life value, needs to set the strange current blood quantity and the maximum blood quantity value, the strange may according to the blood quantity value has the different movement, may continue to fight, or calls the companion to help, or dies. The MP (Magic point) attribute-----Magic value or mana, requires a strange current mana value and a maximum mana value, and monsters will use different skills or different attack modes depending on the mana value. There are physical attack properties, physical Defense Force properties, magical attack properties, and magical defense properties that represent the suitability of physical or magical powers, respectively. As well as the Dodge (Dodge) attribute ——— the chance that a monster NPC will evade player character attacks, in AI design, it is common for some monster NPCs to have the ability to enhance dodge rate and to increase the Dodge capability of the player's attack, causing enough trouble to the player. The hit, fatal hit and block properties are applied in AI similar to dodge properties and are no longer covered. Hit property ——— the hit rate of a monster NPC attacking a player's character. Fatal Strike (Critical) ——— the probability of a deadly hit in a monster NPC attack. Pane
Block ——— the probability that a monster NPC is resisting a player's character.

3 Spontaneous Action Events
In AI systems, setting up spontaneous action events first takes into account the spawn of mobs. Spawn of monsters The first thing to consider is the spawn area of a monster, the activity area of a monster in a spontaneous action event. Need to set a coordinate point point=[x,y] as the center, R is the radius of the circular region to generate some type of Monster NPC; Secondly, to set the number of monsters generated, in the unit area of a type of Monster NPC maximum number of generation; Come on. Spawn time interval, set n seconds to spawn 1 monsters until the maximum number of builds is reached. At the end of the day, you need to set the spawn coordinates and the coordinates of a monster NPC. As well as the monster activity key, every two key points can be arbitrarily generated action path, monsters in the action path activity.
After the build is set, consider the spontaneous action of the monster. Including stay, walk, alert. Walking, is by pre-in a certain area of the random distribution of the stay point, each of the two points of stay between the lines formed the Monster NPC walking path; Stay, is in a certain area of the random set number of units without duplication of the coordinate point, that is, the monster NPC walking stop point; Vigilance, including the "Alert range" setting, the active attack monster NPC during the stay or walk always in the alert range of hostile target search behavior, once the enemy target into the alert range, will actively attack the target.


4 Reactive ACTION Events
When the target enters the alert range, the spontaneous action event will be converted into a reactive action event for the active offensive monsters. Start a series of attack actions on the target. In the case of passive attack, the target is converted to the target of reactive action attack. Monster reaction action events include: Target selection decision, combat skill use judgment, chase judgment, escape judgment.
4.1 Determination of target selection
The key to target selection is the "hatred value" of one of the monster attributes. Monster attack target can be set to first obey the maximum principle of hatred value. In order to consider the current hp (blood) Less object attack principle, the nearest attack principle, low-level object attack principle, the original hatred value ranking high principle.
The most hateful value principle, according to the hatred value calculation method to obtain the current monster Hatred value list, the monster will choose to attack the current hatred list of "hatred value" the biggest goal. So what is the value of hatred? is a numerical summation of the player's strike level, the range of which is a positive integer, is the key to determine the attack object of the monster data. Cause a monster hatred value to be generated in three ways: Enter the "active offensive" monster's "alert range", if player a first active or passive into a "peaceful" active attack of "alert range", the monster will generate N points "initial hatred value" to player A, and enter the "Combat State", actively attacking player characters; Second, the monster is attacked, each attack monster will cause the monster to the player to create a new addition to the "initial hatred value" of the increment of the value of hatred; Third, the object that helps to attack the monster (indirect hostility). Player A has an auxiliary or recovery skill for player B that exists in the monster X hatred list, and Monster X generates a certain amount of hate increment for player A. The hatred value generation and the change of the value will cause the hatred list to refresh, also will cause the monster hatred value change, how to carry on the hatred list refresh? There are three aspects to consider, on the one hand, after each attack (regardless of success or failure), the monster will trigger a "hate list" Refresh event, again from the list of hatred to select the highest level of hate players to attack target; On the other hand, you need to set the time of the attack action event and the Hate list fixed refresh time, this time is defined as n seconds, this setting function is to prevent alternating hatred value change, such as two players ranged attack monsters, so that the monster hatred alternately rise caused mobs to run to run; The monster will immediately force a response to the change caused by a "hate list Refresh" by the player's special skills (the ability to change only their own hatred values without causing damage and adding or subtracting benefits).
Another important setting for the most hateful value principle is the deletion of the hate list. If player A is in the hate list of Monster B, when player a runs out of the hunt range of Monster B, Monster B will remove the hate information from player A in its hatred list; If player A is in the hate list of Monster B, when player a runs out of the map of the scene where Monster B is located, Monster B will remove the hate information from player A from its list of hatred. Player A If you are in the hate list of Monster B, if player A dies, Monster B will remove the hate information from player A from its list of hatred. If player A is in the hate list of Monster B, if player B exits the game or directly returns to the character selection screen, then when player A's logout delay time is over and the game is completely exited, Monster B will remove player A's hatred information from its hatred list. After the monster dies, all the content of the monster's hatred list is emptied, and the player's hatred value is no longer recorded.
4.2 Combat Skill usage decision
That is, the monster NPC in the fight to choose what kind of attack, the main basis for its determination and the 3rd section of the Monster NPC attribute is very dense. Analyze the types of skill attacks that monster NPCs typically use in battles with player characters: normal attack, single melee, melee, ranged, group ranged, single spell, group spell, monomer gain, group gain, monomer Debuff, and group debuff skills.
4.3 Monster NPC Chase judgment
When the player character leaves the range of monsters, mobs will choose to chase. The specific pursuit conditions are generally set to two kinds:
Player characters leave the range of monsters to attack; The player A in the monster hatred list first, will continue to chase player A, to reach the range of monsters attack.
4.4 Monster NPC Escape Verdict:
4.4.1 Escape or not determine
According to the monster's "escape rate" to determine, the greater the rate of escape, the higher the likelihood of escaping, the value range 0.00~1.00. When the HP (blood volume) value is between 15%-20%, the first run-off judgment; If the first decision to escape fails, the current HP value between 5%-10% for a second run-off judgment. Determine if the escape was successful based on the monster's "escape rate". If the HP value is exceeded, the range overflow will automatically lose the chance to run. Set the monster escape mode according to the specific characteristics of the monster NPC:
A complete escape, according to the monster's "escape rate" to determine, the higher the escape rate is easier to escape. After the successful escape, the hatred list content will be cleared.
Determination of 4.4.2 Escape direction
When the HP value of a monster NPC drops to a certain percentage, it is often designed in AI design to let the monster NPC choose to escape, in order to get rid of the player character's continued attack. The basic principles of AI design are usually the following three points:
(1) Run away in the opposite direction of the player's character.
(2) The escape range must be met at all times not exceeding the "spawn area".
(3) escape as far as possible to the nearest companion location and use "call" to bring the surrounding companion to the aid

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.