Virtual role control method and device, storage medium, and electronic device

By determining candidate detour paths and the farthest target coordinates in the virtual character control method, the virtual character can be directly controlled to detour around obstacles and avoid opponents, which solves the problem of low detour path accuracy, improves the level of intelligence and game experience, and reduces server performance requirements.

CN119656596BActive Publication Date: 2026-02-10NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510073953.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-16
Publication Date
2026-02-10
Estimated Expiration
2045-01-16

AI Technical Summary

Technical Problem

Existing virtual character control methods have low accuracy in navigating game scenes, especially in new maps and modes where they lack generalization ability. They also require a large amount of data, long development cycles, and high server performance.

Method used

By determining the candidate detour paths of the virtual character in the game scene and calculating the farthest coordinate point of the target with the adversarial relationship, the target detour path is determined based on the coordinate point. Without imitation learning and reinforcement learning, the virtual character can be directly controlled to move around the target obstacle to avoid the opponent.

Benefits of technology

It improved the accuracy of detour paths, increased the intelligence of virtual characters in decision-making, reaction, and strategy formulation, enhanced the gaming experience, reduced the requirements for server performance, and shortened the development cycle.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119656596B_ABST
    Figure CN119656596B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a virtual role control method and device, a storage medium and an electronic device, and relates to the technical field of computers. The method comprises: determining a candidate detour path of a first virtual role around a candidate obstacle in a game scene according to a first current scene position of the first virtual role in the game scene; determining a first target farthest coordinate point corresponding to a second virtual role in the candidate detour path; determining a target detour path from the candidate detour path based on the first target farthest coordinate point, and determining a target obstacle from the candidate obstacle according to the target detour path; and controlling the first virtual role to move around the target obstacle based on the target detour path in the game scene to avoid the second virtual role. The present disclosure increases the intelligent degree of the first virtual role in multiple dimensions such as decision-making dimension, reaction dimension and strategy-making dimension, thereby increasing the game interaction experience of the player.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present disclosure relate to the technical field of computer, and specifically, to a virtual role control method, a virtual role control apparatus, a computer readable storage medium, and an electronic device. BACKGROUND

[0002] In some related virtual role control methods, full-process imitation learning and reinforcement learning can be directly used to determine the detour path. However, this method has low generalization ability for some game scenes, which leads to low accuracy of the obtained target detour path.

[0003] It should be noted that the information disclosed in the above background section is only used to strengthen the understanding of the background of the present disclosure, and therefore can include information that does not constitute prior art known to those of ordinary skill in the art. SUMMARY

[0004] The purpose of the present disclosure is to provide a virtual role control method, a virtual role control apparatus, a computer readable storage medium, and an electronic device, thereby at least partially overcoming the problem of low accuracy of the obtained target detour path due to the limitations and defects of the related art.

[0005] According to one aspect of the present disclosure, a virtual role control method is provided, comprising:

[0006] determining a candidate detour path of a first virtual role around a candidate obstacle in a game scene according to a first current scene position of the first virtual role in the game scene;

[0007] determining a first target farthest coordinate point corresponding to a second virtual role in the candidate detour path; the first virtual role and the second virtual role are in an antagonistic relationship;

[0008] determining a target detour path from the candidate detour path based on the first target farthest coordinate point, and determining a target obstacle from the candidate obstacle based on the target detour path;

[0009] controlling the first virtual role to move around the target obstacle based on the target detour path in the game scene to avoid the second virtual role.

[0010] According to one aspect of the present disclosure, a virtual role control apparatus is provided, comprising:

[0011] a candidate detour path determination module configured to determine a candidate detour path of a first virtual role around a candidate obstacle in a game scene according to a first current scene position of the first virtual role in the game scene;

[0012] a coordinate point determination module configured to determine a first target farthest coordinate point in the candidate detour path corresponding to a second virtual character; the first virtual character and the second virtual character are in an antagonistic relationship;

[0013] a target detour path determination module configured to determine a target detour path from the candidate detour path based on the first target farthest coordinate point, and determine a target obstacle from the candidate obstacles according to the target detour path;

[0014] a virtual character control module configured to control the first virtual character to move around the target obstacle based on the target detour path in the game scene, so as to avoid the second virtual character.

[0015] According to an aspect of the present disclosure, a computer readable storage medium is provided, which stores a computer program, the computer program is executed by a processor to implement the virtual character control method of any one of the above.

[0016] According to an aspect of the present disclosure, an electronic device is provided, comprising:

[0017] a processor; and

[0018] a memory configured to store executable instructions of the processor;

[0019] The processor is configured to execute the virtual character control method of any one of the above by executing the executable instructions.

[0020] The virtual character control method provided by the embodiments of the present disclosure, on the one hand, determines the candidate detour path of the first virtual character detouring the candidate obstacle in the game scene according to the first current scene position of the first virtual character in the game scene, then determines the first target farthest coordinate point in the candidate detour path corresponding to the second virtual character, and further determines the target detour path from the candidate detour path based on the first target farthest coordinate point, so as to realize the determination of the target detour path without using imitation learning and reinforcement learning, solve the problem of low accuracy of the target detour path caused by the need to use imitation learning and reinforcement learning to determine the target detour path in the related art, and improve the accuracy of the obtained target detour path; on the other hand, since the target obstacle can be determined from the candidate obstacles according to the target detour path, and the first virtual character is controlled to move around the target obstacle based on the target detour path in the game scene to avoid the second virtual character, the intelligent degree of the first virtual character in the decision dimension, the reaction dimension and the strategy making dimension is increased.

[0021] It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF DRAWINGS

[0022] The accompanying drawings, which are incorporated in and form a part of the specification, illustrate one embodiment of the present disclosure and, together with the description, serve to explain the principles of the disclosure. It is appreciated that the drawings described below are only some embodiments of the present disclosure, and other drawings can be obtained by those of ordinary skill in the art without creative effort on the basis of these drawings.

[0023] Figure 1 A flow chart of a control method of a virtual role is schematically shown according to an example embodiment of the present disclosure.

[0024] Figure 2 An example diagram of a game scene is schematically shown according to an example embodiment of the present disclosure.

[0025] Figure 3 A method flow chart of a specific determination process of a first target farthest coordinate point is schematically shown according to an example embodiment of the present disclosure.

[0026] Figure 4 A scene example diagram of an interpolation processing process of a candidate detour path is schematically shown according to an example embodiment of the present disclosure.

[0027] Figure 5 A scene example diagram of a resulting interpolation processing result is schematically shown according to an example embodiment of the present disclosure.

[0028] Figure 6 A scene example diagram of a determination process of a detour direction is schematically shown according to an example embodiment of the present disclosure.

[0029] Figure 7 A scene example diagram of a specific determination process of a next target point is schematically shown according to an example embodiment of the present disclosure.

[0030] Figure 8 A structure example diagram of a control device of a virtual role is schematically shown according to an example embodiment of the present disclosure.

[0031] Figure 9 An electronic device for implementing a control method of a virtual role is schematically shown according to an example embodiment of the present disclosure. DETAILED DESCRIPTION

[0032] Example implementations are now described with reference to the drawings. Example implementations can, however, be implemented in many different forms and should not be construed as limited to the examples set forth herein; rather, these implementations are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the example implementations to those skilled in the art. The described features, structures, or characteristics can be combined in one or more implementations. In the following description, numerous specific details are provided, such as examples of programming, software modules, user selections, network transactions, database queries, database structures, hardware modules, hardware- specific architectures, memory, processors, etc., in order to provide a thorough understanding of the example implementations. However, it will be recognized that the example implementations can be practiced without one or more of the specific details, or with other methods, components, materials, and so forth. In other instances, well-known structures have not been described in detail in order to avoid obscuring the example implementations.

[0033] Furthermore, the accompanying drawings are merely idealized representations that are not necessarily drawn to scale. Like reference numerals can be used to denote like parts throughout the description and the drawings. Some of the block diagrams in the drawings are functional entities that do not necessarily have to correspond to physically or logically independent entities. These functional entities can be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0034] In some Multiplayer Online Battle Arena (MOBA) games, a plurality of (e.g., four or six, or any other number, which is not particularly limited in the present examples) first virtual characters corresponding to survivors can play against a second virtual character corresponding to a guardian; in the process of the game confrontation, the main task of the first virtual character is to repair a virtual object (e.g., a code machine) to be repaired in the game scene in the shortest time, then open the door of a virtual building in the game scene and escape from the virtual building to obtain the final victory.

[0035] However, due to the natural imbalance between the first character ability of the first virtual character and the second character ability of the second virtual character, the first virtual character as the confrontation target of the second virtual character can only try to delay the pursuit time of the second virtual character as much as possible through virtual obstacles (virtual board or virtual window, etc.) or the terrain environment in the virtual scene, so as to achieve the purpose of giving more time for other first virtual characters in the team to repair the virtual object to be repaired in the game scene.

[0036] In the actual game process, the first virtual character can attack the second virtual character by fully utilizing the virtual board body or the virtual window body to cause the second virtual character to have a longer dizziness recovery time, thereby bringing more benefits to the team. However, in each game, since the number of virtual board bodies is limited and cannot be regenerated but only consumed, it is necessary to "save" each virtual board body as much as possible to maximize the benefits of each virtual board body. Further, in the process of surrounding the virtual board body or other virtual obstacles, the first virtual character generally follows the virtual model corresponding to the virtual board body or other virtual obstacles to make a detour, which can make the first virtual character walk around the virtual model corresponding to the virtual board body or other virtual obstacles faster to avoid being attacked by the second virtual character too quickly.

[0037] Under the premise of the above-mentioned content, in order to make a detour around the virtual model corresponding to the virtual board body or other virtual obstacles faster, the existing scheme provides the following implementation method: one implementation manner is to ignore the attack process of the first virtual character and directly select the next interactive point (i.e. inflection point) to make a detour faster; that is, after reaching a target interactive point, another interactive point is quickly selected until the end point is reached; however, based on this way of making a detour, the interaction between the first virtual character and the second virtual character is low, and the player cannot experience the joy of the game; another implementation manner is to directly use full-process imitation learning and reinforcement learning to determine the detour path; however, this method not only needs to be tested based on a large amount of data and developed for a long development cycle, and has very low generalization ability for new virtual scenes of new maps and new modes; and even if this function is put online, the server performance requirement is also very high, and cannot be widely used.

[0038] In order to solve the above problems, a scheme is needed, which can make a detour around the virtual obstacle or the virtual environment terrain under the premise of fully utilizing the virtual model corresponding to the virtual board body or other virtual obstacles and the virtual environment terrain, and the computing power is within an acceptable range and can be quickly landed (i.e. in the case of controllable computing power, the target detour path is quickly determined); with the above scheme, not only can the intelligent level of the first virtual character in multiple dimensions such as decision dimension, reaction dimension and strategy making dimension be greatly improved, but also the player can experience the joy of the game, the generalization ability for new maps and new modes is also high, and a large amount of data and a long development cycle are not required, and the landing speed is greatly improved.

[0039] Based on this, the first provided in the example embodiment is a virtual role control method, which can run on a terminal device, a server, a server cluster, or a cloud server, etc. Of course, those skilled in the art can also run the method of the present disclosure on other platforms according to needs, and the example embodiment does not make special limitations. Specifically, referring to Figure 1 The virtual role control method can include the following steps:

[0040] Step S110. According to the first current scene position of the first virtual role in the game scene, determine the candidate detour path of the first virtual role around the candidate obstacle in the game scene;

[0041] Step S120. Determine the first target farthest coordinate point corresponding to the second virtual role in the candidate detour path; the first virtual role and the second virtual role are in an antagonistic relationship;

[0042] Step S130. Based on the first target farthest coordinate point, determine the target detour path from the candidate detour path, and determine the target obstacle from the candidate obstacle according to the target detour path;

[0043] Step S140. Control the first virtual role to move around the target obstacle based on the target detour path in the game scene to avoid the second virtual role.

[0044] In the above-described virtual role control method, on the one hand, by determining the candidate detour path of the first virtual role around the candidate obstacle in the game scene according to the first current scene position of the first virtual role in the game scene, then determining the first target farthest coordinate point corresponding to the second virtual role in the candidate detour path, and further determining the target detour path from the candidate detour path based on the first target farthest coordinate point, the determination of the target detour path can be realized without using imitation learning and reinforcement learning, solving the problem of low accuracy of the target detour path caused by the need to use imitation learning and reinforcement learning to determine the target detour path in related technologies, and improving the accuracy of the obtained target detour path. On the other hand, since the target obstacle can be determined from the candidate obstacle according to the target detour path, and the first virtual role is controlled to move around the target obstacle based on the target detour path in the game scene to avoid the second virtual role, the intelligent degree of the first virtual role in multiple dimensions such as decision dimension, reaction dimension, and strategy making dimension is increased.

[0045] In the following, the virtual role control method described in the example embodiment of the present disclosure will be further explained and described in conjunction with the drawings.

[0046] Firstly, the nouns involved in the example embodiments of the present disclosure are explained and described.

[0047] Game Tick, GT for short; in the actual application process, almost all games are driven by a large program loop; therefore, just as each gear in the clock is synchronized with the pendulum, each task involved in driving the game simulation is synchronized with the game loop; therefore, correspondingly, a period of the game loop is called a game tick. Generally, the game is fixed to run at a rate of 20 game ticks per second, so a tick is 0.05 seconds (50 milliseconds, or one twenty-first of a second); further, the number of ticks per second (TPS) can be used to measure the running speed of the game, so the default value of the tick can also be modified by / tick rate; however, if the computer cannot keep up with this speed, the TPS will decrease; and since most operations are timed based on ticks rather than real-time, many operations take longer on slower computers.

[0048] First virtual role: the first virtual role involved in the example embodiments of the present disclosure can be the role corresponding to the survivor in the corresponding game scene; in the actual game process, the first virtual role can be controlled in an AI (Artificial Intelligence) manner; that is, in the actual application process, the first current scene position of the first virtual role, the second current scene position of the second virtual role, and the candidate obstacle adjacent to the first current scene position can be input into the corresponding agent for path prediction, that is, the target detour path can be obtained, and the first virtual role can be controlled by the agent to detour the corresponding target obstacle based on the target detour path; based on this, the intelligent degree of the first virtual role in multiple dimensions such as decision-making dimension, reaction dimension, and strategy making dimension can be improved.

[0049] Secondly, the technical implementation principle of the example embodiments of the present disclosure is explained and described. Specifically, in the actual application process, in order to control the first virtual role to move based on the target detour path, firstly, for each virtual obstacle in the game scene, a position adjacent to the virtual obstacle where a virtual role drivable waypoint (that is, a candidate interaction coordinate point) exists is randomly selected, and a pathfinding algorithm provided by the engine is used to obtain a pathfinding route (that is, a candidate detour path) starting from the candidate interaction coordinate point A and ending at the candidate interaction coordinate point A but needing to move around the obstacle; the pathfinding route output is a sequence of coordinates, and in the obtained pathfinding route, the coordinate points included in the pathfinding route are connected by straight lines, and each coordinate point corresponds to an inflection point of the pathfinding route;

[0050] Secondly, since each coordinate point can be the end point of the pathfinding route of the survivor (the first virtual character), and the moving position of the first virtual character in the detour process is controlled by the tick of the game, the interval between two coordinate points included in the pathfinding route is not conducive to the control of the moving position of the first virtual character in the detour process, for example, if the interval between two coordinate points is too large, the specific position of the first virtual character in the next game tick cannot be controlled sensitively, and for another example, if the interval between two coordinate points is too small, high-precision control cannot be achieved, that is, the first virtual character cannot be accurately controlled to move to the next scene position when the next game tick comes. Under this premise, the target distance interval between two coordinate points can be determined according to the game tick frequency of the game and the first moving speed of the first virtual character, for example, if the frequency of the game tick is 0.2s and the moving speed of the first virtual character is 45 yards / s, the target distance interval between two coordinate points can be determined as 9 yards.

[0051] Since the interval between the pathfinding route coordinates obtained by the pathfinding algorithm is basically much larger than 9 yards, after obtaining the target distance interval, the interpolation operation can be performed on the connecting path of the adjacent coordinate point A and the coordinate point B in the coordinate sequence in the candidate detour path to obtain the interpolation result. It should be noted that since the interpolation distance is 9 yards, interpolation is not performed when the distance between the next interpolation point and B is less than 9 yards. Further, after interpolation of all pathfinding routes, there can be a problem that the last interpolation point is too close to the coordinate point of each section of the pathfinding route or the two coordinate points of the pathfinding route are too close (although as mentioned above, the interval between the pathfinding route coordinates is basically much larger than 9 yards, but in some scenes the pathfinding algorithm still returns two close coordinate points). Under this premise, the interpolation points and / or coordinate points included in the interpolation result need to be filtered. Further, in the process of filtering the interpolation points and / or coordinate points, firstly, the straight line distance between any two adjacent interpolation points, the straight line distance between the interpolation points and the inflection points, or the straight line distance between the inflection points, etc. can be calculated. Secondly, after obtaining the straight line distance, if the straight line distance is less than 9 / 2=4.5 yards, the interpolation point / coordinate point is deleted to obtain the target interpolation point.

[0052] Next, the target point farthest from the second virtual character on each pathfinding path (i.e., the first target farthest coordinate point) is calculated. Further, according to the given data, the first movement time of the first virtual character to reach the farthest target point on each pathfinding path and the second movement time of the second virtual character to reach the farthest target point are calculated; under this premise, the selected target detour path needs to ensure that the first movement time of the first virtual character to reach the farthest target point on the path is shorter than the second movement time of the second virtual character to reach the farthest target point on the path, and the second movement time of the second virtual character to reach the farthest target point is as long as possible. Finally, after selecting the path, the number of points to be passed in the counterclockwise direction and the clockwise direction is calculated respectively, and the direction with fewer point distances is selected as the detour direction of the first virtual character.

[0053] In the following, the control method of the virtual character shown in Figure 1 will be further explained and described. Specifically:

[0054] In step S110, a candidate detour path of the first virtual character around a candidate obstacle in the game scene is determined according to a first current scene position of the first virtual character in the game scene.

[0055] Specifically, the specific determination process of the candidate detour path can be realized by the following way: obtaining the first current scene position of the first virtual character in the game scene, and matching the candidate obstacle from the game scene according to the first current scene position; obtaining the candidate interaction coordinate point corresponding to the first virtual character near the candidate obstacle, and generating the candidate detour path of the first virtual character around the candidate obstacle in the game scene based on the candidate interaction coordinate point. Specifically, in the process of matching the candidate obstacle, a candidate area can be determined according to the first current scene position of the first virtual character in the game scene, and then the obstacles included in the candidate area are taken as the candidate obstacles; of course, all obstacles in the game scene can also be directly traversed, and then the candidate obstacles are determined according to the distance between the actual positions of each obstacle and the first current scene position, and this example does not make special limitation. Further, the candidate interaction coordinate point recorded here refers to the point that the first virtual character can travel or stand or climb or jump, etc., which has been pre-established in the game development process; at the same time, taking the candidate obstacle as a virtual wall as an example, the corresponding candidate interaction coordinate point can be referred to as shown in 201 in Figure 2 ; at the same time, the first virtual character can be referred to as shown in 202 in Figure 2 , and the second virtual character can be referred to as shown in 203 in Figure 2As shown in 203; the first virtual character and the second virtual character are in an adversarial relationship, the first virtual character is a survivor and the second virtual character is a hunter.

[0056] In one example embodiment, generating a candidate detour path for the first virtual character to bypass the candidate obstacle based on the candidate interaction coordinate point can be achieved as follows: Convex hull decomposition is performed on the virtual obstacle model corresponding to the candidate obstacle to obtain a first original convex hull block; the positional relationship between the first original convex hull blocks is determined based on their positions in the virtual obstacle model; the target convex hull block containing the candidate interaction coordinate point is determined from the first original convex hull blocks; and other convex hull blocks corresponding to the target convex hull block are determined based on the positional relationship, using the candidate interaction coordinate point as the path start point and path end point; path inflection points in the other convex hull blocks corresponding to the candidate detour path are determined; and a candidate detour path for the first virtual character to bypass the candidate obstacle is generated based on the path start point, path end point, and path inflection points. In other words, the generation of candidate detour paths can be based on corresponding pathfinding algorithms. Taking the navigation mesh as an example, the specific generation principle is as follows: through a series of algorithms, the virtual obstacle model corresponding to the candidate obstacle is converted into a mesh of convex polygons (i.e., the first original convex hull block), and the adjacency relationship between the polygons is established. Furthermore, if it is necessary to calculate the movement path from the starting point to the ending point, it is necessary to find the polygon where the starting point is located and the polygon where the ending point is located. Based on the connection relationship of the polygons, it is necessary to find which polygons the movement needs to pass through. Then, based on the inflection point algorithm, the inflection points of the path are calculated and they are arranged into an array to generate the final candidate detour path.

[0057] Continue to refer to Figure 2 As shown, taking A as the starting and ending point, the resulting candidate detour path can be referenced from 204 in section 2; meanwhile, the coordinate points included in the resulting candidate detour path and their specific coordinate positions are shown in Table 1 below:

[0058] Table 1

[0059] Wayfinding route Coordinate Coordinate A (x A , y A , z A )]]> Coordinate B (x B , y B , z B )]]> … …

[0060] In an exemplary embodiment, convex hull decomposition of the virtual obstacle model corresponding to the candidate obstacle to obtain a first original convex hull block can be achieved as follows: traversing the virtual obstacle model corresponding to the candidate obstacle, extracting the first polyhedron included in the virtual obstacle model, and calculating the sum of the first interior angles of the first polyhedron; determining the first model concave region of the virtual obstacle model based on the sum of the first interior angles, and calculating the first concave distance of the first model concave region; sorting the first concave distance according to its magnitude to obtain a first concave distance sorting result, and configuring a first region weight value for the first model concave region according to the first concave distance sorting result; performing convex hull decomposition on the virtual obstacle model based on the first region weight value and the first model concave region to obtain the first original convex hull block. Specifically, in practical applications, the Convex Decomposition tool in the game development engine can be called to quickly decompose the model into convex hulls according to the specified maximum concave distance, and generate uniform (meaning uniform weight) optimal convex hull blocks based on the model's concave-convex structure. The optimal convex hull partitioning with uniform weights described here refers to the partitioning where the difference between the average concave distances in each partition can be maintained within a specific range; that is, the absolute value of the difference between the average concave distances in each partition needs to be less than or equal to a specific value. Based on this method, the accuracy of the obtained original convex hull partitioning can be improved, thereby improving the accuracy of the obtained candidate detour paths.

[0061] In step S120, the farthest coordinate point of the first target corresponding to the second virtual character in the candidate detour path is determined.

[0062] For details, please refer to Figure 3 As shown, the specific process of determining the farthest coordinate point of the first target may include the following steps:

[0063] In step S310, the candidate detour path is interpolated to obtain multiple target interpolation points, and the second current scene position of the second virtual character in the game scene is obtained.

[0064] In this example embodiment, firstly, interpolation processing is performed on the candidate detour paths to obtain multiple target interpolation points. Specifically, this can be achieved as follows: traverse the path start point, path inflection point, and path end point in the candidate detour paths, calculate the start-inflection point interval between the path start point and the path inflection point, the inflection point interval between the path inflection points, and the inflection point interval between the path inflection point and the path end point; determine the target intervals that need interpolation processing from the start-inflection point intervals, inflection point intervals, and inflection point intervals, and determine the number of original interpolation points that need interpolation in the target intervals; perform interpolation processing on the target intervals based on the number of original interpolation points to obtain interpolation results, and filter the original interpolation points included in the interpolation results to obtain multiple target interpolation points.

[0065] In one exemplary embodiment, determining the number of original interpolation points that need to be interpolated in the target interval can be achieved by: obtaining the first movement speed of the first virtual character in the game scene and the game time of the game scene, and determining a standard interval based on the first movement speed and the game time; and determining the number of original interpolation points that need to be interpolated in the target interval based on the target interval and the standard interval.

[0066] The following will further explain and illustrate the specific interpolation process. Specifically, in the actual application process, in the obtained candidate detour paths, the coordinate points are connected by straight lines and each coordinate point actually corresponds to the turning point of the pathfinding route; and since each coordinate point may become the end point of the survivor's (i.e., the first virtual character) pathfinding, and the first virtual character is controlled by the game's game ticks; therefore, if the distance between each coordinate point (i.e., the first position distance) is too large or too small, it is not conducive to the control of the first virtual character. If the distance is too large, it is not possible to sensitively control the specific location to which the survivor goes, and if the distance is too small, it is not possible to achieve high-precision control. Therefore, the appropriate interval (standard interval) between coordinates can be calculated according to the frequency of the game ticks and the first movement speed of the first virtual character in the game scene; among them, taking the frequency of the game ticks as 0.2s and the first movement speed as 45 yards / second as an example, the specific calculation process of the standard interval can be shown in the following formula (1):

[0067] Standard interval = 45 * 0.2 = 9 yards; Formula (1)

[0068] It should be noted that the specific values ​​of the game's clock frequency and the first movement speed can be set according to the actual situation; this example does not impose any special restrictions on them.

[0069] However, in the obtained candidate detour paths, since the initial distance between two adjacent coordinate points is generally much greater than 9 yards, interpolation is required between adjacent coordinate points in the candidate detour paths. Specifically, taking coordinate point B adjacent to coordinate point A as an example, the specific interpolation process is as follows: Based on the target interval and standard interval between coordinate points A and B, determine the number of original interpolation points (that is, calculate the ratio between the target interval and the standard interval to determine the number of original interpolation points; if the ratio is not an integer, simply round it down); Starting from coordinate point A, the first original interpolation point is obtained by interpolating the standard interval, and so on, to obtain other original interpolation points; finally, the interpolation process stops when the distance between the next original interpolation point and coordinate point B is less than the standard interval of 9 yards. For the specific interpolation process, please refer to [reference needed]. Figure 4 As shown in Table 2, further interpolation of the candidate detour paths yields new coordinate points. The interpolation results can be referenced. Figure 5 As shown.

[0070] Table 2

[0071]

[0072] It's also worth noting that after interpolating all candidate detour paths, the last original interpolation point might be too close to any coordinate point in each segment, or the interval between two coordinate points on the candidate detour path itself might be too short (although, as mentioned above, the interval between coordinates in the pathfinding route is generally much greater than 9 yards, the pathfinding algorithm may still return two relatively close coordinate points in some scenarios). Therefore, it's necessary to filter the interpolated coordinate points. Specifically, in the process of filtering interpolation points and / or coordinate points in the interpolation results, firstly, the straight-line distance between any two adjacent interpolation points, the straight-line distance between an interpolation point and an inflection point, or the straight-line distance between inflection points, etc., can be calculated. Secondly, after obtaining the straight-line distance, if the straight-line distance is less than 9 / 2 = 4.5 yards, then the interpolation point / coordinate point is deleted to obtain the target interpolation point.

[0073] Furthermore, the second virtual character's second current scene position in the game scene is obtained.

[0074] In step S320, the target position spacing between the second current scene position and the path start point, path inflection point, each of the target interpolation points and the path end point is calculated, and the farthest coordinate point of the first target corresponding to the second virtual character in the candidate detour path is determined according to the target position spacing.

[0075] Similarly, continue to refer to Figure 5 As shown, the farthest coordinate point of the first target can be as follows:Figure 5 As shown in 501 and 502; where, Figure 5 501 in the middle can be represented by N' B_J To represent; at the same time, Figure 5 502 in the middle can be used for N” B_J To represent it.

[0076] In step S130, a target detour path is determined from candidate detour paths based on the farthest coordinate point of the first target, and a target obstacle is determined from candidate obstacles based on the target detour path.

[0077] In this example embodiment, firstly, the target detour path is determined; specifically, this can be achieved as follows: determining the first movement time of the first virtual character from the first current scene position to the farthest coordinate point of the first target; determining the second movement time of the second virtual character from the second current scene position to the farthest coordinate point of the first target; and determining the target detour path from the candidate detour paths based on the first movement time and the second movement time.

[0078] In one exemplary embodiment, determining the first movement time for a first virtual character to move from a first current scene position to the farthest coordinate point of the first target can be achieved as follows: determining the first nearest coordinate point corresponding to the first virtual character in the candidate detour path, and determining the first distance to be traveled between the first current scene position and the first nearest coordinate point; determining the number of first target coordinate points that need to be passed when moving from the first nearest coordinate point to the farthest coordinate point of the first target, and determining the second distance to be traveled based on the number of first target coordinate points; and determining the first movement time based on the first distance to be traveled, the second distance to be traveled, and the first movement speed of the first virtual character in the game scene.

[0079] In one exemplary embodiment, determining the number of first target coordinate points that need to be traversed when moving from the first nearest coordinate point to the farthest first target coordinate point can be achieved as follows: determining the number of first clockwise coordinate points that need to be traversed when moving from the first nearest coordinate point to the farthest first target coordinate point in a clockwise direction; determining the number of first counterclockwise coordinate points that need to be traversed when moving from the first nearest coordinate point to the farthest first target coordinate point in a counterclockwise direction; and determining the number of first target coordinate points based on the number of first clockwise coordinate points and the number of first counterclockwise coordinate points.

[0080] In one exemplary embodiment, determining the second movement time for the second virtual character to move from the second current scene position to the farthest coordinate point of the first target can be achieved as follows: determining the second nearest coordinate point corresponding to the second virtual character in the candidate detour path, and determining the third distance to be traveled between the second current scene position and the second nearest coordinate point; determining the number of second target coordinate points that need to be passed when moving from the second nearest coordinate point to the farthest coordinate point of the first target, and determining the fourth distance to be traveled based on the number of second target coordinate points; and determining the second movement time based on the third distance to be traveled, the fourth distance to be traveled, and the second movement speed of the second virtual character in the game scene.

[0081] In one exemplary embodiment, determining the number of second target coordinate points that need to be traversed when moving from the second nearest coordinate point to the farthest first target coordinate point can be achieved as follows: determining the number of second clockwise coordinate points that need to be traversed when moving from the second nearest coordinate point to the farthest first target coordinate point in a clockwise direction; determining the number of second counterclockwise coordinate points that need to be traversed when moving from the second nearest coordinate point to the farthest first target coordinate point in a counterclockwise direction; and determining the number of second target coordinate points based on the number of second clockwise coordinate points and the number of second counterclockwise coordinate points.

[0082] The following section will further explain and illustrate the specific process of determining the target detour path. Specifically, in practical applications, for candidate interaction coordinates near candidate obstacles corresponding to the first virtual character, there are generally at least two routes. Interpolating these routes yields the corresponding path. For example, for... Figure 5 For the virtual board shown, the two interpolated paths are used to calculate the point farthest from the supervisor (i.e., the farthest coordinate point of the first target) on each path. Next, the first and second closest coordinate points to the first and second virtual characters are calculated on each path. Furthermore, the number of points in the clockwise and counter-clockwise directions needs to be calculated. Specifically, taking the calculation of the farthest coordinate points from the first virtual character to the first target on a certain path as an example, the specific number of coordinate points obtained can be shown in Table 3 below:

[0083] Table 3

[0084]

[0085] Furthermore, after obtaining the specific number of coordinate points, the minimum number of points is selected for each point, that is, the number of first target coordinate points can be 6; the number of second target coordinate points can be 5; then, the first distance to be traveled between the first virtual character and the first nearest coordinate point and the third distance to be traveled between the second virtual character and the second nearest coordinate point are calculated; under this premise, the specific calculation process of the first movement time for the survivor to reach the farthest point (that is, the farthest coordinate point of the first target) and the second movement time for the hunter to reach the farthest point (that is, the farthest coordinate point of the first target) can be shown in the following formula (2):

[0086]

[0087] Where t1 is the first movement time, t2 is the second movement time, and D B_Q D is the first distance to be traveled. B_J The third distance to be traveled, S Q S represents the initial movement speed of the first virtual character in the game scene. J The second virtual character's second movement speed in the game scene. Further, using the same method, the times t3 and t4 for the survivor and the hunter to reach the farthest point corresponding to other candidate paths can be calculated. Under this premise, the selected target detour path needs to ensure that the survivor's time to reach the farthest point is shorter than the hunter's time to reach the farthest point, and that the hunter's time to reach the farthest point is as long as possible. Here, we can assume t1 < t2 and t3 < t4. Under this premise, if t2 > t4, then the candidate detour path corresponding to t2 is selected as the target detour path; otherwise, the candidate detour path corresponding to t4 is selected as the target detour path. Based on this, we can ensure that the time for the second virtual character to reach the first target's farthest coordinate point is as long as possible, thus giving the first virtual character as much escape time as possible to achieve the goal of avoiding the second virtual character. At this point, the first virtual character can flexibly switch between multiple paths corresponding to the same interaction point on the target detour path.

[0088] In step S140, the first virtual character is controlled to move around the target obstacle in the game scene based on the target detour path in order to avoid the second virtual character.

[0089] Specifically, after obtaining the target detour path, you can control the first virtual character to move around the game scene to avoid the second virtual character and buy as much time as possible for your teammates.

[0090] In one possible example embodiment, after obtaining the target detour path, it is also necessary to determine the detour direction; specifically, this can be achieved as follows: determine the target detour direction of the first virtual character during its movement around the target obstacle based on the target detour path, and determine the next target point of the first virtual character according to the target detour direction; control the first virtual character to move from the first current scene position to the next target point in the game scene until the end of the path is reached, so as to achieve movement around the target obstacle and avoidance of the second virtual character.

[0091] In one exemplary embodiment, determining the target detour direction of the first virtual character during its movement around the target obstacle based on the target detour path can be achieved as follows: determining the second nearest coordinate point corresponding to the first virtual character and the second farthest coordinate point corresponding to the second virtual character in the target detour path; determining the number of second clockwise coordinate points that need to be passed when moving from the second nearest coordinate point to the second farthest coordinate point in a clockwise direction; determining the number of second counterclockwise coordinate points that need to be passed when moving from the second nearest coordinate point to the second farthest coordinate point in a counterclockwise direction; and determining the target detour direction of the first virtual character during its movement around the target obstacle based on the target detour path based on the number of second clockwise coordinate points and the number of second counterclockwise coordinate points.

[0092] In one exemplary embodiment, controlling the first virtual character to move from the first current scene position to the next target point in the game scene until the end of the path can be achieved by: determining the target interaction method between the first virtual character and the target obstacle at the next target point; controlling the first virtual character to move from the first current scene position to the next target point in the game scene, and interacting with the target obstacle based on the target interaction method until the end of the path is reached.

[0093] In one exemplary embodiment, determining the target interaction mode between the first virtual character and the target obstacle at the next target point can be achieved by: constructing a target line connecting the second nearest coordinate point and the next target point, and determining the intersection point between the target line and the vertex lines connecting the target convex hull block and / or other convex hull blocks corresponding to the target obstacle; and determining the target interaction mode between the first virtual character and the target obstacle at the next target point based on the intersection point.

[0094] In an exemplary embodiment, determining the target interaction mode between the first virtual character and the target obstacle at the next target point based on the intersection point can be achieved as follows: if the intersection point exists, the distance between the intersection point and the next target point is calculated; if the distance between the intersection point and the next target point is less than or equal to a preset distance threshold, the target interaction mode between the first virtual character and the target obstacle at the next target point is determined to be skipping the target obstacle; if the intersection point does not exist or exists but the distance between the intersection point and the next target point is greater than or equal to the preset distance threshold, the target interaction mode between the first virtual character and the target obstacle at the next target point is determined to be normal movement.

[0095] The following will further explain the specific process of determining the detour direction and interaction method. Specifically, after obtaining the target detour path, it is necessary to determine the detour direction. Specifically, in the calculation of the detour direction, firstly, calculate the point on the target detour path that is farthest from the hunter (i.e., the farthest coordinate point of the second target corresponding to the second virtual character), and calculate the point on the target detour path that is closest to the survivor (i.e., the second closest coordinate point corresponding to the first virtual character). Then, calculate the number of points that the target detour path passes through in both the counter-clockwise and clockwise directions, and select the direction with fewer points as the survivor's detour direction. For a specific example diagram of the specific process of determining the detour direction, please refer to [link to example diagram]. Figure 6 As shown in Table 4 below, 601 represents the clockwise direction and 602 represents the counter-clockwise direction. For example, as shown in Table 4 below, the clockwise direction should be chosen as the survivor's direction of movement around the interaction point.

[0096]

[0097] Furthermore, after obtaining the target detour direction, it is also necessary to determine the next target location and the corresponding interaction method. Specifically, this can be achieved as follows: (See details...) Figure 7 As shown, assuming the second nearest coordinate point is 701 and the direction of travel is counterclockwise, the next target point is 702. Calculate whether the line connecting the two points intersects with the window sill line segment (i.e., the line connecting the vertices of the target convex hull block and / or other convex hull blocks corresponding to the target obstacle) and whether the distance between the intersection point and the target point in the following figure is within a certain range. If the conditions are met, it means that the window needs to be climbed. Otherwise, calculate whether the line connecting the two points intersects with the line segment where the board is located (i.e., the line connecting the vertices of the target convex hull block and / or other convex hull blocks corresponding to the target obstacle) and whether the distance between the intersection point and the target point in the following figure is within a certain range. If the conditions are met, it means that the board needs to be climbed. If neither of the above two conditions is met, proceed directly without interaction.

[0098] Thus, the virtual character control method described in this embodiment has been fully implemented. Based on the foregoing description, it can be understood that the virtual character control method described in this example embodiment, through pathfinding path segmentation and multi-path switching methods, direction selection within the same path, and selection of the method to reach the next point, not only significantly enhances the intelligence of the virtual character in multiple dimensions such as decision-making, reaction, and strategy formulation, but also allows players to experience the thrill of strategic gameplay. It also has high generalization ability for new maps and modes, and requires minimal data and a long development cycle, greatly accelerating deployment.

[0099] The following are embodiments of the apparatus disclosed herein, which can be used to execute embodiments of the method disclosed herein. For details not disclosed in the apparatus embodiments of this disclosure, please refer to the embodiments of the method disclosed herein.

[0100] This disclosure also provides a control device for a virtual character. Specifically, see [link to relevant documentation]. Figure 8 As shown, the control device for the virtual character may include a candidate detour path determination module 810, a coordinate point determination module 820, a target detour path determination module 830, and a virtual character control module 840. Wherein:

[0101] The candidate detour path determination module 810 can be used to determine the candidate detour path for the first virtual character to bypass the candidate obstacles in the game scene based on the first current scene position of the first virtual character in the game scene;

[0102] The coordinate point determination module 820 can be used to determine the farthest coordinate point of the first target corresponding to the second virtual character in the candidate detour path; the first virtual character and the second virtual character are in an adversarial relationship;

[0103] The target detour path determination module 830 can be used to determine the target detour path from the candidate detour paths based on the farthest coordinate point of the first target, and to determine the target obstacle from the candidate obstacles according to the target detour path;

[0104] The virtual character control module 840 can be used to control a first virtual character to move around the target obstacle in the game scene based on a target detour path in order to avoid the second virtual character.

[0105] In one exemplary embodiment of this disclosure, determining a candidate detour path for the first virtual character to bypass candidate obstacles in the game scene based on the first current scene position of the first virtual character in the game scene includes: obtaining the first current scene position of the first virtual character in the game scene, and matching candidate obstacles from the game scene based on the first current scene position; obtaining candidate interaction coordinate points near the candidate obstacles corresponding to the first virtual character, and generating a candidate detour path for the first virtual character to bypass candidate obstacles in the game scene based on the candidate interaction coordinate points.

[0106] In one exemplary embodiment of this disclosure, generating a candidate detour path for the first virtual character to bypass candidate obstacles in the game scene based on the candidate interaction coordinate points includes: performing convex hull decomposition on the virtual obstacle model corresponding to the candidate obstacles to obtain first original convex hull blocks, and determining the positional relationship between the first original convex hull blocks according to the block positions of the first original convex hull blocks in the virtual obstacle model; determining the target convex hull block where the candidate interaction coordinate points are located from the first original convex hull blocks, and determining other convex hull blocks corresponding to the target convex hull block based on the positional relationship, using the candidate interaction coordinate points as the path start point and path end point; determining the path inflection points in the other convex hull blocks that correspond to the candidate detour path, and generating a candidate detour path for the first virtual character to bypass candidate obstacles in the game scene based on the path start point, path end point, and path inflection points.

[0107] In an exemplary embodiment of this disclosure, convex hull decomposition is performed on the virtual obstacle model corresponding to the candidate obstacle to obtain a first original convex hull block. This includes: traversing the virtual obstacle model corresponding to the candidate obstacle, extracting a first polyhedron included in the virtual obstacle model, and calculating the sum of the first interior angles of the first polyhedron; determining a first model concave region of the virtual obstacle model based on the sum of the first interior angles, and calculating a first concave distance of the first model concave region; sorting the first concave distances according to their magnitude to obtain a first concave distance sorting result, and configuring a first region weight value for the first model concave region according to the first concave distance sorting result; and performing convex hull decomposition on the virtual obstacle model based on the first region weight value and the first model concave region to obtain the first original convex hull block.

[0108] In an exemplary embodiment of this disclosure, determining the farthest coordinate point of the first target corresponding to the second virtual character in the candidate detour path includes: performing interpolation processing on the candidate detour path to obtain multiple target interpolation points, and obtaining the second current scene position of the second virtual character in the game scene; calculating the target position distance between the second current scene position and the path start point, path inflection point, each of the target interpolation points and the path end point, and determining the farthest coordinate point of the first target corresponding to the second virtual character in the candidate detour path based on the target position distance.

[0109] In one exemplary embodiment of this disclosure, interpolation processing is performed on the candidate detour path to obtain multiple target interpolation points, including: traversing the path start point, path inflection point, and path end point in the candidate detour path; calculating the start point-inflection point interval between the path start point and the path inflection point, the inflection point-inflection point interval between the path inflection points, and the inflection point-end point interval between the path inflection point and the path end point; determining the target interval that needs to be interpolated from the start point-inflection point interval, the inflection point-inflection point interval, and the inflection point-end point interval, and determining the number of original interpolation points that need to be interpolated in the target interval; performing interpolation processing on the target interval based on the number of original interpolation points to obtain the interpolation result, and filtering the original interpolation points included in the interpolation result to obtain multiple target interpolation points.

[0110] In one exemplary embodiment of this disclosure, determining the number of original interpolation points that need to be interpolated in the target interval includes: obtaining a first movement speed of the first virtual character in the game scene and a game tick of the game scene, and determining a standard interval based on the first movement speed and the game tick; and determining the number of original interpolation points that need to be interpolated in the target interval based on the target interval and the standard interval.

[0111] In one exemplary embodiment of this disclosure, determining a target detour path from the candidate detour paths based on the farthest coordinate point of the first target includes: determining a first movement time for the first virtual character to move from a first current scene position to the farthest coordinate point of the first target; determining a second movement time for the second virtual character to move from a second current scene position to the farthest coordinate point of the first target; and determining the target detour path from the candidate detour paths based on the first movement time and the second movement time.

[0112] In an exemplary embodiment of this disclosure, determining the first movement time for the first virtual character to move from the first current scene position to the farthest coordinate point of the first target includes: determining the first nearest coordinate point corresponding to the first virtual character in the candidate detour path, and determining the first distance to be traveled between the first current scene position and the first nearest coordinate point; determining the number of first target coordinate points that need to be passed when moving from the first nearest coordinate point to the farthest coordinate point of the first target, and determining the second distance to be traveled based on the number of first target coordinate points; and determining the first movement time based on the first distance to be traveled, the second distance to be traveled, and the first movement speed of the first virtual character in the game scene.

[0113] In one exemplary embodiment of this disclosure, determining the number of first target coordinate points that need to be traversed when moving from the first nearest coordinate point to the first farthest target coordinate point includes: determining the number of first clockwise coordinate points that need to be traversed when moving from the first nearest coordinate point to the first farthest target coordinate point in a clockwise direction; determining the number of first counterclockwise coordinate points that need to be traversed when moving from the first nearest coordinate point to the first farthest target coordinate point in a counterclockwise direction; and determining the number of the first target coordinate points based on the number of first clockwise coordinate points and the number of first counterclockwise coordinate points.

[0114] In one exemplary embodiment of this disclosure, controlling the first virtual character to move around the target obstacle in the game scene based on the target detour path to avoid the second virtual character includes: determining the target detour direction of the first virtual character during its movement around the target obstacle based on the target detour path, and determining the next target point of the first virtual character based on the target detour direction; controlling the first virtual character to move from a first current scene position to the next target point in the game scene until the end of the path is reached, so as to achieve movement around the target obstacle and avoidance of the second virtual character.

[0115] In one exemplary embodiment of this disclosure, determining the target detour direction of the first virtual character during its movement around the target obstacle based on the target detour path includes: determining a second nearest coordinate point corresponding to the first virtual character and a second farthest coordinate point corresponding to the second virtual character in the target detour path; determining the number of second clockwise coordinate points that need to be passed when moving from the second nearest coordinate point to the second farthest coordinate point in a clockwise direction; determining the number of second counterclockwise coordinate points that need to be passed when moving from the second nearest coordinate point to the second farthest coordinate point in a counterclockwise direction; and determining the target detour direction of the first virtual character during its movement around the target obstacle based on the number of second clockwise coordinate points and the number of second counterclockwise coordinate points.

[0116] In one exemplary embodiment of this disclosure, controlling the first virtual character to move from a first current scene position to the next target point in the game scene until the path endpoint is reached includes: determining the target interaction mode between the first virtual character and the target obstacle at the next target point; controlling the first virtual character to move from the first current scene position to the next target point in the game scene, and interacting with the target obstacle based on the target interaction mode until the path endpoint is reached.

[0117] In one exemplary embodiment of this disclosure, determining the target interaction mode between the first virtual character and the target obstacle at the next target point includes: constructing a target line connecting the second nearest coordinate point and the next target point, and determining the intersection point between the target line and the vertex lines connecting the target convex hull block and / or other convex hull blocks corresponding to the target obstacle; and determining the target interaction mode between the first virtual character and the target obstacle at the next target point based on the intersection point.

[0118] In an exemplary embodiment of this disclosure, determining the target interaction mode between the first virtual character and the target obstacle at the next target point based on the intersection point includes: if the intersection point exists, calculating the distance between the intersection point and the next target point; if the distance between the intersection point and the next target point is less than or equal to a preset distance threshold, determining the target interaction mode between the first virtual character and the target obstacle at the next target point as skipping the target obstacle; if the intersection point does not exist or exists but the distance between the intersection point and the next target point is greater than or equal to the preset distance threshold, determining the target interaction mode between the first virtual character and the target obstacle at the next target point as normal movement.

[0119] The specific details of each module in the control device of the aforementioned virtual character have been described in detail in the corresponding control method of the virtual character, so they will not be repeated here.

[0120] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0121] Furthermore, although the steps of the method in this disclosure are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.

[0122] In exemplary embodiments of this disclosure, an electronic device capable of implementing the above-described methods is also provided. Those skilled in the art will understand that various aspects of this disclosure can be implemented as systems, methods, or program products. Therefore, various aspects of this disclosure can be specifically implemented in the following forms: entirely hardware implementations, entirely software implementations (including firmware, microcode, etc.), or implementations combining hardware and software aspects, collectively referred to herein as circuits, modules, or systems.

[0123] The following reference Figure 9 To describe an electronic device 900 according to such an embodiment of the present disclosure. Figure 9 The electronic device 900 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.

[0124] like Figure 9 As shown, the electronic device 900 is manifested in the form of a general-purpose computing device. The components of the electronic device 900 may include, but are not limited to: at least one processing unit 910, at least one storage unit 920, a bus 930 connecting different system components (including storage unit 920 and processing unit 910), and a display unit 940.

[0125] The storage unit stores program code that can be executed by the processing unit 910, causing the processing unit 910 to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this disclosure. For example, the processing unit 910 can perform actions such as... Figure 1Step S110: Based on the first current scene position of the first virtual character in the game scene, determine the candidate detour path for the first virtual character to bypass the candidate obstacles in the game scene; Step S120: Determine the farthest coordinate point of the first target corresponding to the second virtual character in the candidate detour path; The first virtual character and the second virtual character are in an adversarial relationship; Step S130: Based on the farthest coordinate point of the first target, determine the target detour path from the candidate detour paths, and determine the target obstacle from the candidate obstacles according to the target detour path; Step S140: Control the first virtual character to move around the target obstacle in the game scene based on the target detour path to avoid the second virtual character.

[0126] Storage unit 920 may include readable media in the form of volatile storage units, such as random access memory (RAM) 9201 and / or cache memory 9202, and may further include read-only memory (ROM) 9203.

[0127] Storage unit 920 may also include a program / utility 9204 having a set (at least one) program module 9205, such program module 9205 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.

[0128] Bus 930 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.

[0129] Electronic device 900 can also communicate with one or more external devices 1000 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 900, and / or with any device that enables electronic device 900 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 950. Furthermore, electronic device 900 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 960. As shown, network adapter 960 communicates with other modules of electronic device 900 via bus 930. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 900, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0130] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.

[0131] In exemplary embodiments of this disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the methods described above is stored. In some possible implementations, various aspects of this disclosure may also be implemented as a program product including program code that, when the program product is run on a terminal device, causes the terminal device to perform the steps of the various exemplary embodiments of this disclosure described in the "Exemplary Methods" section above.

[0132] The program product for implementing the above-described method according to embodiments of the present disclosure may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto. In this document, the readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.

[0133] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0134] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.

[0135] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0136] Program code for performing the operations of this disclosure can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0137] Furthermore, the above figures are merely illustrative of the processes included in the method according to exemplary embodiments of this disclosure and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.

[0138] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention described herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not invented by this disclosure. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.

Claims

1. A method for controlling a virtual character, characterized in that, include: Based on the first virtual character's current scene position in the game scene, a candidate detour path is determined for the first virtual character to bypass candidate obstacles in the game scene. The candidate detour path is determined as follows: convex hull decomposition is performed on the virtual obstacle model corresponding to the candidate obstacle to obtain a first original convex hull block; the positional relationship between the first original convex hull blocks is determined based on their positions in the virtual obstacle model; a target convex hull block containing candidate interaction coordinate points is determined from the first original convex hull blocks; using the candidate interaction coordinate points as the path start and end points, other convex hull blocks corresponding to the target convex hull block are determined based on the positional relationship; path inflection points in the other convex hull blocks are determined; and a candidate detour path for the first virtual character to bypass candidate obstacles in the game scene is generated based on the path start, path end, and path inflection points. Determine the farthest coordinates of the first target corresponding to the second virtual character in the candidate detour paths; the first virtual character and the second virtual character are in an adversarial relationship; Based on the farthest coordinate point of the first target, a target detour path is determined from the candidate detour paths, and a target obstacle is determined from the candidate obstacles based on the target detour path; The first virtual character is controlled to move around the target obstacle in the game scene based on the target detour path in order to avoid the second virtual character.

2. The method for controlling a virtual character according to claim 1, characterized in that, Based on the first virtual character's first current scene position in the game scene, determine the first virtual character's candidate detour path around the candidate obstacles in the game scene, including: Obtain the first current scene position of the first virtual character in the game scene, and match candidate obstacles from the game scene based on the first current scene position; Obtain candidate interaction coordinates near the candidate obstacle that correspond to the first virtual character, and based on the candidate interaction coordinates, generate a candidate detour path for the first virtual character to bypass the candidate obstacle in the game scene.

3. The method for controlling a virtual character according to claim 1, characterized in that, Perform convex hull decomposition on the virtual obstacle model corresponding to the candidate obstacle to obtain the first original convex hull block, including: Traverse the virtual obstacle models corresponding to the candidate obstacles, extract the first polyhedron included in the virtual obstacle model, and calculate the sum of the first interior angles of the first polyhedron; Based on the first interior angle, a first model recessed area of ​​the virtual obstacle model is determined, and a first recessed distance of the first model recessed area is calculated; The first indentation distances are sorted according to their magnitudes to obtain a sorting result for the first indentation distances. A first region weight value is then configured for the indented region of the first model based on the sorting result for the first indentation distances. Based on the weight value of the first region and the concave region of the first model, the virtual obstacle model is decomposed into a convex hull to obtain the first original convex hull block.

4. The method for controlling a virtual character according to claim 1, characterized in that, Determining the farthest coordinates of the first target corresponding to the second virtual character in the candidate detour paths includes: The candidate detour paths are interpolated to obtain multiple target interpolation points, and the second current scene position of the second virtual character in the game scene is obtained. Calculate the target position spacing between the second current scene position and the path start point, path inflection point, each of the target interpolation points and the path end point, and determine the farthest coordinate point of the first target corresponding to the second virtual character in the candidate detour path based on the target position spacing.

5. The method for controlling a virtual character according to claim 4, characterized in that, The candidate detour paths are interpolated to obtain multiple target interpolation points, including: Traverse the path start point, path inflection point and path end point in the candidate detour path, and calculate the start point-inflection point interval between the path start point and the path inflection point, the inflection point-inflection point interval between the path inflection points and the inflection point-end point interval between the path inflection point and the path end point. Determine the target interval that needs interpolation processing from the start-inflection interval, the inflection-inflection interval, and the inflection-end interval, and determine the number of original interpolation points that need to be interpolated in the target interval. The target interval is interpolated based on the number of original interpolation points to obtain the interpolation result. The original interpolation points included in the interpolation result are then filtered to obtain multiple target interpolation points.

6. The method for controlling a virtual character according to claim 5, characterized in that, Determine the number of original interpolation points in the target interval that need to be interpolated, including: The first movement speed of the first virtual character in the game scene and the game time of the game scene are obtained, and a standard interval is determined based on the first movement speed and the game time. Based on the target interval and the standard interval, determine the number of original interpolation points in the target interval that need to be interpolated.

7. The method for controlling a virtual character according to claim 1, characterized in that, Based on the farthest coordinates of the first target, the target detour path is determined from the candidate detour paths, including: Determine the first movement time of the first virtual character from the first current scene position to the farthest coordinate point of the first target; Determine the second movement time for the second virtual character to move from the second current scene position to the farthest coordinate point of the first target; The target detour path is determined from the candidate detour paths based on the first travel time and the second travel time.

8. The method for controlling a virtual character according to claim 7, characterized in that, Determining the first movement time of the first virtual character from its current scene position to the farthest coordinate point of the first target includes: Determine the first nearest coordinate point in the candidate detour path that corresponds to the first virtual character, and determine the first distance to be traveled between the first current scene position and the first nearest coordinate point; Determine the number of first target coordinate points that need to be traversed when moving from the first nearest coordinate point to the first farthest target coordinate point, and determine the second distance to be traveled based on the number of first target coordinate points; The first travel time is determined based on the first travel distance, the second travel distance, and the first movement speed of the first virtual character in the game scene.

9. The method for controlling a virtual character according to claim 8, characterized in that, Determine the number of first target coordinate points that need to be traversed when moving from the first nearest coordinate point to the first farthest target coordinate point, including: Determine the number of clockwise coordinate points that need to be traversed when moving from the first nearest coordinate point to the farthest coordinate point of the first target in a clockwise direction; Determine the number of first counterclockwise coordinate points that need to be traversed when moving from the first nearest coordinate point to the first farthest coordinate point of the first target in a counterclockwise direction; The number of the first target coordinate points is determined based on the number of the first clockwise coordinate points and the number of the first counterclockwise coordinate points.

10. The method for controlling a virtual character according to claim 1, characterized in that, Controlling the first virtual character to move around the target obstacle in the game scene based on the target detour path to avoid the second virtual character includes: Determine the target detour direction of the first virtual character as it moves around the target obstacle based on the target detour path, and determine the next target point of the first virtual character based on the target detour direction; The first virtual character is controlled to move from the first current scene position to the next target point in the game scene until the end of the path is reached, so as to move around the target obstacle and avoid the second virtual character.

11. The method for controlling a virtual character according to claim 10, characterized in that, Determining the target detour direction of the first virtual character during its movement around the target obstacle based on the target detour path includes: Determine the second nearest coordinate point corresponding to the first virtual character and the second farthest coordinate point corresponding to the second virtual character in the target detour path; Determine the number of second clockwise coordinate points that need to be traversed when moving from the second nearest coordinate point to the second farthest coordinate point of the second target in a clockwise direction; Determine the number of second counterclockwise coordinate points that need to be traversed when moving from the second nearest coordinate point to the second farthest coordinate point of the second target in a counterclockwise direction; Based on the number of the second clockwise coordinate points and the number of the second counterclockwise coordinate points, the target detour direction of the first virtual character during the movement around the target obstacle based on the target detour path is determined.

12. The method for controlling a virtual character according to claim 10, characterized in that, Controlling the first virtual character to move from its current position to the next target point in the game scene until the path ends includes: Determine the target interaction method between the first virtual character and the target obstacle at the next target location; The first virtual character is controlled to move from the first current scene position to the next target point in the game scene, and interact with the target obstacle based on the target interaction method until the end of the path is reached.

13. The method for controlling a virtual character according to claim 12, characterized in that, Determining the target interaction method between the first virtual character and the target obstacle at the next target location includes: Construct a target line connecting the second nearest coordinate point and the next target point, and determine the intersection point between the target line and the vertex connection of the target convex hull block and / or other convex hull blocks corresponding to the target obstacle; The target interaction method between the first virtual character and the target obstacle at the next target point is determined based on the intersection point.

14. The method for controlling a virtual character according to claim 13, characterized in that, Determining the target interaction method between the first virtual character and the target obstacle at the next target location based on the intersection point includes: If the intersection point exists, calculate the distance between the intersection point and the next target point; If the distance between the intersection and the next target point is less than or equal to a preset distance threshold, then the target interaction method between the first virtual character and the target obstacle at the next target point is determined to be skipping the target obstacle; If the intersection does not exist, or if the intersection exists but the distance between the intersection and the next target point is greater than or equal to a preset distance threshold, then the target interaction mode between the first virtual character and the target obstacle at the next target point is determined to be normal movement.

15. A control device for a virtual character, characterized in that, include: A candidate detour path determination module is used to determine a candidate detour path for the first virtual character to bypass candidate obstacles in the game scene based on the first current scene position of the first virtual character in the game scene. The candidate detour path is determined as follows: convex hull decomposition is performed on the virtual obstacle model corresponding to the candidate obstacle to obtain a first original convex hull block; the positional relationship between the first original convex hull blocks is determined based on their positions in the virtual obstacle model; a target convex hull block containing candidate interaction coordinate points is determined from the first original convex hull blocks; other convex hull blocks corresponding to the target convex hull block are determined based on the positional relationship, using the candidate interaction coordinate points as the path start and end points; path inflection points are determined in the other convex hull blocks; and a candidate detour path for the first virtual character to bypass candidate obstacles in the game scene is generated based on the path start, path end, and path inflection points. The coordinate point determination module is used to determine the farthest coordinate point of the first target corresponding to the second virtual character in the candidate detour path; the first virtual character and the second virtual character are in an adversarial relationship; The target detour path determination module is used to determine the target detour path from the candidate detour paths based on the farthest coordinate point of the first target, and to determine the target obstacle from the candidate obstacles based on the target detour path; A virtual character control module is used to control the first virtual character to move around the target obstacle in the game scene based on the target detour path in order to avoid the second virtual character.

16. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the virtual character control method according to any one of claims 1-14.

17. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to execute the virtual character control method according to any one of claims 1-14 by executing the executable instructions.

Citation Information

Patent Citations

  • Game role moving path determination method and device and electronic equipment

    CN113082714A

  • Method and device for determining way-finding path in game and electronic equipment

    CN116943210A