Game AI training method and system

Through neural network training models, the interactive behavior of game AI is solved, and the problem of insufficient flexibility in game AI training methods in the existing technology is achieved, and more intelligent and diversified AI performance is achieved.

CN119499665APending Publication Date: 2025-02-25FENGQIN DEVELOPMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411634723.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-15
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

The existing game AI training methods rely on preset rules and behavior trees, making it difficult to deal with complex game scenarios and changeable player strategies, lack of flexibility, and reduce the playability and attractiveness of the game.

Method used

By obtaining the operation interface of the game character, preprocessing, annotating interactive behaviors, training neural network models, identifying interactive behaviors, and adjusting NPC's actions based on the recognition results.

Benefits of technology

It realizes the intelligent and diversified performance of game AI, allowing AI to be flexibly applied to different types of game characters and scenarios, improving the playability and attractiveness of the game.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119499665A_ABST
    Figure CN119499665A_ABST
Patent Text Reader

Abstract

The invention relates to a game AI training method and system. The method comprises the steps that an operation interface of a game role is obtained; preprocessing the operation interface to obtain a preprocessed operation interface; marking the interaction behavior of the game role in the preprocessed operation interface to form a sample; inputting the sample into a neural network for training to obtain a game role interaction behavior recognition model; utilizing the game role interaction behavior recognition model to recognize the interaction behavior of a target game role; and adjusting the action of the NPC in the game according to the identified interaction behavior. The game role interaction behavior recognition model obtained based on the neural network can be flexibly applied to different types of game roles and scenes, so that AI expression is more intelligent and diversified.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of game technology, and in particular to a method and system for game AI training. Background Art

[0002] With the rapid development of the electronic game industry and the continuous advancement of artificial intelligence technology, the intelligence level of game AI has become an important factor in improving the gaming experience and player immersion. In recent years, the development of game AI with autonomous learning ability and adaptability has become a research hotspot. Many game developers and researchers are committed to improving the behavioral intelligence of game NPCs (non-player characters) and enemy AI to achieve a more realistic and challenging gaming environment.

[0003] At present, game AI training mainly relies on traditional methods such as preset rules and behavior trees. These methods can achieve autonomous behavior of AI characters to a certain extent, but they are often difficult to cope with complex game scenarios and changing player strategies, and lack flexibility, thus reducing the playability and attractiveness of the game. Summary of the invention

[0004] To solve the above problems, an embodiment of the present invention aims to provide a method and system for game AI training.

[0005] A method for game AI training, comprising:

[0006] Step 1: Get the game character's operation interface;

[0007] Step 2: preprocessing the operation interface to obtain a preprocessed operation interface;

[0008] Step 3: Annotate the interactive behaviors of the game characters in the preprocessed operation interface to form samples;

[0009] Step 4: Input the sample into the neural network for training to obtain a game character interaction behavior recognition model;

[0010] Step 5: using the game character interaction behavior recognition model to identify the interaction behavior of the target game character;

[0011] Step 6: Adjust the actions of the NPC in the game based on the identified interactive behaviors.

[0012] Preferably, the step 2: preprocessing the operation interface to obtain a preprocessed operation interface includes:

[0013] Step 2.1: Obtain a contrast image composed of brightness components of the operation interface;

[0014] Step 2.2: Calculate the contrast weight with any point on the contrast image as the center;

[0015] Step 2.3: Calculating a contrast increment value based on the contrast weight;

[0016] Step 2.4: The contrast increment value and the original brightness component are merged to form a pre-processed operation interface.

[0017] Preferably, the step 2.2: calculating the contrast weight with any point on the contrast image as the center, comprises:

[0018]

[0019] Calculate the contrast weight; where D(i,j) represents the contrast weight, μ V Represents the mean value of all pixels on the contrast image, V m (i,j) represents the mean value of the pixel points in the 3*3 window centered at point (i,j), max(V m ) represents the maximum value of all pixels in the 3*3 window centered at point (i, j), min(V m ) represents the minimum value of all pixels in the 3*3 window centered at point (i,j).

[0020] Preferably, the step 2.3: calculating the contrast increment value based on the contrast weight comprises:

[0021]

[0022] V1(i,j) represents the contrast increment value, μ target represents the target contrast, w represents the width of the contrast image, and h represents the length of the contrast image.

[0023] Preferably, in step 2.4, the contrast increment value and the original brightness component are weighted to form weighted pixel points, and a pre-processed operation interface is formed based on the weighted pixel points; wherein the weighted processing formula is:

[0024]

[0025] Among them, V0(i,j) represents the weighted pixel point, ω represents the weight, V2(i,j) represents the original pixel value on the contrast image, min(E) represents the minimum value of the pixel point on the contrast image, and max(E) represents the maximum value of the pixel point on the contrast image.

[0026] Preferably, the step 4: inputting the sample into a neural network for training to obtain a game character interaction behavior recognition model includes:

[0027] The cross entropy loss function is used to optimize the neural network training to obtain the game character interaction behavior recognition model; wherein the cross entropy loss function is:

[0028]

[0029] Among them, N represents the number of samples, C represents the category of game character interaction behavior, and y ic represents the real interactive behavior of the game character in the i-th sample, Represents the interactive behavior predicted by the neural network.

[0030] The present invention also provides a system for game AI training, comprising:

[0031] An operation interface acquisition module is used to obtain the operation interface of the game character;

[0032] A preprocessing module, used for preprocessing the operation interface to obtain a preprocessed operation interface;

[0033] A labeling module is used to label the interactive behaviors of the game characters in the pre-processed operation interface to form samples;

[0034] A training module is used to input samples into a neural network for training to obtain a game character interaction behavior recognition model;

[0035] An interactive behavior recognition module, used to recognize the interactive behavior of the target game character using the game character interactive behavior recognition model;

[0036] The NPC action adjustment module is used to adjust the actions of the NPC in the game according to the recognized interactive behaviors.

[0037] The present invention also provides an electronic device, comprising a bus, a transceiver, a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the transceiver, the memory, and the processor are connected via the bus, and wherein the computer program, when executed by the processor, implements the steps in the above-mentioned method for game AI training.

[0038] The present invention also provides a computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the steps of the above-mentioned method for game AI training are implemented.

[0039] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:

[0040] The present invention relates to a method and system for game AI training. Compared with the prior art, the game character interaction behavior recognition model obtained by the present invention based on a neural network can be flexibly applied to different types of game characters and scenes, making the performance of AI more intelligent and diversified.

[0041] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0043] Figure 1 A flow chart of a method for game AI training in an embodiment of the present invention;

[0044] Figure 2 This is a schematic diagram of a game AI training system in an embodiment provided by the present invention. DETAILED DESCRIPTION

[0045] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise" and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the referred device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as limiting the present invention.

[0046] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0047] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be an indirect connection through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0048] See also Figure 1 , a method for game AI training, comprising:

[0049] Step 1: Get the game character's operation interface;

[0050] The present invention can obtain the operation interface of the game character through the game engine interface, screen capture or game video playback.

[0051] Step 2: preprocessing the operation interface to obtain a preprocessed operation interface;

[0052] When training a model, the quality of the input image directly affects the performance of the model. Contrast enhancement can improve the consistency and recognizability of the training samples, thereby improving the learning effect and prediction ability of the model.

[0053] Furthermore, the step 2 comprises:

[0054] Step 2.1: Obtain a contrast image composed of brightness components of the operation interface;

[0055] Step 2.2: Calculate the contrast weight with any point on the contrast image as the center;

[0056] Wherein, in said step 2.2, the present invention

[0057]

[0058] Calculate the contrast weight; where D(i,j) represents the contrast weight, μ V Represents the mean value of all pixels on the contrast image, V m (i,j) represents the mean value of the pixel points in the 3*3 window centered at point (i,j), max(V m ) represents the maximum value of all pixels in the 3*3 window centered at point (i, j), min(V m ) represents the minimum value of all pixels in the 3*3 window centered at point (i,j).

[0059] Step 2.3: Calculating a contrast increment value based on the contrast weight;

[0060] In step 2.3, the contrast increment value is calculated as follows:

[0061]

[0062] V1(i,j) represents the contrast increment value, μ target represents the target contrast, w represents the width of the contrast image, and h represents the length of the contrast image.

[0063] Step 2.4: The contrast increment value and the original brightness component are merged to form a pre-processed operation interface.

[0064] In step 2.4, the contrast increment value and the original brightness component are weighted to form weighted pixel points, and a pre-processed operation interface is formed based on the weighted pixel points; wherein the weighted processing formula is:

[0065]

[0066] Among them, V0(i,j) represents the weighted pixel point, ω represents the weight, V2(i,j) represents the original pixel value on the contrast image, min(E) represents the minimum value of the pixel point on the contrast image, and max(E) represents the maximum value of the pixel point on the contrast image.

[0067] By enhancing the contrast, details in the image (such as edges, textures, etc.) can be made more obvious, which can help the neural network to more accurately identify the different components of the operating interface. This is very important for the subsequent learning and recognition process, especially when dealing with scenes with low contrast or high lighting changes.

[0068] Step 3: Annotate the interactive behaviors of the game characters in the preprocessed operation interface to form samples;

[0069] In the embodiment of the present invention, the types of interactive behaviors that need to be labeled are first clarified. These behaviors may include the movement, attack, release of special skills, use of items, etc. of the character. Specific UI element interactions in the game may also be considered, such as button clicks, menu selections, etc. For example, different behaviors may be identified with labels such as "move", "attack", and "use items". In addition, considering the state of defining the behavior (such as start, in progress, and complete) also helps to more comprehensively describe the behavior of the game character.

[0070] On the selected images, manually annotate the interactive behaviors of the game characters using annotation tools. You can use bounding boxes or segmentation masks to frame characters or key information, and apply different labels for different interactive behaviors. Ensure the accuracy and consistency of the annotations. Record all annotation information into a file (usually in JSON, CSV, or XML format). Each sample should include the image file name, image size, annotated category, and its corresponding coordinate location information. This will form a structured annotation dataset.

[0071] Step 4: Input the sample into the neural network for training to obtain a game character interaction behavior recognition model;

[0072] Further, the step 4 comprises:

[0073] The cross entropy loss function is used to optimize the neural network training to obtain the game character interaction behavior recognition model; wherein the cross entropy loss function is:

[0074]

[0075] Among them, N represents the number of samples, C represents the category of game character interaction behavior, and y ic represents the real interactive behavior of the game character in the i-th sample, Represents the interactive behavior predicted by the neural network.

[0076] Step 5: using the game character interaction behavior recognition model to identify the interaction behavior of the target game character;

[0077] Step 6: Adjust the actions of the NPC in the game based on the identified interactive behaviors.

[0078] Furthermore, in an embodiment of the present invention, when running in the game, behavioral data of the player's interaction with the NPC is collected. This includes identifying the player's input, behavior patterns, and the NPC's response in the corresponding scene. A set of response logic is formulated to clarify the actions that the NPC should take when facing specific player behaviors. For example: if the player uses an attacking behavior, the NPC can choose to defend, counterattack, or dodge. If the player is waiting at a certain location, the NPC can take corresponding patrol or conversation actions.

[0079] The game character interaction behavior recognition model obtained by the present invention based on the neural network can be flexibly applied to different types of game characters and scenes, making the performance of AI more intelligent and diversified.

[0080] See also Figure 2 The present invention also provides a system for game AI training, comprising:

[0081] An operation interface acquisition module is used to obtain the operation interface of the game character;

[0082] A preprocessing module, used for preprocessing the operation interface to obtain a preprocessed operation interface;

[0083] A labeling module is used to label the interactive behaviors of the game characters in the pre-processed operation interface to form samples;

[0084] A training module is used to input samples into a neural network for training to obtain a game character interaction behavior recognition model;

[0085] An interactive behavior recognition module, used to recognize the interactive behavior of the target game character using the game character interactive behavior recognition model;

[0086] The NPC action adjustment module is used to adjust the actions of the NPC in the game according to the recognized interactive behaviors.

[0087] Compared with the prior art, the beneficial effects of a game AI training system provided by the present invention are the same as the beneficial effects of a game AI training method described in the above technical solution, which will not be repeated here.

[0088] The present invention also provides an electronic device, comprising a bus, a transceiver, a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the transceiver, the memory, and the processor are connected via the bus, and is characterized in that when the computer program is executed by the processor, the steps of the above-mentioned method for training game AI are implemented. Compared with the prior art, the beneficial effects of the electronic device provided by the present invention are the same as the beneficial effects of the method for training game AI described in the above-mentioned technical solution, and are not elaborated herein.

[0089] The present invention also provides a computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the steps of the above-mentioned method for game AI training are implemented. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present invention are the same as the beneficial effects of the method for game AI training described in the above-mentioned technical solution, which will not be repeated here.

[0090] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technical solution that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A method for game AI training, characterized in that: include: Step 1: Get the game character's operation interface; Step 2: preprocessing the operation interface to obtain a preprocessed operation interface; Step 3: Annotate the interactive behaviors of the game characters in the preprocessed operation interface to form samples; Step 4: Input the sample into the neural network for training to obtain a game character interaction behavior recognition model; Step 5: using the game character interaction behavior recognition model to identify the interaction behavior of the target game character; Step 6: Adjust the actions of the NPC in the game based on the identified interactive behaviors.

2. A method for game AI training according to claim 1, characterized in that: The step 2: preprocessing the operation interface to obtain a preprocessed operation interface includes: Step 2.1: Obtain a contrast image composed of brightness components of the operation interface; Step 2.2: Calculate the contrast weight with any point on the contrast image as the center; Step 2.3: Calculating a contrast increment value based on the contrast weight; Step 2.4: The contrast increment value and the original brightness component are merged to form a pre-processed operation interface.

3. A method for game AI training according to claim 2, characterized in that: The step 2.2: calculating the contrast weight with any point on the contrast image as the center, comprises: Calculate the contrast weight; where D(i,j) represents the contrast weight, μ V Represents the mean value of all pixels on the contrast image, V m (i,j) represents the mean value of the pixel points in the 3*3 window centered at point (i,j), max(V m ) represents the maximum value of all pixels in the 3*3 window centered at point (i, j), min(V m ) represents the minimum value of all pixels in the 3*3 window centered at point (i,j).

4. A method for game AI training according to claim 3, characterized in that: The step 2.3: calculating the contrast increment value based on the contrast weight comprises: V1(i,j) represents the contrast increment value, μ target represents the target contrast, w represents the width of the contrast image, and h represents the length of the contrast image.

5. A method for game AI training according to claim 4, characterized in that: In step 2.4, the contrast increment value and the original brightness component are weighted to form weighted pixel points, and a pre-processed operation interface is formed based on the weighted pixel points; wherein the weighted processing formula is: Among them, V0(i,j) represents the weighted pixel point, ω represents the weight, V2(i,j) represents the original pixel value on the contrast image, min(E) represents the minimum value of the pixel point on the contrast image, and max(E) represents the maximum value of the pixel point on the contrast image.

6. A method for game AI training according to claim 1, characterized in that: The step 4: inputting the sample into a neural network for training to obtain a game character interaction behavior recognition model, including: The cross entropy loss function is used to optimize the neural network training to obtain the game character interaction behavior recognition model; wherein the cross entropy loss function is: Among them, N represents the number of samples, C represents the category of game character interaction behavior, and y ic represents the real interactive behavior of the game character in the i-th sample, Represents the interactive behavior predicted by the neural network.

7. A system for game AI training, characterized in that: include: An operation interface acquisition module is used to obtain the operation interface of the game character; A preprocessing module, used for preprocessing the operation interface to obtain a preprocessed operation interface; A labeling module is used to label the interactive behaviors of the game characters in the pre-processed operation interface to form samples; A training module is used to input samples into a neural network for training to obtain a game character interaction behavior recognition model; An interactive behavior recognition module, used to recognize the interactive behavior of the target game character using the game character interactive behavior recognition model; The NPC action adjustment module is used to adjust the actions of the NPC in the game according to the recognized interactive behaviors.

8. An electronic device, comprising a bus, a transceiver, a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the transceiver, the memory, and the processor are connected via the bus, wherein: When the computer program is executed by the processor, the steps of a method for game AI training as described in any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of a method for game AI training as described in any one of claims 1 to 6 are implemented.