Deep learning based cross-version game ai decision reproducible method
Patent Information
- Application Number
- CN202610580321.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-29
- Publication Date
- 2026-08-18
AI Technical Summary
[0005]但是,上述现有技术通常一端偏向历史过程重放,另一端偏向当前环境下的行为生成,尚未围绕跨版本非玩家角色动作分支复现建立稳定的中间判定载体
[0074] (1) This invention proposes an improved method for reproducing non-player character action branches in cross-version games. It introduces shortened BCH code constraints at the action branch representation layer, assigns a unique legal branch code to each executed action branch category, and decodes the original branch code output by KAN within a set codeword distance range before determining the action branch. The legal branch code with the smallest codeword distance is then selected from the set of legal branch codes. Unlike existing solutions that directly replay instructions or messages, or directly output action categories, this invention transforms the branch judgment process, which is easily affected by version disturbances, into a codeword discrimination process constrained by the minimum codeword distance. This ensures that the interface input falls into a discrete and unique legal branch code space, thereby reducing action branch confusion and cross-version reproduction drift, and improving the reproducibility of action branches in cross-version scenarios.
Smart Images

Figure CN122582593A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of non-player character action branch reproduction technology in cross-version games, and in particular to a reproducible method for AI decision-making in cross-version games based on deep learning. Background Technology
[0002] During continuous game version iterations, the action branches of non-player characters in scenarios such as combat, pursuit, being hit, skill release, target switching, and path adjustment typically need to be determined by combining the action triggering event, the relative position of the target, state constraint information, and temporal context. Action branches are not directly determined by a single input. In development testing, issue review, regression verification, and cross-version replay scenarios, it is often necessary to re-enter the action branch determination process of non-player character action branches that have occurred in the existing version into the target version based on historical operation records, in order to verify the consistency of behavior and the reproduction of results.
[0003] Existing Chinese patent CN105013174B discloses a game video playback method and system. The method mainly focuses on recording basic game information, successfully executed commands, and character identifiers to generate a video file, and then playing back the video upon request during the playback phase. Additionally, Chinese patent CN114053716A discloses a method, device, and storage medium for controlling the behavior of non-player characters (NPCs) in games. This method mainly focuses on monitoring real-time environmental information within the game and acquiring target behavior generation data that matches the real-time environmental information to control the behavior of the target NPC. These disclosures indicate that game playback and non-player character behavior control have reached a relatively mature technological stage.
[0004] In existing technical solutions, one type focuses more on recording and replaying the game process. For example, CN105013174B saves basic game information, successfully executed commands, and corresponding character identifiers to form a video file, and then reads the video file to complete the playback in a subsequent stage. The focus is on recording, saving, and reproducing existing game processes. Another type of solution focuses more on generating non-player character behaviors. For example, CN114053716A monitors real-time environmental information within the game to obtain target behavior generation data that matches the real-time environment information. This target behavior generation data includes the target creation location and target control commands, and then controls the target NPC to execute corresponding behaviors. The focus is on generating and driving non-player character behaviors based on real-time environmental changes. Thus, existing technologies cover both game process playback and non-player character behavior control.
[0005] However, the aforementioned existing technologies typically focus on both historical process replay and behavior generation in the current environment, failing to establish a stable intermediate decision-making mechanism for reproducing cross-version non-player character action branches. Upon entering a cross-version scenario, any local change in action triggering conditions, target relative positions, state constraints, or the semantics of the action branch decision interface can cause historical records to struggle to consistently correspond to a unique action branch, leading to action branch confusion, replay drift, and inconsistencies between reproducible and actual results. Furthermore, existing publicly available solutions lack an intermediate encoding mechanism with codeword distance constraints and a decoder within an executable range to support action branches.
[0006] Therefore, a reproducible method for cross-version game AI decision-making that can overcome the shortcomings of the existing technology is a problem that needs to be solved by those skilled in the art. Summary of the Invention
[0007] One objective of this invention is to propose a reproducible AI decision-making method for cross-version games based on deep learning. The core technical problem to be solved by this application is: in the non-player character replay scenario of cross-version games, relying solely on the non-player character's running records, how to establish a stable and directly input legal branch code intermediate representation that can be judged and directly input into the action branch determination interface when there are version disturbances between the action triggering event, the target relative position relationship, the state restriction information and the action branch determination interface, so that the non-player character's action branches can be reliably reproduced according to the action triggering sequence.
[0008] A reproducible method for cross-version game AI decision-making based on deep learning according to embodiments of the present invention includes:
[0009] S1. Receive the running record of the non-player character, extract the action triggering event, the relative position relationship of the target, the state restriction information and the executed action branch from the running record of the non-player character, and form an action branch sample sequence.
[0010] S2. Based on the executed action branches in the action branch sample sequence, assign a unique legal branch code to each executed action branch under the minimum codeword distance constraint of the shortened BCH code, and form a set of legal branch codes.
[0011] S3. Input the action triggering event, target relative position relationship and state restriction information in the action branch sample sequence into KAN, limit the KAN output layer to correspond to the code bits in the set of legal branch codes, perform unified mapping of action triggering event, target relative position relationship and state restriction information, and output the original branch code corresponding to the executed action branch;
[0012] S4. Before the action branch is determined, the original branch code is decoded on the set of legal branch codes. The decoding is performed within a set codeword distance range. The codeword distance between the original branch code and each legal branch code is calculated. The legal branch code with the smallest codeword distance from the original branch code within the set codeword distance range is determined from the set of legal branch codes. The legal branch code is then used as the input value of the action branch determination interface.
[0013] S5. Determine the current action branch of the non-player character based on the valid branch code, and record the valid branch codes according to the action trigger sequence to form a valid branch code sequence;
[0014] S6. Input the valid branch code sequence into the action branch determination interface in the cross-version replay process, and output the non-player character replay action branch sequence based on the valid branch code sequence.
[0015] Optionally, S1 is as follows:
[0016] Receive the running records of non-player characters, and divide the running records of non-player characters into record segments according to the action triggering sequence and the action branch determination position. Each record segment contains the state before the action is triggered, the state when the action is triggered, and the state when the action branch is determined.
[0017] Extract the recorded content corresponding to the non-player character's action triggering conditions from the recorded fragments to form action triggering events, and extract the recorded content corresponding to the proximity relationship with the target from the recorded fragments to form the target's relative position relationship;
[0018] Extract the recording content corresponding to the non-player character's action execution restrictions from the recording fragments to form state restriction information, and determine the executed action branches based on the actual execution results in the recording fragments;
[0019] The action triggering event, the target's relative position, the state constraint information, and the executed action branch are aligned and combined according to the action triggering sequence, so that the action triggering event, the target's relative position, the state constraint information, and the executed action branch are established in the same record segment, forming an action branch sample sequence.
[0020] Terminology Explanation:
[0021] The action branch determination position is the action trigger timing position in the recorded segment for determining the executed action branch.
[0022] Optionally, S2 is as follows:
[0023] Read each executed action branch from the action branch sample sequence one by one, and group the executed action branches with the same content in the action branch sample sequence into one executed action branch category to form an executed action branch set;
[0024] Based on the number of executed action branch categories in the executed action branch set, determine the code length, the number of allocatable codewords, and the fixed code position order of the shortened BCH code, so that the number of allocatable codewords is not less than the number of executed action branch categories, thus forming the code length determination result;
[0025] Based on the code length determination result, a candidate codeword set with the corresponding code length is generated under a fixed code position order, and each candidate codeword in the candidate codeword set is represented as a complete code position combination arranged in a fixed code position order, forming the candidate codeword representation result;
[0026] For each candidate codeword in the candidate codeword representation result, calculate the pairwise codeword distance, and compare the calculated codeword distance with the minimum codeword distance constraint of the shortened BCH code. If the comparison condition is met, retain the corresponding candidate codeword to form a set of constraint codewords.
[0027] Based on the number of executed action branch categories, select the same number of candidate codewords from the constraint codeword set to form an allocation codeword group, and perform codeword distance verification on any two candidate codewords in the allocation codeword group so that each candidate codeword in the allocation codeword group satisfies the minimum codeword distance constraint of the shortened BCH code under a fixed code position order.
[0028] Each candidate codeword in the assigned codeword group is assigned one by one to each executed action branch category in the executed action branch set to obtain the legal branch code corresponding to each executed action branch category. Each legal branch code is then written into the corresponding executed action branch position in the action branch sample sequence to form the legal branch code annotation result.
[0029] Based on the results of the legal branch code annotation, all legal branch codes are summarized to form a legal branch code set. The fixed code position order in the legal branch code set is maintained, while also corresponding to the code position correspondence in the KAN output layer and the code word distance calculation position in the action branch determination interface.
[0030] Terminology Explanation:
[0031] The fixed code position order is the same arrangement order used for the complete code position combination in the candidate code word representation result, each legal branch code in the legal branch code set, the code position correspondence in the KAN output layer, and the code word distance calculation position in the action branch determination interface;
[0032] The shortened BCH code is a BCH code encoding form that determines the code length and the number of allocable codewords based on the number of executed action branch categories, forms a set of legal branch codes that satisfy the minimum codeword distance constraint under a fixed code position order, and uses whether the codeword distance between the original branch code and each legal branch code is within a set codeword distance range as the basis for decoding judgment.
[0033] The process involves assigning each candidate codeword in the assigned codeword group to each executed action branch category in the executed action branch set, thereby obtaining the legal branch code corresponding to each executed action branch category. Each executed action branch category corresponds to only one legal branch code, and each legal branch code corresponds to only one executed action branch category.
[0034] Optionally, S3 specifically refers to:
[0035] Extract action triggering events, target relative position relationships, and state constraint information from the action branch sample sequence, and unfold the action triggering events, target relative position relationships, and state constraint information into a fixed position arrangement according to the action triggering time sequence, so that the action triggering events, target relative position relationships, and state constraint information under the same action triggering time sequence establish a correspondence at adjacent input positions, forming the input arrangement result;
[0036] Based on the executed action branches in the action branch sample sequence, read the legal branch codes corresponding to the executed action branches from the legal branch code set, and expand the legal branch codes into code position annotation results according to the fixed code position order in the legal branch code set. This ensures that each code position in the code position annotation results has a unique correspondence with the executed action branches, and the executed action branches are retained as code position annotation results without inputting KAN.
[0037] The input permutation result is input into the input layer and the first hidden layer of KAN. In the first hidden layer, learnable weights, biases and cubic spline nonlinear units are set for each input position of the input permutation result. The first layer unified mapping is performed on the action triggering event, the target relative position relationship and the state constraint information to form the first layer intermediate representation.
[0038] The first intermediate representation is input into the second hidden layer of KAN. In the second hidden layer, learnable weights, biases and cubic spline nonlinear units are set for the first intermediate representation. The second unified mapping is then performed on the first intermediate representation so that the action triggering event, the target relative position relationship and the state constraint information are combined and calculated on the same mapping chain to obtain the second intermediate representation.
[0039] Based on the code point annotation results, code point positioning is performed on the second-layer intermediate representation to establish a positional correspondence between each calculated position in the second-layer intermediate representation and each fixed code point in the set of legal branch codes, thus forming a code point mapping result.
[0040] Based on the code point mapping result, the KAN output layer is limited to a code point output structure corresponding to the code points in the set of legal branch codes. The code point mapping result is input into the code point output structure, and bit value calculation is performed on each fixed code point to form the code point output result.
[0041] The code point output results are combined into the original branch code according to the fixed code point order in the set of legal branch codes. The bit-by-bit correspondence between the original branch code and the executed action branch is determined according to the code point annotation results, thus forming the original branch code corresponding to the executed action branch.
[0042] Terminology Explanation:
[0043] The code point annotation result is the result formed by expanding the legal branch codes according to the fixed code point order in the legal branch code set and establishing a correspondence between each code point and the executed action branch.
[0044] The original branch code is a combination of code points that KAN outputs in a fixed code point order in the set of legal branch codes and is used to calculate the distance between code words with each legal branch code before entering the action branch determination interface.
[0045] The KAN is a Kolmogorov-Arnold network that includes an input layer, a first hidden layer, a second hidden layer, and an output layer, and uses learnable weights, biases, and cubic spline nonlinear units to uniformly map action triggering events, target relative position relationships, and state constraint information into the original branch code.
[0046] Optionally, S4 specifically refers to:
[0047] The original branch code is input into the action branch determination interface as a comparison object for decoding within a set codeword distance range. The action branch determination interface reads each legal branch code from the legal branch code set one by one, so that the original branch code and each legal branch code establish a bit-by-bit comparison relationship according to the code position correspondence in the legal branch code set, and form a bit-by-bit comparison result.
[0048] Based on the bit-by-bit comparison results, the consistency of bit values between the original branch code and each legal branch code is determined, and the number of bit values that are inconsistent between the original branch code and each legal branch code is determined as the codeword distance of the corresponding legal branch code, thus forming the codeword distance result;
[0049] Compare the code word distances in the code word distance results with the set code word distance range, filter out the legal branch codes whose code word distances are within the set code word distance range, and form legal branch codes within the range;
[0050] Perform minimum value determination based on the codeword distance corresponding to the legal branch codes within the range to obtain the minimum codeword distance, and then filter out the legal branch codes corresponding to the minimum codeword distance from the legal branch codes within the range to form the minimum distance legal branch codes;
[0051] Based on the minimum codeword distance constraint of the shortened BCH code, the validity of the minimum distance valid branch code is determined, and the minimum distance valid branch code that satisfies the minimum codeword distance constraint of the shortened BCH code is determined as a valid branch code, thus forming the decoding result;
[0052] Write the valid branch code from the decoding result into the action branch determination interface as input value, and make the action branch determination interface perform action branch determination based on the valid branch code.
[0053] Terminology Explanation:
[0054] The legal branch code within the specified range is a legal branch code in which the codeword distance between the original branch code and the legal branch code is within the set codeword distance range;
[0055] The decoding within the set codeword distance range is a process that uses whether the codeword distance between the original branch code and each legal branch code is within the set codeword distance range as a legal branch code filtering condition, and determines the legal branch code with the smallest codeword distance from the legal branch codes that meet the filtering condition.
[0056] Optional, S5 specifically includes:
[0057] Input the valid branch code into the action branch determination interface, and match the valid branch code according to the correspondence between each valid branch code in the valid branch code set and the executed action branch to form the action branch matching result;
[0058] Based on the action branch matching results, determine the current action branch of the non-player character corresponding to the valid branch code, and form the action branch determination result;
[0059] Extract the corresponding action trigger sequence based on the action branch determination result, and bind the valid branch code with the action trigger sequence to form a sequence binding result;
[0060] The valid branch codes in the timing binding result are arranged and recorded sequentially according to the action triggering sequence to form a valid branch code sequence.
[0061] Terminology Explanation:
[0062] The timing binding result is the result formed after establishing a correspondence between the valid branch code and the corresponding action trigger timing.
[0063] Optional, S6 specifically includes:
[0064] The valid branch code sequence is input into the action branch determination interface in the cross-version playback process, and the valid branch codes are read sequentially from the valid branch code sequence according to the action triggering sequence, so that each valid branch code is associated with the corresponding action triggering position in the cross-version playback process, forming a timing input result;
[0065] Based on the correspondence between each legal branch code in the set of legal branch codes and the executed action branches, each legal branch code in the timing input result is matched to determine the executed action branch corresponding to each legal branch code, thus forming the timing action branch matching result;
[0066] The executed action branches in the timing action branch matching results are arranged in order according to the action triggering sequence to form a sequence of action branches reproduced by non-player characters.
[0067] Terminology Explanation:
[0068] The timing input result is the result formed by mapping each legal branch code in the legal branch code sequence to the corresponding action trigger position in the cross-version playback process according to the action trigger timing.
[0069] The step of inputting the legal branch code sequence into the action branch determination interface during the cross-version replay process means directly using the legal branch code sequence as the input value of the action branch determination interface during the cross-version replay process, and outputting the non-player character's reproduced action branch sequence according to the correspondence between each legal branch code in the legal branch code set and the executed action branch.
[0070] Optionally, when allocating each candidate codeword in the allocation codeword group to each executed action branch category in the executed action branch set, the number of content inconsistencies between any two executed action branch categories is calculated based on the action triggering event, target relative position relationship, and state restriction information corresponding to each executed action branch category in the action branch sample sequence. The number of times any two executed action branch categories appear consecutively in the action triggering sequence is also counted. If the number of content inconsistencies is less than a preset threshold and the number of consecutive occurrences is greater than a preset threshold, two candidate codewords with a codeword distance greater than a preset codeword distance threshold are selected from the allocation codeword group and allocated to the corresponding two executed action branch categories, where the preset codeword distance threshold is greater than the minimum codeword distance of the shortened BCH code.
[0071] Optionally, after combining the code point output results into the original branch code according to the fixed code point order in the set of legal branch codes, the original branch code is compared bit by bit with the code point annotation results, and the positions where the code point values are inconsistent are mapped to the calculation positions in the code point mapping results. The learnable weights and biases in the first hidden layer, the second hidden layer and the code point output structure are adjusted according to each calculation position. Based on the adjusted learnable weights and biases, the first layer unified mapping, the second layer unified mapping and the bit value calculation are re-executed to obtain the original branch code whose code word distance with the code point annotation results is within the set code word distance range.
[0072] Optionally, when multiple valid branch codes exist within the range whose codeword distances to the original branch code are all within the set codeword distance range and equal to the minimum codeword distance, sample records with consistent action triggering events, target relative position relationships, and state restriction information are selected from the action branch sample sequence based on the action triggering event, target relative position relationship, and state restriction information corresponding to the original branch code. Valid branch codes corresponding to the executed action branches in the sample records are retained from the multiple valid branch codes. If the number of retained valid branch codes is 1, the retained valid branch code is determined as a valid branch code. If the number of retained valid branch codes is not equal to 1, multiple valid branch codes are used as statistical objects. The number of consecutive occurrences of the valid branch code with the previously determined action triggering sequence and multiple valid branch codes in the action branch sample sequence is counted, and the valid branch code with the largest number of consecutive occurrences is determined as a valid branch code.
[0073] The beneficial effects of this invention are:
[0074] (1) This invention proposes an improved method for reproducing non-player character action branches in cross-version games. It introduces shortened BCH code constraints at the action branch representation layer, assigns a unique legal branch code to each executed action branch category, and decodes the original branch code output by KAN within a set codeword distance range before determining the action branch. The legal branch code with the smallest codeword distance is then selected from the set of legal branch codes. Unlike existing solutions that directly replay instructions or messages, or directly output action categories, this invention transforms the branch judgment process, which is easily affected by version disturbances, into a codeword discrimination process constrained by the minimum codeword distance. This ensures that the interface input falls into a discrete and unique legal branch code space, thereby reducing action branch confusion and cross-version reproduction drift, and improving the reproducibility of action branches in cross-version scenarios.
[0075] (2) This invention proposes an action branch modeling method based on KAN and code-bit aligned output structure. It expands the action triggering event, target relative position relationship, and state constraint information according to fixed field positions and action triggering sequence, and uses a continuous window input KAN to learn the combination relationship between multiple conditions on a unified mapping chain. Simultaneously, the output layer does not generate common action category scores, but instead corresponds bit-by-bit with fixed code bits in the set of legal branch codes to directly form the original branch code. It then performs bit-by-bit comparison and parameter adjustment based on the code-bit annotation results, ensuring that the codeword distance between the original branch code and the target legal branch code falls within a set range. Compared to direct multi-classification algorithms, this invention implements action branch estimation at the code-bit level in the intermediate representation construction and constraint discrimination process, which helps to form decodable key intermediate quantities under conditions that rely solely on running records.
[0076] (3) This invention proposes an action branch reproduction method for cross-version replay closed loop. By recording the decoded legal branch codes as a legal branch code sequence according to the action triggering sequence, and directly inputting them into the action branch judgment interface during cross-version replay, a complete connection is achieved from running record extraction, legal branch code allocation, KAN mapping, range decoding to sequence replay. Existing technologies usually directly bind historical records to the old version judgment logic. This invention adds a legal branch code intermediate layer between the historical sample and the target version interface, and uses the consistency of sample records and the number of consecutive occurrences to handle parallel cases, so that the non-player character action branches can be stably output according to the action triggering sequence, which is convenient for cross-version regression verification, problem review and behavior consistency check. Attached Figure Description
[0077] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:
[0078] Figure 1 This is a flowchart of a reproducible cross-version game AI decision-making method based on deep learning proposed in this invention;
[0079] Figure 2 This is a flowchart illustrating the action branch sample sequence formation of a reproducible cross-version game AI decision-making method based on deep learning proposed in this invention.
[0080] Figure 3 This is a flowchart illustrating the formation of legal branch codes for a reproducible cross-version game AI decision-making method based on deep learning proposed in this invention.
[0081] Figure 4 This is a flowchart of the original branch code output for a reproducible cross-version game AI decision-making method based on deep learning proposed in this invention.
[0082] Figure 5 This is a flowchart of the legal branch code decoding process for a reproducible cross-version game AI decision-making method based on deep learning proposed in this invention.
[0083] Figure 6 This is a flowchart illustrating the formation of a valid branch code sequence for a reproducible cross-version game AI decision-making method based on deep learning proposed in this invention.
[0084] Figure 7 This is a flowchart illustrating the cross-version replay reproduction process of a deep learning-based cross-version game AI decision-making reproducible method proposed in this invention.
[0085] Figure 8 This is an algorithm model architecture diagram of a reproducible cross-version game AI decision-making method based on deep learning proposed in this invention;
[0086] Figure 9 This diagram illustrates the consistency of NPC paths in a cross-version game AI decision-making reproducible method based on deep learning proposed in this invention. The diagram compares the movement paths of NPCs in the same level in the V1 recording version and the V2 target version. The left side shows the original path of the NPC from the starting point around the obstacle to the target position during recording. The dashed line on the right side represents the original path referenced in V2, and the solid line represents the actual path after playback using this invention. The two paths basically overlap near the starting point, the obstacle-around process, and the end point, which intuitively demonstrates that this invention can maintain the consistency of NPC behavior and routes across versions even when the geometric details of the scene change.
[0087] Figure 10 This diagram compares the traditional playback method and the playback method of this invention, which is a reproducible cross-version game AI decision-making method based on deep learning proposed in this invention. In the same target version scene, the upper part of the diagram shows the traditional playback method: the dashed line is the original path of the recorded version, and the solid line is the actual path of the traditional playback. It can be seen that the NPC deviates from the expected route in the middle and there is a significant error in the destination position. The lower part shows the playback method of this invention: under the same starting point and target position, the dashed line is the recording path, and the solid line is the playback path driven by this invention. The two almost overlap. By comparing the upper and lower parts, it can be seen that this invention can also significantly improve the consistency of NPC trajectory when replaying the recorded behavior in the same game version.
[0088] Figure 11 This diagram illustrates the algorithm for ensuring time consistency of NPC action branches across versions, based on a deep learning-based method for reproducible cross-version game AI decision-making proposed in this invention. The upper part of the diagram uses time axes T1, T2, and T3 to represent multiple key moments, corresponding to the action branch code sequences selected by the recorded and replay versions at each moment. Black and white blocks represent different action branches, demonstrating that the replay version can be decoded into a "legal branch code sequence" consistent with the recorded version under the method of this invention. The lower part shows the processing flow: the state feature sequence is uniformly mapped to the original branch code by KAN, and then the legal branch code sequence is obtained by shortening the BCH and decoding, which is used to drive the NPC. This diagram emphasizes that this invention ensures consistent mapping of action branches on the time axis.
[0089] Figure 12This is a cross-version replay error distribution map of a reproducible cross-version game AI decision-making method based on deep learning proposed in this invention. The map adopts a grid heatmap form of time × position index. The upper map is the traditional replay method, and the lower map is the method of this invention. The horizontal axis is the time step or frame number, and the vertical axis is the discrete path grid point or key position index. The gray level of each grid represents the size of the cross-version position error at that moment and position. Black represents a large error, and white represents a small error. Comparing the two maps, it can be seen that there are a lot of dark blocks in the traditional method, and the error area is scattered and large. In the method of this invention, the grid is lighter overall, and the large error area shrinks significantly, indicating that the NPC's position in time and space is closer to the recorded version.
[0090] Figure 13 This is a color-filled contour plot of the action branch cost field of a reproducible cross-version game AI decision-making method based on deep learning proposed in this invention. The plot uses a two-dimensional environmental feature space as the coordinate system, with the horizontal and vertical axes representing two normalized environmental features (such as distance, health, visibility, etc.). The grayscale color fill indicates the cost or risk of selecting the wrong action branch under the feature combination. The dark central area is the high-risk area, and the light gray outer area is the low-risk area. The dashed contour lines in the plot represent the area covered by the traditional method at a certain risk threshold, which is relatively large. The solid contour lines represent the risk area obtained by the method of this invention at the same threshold, which is significantly shrunken to a smaller area. This plot illustrates that the present invention reduces the overall risk of action branch selection within the feature space.
[0091] Figure 14 This is a graph showing the mean and variance of cross-version error over time for a reproducible cross-version game AI decision-making method based on deep learning proposed in this invention. The graph presents two curves that change over time in a unified coordinate system. The solid line represents the mean of NPC position error in multiple cross-version replay experiments, and the dashed line represents the corresponding error variance or standard deviation. The curves are formed by connecting a large number of discrete sampling points, all of which are marked with dots. The curves decrease monotonically over time with slight fluctuations, which is closer to the characteristics of real data. The solid line gradually approaches the low error region, and the dashed line decreases synchronously, indicating that this invention not only significantly reduces the cross-version error level but also improves the stability of replay behavior.
[0092] Figure 15This diagram illustrates the overall process flow of cross-version NPC behavior reproduction in a deep learning-based cross-version game AI decision-making reproducible method proposed in this invention. The diagram summarizes the processing flow of this invention from a macro perspective: Recording stage: Collecting NPC behavior data during game runtime; Encoding stage: Inputting the behavior records into a KAN encoding model to obtain branch code representations, then using BCH error correction decoding to obtain a valid branch code sequence that is also valid in the target version; Playback stage: Driving the NPC to perform actions according to this branch code sequence in the cross-version game environment. The entire diagram connects the data flow and module relationships, demonstrating that this invention decomposes the complex cross-version behavior reproduction into three stages: recording, encoding error correction, and playback. Detailed Implementation
[0093] In Example 1, reference Figures 1 to 15 A reproducible method for cross-version game AI decision-making based on deep learning, comprising:
[0094] S1. Receive the running record of the non-player character, extract the action triggering event, the relative position relationship of the target, the state restriction information and the executed action branch from the running record of the non-player character, and form an action branch sample sequence.
[0095] S2. Based on the executed action branches in the action branch sample sequence, assign a unique legal branch code to each executed action branch under the minimum codeword distance constraint of the shortened BCH code, and form a set of legal branch codes.
[0096] S3. Input the action triggering event, target relative position relationship and state restriction information in the action branch sample sequence into KAN, limit the KAN output layer to correspond to the code bits in the set of legal branch codes, perform unified mapping of action triggering event, target relative position relationship and state restriction information, and output the original branch code corresponding to the executed action branch;
[0097] S4. Before the action branch is determined, the original branch code is decoded on the set of legal branch codes. The decoding is performed within a set codeword distance range. The codeword distance between the original branch code and each legal branch code is calculated. The legal branch code with the smallest codeword distance from the original branch code within the set codeword distance range is determined from the set of legal branch codes. The legal branch code is then used as the input value of the action branch determination interface.
[0098] S5. Determine the current action branch of the non-player character based on the valid branch code, and record the valid branch codes according to the action trigger sequence to form a valid branch code sequence;
[0099] S6. Input the valid branch code sequence into the action branch determination interface in the cross-version replay process, and output the non-player character replay action branch sequence based on the valid branch code sequence.
[0100] In this embodiment, step S1 specifically includes:
[0101] Organize the non-player character's activity logs into a sequence of records arranged in ascending order of timestamps. , For the first The timestamp of the record For the first The content of each record, To effectively record the total number, the recorded content must include at least the skill trigger type, hit and interrupted state, target switching state, relative distance, relative direction, line-of-sight obstruction, path reachability, control state, skill availability, previous action completion status, and action execution result, for the recorded sequence. A sequential scan is performed, identifying the record positions where skill trigger type changes, hit / interrupt status changes, target switching status changes, or action trigger timing changes as action trigger moments. Records are segmented around each action trigger moment. The most recent valid record before the action trigger moment is selected as the pre-action trigger state, and the corresponding record at the action trigger moment is selected as the action trigger state. After the action trigger moment, the action execution results are read sequentially along the timeline. The first record position that directly identifies the executed action branch is identified as the action branch determination position, and the record corresponding to the action branch determination position is identified as the action branch determination state. The action branch determination position is the action trigger timing position in the record segment that determines the executed action branch. Record segments lacking a pre-action trigger state, action trigger state, or action branch determination state are directly discarded and not included in the subsequent construction process.
[0102] The filtered record segments will be renumbered according to their action trigger sequence. , To effectively record the number of fragments, for each index Recording fragment extraction action trigger event Relative positional relationship of targets Status restriction information and executed action branches The action trigger event is read from the state before the action is triggered and the state at the time the action is triggered. to Indicates the skill trigger type. and Indicates the state of being hit and interrupted. and Indicates the target switching state. and This indicates the timing of the action trigger. The relative position of the target is read from the state when the action is triggered and the state when the action branch is determined. and Indicates a relative distance range. and Indicates a relative azimuth range. Indicates obstruction of vision. This indicates that the path is reachable; state constraint information is read from the state when the action is triggered and the state when the action branch is determined. to Indicates the control status. to Indicates the available skill slots. Indicates the position where the previous action was completed;
[0103] Skill trigger type, target switching state, control state, relative distance range, and relative orientation range are written to the corresponding dimensions using fixed-position binary encoding. Hit and interruption states, line-of-sight obstruction, path reachability, skill availability, and previous action completion are directly written to the corresponding dimensions according to the recorded values. When relative distance and relative orientation are continuous values in the original record, they are first discretized according to preset interval boundaries and then written to fixed positions. (Executed action branches are also included.) The action execution result field is directly read from the state when the action branch is determined, without inferring the action trigger event based on the action trigger event, the relative position of the target, or state constraint information. The relative positions of the targets are represented by a 12-dimensional vector. It is a 6-dimensional vector containing state constraint information. For an 8-dimensional vector, , and Formed by connecting in a fixed order , For the first The 26-dimensional feature vector corresponding to each record segment;
[0104] Will and In the same index Alignment is performed below to obtain a sequence arranged according to the action triggering order. Each From a single recorded fragment, each When the state is determined by action branches from the same record segment, a fixed correspondence is established between the action triggering event, the relative position of the target, the state constraint information, and the executed action branches within the same record segment, forming a sequence. This is the action branch sample sequence. The field arrangement in the action branch sample sequence remains fixed. The action triggering event is located in the first 12 dimensions, the target relative position relationship is located in the middle 6 dimensions, the state constraint information is located in the last 8 dimensions, and the executed action branches are kept separately as an index. Aligned label fields;
[0105] To enable the action branch sample sequences to be directly used by KAN, a continuous window of length 4 is used to read the action branch sample sequences, and the end position of the window is recorded as . , For any Read sequentially according to the action trigger sequence , , and The action trigger events at the four action trigger times are expanded into 48 dimensions, the relative positional relationships of the targets at the four action trigger times are expanded into 24 dimensions, and the state constraint information at the four action trigger times is expanded into 32 dimensions. These are then concatenated in a fixed order according to the action trigger events, target relative positional relationships, and state constraint information. , Given a 104-dimensional input vector, and Aligned executed action branches ,when At that time, no construction It was constructed using a continuous window of length 4. Maintaining fixed dimensions, fixed field positions, and a fixed action triggering sequence allows it to be directly used as input to a KAN. and The last action trigger time maintains a unique correspondence, which is used to establish the correspondence between the valid branch code and the executed action branch.
[0106] In this embodiment, step S2 specifically includes:
[0107] Action branch sample sequence For input, Indicates the number of sample items. Indicates the first The action of each sample item triggers an event. Indicates the first The relative positional relationship of the targets of each sample item Indicates the first State constraint information for each sample item Indicates the first Each sample item's executed action branch has a 12-dimensional vector for its trigger events. The 12 positions sequentially represent the skill trigger type, hit / interrupted state, target switching state, and action trigger timing position. The target's relative positional relationship is a 6-dimensional vector, with six positions sequentially representing the relative distance range, relative orientation range, line-of-sight occlusion, and path reachability. The status constraint information is an 8-dimensional vector, with eight bits sequentially representing the control state, skill availability, and previous action completion. Each item is read sequentially. When the action execution result identifiers are completely identical, sample items are grouped into the same executed action branch category, denoted as... , , This indicates the number of action branch categories that have been executed. For each executed action branch category... Record sample location set Sample location set Used to identify the branch category of the executed action. All occurrences in the action branch sample sequence;
[0108] Based on the number of branch categories of actions already executed The code length of the shortened BCH code is determined as follows: Candidate code lengths are selected sequentially in ascending order of length. For each candidate code length, all codewords corresponding to the shortened BCH code are generated. The number of allocatable codewords that satisfy the minimum codeword distance constraint of the shortened BCH code is counted, and the number of allocatable codewords is no less than [a certain number]. The minimum candidate code length is determined as the code length. The fixed code point order is defined as the sequence from the first code point to the second code point. The unique arrangement order of the code points, a fixed code point order, is used simultaneously for the complete code point combination in the candidate codeword representation result, each legal branch code in the legal branch code set, the code point correspondence in the KAN output layer, and the codeword distance calculation position in the action branch determination interface. In a fixed example configuration... Time selection The fixed code position sequence corresponds to fifteen consecutive code position positions, and the positions are consistent with the fifteen output neurons of the KAN output layer.
[0109] In code length Once determined, candidate codewords are generated according to a fixed code position order, and the first... The candidate codewords are denoted as , , Indicates the number of candidate codewords. Indicates the first The candidate codeword in the th ... The code value of a code point, for any two candidate codewords and Press the first code point to the... The code points are compared bit by bit, and the number of code points with inconsistent code values is determined as the distance between codewords. If the candidate codeword... with candidate codewords If the codeword distance is less than the minimum codeword distance of the shortened BCH code, then delete the candidate codewords that are later in the lexicographical order under the fixed codeword order. The lexicographical order under the fixed codeword order is from the 1st codeword to the 2nd codeword. The codewords are compared bit by bit to form the arrangement order. After comparing all candidate codewords, a constraint codeword set is obtained. Then, candidate codewords in the constraint codeword set are read from front to back according to the lexicographical order under the fixed codeword order, and added to the assigned codeword group in turn. For each added candidate codeword, the codeword distance is checked against each candidate codeword already added to the assigned codeword group. If the minimum codeword distance constraint of the shortened BCH code is met, it is retained; otherwise, it is skipped. This process continues until the number of candidate codewords in the assigned codeword group reaches a certain threshold. ;
[0110] To perform the one-to-one allocation improvement process, for each executed action branch category From the sample location set The corresponding sample items are used to extract action triggering events, target relative positional relationships, and state constraint information. The frequency of occurrence of each position is counted according to the field position to form a category representative vector. The category represents the vector. The first to 12th positions correspond to the skill trigger type, hit / interrupted state, target switching state, and action trigger timing position in the action trigger event. The 13th to 18th positions correspond to the relative distance range, relative orientation range, line-of-sight occlusion, and path reachability in the target's relative position relationship. The 19th to 26th positions correspond to the control state, skill availability, and previous action completion position in the status restriction information. When multiple values have the same frequency at a certain position, the field value that appears first in the action branch sample sequence is selected and written to the corresponding position. For any two executed action branch categories... and Compare the category representative vectors position by position according to the twenty-six positions. and The number of inconsistent positions is determined as the number of inconsistent contents. Then, the action branch sample sequence is scanned according to the action triggering time sequence. The inconsistencies are found between two adjacent sample positions. and Accumulate the number of consecutive occurrences at once, sort all category pairs by the number of consecutive occurrences in descending order, and sort by the number of inconsistent content in ascending order when the number of consecutive occurrences in the same case is the same.
[0111] For each sorted category pair, codeword priority allocation is performed. When the number of inconsistent contents is less than a preset threshold and the number of consecutive occurrences is greater than a preset threshold, two unassigned candidate codewords are selected from the allocated codeword group, and the codeword distance between the two candidate codewords is calculated. When the codeword distance is greater than the preset codeword distance threshold, the two candidate codewords are assigned to the two corresponding executed action branch categories. When multiple candidate codeword pairs meet the conditions at the same time, the candidate codeword pair with the largest codeword distance is selected first. When the codeword distances are the same, the candidate codeword pair with the earlier lexicographical order under the fixed code position order is selected first. The preset codeword distance threshold is greater than the minimum codeword distance of the shortened BCH code. Executed action branch categories that do not meet the codeword priority allocation conditions are arranged according to the action triggering time sequence of the first occurrence in the action branch sample sequence, and then assigned one by one with the remaining candidate codewords in the allocated codeword group according to the fixed code position order.
[0112] Assign to the branch category of the already executed action The candidate codewords are denoted as , Indicates the branch category of the action that has been executed. The corresponding valid branch codes, for all Write the valid branch code at the sample position. This process generates valid branch code annotations at the positions of existing executed action branches in the action branch sample sequence, and then summarizes all valid branch codes according to the order of the executed action branch categories. This forms a set of valid branch codes. In a fixed example configuration, the set of valid branch codes contains thirty-two 15-bit valid branch codes. The distance between any two valid branch codes is no less than five. The first to the 15th code bits in the set of valid branch codes correspond to the first to the 15th output neurons in the KAN output layer, and also correspond to the comparison positions of the first to the 15th code bits in the action branch determination interface. The executed action branches in the action branch sample sequence are thus converted into valid branch codes that are uniformly aligned with the KAN output structure and the action branch determination interface.
[0113] In this embodiment, step S3 specifically includes:
[0114] Read from the action branch sample sequence , , and , , For the first An action trigger event at the moment an action is triggered. to Indicates the skill trigger type. and Indicates the state of being hit and interrupted. and Indicates the target switching state. and Indicates the timing position of the action trigger. For the first The relative positional relationship of the target at the moment the action is triggered. and Indicates a relative distance range. and Indicates a relative azimuth range. Indicates obstruction of vision. Indicates that the path is reachable. For the first State constraint information at the moment an action is triggered. to Indicates the control status. to Indicates the available skill slots. Indicates the position where the previous action was completed. For the first The executed action branches at each action trigger moment are used to construct an input window from four consecutive action trigger moments, with the window end index denoted as . , For each According to the rules of action triggering sequence and adjacent arrangement of the same action triggering time, , , , , , , , , , , and Assembled sequentially , The input vector is 104-dimensional. Each action trigger time corresponds to a 26-dimensional input segment. Each 26-dimensional input segment consists of a 12-dimensional action trigger event, a 6-dimensional target relative position relationship, and an 8-dimensional state constraint information sequence. Therefore, the action trigger event, target relative position relationship, and state constraint information under the same action trigger sequence are... Maintaining adjacent positional relationships, Do not write ;
[0115] Read from the set of valid branch codes and The corresponding valid branch codes are represented as follows: , The number of valid branch codes, For the first Each of the 15 valid branch codes maintains the same order as the fixed code points. Reading and The corresponding valid branch codes, expanded in a fixed code position order as follows: , For the code point annotation results, Indicates the first A fixed code point label value, Each code point in the code point annotation result is related to... A unique correspondence is established. The code position annotation result does not enter the KAN input layer. The code position annotation result only participates in code position positioning and parameter adjustment. The code position annotation result is the result formed by expanding the legal branch code according to the fixed code position order in the legal branch code set and establishing a correspondence between each code position and the executed action branch.
[0116] KAN employs a single-chain hierarchical structure, including an input layer, a first hidden layer, a second hidden layer, and an output layer. The input layer has 104 input nodes, which are connected to... The 104 input positions correspond to 48 neurons in the first hidden layer. Each input node is connected to each neuron in the first hidden layer. Each connection sequentially performs the following operations: multiplying the input value by the corresponding learnable weight, adding it to the corresponding bias, and inputting it to a cubic spline nonlinear unit. The cubic spline nonlinear unit outputs a nonlinear value according to a piecewise cubic spline curve within a preset node interval, and maintains the boundary output value outside the preset node interval. The 48 neurons in the first hidden layer sum the outputs from the connections at the 104 input positions to form the intermediate representation of the first layer. The second hidden layer has twenty-four neurons, and forty-eight neurons in the first hidden layer are fully connected to the twenty-four neurons in the second hidden layer. The connection processing order continues to maintain the cascaded structure of learnable weights, biases, and cubic spline nonlinear units. The twenty-four neurons in the second hidden layer sum the outputs of the forty-eight connections to form the intermediate representation of the second layer. , Indicates the first The input window in the middle of the second layer indicates the first... The value at each calculation position Action triggering events, target relative position relationships and state constraint information are uniformly mapped through the same input layer, first hidden layer and second hidden layer mapping chain, without generating action category scores or continuous action boundary quantities;
[0117] exist In this case, the code points of the second-layer intermediate representation are located based on the code point annotation results, and each fixed code point is used. Select the position from the twenty-four calculation positions that corresponds to the first position. The calculation position that best matches a fixed code point is selected according to the following rule.
[0118] ;
[0119] In the formula, Indicates the first The calculation position corresponding to each fixed code point Indicates a fixed code position number. This indicates the calculation position number in the intermediate representation of the second layer. This indicates the end index of the input window. This indicates the end index of the input window used when calculating the location mean statistics. This indicates the number of sample items in the action branch sample sequence. Indicates the first The input window in the first The value at each calculation position Indicates the first The first input window corresponds to the code position annotation result. Each fixed code point takes a value. This indicates an indicator function; it assigns a value of 1 if the condition within the parentheses is true, and a value of zero if the condition within the parentheses is false. This represents the calculated location selection result that minimizes the cumulative number of inconsistencies. This indicates that accumulation is performed within the given index range. This represents the absolute value. The absolute value in the current formula is either zero or one. The formula is used to obtain... After that, the first The computational location is bound to the first... The calculation position corresponding to each fixed code position. When multiple fixed code positions obtain the same calculation position, the fixed code position with the smaller cumulative number of inconsistencies is retained. When the cumulative number of inconsistencies is the same, the fixed code position with the smaller fixed code position number is retained. The fixed code positions that have not been bound are repeatedly subjected to the same selection rule in the remaining calculation positions until all fifteen fixed code positions obtain a unique calculation position, thus forming a code position mapping result.
[0120] Based on the code point mapping results, the output layer is limited to a code point output structure corresponding to fifteen fixed code points in the set of legal branch codes. The output layer is configured with fifteen output neurons, and twenty-four second hidden layer neurons are fully connected to the fifteen output neurons. The nth output neuron corresponds to the nth... Each output neuron has 24 input weights, a bias, and a piecewise linear compression unit. The piecewise linear compression unit performs bit-value compression on the weighted sum of the output neurons: outputting zero when the weighted sum is less than or equal to zero, retaining the original value when the weighted sum is greater than zero and less than one, and outputting one when the weighted sum is greater than or equal to one. The compressed result is then compared to a fixed threshold of 0.5. A bit value of 1 is generated when the compressed result is greater than or equal to 0.5, and a bit value of zero is generated when the compressed result is less than 0.5. After the 15 output neurons complete their bit-value calculations, a bit value is formed. ,Will The original branch code is formed by combining the code points in a fixed code position order. The original branch code is a code position combination that is output by KAN in a fixed code position order in the set of legal branch codes and used to calculate the code word distance with each legal branch code before entering the action branch determination interface.
[0121] Original branch code Comparison with code point annotation results Bit-by-bit comparison is performed to count the number of code bits with inconsistent values among the fifteen code bits. The positions of these inconsistent code bits are then mapped to their calculated positions in the code bit mapping results. For each inconsistent code bit position, the twenty-four input weights and one bias of the corresponding output neuron are first located. Then, along the fully connected relationships, the learnable weights and biases between the second and first hidden layer neurons, as well as between the input layer and the first hidden layer neurons, are located. Parameter adjustments are only performed on the positions that contribute to the formation of inconsistent code bits. After each parameter adjustment, the identical... Re-input the input layer, first hidden layer, second hidden layer, and code point output structure to obtain the first-layer intermediate representation, second-layer intermediate representation, and original branch code. Recalculate the codeword distance between the original branch code and the code point annotation result. Stop the current operation when the codeword distance falls within the set codeword distance range. The corresponding parameter adjustments apply to all. After performing the same processing, fix the learnable weights and biases;
[0122] During runtime, for each new action trigger moment, the earliest 26-dimensional input segment is removed from the current input window, and a new 26-dimensional input segment is appended to the end of the input window, forming a new... new Continue performing a forward mapping in the order of input layer, first hidden layer, second hidden layer, and code point output structure to obtain a new original branch code. Therefore, KAN always receives a 104-dimensional input vector at each action trigger moment. KAN consistently outputs a 15-dimensional original branch code. The fifteen output bits always remain consistent with the fifteen fixed code bits in the set of valid branch codes.
[0123] In this embodiment, step S4 specifically includes:
[0124] The action branch determination interface uses each action trigger timing index. Receive a 15-dimensional raw branch code ,in , Indicates the original branch code at the th The code bit values at a fixed code position. The action branch determination interface maintains a set of valid branch codes internally. ,in , Indicates the first The valid branch code in the first... The code bit values at a fixed code position. This indicates the number of valid branch codes. In a fixed example configuration, Each valid branch code is a 15-bit codeword. Any two valid branch codes satisfy a minimum codeword distance of 5 for the shortened BCH code. The codeword distance range is set to 0 to 2. The action branch determination interface checks each index... Perform decoding independently, and in the index Generate a 15-dimensional valid branch code as the interface input value for the current action triggering sequence;
[0125] Action branch determination interface processing index When encountering the corresponding original branch code, each valid branch code is read sequentially according to its order in the set of valid branch codes. and in positions 1 to 15 and Bit-by-bit comparison generates the bit-by-bit comparison result corresponding to the current valid branch code, where a certain code position appears. At this point, increment the codeword distance count of the currently valid branch code by one. After all fifteen code bits have been compared, the original branch code is obtained. With valid branch code codeword spacing The codeword distances corresponding to all valid branch codes. Write the codeword distance results in the order of arrangement, then retain the valid branch codes whose codeword distance falls within the set codeword distance range of zero to two, and obtain the index. Valid branch codes within the corresponding range The legal branch code within the specified range is a legal branch code whose codeword distance between the original branch code and the legal branch code is within a set codeword distance range. The action branch determination interface then... Internal scan complete Read the minimum codeword distance, denoted as Then the spacing between codewords satisfies The valid branch codes are retained as candidates for valid branch codes with minimum distance, denoted as . ,when When there is only one valid branch code, the action branch determination interface directly uses the current valid branch code candidate as the valid branch code to be confirmed. When there are multiple valid branch codes, the action branch determination interface continues to perform sample record consistency statistics and adjacent occurrence count statistics. The decoding within the set codeword distance range is to use whether the codeword distance between the original branch code and each valid branch code is within the set codeword distance range as the valid branch code filtering condition, and to determine the valid branch code with the smallest codeword distance from the valid branch codes that meet the filtering condition.
[0126] To ensure consistency of statistical sample records, the action branch determination interface reads and indexes. Alignment action trigger event Relative positional relationship of targets and status restriction information ,in, This is a twelve-dimensional action trigger event, with the twelve positions representing, in order, the skill trigger type, the hit and interrupted state, the target switching state, and the action trigger sequence position. This represents the relative positional relationships of six-dimensional targets. The six positions sequentially represent the relative distance interval, relative orientation interval, line-of-sight occlusion, and path reachability. This is an eight-dimensional state constraint information, with eight bits representing the control state, skill availability, and previous action completion, respectively. The action branch determination interface... Each valid branch code in Scan action branch sample sequence full sample index ,in Indicates the number of sample items in the action branch sample sequence, index The location's action triggering event, the target's relative positional relationship, and the state constraint information are respectively denoted as... , and ,when and All twelve positions are identical. and All six positions are identical. and All eight positions are identical, and the index The valid branch code written at the position is equal to At that time, the current valid branch code Increment the number of sample records by one, and record the cumulative number of sample records as . , It is obtained directly from the sample index count, without introducing additional inference.
[0127] To count the number of consecutive occurrences, the action branch determination interface uses the current index. Establish valid branch codes where the triggering sequence of the previous action is already determined. ,when hour, Get Action Branch Sample Sequence Index The position has already been written with valid branch code, when hour, Get index The valid branch code has been determined, and the action branch determination interface then... Each valid branch code in Scan Sample Index When index The valid branch code written at the position is equal to and index The valid branch code written at the position is equal to At that time, the current valid branch code The number of consecutive occurrences of each element is incremented by one, and the cumulative number of consecutive occurrences is recorded as follows: , Similarly, it is obtained directly from the sample index count;
[0128] Action branch determination interface Each valid branch code in the code is uniformly evaluated, and the index is determined by the following formula. Corresponding valid branch code to be confirmed:
[0129] ;
[0130] In the formula, Indicates index The corresponding unconfirmed valid branch code, with the asterisk indicating the current index. The final selection result, This indicates selecting the legal branch code from the candidate legal branch codes that maximizes the result within the parentheses. Represents the first of the minimum distance valid branch code candidates. A valid branch code, Indicates index The corresponding minimum distance valid branch code candidate, This indicates the number of sample items in the action branch sample sequence. This represents the action triggering event, the relative position of the target, and the state constraint information and index. Completely identical, and the valid branch code equals The number of sample records, This indicates a valid branch code whose triggering sequence for the previous action is already determined. The number of consecutive occurrences in the action branch sample sequence. This represents the index of the valid branch code within the set of valid branch codes. Indicates the action trigger sequence index, because The value range is from zero to... , The value range is from zero to... Therefore, the difference in the number of sample records multiplied by The result must be greater than the difference in the number of occurrences of any adjacent occurrences. Therefore, the formula first completes the consistency preservation of sample records, and then completes the determination of the number of occurrences of adjacent occurrences when the number of sample records is the same. When the formula results of multiple legal branch codes are the same, the action branch determination interface selects the legal branch code with the smaller index in the legal branch code set.
[0131] In obtaining Afterwards, the action branch determination interface... Perform a minimum codeword distance constraint check on the shortened BCH code. The check method is as follows: With the set of legal branch codes Except For each valid branch code other than the first one, compare each bit from the 1st to the 15th bit, and recount the number of inconsistent bit values. When all the verification results are not less than five, After passing the legality check and being identified as a valid branch code, since all valid branch codes in the valid branch code set already satisfy the minimum codeword distance of the shortened BCH code during establishment, the action branch determination interface can obtain valid branch codes that satisfy the minimum codeword distance constraint during the current review process. The action branch determination interface writes the valid branch code that has passed the legality check into the current input value position, and performs action branch determination according to the pre-established correspondence between valid branch codes and executed action branches. Once the corresponding valid branch code is determined, the action branch determination interface continues to process the index. The corresponding original branch code, and the index The already determined valid branch code is used as an index. of Continue executing the count of adjacent occurrences, thereby sequentially decoding all original branch codes along the action trigger sequence.
[0132] In this embodiment, step S5 specifically includes:
[0133] Action branch determination interface indexed by action trigger timing Receive the valid branch codes determined by S4 one by one. ,in , This represents the number of sample items in the action branch sample sequence. The action branch determination interface internally stores the set of valid branch codes. , Indicates the number of valid branch codes. Indicates the first There are 15 valid branch codes, and the positions of the 15 code positions are consistent with the fixed code position order. The action branch determination interface internally stores each valid branch code and the category of the executed action branch. To establish a correspondence so that non-player characters can directly read the current action branch from the already executed action branch category, for each already executed action branch category... Record the original values of the executed action branches used when merging this category. ,in Indicates the branch category of the action that has been executed. The corresponding executed action branches, since the formation of executed action branch categories is based on the consistency of the content of executed action branches, therefore each Only one Each Only one ;
[0134] The action branch decision interface for input Perform exact matching according to the order of the valid branch codes in the set, and no longer... Recalculate the codeword distance; for exact matching, With each Comparing each bit from the 1st to the 15th bit, only when all fifteen bits are identical is the current bit complete. Only after being identified as a matching valid branch code is the action branch determination interface determined to be a matching valid branch code. Then, immediately read and The unique corresponding executed action branch category and executed action branches And generate action branch matching results. , Indicates index The corresponding action branch matching results, since each legal branch code in the set of legal branch codes maintains a correspondence with the category of the executed action branch, and the action branch determination interface is in the same index. The position only yields one action branch match result, and will not be in the same index. The location yields multiple branches of executed actions;
[0135] In action branch matching results After generation, the action branch determination interface directly... Executed action branches in Identify the current action branch as belonging to a non-player character and generate the action branch determination result. , Indicates index The corresponding action branch determination result shows that the first position represents the action trigger timing index, and the second position represents the current action branch of the non-player character. The action trigger timing in the action branch determination result is not inferred from other status fields; the action trigger timing in the action branch determination result is directly taken from the valid branch code. Corresponding action trigger timing index Through this process, a unique correspondence is established between the valid branch code, the type of the executed action branch, the executed action branch, and the action triggering sequence at the same index position;
[0136] The action branch determination interface determines the result based on the action branch. Extract Action Trigger Sequence Index and valid branch codes Action trigger timing index Perform binding and generate timing binding results. , Indicates index The corresponding timing binding result shows that the first position represents the action trigger timing, and the second position represents the valid branch code corresponding to the current action trigger timing. The timing binding result is formed by establishing a correspondence between valid branch codes and their corresponding action trigger timings. Since S3 constructs the input window using four consecutive action trigger times, the index of the first valid action trigger timing is... The action branch determination interface starts from... Start by recording the binding results of each time series sequentially, and then sort them according to the index in ascending order. Arranged into a valid branch code sequence Valid branch code sequence The sequence length is Each sequence element is a 15-dimensional binary codeword. The 15 code points of each sequence element are completely consistent with the fixed code point order in the set of legal branch codes. The sequence index corresponds to the action triggering sequence. The action branch determination interface receives the same index. When a new valid branch code is obtained, the index is overwritten with the new valid branch code. The old valid branch codes have been recorded, so that each action triggering timing position in the valid branch code sequence is kept to save only one final valid valid branch code record.
[0137] In this embodiment, step S6 specifically includes:
[0138] The valid branch code sequence formed by S5 is represented as follows: ,in This indicates the total number of action trigger sequences involved in the recording. Indicates the action trigger sequence index. Indicates index The corresponding valid branch code, Indicates the legal branch code at the th... The code bit values at a fixed code position. The first to the 15th code points correspond to the first to the 15th code points in the fixed code point order determined by S2, therefore For a length of The sequence of time-series codewords, where each element is a 15-dimensional binary codeword, allows the action branch determination interface during cross-version playback to directly use... As input values, it no longer accepts action trigger events, target relative position relationships, state restriction information, and original branch codes; the action branch determination interface internally stores a set of valid branch codes. ,in Indicates the number of valid branch codes. Indicates the first A valid branch code, Indicates the first The valid branch code in the first... The code value is taken at a fixed code position, and the action branch determination interface also stores the category of the executed action branch. With executed action branches The correspondence, where Indicates the first Each executed action branch category Indicates the first The original values of the executed action branches corresponding to each executed action branch category are stored internally by the action branch determination interface, since S2 has already established a correspondence between valid branch codes and executed action branch categories. , and A unique correspondence;
[0139] During cross-version replay, each time the action branch determination interface is called in the replay process, it corresponds to a replay action trigger position arranged in the action trigger sequence, which will be related to... The corresponding first replay action trigger position is denoted as , will with The corresponding trigger position for the next replay action is denoted as Record them in order. ,in, Indicates index The corresponding playback action trigger position, the action branch determination interface according to the index The order, from the sequence of valid branch codes Read from and will Write the playback action trigger position The interface input position, thus forming the timing input result. ,in, Indicates index The corresponding timing input results, where the first position represents the playback action trigger position and the second position represents the valid branch code written to the playback action trigger position, are formed by mapping each valid branch code in the valid branch code sequence to the corresponding action trigger position in the cross-version playback process according to the action trigger timing. All timing input results can be represented as follows: ;
[0140] Action branch decision interface in each Perform a valid branch code matching operation. During the matching process, the following will be performed: With each of the legal branch codes in the set Compare each bit sequentially from bit 1 to bit 15. Only when all fifteen bits are identical is the current... Only after being identified as a matching valid branch code is the action branch determination interface determined to be a matching valid branch code. After that, read and The unique corresponding executed action branch category And then according to Read the corresponding executed action branch This generates a timing action branch matching result. ,in, Indicates index The corresponding timing action branch matching result shows that the five positions represent, in order, the playback action trigger position, the input valid branch code, the matched valid branch code, the executed action branch type, and the executed action branch. This is due to the valid branch code sequence... Each of them All are derived from the set of valid branch codes, and each valid branch code in the set corresponds to only one executed action branch category, so each index Only one timing action branch matching result is generated;
[0141] Action branch decision interface from each Read the executed action branch And record the executed action branch obtained from the reading as ,in, This indicates that the cross-version replay process is in the index. Corresponding playback action trigger position The branches of actions that have already been executed, as determined above. The record format is consistent with the executed action branches in S1, and the action branch determination interface is based on the index. To Index The following steps are executed sequentially: reading the valid branch code, writing the replay action trigger position, precisely matching the valid branch code, and determining the executed action branch. Arranged in the order of action triggering, these are the non-player character action branch sequences. ,in, This represents the sequence of action branches reproduced by a non-player character, with a sequence length of [length missing]. Each sequence element is an executed action branch, and the sequence index corresponds to the playback action trigger position. The step of inputting the legal branch code sequence into the action branch determination interface in the cross-version playback process means directly using the legal branch code sequence as the input value of the action branch determination interface in the cross-version playback process, and outputting the non-player character reproduced action branch sequence according to the correspondence between each legal branch code in the legal branch code set and the executed action branch.
[0142] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
[0143] This invention addresses the issue of action branch decision boundary drift caused by version changes, operator differences, and runtime value disturbances in non-player character action branch reproduction scenarios across game versions. This drift leads to the same set of action trigger events, target relative position relationships, and state constraint information falling into different action branches in different versions, causing non-player character action chain breaks and replay results distortion. Under the condition of only being able to stably obtain non-player character execution records, action branch sample sequences, and statistical results of executed action branches, this invention constructs a code-level constraint expression mechanism with a set of valid branch codes as its core. Furthermore, it organizes action trigger events, target relative position relationships, and state constraint information into a fixed-position arrangement and inputs it into a KAN, so that the KAN no longer... Instead of outputting action category scores, it directly generates original branch codes according to a fixed code position order. Then, the original branch codes are input into the action branch determination interface. Within the shortened BCH code codeword space limited by the set of legal branch codes, codeword distance comparison and decoding are performed within the set codeword distance range. The original branch codes affected by local disturbances are converged into legal branch codes that meet the minimum codeword distance constraint. Then, based on the correspondence between legal branch codes and executed action branches, the action branch determination, legal branch code sequence recording, and timing input during cross-version playback are completed. In this way, the action branch determination chain is transformed from a direct classification path that is sensitive to continuous boundaries into a closed-loop technical path where code positions can be aligned, distances can be calculated, and results can be played back.
[0144] Compared to the general approach of directly inputting action triggering events, target relative position relationships, and state constraint information into a classification network and outputting action category scores, this invention specifically modifies the algorithm structure and intermediate objects around cross-version reproduction constraints to enhance the stability and feasibility of action branch reproduction: First, a set of legal branch codes satisfying the minimum codeword distance constraint of shortened BCH codes is constructed based on the number of executed action branch categories. This ensures that each executed action branch category has a fixed code position order and decodable code boundary before entering the model, thus providing the action branch determination interface with a directly comparable discrete codeword basis. Second, the KAN output layer is limited to a code position output structure that corresponds one-to-one with each code position in the set of legal branch codes. This compresses the action triggering events, target relative position relationships, and state constraint information into bit changes in the original branch codes on a unified mapping chain, avoiding the limitations of general classification. The output is directly triggered to change the action branch after being disturbed at the boundary position. Third, the action branch determination interface does not directly use the original branch code to determine the action branch. Instead, it calculates the codeword distance between the original branch code and each legal branch code and decodes within the set codeword distance range. This transforms the local code position deviation into a constrained selection of the legal branch code set, so that the action branch determination is based on discrete codeword constraints rather than continuous score thresholds. Fourth, the legal branch codes obtained by decoding are further formed into a legal branch code sequence according to the action triggering sequence. This sequence is directly used as the input value of the action branch determination interface during cross-version playback. This allows the online generation stage and the cross-version playback stage to share the same combination method branch code set, the same fixed code position order, and the same action branch determination interface. This achieves stable reproduction of action branches and closed-loop delivery of the entire task chain at the fine-grained action triggering sequence level.
Claims
1. A reproducible method for cross-version game AI decision-making based on deep learning, characterized in that, include: S1. Receive the running record of the non-player character, extract the action triggering event, the relative position relationship of the target, the state restriction information and the executed action branch from the running record of the non-player character, and form an action branch sample sequence. S2. Based on the executed action branches in the action branch sample sequence, assign a unique legal branch code to each executed action branch under the minimum codeword distance constraint of the shortened BCH code, and form a set of legal branch codes. S3. Input the action triggering event, target relative position relationship and state restriction information in the action branch sample sequence into KAN, limit the KAN output layer to correspond to the code bits in the set of legal branch codes, perform unified mapping of action triggering event, target relative position relationship and state restriction information, and output the original branch code corresponding to the executed action branch; S4. Before the action branch is determined, the original branch code is decoded on the set of legal branch codes. The decoding is performed within a set codeword distance range. The codeword distance between the original branch code and each legal branch code is calculated. The legal branch code with the smallest codeword distance from the original branch code within the set codeword distance range is determined from the set of legal branch codes. The legal branch code is then used as the input value of the action branch determination interface. S5. Determine the current action branch of the non-player character based on the valid branch code, and record the valid branch codes according to the action trigger sequence to form a valid branch code sequence; S6. Input the valid branch code sequence into the action branch determination interface in the cross-version replay process, and output the non-player character replay action branch sequence based on the valid branch code sequence.
2. The reproducible method for cross-version game AI decision-making based on deep learning according to claim 1, characterized in that, S1 specifically refers to: Receive the running records of non-player characters, and divide the running records of non-player characters into record segments according to the action triggering sequence and the action branch determination position. Each record segment contains the state before the action is triggered, the state when the action is triggered, and the state when the action branch is determined. Extract the recorded content corresponding to the non-player character's action triggering conditions from the recorded fragments to form action triggering events, and extract the recorded content corresponding to the proximity relationship with the target from the recorded fragments to form the target's relative position relationship; Extract the recording content corresponding to the non-player character's action execution restrictions from the recording fragments to form state restriction information, and determine the executed action branches based on the actual execution results in the recording fragments; The action triggering event, the target's relative position, the state constraint information, and the executed action branch are aligned and combined according to the action triggering sequence, so that the action triggering event, the target's relative position, the state constraint information, and the executed action branch are established in the same record segment, forming an action branch sample sequence.
3. The reproducible method for cross-version game AI decision-making based on deep learning according to claim 1, characterized in that, S2 specifically refers to: Read each executed action branch from the action branch sample sequence one by one, and group the executed action branches with the same content in the action branch sample sequence into one executed action branch category to form an executed action branch set; Based on the number of executed action branch categories in the executed action branch set, determine the code length, the number of allocatable codewords, and the fixed code position order of the shortened BCH code, so that the number of allocatable codewords is not less than the number of executed action branch categories, thus forming the code length determination result; Based on the code length determination result, a candidate codeword set with the corresponding code length is generated under a fixed code position order, and each candidate codeword in the candidate codeword set is represented as a complete code position combination arranged in a fixed code position order, forming the candidate codeword representation result; For each candidate codeword in the candidate codeword representation result, calculate the pairwise codeword distance, and compare the calculated codeword distance with the minimum codeword distance constraint of the shortened BCH code. If the comparison condition is met, retain the corresponding candidate codeword to form a set of constraint codewords. Based on the number of executed action branch categories, select the same number of candidate codewords from the constraint codeword set to form an allocation codeword group, and perform codeword distance verification on any two candidate codewords in the allocation codeword group so that each candidate codeword in the allocation codeword group satisfies the minimum codeword distance constraint of the shortened BCH code under a fixed code position order. Each candidate codeword in the assigned codeword group is assigned one by one to each executed action branch category in the executed action branch set to obtain the legal branch code corresponding to each executed action branch category. Each legal branch code is then written into the corresponding executed action branch position in the action branch sample sequence to form the legal branch code annotation result. Based on the results of the legal branch code annotation, all legal branch codes are summarized to form a legal branch code set. The fixed code position order in the legal branch code set is maintained, while also corresponding to the code position correspondence in the KAN output layer and the code word distance calculation position in the action branch determination interface.
4. The reproducible method for cross-version game AI decision-making based on deep learning according to claim 1, characterized in that, S3 specifically refers to: Extract action triggering events, target relative position relationships, and state constraint information from the action branch sample sequence, and unfold the action triggering events, target relative position relationships, and state constraint information into a fixed position arrangement according to the action triggering time sequence, so that the action triggering events, target relative position relationships, and state constraint information under the same action triggering time sequence establish a correspondence at adjacent input positions, forming the input arrangement result; Based on the executed action branches in the action branch sample sequence, read the legal branch codes corresponding to the executed action branches from the legal branch code set, and expand the legal branch codes into code position annotation results according to the fixed code position order in the legal branch code set. This ensures that each code position in the code position annotation results has a unique correspondence with the executed action branches, and the executed action branches are retained as code position annotation results without inputting KAN. The input permutation result is input into the input layer and the first hidden layer of KAN. In the first hidden layer, learnable weights, biases and cubic spline nonlinear units are set for each input position of the input permutation result. The first layer unified mapping is performed on the action triggering event, the target relative position relationship and the state constraint information to form the first layer intermediate representation. The first intermediate representation is input into the second hidden layer of KAN. In the second hidden layer, learnable weights, biases and cubic spline nonlinear units are set for the first intermediate representation. The second unified mapping is then performed on the first intermediate representation so that the action triggering event, the target relative position relationship and the state constraint information are combined and calculated on the same mapping chain to obtain the second intermediate representation. Based on the code point annotation results, code point positioning is performed on the second-layer intermediate representation to establish a positional correspondence between each calculated position in the second-layer intermediate representation and each fixed code point in the set of legal branch codes, thus forming a code point mapping result. Based on the code point mapping result, the KAN output layer is limited to a code point output structure corresponding to the code points in the set of legal branch codes. The code point mapping result is input into the code point output structure, and bit value calculation is performed on each fixed code point to form the code point output result. The code point output results are combined into the original branch code according to the fixed code point order in the set of legal branch codes. The bit-by-bit correspondence between the original branch code and the executed action branch is determined according to the code point annotation results, thus forming the original branch code corresponding to the executed action branch.
5. The reproducible method for cross-version game AI decision-making based on deep learning according to claim 1, characterized in that, S4 specifically refers to: The original branch code is input into the action branch determination interface as a comparison object for decoding within a set codeword distance range. The action branch determination interface reads each legal branch code from the legal branch code set one by one, so that the original branch code and each legal branch code establish a bit-by-bit comparison relationship according to the code position correspondence in the legal branch code set, and form a bit-by-bit comparison result. Based on the bit-by-bit comparison results, the consistency of bit values between the original branch code and each legal branch code is determined, and the number of bit values that are inconsistent between the original branch code and each legal branch code is determined as the codeword distance of the corresponding legal branch code, thus forming the codeword distance result; Compare the code word distances in the code word distance results with the set code word distance range, filter out the legal branch codes whose code word distances are within the set code word distance range, and form legal branch codes within the range; Perform minimum value determination based on the codeword distance corresponding to the legal branch codes within the range to obtain the minimum codeword distance, and then filter out the legal branch codes corresponding to the minimum codeword distance from the legal branch codes within the range to form the minimum distance legal branch codes; Based on the minimum codeword distance constraint of the shortened BCH code, the validity of the minimum distance valid branch code is determined, and the minimum distance valid branch code that satisfies the minimum codeword distance constraint of the shortened BCH code is determined as a valid branch code, thus forming the decoding result; Write the valid branch code from the decoding result into the action branch determination interface as input value, and make the action branch determination interface perform action branch determination based on the valid branch code.
6. The reproducible method for cross-version game AI decision-making based on deep learning according to claim 1, characterized in that, S5 specifically refers to: Input the valid branch code into the action branch determination interface, and match the valid branch code according to the correspondence between each valid branch code in the valid branch code set and the executed action branch to form the action branch matching result; Based on the action branch matching results, determine the current action branch of the non-player character corresponding to the valid branch code, and form the action branch determination result; Extract the corresponding action trigger sequence based on the action branch determination result, and bind the valid branch code with the action trigger sequence to form a sequence binding result; The valid branch codes in the timing binding result are arranged and recorded sequentially according to the action triggering sequence to form a valid branch code sequence.
7. The reproducible method for cross-version game AI decision-making based on deep learning according to claim 1, characterized in that, S6 specifically refers to: The valid branch code sequence is input into the action branch determination interface in the cross-version playback process, and the valid branch codes are read sequentially from the valid branch code sequence according to the action triggering sequence, so that each valid branch code is associated with the corresponding action triggering position in the cross-version playback process, forming a timing input result; Based on the correspondence between each legal branch code in the set of legal branch codes and the executed action branches, each legal branch code in the timing input result is matched to determine the executed action branch corresponding to each legal branch code, thus forming the timing action branch matching result; The executed action branches in the timing action branch matching results are arranged in order according to the action triggering sequence to form a sequence of action branches reproduced by non-player characters.
8. The reproducible method for cross-version game AI decision-making based on deep learning according to claim 3, characterized in that, When assigning each candidate codeword in the assigned codeword group to each executed action branch category in the executed action branch set, the number of content inconsistencies between any two executed action branch categories is calculated based on the action triggering event, target relative position relationship, and state restriction information corresponding to each executed action branch category in the action branch sample sequence. The number of times any two executed action branch categories appear consecutively in the action triggering sequence is also counted. If the number of content inconsistencies is less than a preset threshold and the number of consecutive occurrences is greater than a preset threshold, two candidate codewords with a codeword distance greater than a preset codeword distance threshold are selected from the assigned codeword group and assigned to the corresponding two executed action branch categories. The preset codeword distance threshold is greater than the minimum codeword distance of the shortened BCH code.
9. The reproducible method for cross-version game AI decision-making based on deep learning according to claim 4, characterized in that, After combining the code point output results into the original branch code according to the fixed code point order in the set of legal branch codes, the original branch code is compared bit by bit with the code point annotation results. The positions where the code point values are inconsistent are mapped to the calculation positions in the code point mapping results. The learnable weights and biases in the first hidden layer, the second hidden layer and the code point output structure are adjusted according to the calculation positions. Based on the adjusted learnable weights and biases, the first layer unified mapping, the second layer unified mapping and the bit value calculation are re-executed to obtain the original branch code whose code word distance with the code point annotation results is within the set code word distance range.
10. The reproducible method for cross-version game AI decision-making based on deep learning according to claim 5, characterized in that, If multiple valid branch codes exist within the range of valid branch codes, and the codeword distance between them and the original branch code is within the set codeword distance range and equal to the minimum codeword distance, then based on the action triggering event, target relative position relationship, and state restriction information corresponding to the original branch code, sample records with the same content of action triggering event, target relative position relationship, and state restriction information are selected from the action branch sample sequence. Valid branch codes corresponding to the executed action branches in the sample records are retained from the multiple valid branch codes. If the number of retained valid branch codes is 1, the retained valid branch code is determined as a valid branch code. If the number of retained valid branch codes is not equal to 1, multiple valid branch codes are used as statistical objects. The number of times the valid branch code with the previously determined action triggering sequence appears consecutively in the action branch sample sequence is counted, and the valid branch code with the largest consecutive occurrence is determined as a valid branch code.
Citation Information
Patent Citations
Game video playback method and system
CN105013174B
Game non-player character NPC behavior control method and device and storage medium
CN114053716A