Virtual character control method and device, storage medium and electronic equipment

By determining the candidate bypass path according to the current position in the virtual role control method and determining the target bypass path based on the target furthest coordinate point, the problem of low accuracy of the target bypass path in the prior art is solved, and higher generalization ability and faster landing speed are achieved.

CN119656596AActive Publication Date: 2025-03-21NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In the prior art, the method of determining the target bypass path through imitation learning and reinforcement learning leads to a low accuracy of the target bypass path, and a low generalization ability to new maps and new models, and requires a large amount of data and a long R&D cycle.

Method used

By determining the candidate orbit path based on the current position of the virtual character in the game scene, finding the target farthest coordinate point corresponding to the adversarial character, determining the target orbit path based on the coordinate point, and controlling the virtual character to move around the target obstacle to avoid the adversarial character.

Benefits of technology

It improves the accuracy of the target bypass path, enhances the decision-making, response and strategy formulation capabilities of virtual characters, improves the ability to generalize new maps and new models, and reduces data demand and R&D cycle.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119656596A_ABST
    Figure CN119656596A_ABST
Patent Text Reader

Abstract

The invention relates to a virtual character control method and device, a storage medium and electronic equipment, and relates to the technical field of computers. The method comprises the following steps: according to a first current scene position of a first virtual character in a game scene, determining a candidate bypassing path of bypassing a candidate obstacle in the game scene by the first virtual character; determining a first target farthest coordinate point corresponding to the second virtual character in the candidate detour path; determining a target detour path from the candidate detour paths based on the first target farthest coordinate point, and determining a target obstacle from the candidate obstacles according to the target detour path; and controlling the first virtual character to move around the target obstacle based on the target bypassing path in the game scene so as to avoid the second virtual character. According to the method, the intelligent degree of the first virtual character in multiple dimensions such as the decision dimension, the reaction dimension and the strategy making dimension is increased, and then the game interaction experience of players is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present disclosure relate to the field of computer technology, and in particular, to a method for controlling a virtual character, a device for controlling a virtual character, a computer-readable storage medium, and an electronic device. Background Art

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

[0003] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0004] The purpose of the present disclosure is to provide a control method for a virtual character, a control device for a virtual character, a computer-readable storage medium, and an electronic device, thereby at least to a certain extent overcoming the problem of low accuracy of the target detour path obtained due to the limitations and defects of the relevant technology.

[0005] According to one aspect of the present disclosure, a method for controlling a virtual character is provided, comprising:

[0006] Determining, according to a first current scene position of a first virtual character in a game scene, a candidate detour path for the first virtual character to detour around a candidate obstacle in the game scene;

[0007] 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;

[0008] Determining a target detour path from candidate detour paths based on the farthest coordinate point of the first target, and determining a target obstacle from candidate obstacles according to the target detour path;

[0009] 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.

[0010] According to one aspect of the present disclosure, there is provided a control device for a virtual character, comprising:

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

[0012] A coordinate point determination module, used to determine the farthest coordinate point of a first target corresponding to a second virtual character in the candidate detour path; the first virtual character and the second virtual character are in an adversarial relationship;

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

[0014] The virtual character control module is used to control the first virtual character to move around the target obstacle based on the target detour path in the game scene to avoid the second virtual character.

[0015] According to one aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method for controlling a virtual character described in any one of the above is implemented.

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

[0017] Processor; and

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

[0019] Wherein, the processor is configured to execute any one of the above-mentioned methods for controlling a virtual character by executing the executable instructions.

[0020] A control method for a virtual character provided by an embodiment of the present disclosure, on the one hand, determines a candidate bypass path for the first virtual character to bypass a candidate obstacle in a game scene according to a first current scene position of the first virtual character in the game scene; then determines the first target farthest coordinate point corresponding to the second virtual character in the candidate bypass path; and then determines the target bypass path from the candidate bypass paths based on the first target farthest coordinate point, and the determination of the target bypass path can be achieved without adopting imitation learning and reinforcement learning, thereby solving the problem of low accuracy of the target bypass path caused by the need to adopt imitation learning and reinforcement learning to determine the target bypass path in the related art, and improving the accuracy of the obtained target bypass path; on the other hand, since the target obstacle can be determined from the candidate obstacles according to the target bypass path, and the first virtual character can be controlled to move around the target obstacle based on the target bypass path in the game scene to avoid the second virtual character, the intelligence level of the first virtual character in the decision-making dimension, reaction dimension and strategy formulation dimension is increased.

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

[0022] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.

[0023] Figure 1 A flowchart schematically illustrates a method for controlling a virtual character according to an exemplary embodiment of the present disclosure.

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

[0025] Figure 3 A method flow chart schematically illustrates a specific process of determining the farthest coordinate point of a first target according to an exemplary embodiment of the present disclosure.

[0026] Figure 4 A diagram schematically illustrates an example scenario of a process of interpolating candidate detour paths according to an example embodiment of the present disclosure.

[0027] Figure 5 A scene example diagram schematically illustrates an interpolation processing result obtained according to an example embodiment of the present disclosure.

[0028] Figure 6 A diagram schematically illustrates a scenario example of a process for determining a detour direction according to an example embodiment of the present disclosure.

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

[0030] Figure 8 The following schematically shows a structural example diagram of a control device for a virtual character according to an exemplary embodiment of the present disclosure.

[0031] Fig. 9 An electronic device for implementing a method for controlling a virtual character according to an exemplary embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION

[0032] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the example embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, the known technical solutions are not shown or described in detail to avoid obscuring the various aspects of the present disclosure.

[0033] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.

[0034] In some MOBA (Multiplayer Online Battle Arena) games, a first virtual character corresponding to multiple (for example, four or six, of course, it can also be other numbers, and this example does not impose any special restrictions on this) survivors can compete in a game with a second virtual character corresponding to a supervisor; wherein, during the game confrontation, the main task of the first virtual character is to complete the repair of the virtual object to be repaired in the game scene (for example, it can be a cipher machine) in the shortest time, and then open the door of the virtual building in the game scene and escape from the virtual building to win 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, which is the target of the second virtual character, can only delay the pursuit time of the second virtual character as much as possible through virtual obstacles (virtual boards or virtual windows, etc.) or the terrain environment in the virtual scene, so as to achieve the purpose of allowing other first virtual characters in the team to have more time to repair the virtual objects to be repaired in the game scene.

[0036] In the actual game process, the first virtual character can make full use of the virtual board or virtual window to attack the second virtual character, so as to bring more benefits to the team by causing the second virtual character to have a longer dizziness recovery time. However, in each game, since the number of virtual boards is limited and cannot be regenerated and can only be consumed, it is necessary to "save" each virtual board as much as possible to maximize the benefits of each virtual board. Furthermore, in the process of going around the virtual board or other virtual obstacles, the first virtual character will generally go around the virtual model corresponding to the virtual board or other virtual obstacles, so that it can go around the virtual model corresponding to the virtual board or other virtual obstacles faster, so as to avoid being attacked by the second virtual character too quickly.

[0037] On the premise of the above-mentioned contents, in order to be able to go around the virtual model corresponding to the virtual board or other virtual obstacles more quickly, the existing scheme provides the following implementation method: one implementation method is to ignore the attack process of the first virtual character and directly adopt the method of constantly selecting the next interactive point (that is, the turning point) to quickly go around; that is, after reaching a target interactive point, quickly select another interactive point until reaching the end; however, the detour based on this method makes the interaction between the first virtual character and the second virtual character low, and the player cannot experience the pleasure of the game; another implementation method is: directly adopt the full-process imitation learning and reinforcement learning method to determine the detour path; however, this method not only requires testing based on a large amount of data and a long R&D cycle for research and development, but also has extremely low generalization ability for new maps and new modes of newly added virtual scenes; and even if this function is launched, the server performance requirements are extremely high and cannot be implemented on a large scale.

[0038] In order to solve the above problems, there is a need for a solution that can, like the first virtual character, bypass the virtual obstacle or virtual environment terrain while making full use of the virtual model corresponding to the virtual board or other virtual obstacles and the virtual environment terrain, and the computing power can be quickly implemented within an acceptable range (that is, when the computing power is controllable, the target bypass path can be quickly determined; with the above solution, not only can the intelligence of the first virtual character in multiple dimensions such as decision-making dimension, reaction dimension and strategy formulation dimension be greatly improved, but also the player can experience the pleasure of the game, and the generalization ability for new maps and new modes is also high. At the same time, it does not require a large amount of data and a long research and development cycle, and the implementation speed is greatly improved.

[0039] Based on this, this exemplary embodiment first provides a method for controlling a virtual character, which can be 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 disclosed in this disclosure on other platforms as required, and this exemplary embodiment does not specifically limit this. Figure 1 As shown, the control method of the virtual character may include the following steps:

[0040] Step S110. Determine a candidate detour path for the first virtual character to detour around a candidate obstacle in the game scene according to a first current scene position of the first virtual character in the game scene;

[0041] 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;

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

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

[0044] In the control method of the virtual character recorded above, on the one hand, a candidate detour path for the first virtual character to detour around the candidate obstacles in the game scene is determined according to the first current scene position of the first virtual character in the game scene; then the first target farthest coordinate point corresponding to the second virtual character in the candidate detour path is determined; and then based on the first target farthest coordinate point, the target detour path is determined from the candidate detour paths, and the determination of the target detour path can be achieved without the need to adopt imitation learning and reinforcement learning, thereby solving the problem of low accuracy of the target detour path caused by the need to adopt imitation learning and reinforcement learning to determine the target detour path in the related technology, and improving 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 can be controlled to move around the target obstacle based on the target detour path in the game scene to achieve the purpose of avoiding the second virtual character, the intelligence level of the first virtual character in multiple dimensions such as decision-making dimension, reaction dimension and strategy formulation dimension is increased.

[0045] Hereinafter, the control method of the virtual character described in the exemplary embodiment of the present disclosure will be further explained and illustrated in conjunction with the accompanying drawings.

[0046] First, the terms involved in the exemplary embodiments of the present disclosure are explained and illustrated.

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

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

[0049] Secondly, the technical implementation principle of the example embodiment of the present disclosure is explained and illustrated. Specifically, in the process of actual application, in order to control the first virtual character to move based on the target detour path, first, for each virtual obstacle in the game scene, randomly select the position of the virtual obstacle near the waypoint where the virtual character can travel (that is, the candidate interaction coordinate point), and use the pathfinding algorithm provided by the engine to obtain a pathfinding route (that is, the candidate detour path) with the candidate interaction coordinate point A as the starting point and the candidate interaction coordinate point A as the end point but needing to move around the obstacle; the pathfinding route is output as a series of coordinate sequences, and at the same time, 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 may become the end point of the path-finding route of the survivor (first virtual character), and the moving position of the first virtual character during the detour is controlled by the game tick (game tick); therefore, if the distance between the two coordinate points included in the path-finding route is too large or too small, it is not conducive to the control of the moving position of the first virtual character during the detour; for example, if the distance between the two coordinate points is too large, it is impossible to sensitively control the specific position of the first virtual character in the next game tick during the detour; for another example, if the distance between the two coordinate points is too small, it is impossible to achieve high-precision control; that is, it is impossible to accurately control the first virtual character to move to the next scene position when the next game tick arrives. Under this premise, the target distance interval between the 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 game tick frequency is 0.2s and the moving speed of the first virtual character is 45 yards / s, the target distance interval between the two coordinate points can be determined to be 9 yards.

[0051] Since the intervals between the coordinates of the routing route obtained by the routing algorithm are basically much larger than 9 yards, after obtaining the target distance interval, the connecting path of the adjacent coordinate point A and the coordinate point B in the coordinate sequence of the candidate detour path can be interpolated to obtain the interpolation result; it should be noted here 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. Furthermore, after all the pathfinding routes are interpolated, there may be a problem that the last interpolation point is too close to the coordinate point of each pathfinding route segment or the two coordinate points of the pathfinding route itself are close (although as mentioned above, the interval between the pathfinding route coordinates is basically much larger than 9 yards, the pathfinding algorithm will still return two closer coordinate points in some scenarios); under this premise, it is necessary to filter the interpolation points and / or coordinate points included in the interpolation results; further, in the process of filtering the interpolation points and / or coordinate points, first, the straight-line distance between any two adjacent interpolation points in the interpolation results, the straight-line distance between the interpolation point and the inflection point, 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, calculate the target point farthest from the second virtual character on each pathfinding path (that is, the farthest coordinate point of the first target). Further, based on the given data, calculate the first moving time for the first virtual character to reach the farthest target point on each pathfinding path, and the second moving time for the second virtual character to reach the farthest target point; under this premise, the selected target detour path needs to ensure that the first moving time for the first virtual character to reach the farthest target point on the path is shorter than the second moving time for the second virtual character to reach the farthest target point on the path, and the second moving time for the second virtual character to reach the farthest target point is as long as possible. Finally, after selecting the path, calculate the number of points to be passed in the counterclockwise direction and the clockwise direction respectively, and select the direction with fewer distance points as the detour direction of the first virtual character.

[0053] The following will Figure 1 The control method of the virtual character shown in the figure is further explained and illustrated. Specifically:

[0054] In step S110, a candidate detour path for the first virtual character to detour 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 implemented in the following manner: obtain the first current scene position of the first virtual character in the game scene, and match the candidate obstacles from the game scene according to the first current scene position; obtain the candidate interaction coordinate points corresponding to the first virtual character near the candidate obstacles, and generate the candidate detour path for the first virtual character to bypass the candidate obstacles in the game scene based on the candidate interaction coordinate points. Specifically, in the process of matching the candidate obstacles, 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 used as candidate obstacles; of course, all obstacles in the game scene can be directly traversed, and then the candidate obstacles are determined according to the distance between the actual position of each obstacle and the first current scene position. This example does not impose any special restrictions on this. Furthermore, the candidate interaction coordinate points recorded here refer to the points where the first virtual character can travel, stand, climb, jump, etc., which have been pre-established during the game development process; at the same time, taking the candidate obstacle as a virtual wall as an example, the corresponding candidate interaction coordinate points can refer to Figure 2 At the same time, the first virtual character can refer to Figure 2 As shown in 202, the second virtual character can refer to 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 role, and the second virtual character is a supervisor role.

[0056] In an exemplary embodiment, based on the candidate interaction coordinate point, generating a candidate detour path for the first virtual character to detour the candidate obstacle can be achieved in the following manner: performing convex hull decomposition on the virtual obstacle model corresponding to the candidate obstacle to obtain a first original convex hull block, and determining the positional relationship between the first original convex hull blocks based on 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 point is located from the first original convex hull block, and taking the candidate interaction coordinate point as the path starting point and the path end point, determining other convex hull blocks corresponding to the target convex hull block based on the positional relationship; determining the path inflection points corresponding to the candidate detour path in the other convex hull blocks, and generating a candidate detour path for the first virtual character to detour the candidate obstacle based on the path starting point, the path end point and the path inflection point. That is, in the process of generating candidate detour paths, it can be implemented based on the corresponding path-finding algorithm; taking the navigation grid as an example, the specific generation principle is: through a series of algorithms, the virtual obstacle model corresponding to the candidate obstacle is converted into a grid of convex polygons (that is, the first original convex hull block), and the adjacency relationship between the polygons is established; further, if it is necessary to calculate the moving path between the starting point and the end point, it is necessary to find out the polygon where the starting point and the polygon where the end point are located, and according to the connection relationship of the polygons, find out which polygons need to be passed through for movement, and then according to the inflection point algorithm, calculate the inflection points of the path, organize them into an array, and generate the final candidate detour path.

[0057] Continue to refer Figure 2 As shown, taking the starting point and the end point as A as an example, the candidate detour path obtained can refer to 204 shown in 2; at the same time, the coordinate points included in the obtained candidate detour path and the specific coordinate positions of the coordinate points can be shown in the following Table 1:

[0058] Table 1

[0059] Wayfinding coordinate Coordinate A <![CDATA[(x A 、y A 、z A )]]> Coordinate B <![CDATA[(x B 、y B 、z B )]]> … …

[0060] In an exemplary embodiment, the virtual obstacle model corresponding to the candidate obstacle is decomposed by convex hull to obtain the first original convex hull block, which can be achieved in the following way: traverse the virtual obstacle model corresponding to the candidate obstacle, extract the first polyhedron included in the virtual obstacle model, and calculate the first internal angle sum of the first polyhedron; determine the first model concave area of ​​the virtual obstacle model based on the first internal angle sum, and calculate the first concave distance of the first model concave area; sort the first concave distance according to the size of the first concave distance to obtain the first concave distance sorting result, and configure the first area weight value for the first model concave area according to the first concave distance sorting result; based on the first area weight value and the first model concave area, the virtual obstacle model is decomposed by convex hull to obtain the first original convex hull block. Specifically, in the actual application process, the block tool Convex Decomposition in the game development engine can be called to quickly decompose the model according to the specified maximum concave distance, and generate uniform (weighted uniform) optimal convex hull blocks according to the concave-convex structure of the model. The optimal convex hull segmentation with uniform weights recorded here means that the difference between the average concave distances in each segment can be maintained within a specific range, that is, the absolute value of the difference between the average concave distances in each segment needs to be less than or equal to a specific value. Based on this method, the accuracy of the original convex hull segmentation can be improved, thereby improving the accuracy of the candidate detour path.

[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] Specifically, 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 a plurality of target interpolation points, and a second current scene position of the second virtual character in the game scene is acquired.

[0064] In this example embodiment, first, the candidate detour path is interpolated to obtain a plurality of target interpolation points; specifically, this can be achieved in the following manner: the path starting point, path turning point and path end point in the candidate detour path are traversed to calculate the starting point-turning point interval between the path starting point and the path turning point, the turning point-turning point interval between the path turning points, and the turning point-end point interval between the path turning point and the path end point; the target interval that needs to be interpolated is determined from the starting point-turning point interval, the turning point-turning point interval and the turning point-end point interval, and the number of original interpolation points that need to be interpolated in the target interval is determined; the target interval is interpolated based on the number of original interpolation points to obtain an interpolation result, and the original interpolation points included in the interpolation result are filtered to obtain a plurality of target interpolation points.

[0065] In an exemplary embodiment, determining the number of original interpolation points that need to be interpolated in the target interval can be achieved in the following manner: 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.

[0066] The specific interpolation process will be further explained and illustrated below. Specifically, in the actual application process, in the candidate detour path obtained, the coordinate points are connected by straight lines and each coordinate point actually corresponds to the turning point of the path-finding route; and, since each coordinate point may become the end point of the path-finding of the survivor (that is, the first virtual character), and the first virtual character is controlled by the game ticks of the game; therefore, the spacing between each coordinate point (that is, the first position spacing) is too large or too small, which is not conducive to the control of the first virtual character. If the spacing is too large, it is impossible to sensitively control the specific location of the survivor, and if the spacing is too small, high-precision control cannot be achieved. Therefore, the appropriate interval (standard interval) between coordinates can be calculated based on the frequency of the game ticks and the first moving speed of the first virtual character in the game scene; wherein, taking the game tick frequency of 0.2s and the first moving speed of 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 value of the frequency of the game ticks and the specific value of the first moving speed can be set according to actual conditions, and this example does not impose any special restrictions on this.

[0069] However, in the obtained candidate detour path, since the first position spacing between two adjacent coordinate points is basically much larger than 9 yards, it is necessary to perform interpolation processing between two adjacent coordinate points in the candidate detour path; specifically, taking coordinate point B adjacent to coordinate point A as an example, the specific interpolation process is: according to the target interval and standard interval between coordinate point A and coordinate point 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, directly round it to the integer); take coordinate point A as the starting point, and the first original interpolation point can be obtained by spacing the standard interval, and so on to obtain other original interpolation points; finally, when the distance between the next original interpolation point and coordinate point B is less than the standard interval of 9 yards, stop the interpolation processing; among which, the specific interpolation process can be referred to. Figure 4 Further, after interpolating the candidate detour paths, new coordinate points as shown in Table 2 can be obtained. The interpolation results obtained after the interpolation process can be referred to Figure 5 shown.

[0070] Table 2

[0071]

[0072] It should be noted that after all candidate detour paths are interpolated, there may be a last original interpolation point that is too close to the coordinate point of each section or the distance between the two coordinate points of the candidate detour path itself is close (although as mentioned above, the distance between the coordinates of the path finding route is basically much larger than 9 yards, but in some scenarios the path finding algorithm will still return two closer coordinate points). Therefore, the interpolated coordinate points need to be filtered; specifically, in the process of filtering the interpolation points and / or coordinate points in the interpolation results, first, the straight-line distance between any two adjacent interpolation points in the interpolation results, the straight-line distance between the interpolation point and the inflection point, 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.

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

[0074] In step S320, the target position distances between the second current scene position and the path starting point, the path turning point, each of the target interpolation points and the path end point are calculated, and the first target farthest coordinate point corresponding to the second virtual character in the candidate detour path is determined based on the target position distances.

[0075] Similarly, continue to refer to Figure 5 As shown, the farthest coordinate point of the first target can be Figure 5 As shown in 501 and 502; wherein, Figure 5 501 can be replaced with N' B_J To express; at the same time, Figure 5 502 in can be used for N" B_J To express.

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

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

[0078] In an exemplary embodiment, determining a first moving time for a first virtual character to move from a first current scene position to the first target farthest coordinate point can be achieved in the following manner: determining a first nearest coordinate point corresponding to the first virtual character in the candidate detour path, and determining a 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 first target farthest coordinate point, and determining a second distance to be traveled based on the number of the first target coordinate points; determining the first moving time based on the first distance to be traveled, the second distance to be traveled, and the first moving speed of the first virtual character in the game scene.

[0079] In an exemplary embodiment, determining the number of first target coordinate points that need to be passed when moving from the first nearest coordinate point to the first target farthest coordinate point can be achieved in the following manner: determining the number of first clockwise coordinate points that need to be passed when moving from the first nearest coordinate point to the first target farthest coordinate point along the clockwise direction; determining the number of first counterclockwise coordinate points that need to be passed when moving from the first nearest coordinate point to the first target farthest coordinate point along the counterclockwise direction; 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 an exemplary embodiment, determining the second moving 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 in the following manner: determining the second nearest coordinate point corresponding to the second virtual character in the candidate detour path, and determining a 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 a fourth distance to be traveled based on the number of second target coordinate points; determining the second moving time based on the third distance to be traveled, the fourth distance to be traveled and the second moving speed of the second virtual character in the game scene.

[0081] In an exemplary embodiment, 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 can be achieved in the following manner: determining the number of second clockwise coordinate points that need to be passed when moving from the second nearest coordinate point to the farthest coordinate point of the first target along 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 farthest coordinate point of the first target along a counterclockwise direction; 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 will further explain and illustrate the specific process of determining the target detour path. Specifically, in the actual application process, for the candidate interaction coordinate points corresponding to the first virtual character near the candidate obstacle, generally speaking, there are at least two routes, and the corresponding path can be obtained by interpolating the routes. For example, Figure 5 For the virtual board shown in , the two interpolated paths respectively calculate the point farthest from the supervisor on each path (that is, the farthest coordinate point of the first target); then, calculate the first closest coordinate point and the second closest coordinate point to the first virtual character and the second virtual character on each path; further, it is also necessary to calculate the number of points in the clockwise and counterclockwise directions; specifically, taking the calculation of the farthest coordinate point of the first virtual character arriving at the first target and the farthest coordinate point of the second virtual character arriving at the first target on a certain path as an example, the specific number of coordinate points obtained can be shown in the following Table 3:

[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 the first target coordinate points can be 6; the number of the second target coordinate points can be 5; then, the first distance to be traveled between the first virtual character and the first closest coordinate point and the third distance to be traveled between the second virtual character and the second closest coordinate point in the current game are calculated; under this premise, the specific calculation process of the first moving time for the survivor to reach the farthest point (that is, the farthest coordinate point of the first target) and the second moving time for the supervisor 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] Among them, t1 is the first moving time, t2 is the second moving time, D B_Q is the first distance to be traveled, D B_J is the third distance to be traveled, S Q is the first moving speed of the first virtual character in the game scene, S J The second moving speed of the second virtual character in the game scene. Further, the time t3 and t4 for the survivors and the supervisor to reach the farthest point corresponding to other candidate paths can be calculated in the same way; under this premise, the selected target detour path needs to ensure that the time for the survivors to reach the farthest point is shorter than the time for the supervisor to reach the farthest point, and the time for the supervisor to reach the farthest point is as long as possible. Here, it can be assumed that t1 < t2 and t3 < t4; under this premise, if t2 > t4, the candidate detour path corresponding to t2 is selected as the target detour, otherwise the candidate detour path corresponding to t4 is selected as the target detour path; based on this, it can be ensured that the time for the second virtual character to reach the farthest coordinate point of the first target is as long as possible, so as to gain as much escape time as possible for the first virtual character to achieve the purpose of avoiding the second virtual character. At this point, the first virtual character can flexibly switch between multiple paths corresponding to the same interactive point on the target detour path.

[0088] In step S140, 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.

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

[0090] In a possible example embodiment, after obtaining the target bypass path, it is also necessary to determine the bypass direction; specifically, this can be achieved in the following manner: determine the target bypass direction of the first virtual character in the process of moving around the target obstacle based on the target bypass path, and determine the next target point of the first virtual character according to the target bypass 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 move around the target obstacle and avoid the second virtual character.

[0091] In an exemplary embodiment, determining the target bypass direction of the first virtual character in the process of moving around the target obstacle based on the target bypass path can be achieved in the following manner: determining the second closest coordinate point corresponding to the first virtual character and the second target farthest coordinate point corresponding to the second virtual character in the target bypass path; determining the number of second clockwise coordinate points that need to be passed when moving from the second closest coordinate point to the second target 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 closest coordinate point to the second target farthest coordinate point in a counterclockwise direction; based on the number of the second clockwise coordinate points and the number of the second counterclockwise coordinate points, determining the target bypass direction of the first virtual character in the process of moving around the target obstacle based on the target bypass path.

[0092] In an 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 reaching the end of the path can be achieved in the following manner: determining a 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 reaching the end of the path.

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

[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 can be achieved in the following manner: if the intersection exists, calculating the distance between the intersection 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, determining that the target interaction mode between the first virtual character and the target obstacle at the next target point is to jump over the target obstacle; if the intersection does not exist or the intersection exists but the distance between the intersection and the next target point is greater than or equal to the preset distance threshold, determining that the target interaction mode between the first virtual character and the target obstacle at the next target point is normal movement.

[0095] Below, the specific process of determining the detour direction and the interaction method will be further explained and illustrated. Specifically, after obtaining the target detour path, it is also necessary to determine the detour direction; specifically, in the process of calculating the detour direction, first, calculate the point on the target detour path that is farthest from the supervisor (that is, 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 (that is, the second closest coordinate point corresponding to the first virtual character); then, calculate the number of points to be passed in the counterclockwise and clockwise directions of the target detour path, and select the direction with fewer distance points as the detour direction for survival; specifically, the scene example diagram of the specific process of determining the detour direction can be referred to. Figure 6 As shown in the figure, 601 is the clockwise direction and 602 is the counterclockwise direction. For example, as shown in Table 4 below, the clockwise direction should be selected as the direction for the survivor to go around the interaction point.

[0096]

[0097] Furthermore, after obtaining the target detour direction, it is necessary to determine the next target point and the interaction method corresponding to the next target point. Specifically, this can be achieved in the following ways: Figure 7 As shown, assuming that the second nearest coordinate point is 701 and the detour direction is counterclockwise, the next target point is 702. Calculate whether the line connecting the two points and the window sill line segment (that is, the target convex hull block corresponding to the target obstacle and / or the vertex line connecting the other convex hull blocks) have an intersection and whether the distance between the intersection and the target point in the figure below is within a certain range. If the conditions are met, it means that the window needs to be flipped. Otherwise, calculate whether the line connecting the two points and the line segment where the board is located (that is, the vertex line connecting the target convex hull block corresponding to the target obstacle and / or the vertex line connecting the other convex hull blocks) have an intersection and whether the distance between the intersection and the target point in the figure below is within a certain range. If the conditions are met, it means that the board needs to be flipped. If the above two conditions are not met, go directly without interaction.

[0098] So far, the control method of the virtual character recorded in the embodiment of the present disclosure has been fully realized. Based on the above-mentioned content, it can be known that the control method of the virtual character recorded in the exemplary embodiment of the present disclosure, through the segmentation of the path finding path and the switching method of multiple paths, the direction selection under the same path and the selection of the way to reach the next point, can not only greatly improve the intelligence of the first virtual character in multiple dimensions such as decision-making dimension, reaction dimension and strategy formulation dimension, but also allow players to experience the pleasure of the game, and the generalization ability for new maps and new modes is also high. At the same time, it does not require a large amount of data and a long research and development cycle, and the landing speed is greatly improved.

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

[0100] The present disclosure also provides a control device for a virtual character. Figure 8 As shown, the control device of 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. Among them:

[0101] The candidate detour path determination module 810 may be used to determine a candidate detour path for the first virtual character to detour around a candidate obstacle in the game scene according to a first current scene position of the first virtual character in the game scene;

[0102] The coordinate point determination module 820 may 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 may be configured to determine a target detour path from candidate detour paths based on the farthest coordinate point of the first target, and determine a target obstacle from candidate obstacles based on the target detour path;

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

[0105] In an exemplary embodiment of the present disclosure, a candidate detour path for a first virtual character to bypass a candidate obstacle in a game scene is determined based on a first current scene position of the first virtual character in a game scene, including: 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 corresponding to the first virtual character near the candidate obstacles, and generating a candidate detour path for the first virtual character to bypass the candidate obstacles in the game scene based on the candidate interaction coordinate points.

[0106] In an exemplary embodiment of the present disclosure, based on the candidate interaction coordinate point, a candidate detour path for the first virtual character to detour the candidate obstacle in the game scene is generated, including: performing convex hull decomposition on the virtual obstacle model corresponding to the candidate obstacle to obtain a first original convex hull block, and determining the positional relationship between the first original convex hull blocks according to the block position of the first original convex hull block in the virtual obstacle model; determining the target convex hull block where the candidate interaction coordinate point is located from the first original convex hull block, and taking the candidate interaction coordinate point as the path starting point and the path end point, determining other convex hull blocks corresponding to the target convex hull block based on the positional relationship; determining the path inflection point corresponding to the candidate detour path in the other convex hull blocks, and generating a candidate detour path for the first virtual character to detour the candidate obstacle in the game scene according to the path starting point, the path end point and the path inflection point.

[0107] In an exemplary embodiment of the present disclosure, a convex hull decomposition is performed on a virtual obstacle model corresponding to the candidate obstacle to obtain a first original convex hull block, including: traversing the virtual obstacle model corresponding to the candidate obstacle, extracting a first polyhedron included in the virtual obstacle model, and calculating a first internal angle sum of the first polyhedron; determining a first model concave area of ​​the virtual obstacle model based on the first internal angle sum, and calculating a first concave distance of the first model concave area; sorting the first concave distances according to the size of the first concave distances to obtain a first concave distance sorting result, and configuring a first area weight value for the first model concave area according to the first concave distance sorting result; and performing a convex hull decomposition on the virtual obstacle model based on the first area weight value and the first model concave area to obtain a first original convex hull block.

[0108] In an exemplary embodiment of the present disclosure, determining the first target farthest coordinate point corresponding to the second virtual character in the candidate detour path includes: interpolating 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 distances between the second current scene position and the path starting point, the path turning point, each of the target interpolation points and the path end point, and determining the first target farthest coordinate point corresponding to the second virtual character in the candidate detour path based on the target position distances.

[0109] In an exemplary embodiment of the present disclosure, the candidate detour path is interpolated to obtain a plurality of target interpolation points, including: traversing the path starting point, path turning point and path end point in the candidate detour path, calculating the starting point-turning point interval between the path starting point and the path turning point, the turning point-turning point interval between the path turning points, and the turning point-end point interval between the path turning point and the path end point; determining a target interval that needs to be interpolated from the starting point-turning point interval, the turning point-turning point interval and the turning point-end point interval, and determining the number of original interpolation points that need to be interpolated in the target interval; interpolating the target interval based on the number of original interpolation points to obtain an interpolation result, and filtering the original interpolation points included in the interpolation result to obtain a plurality of target interpolation points.

[0110] In an exemplary embodiment of the present disclosure, determining the number of original interpolation points that need to be interpolated in a 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 an exemplary embodiment of the present disclosure, based on the first target farthest coordinate point, a target detour path is determined from the candidate detour paths, including: determining a first movement time for the first virtual character to move from a first current scene position to the first target farthest coordinate point; determining a second movement time for the second virtual character to move from a second current scene position to the first target farthest coordinate point; 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 the present disclosure, determining a first moving time for the first virtual character to move from a first current scene position to the first target farthest coordinate point includes: determining a first nearest coordinate point corresponding to the first virtual character in the candidate detour path, and determining a 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 first target farthest coordinate point, and determining a second distance to be traveled based on the number of the first target coordinate points; determining the first moving time based on the first distance to be traveled, the second distance to be traveled, and the first moving speed of the first virtual character in the game scene.

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

[0114] In an exemplary embodiment of the present disclosure, controlling the first virtual character to move around the target obstacle based on the target bypass path in the game scene to avoid the second virtual character includes: determining the target bypass direction of the first virtual character in the process of moving around the target obstacle based on the target bypass path, and determining the next target point of the first virtual character according to the target bypass direction; controlling the first virtual character to move from the first current scene position to the next target point in the game scene until reaching the end of the path, so as to move around the target obstacle and avoid the second virtual character.

[0115] In an exemplary embodiment of the present disclosure, determining a target detour direction of the first virtual character in the process of moving 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 target 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 target 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 target farthest coordinate point in a counterclockwise direction; based on the number of the second clockwise coordinate points and the number of the second counterclockwise coordinate points, determining the target detour direction of the first virtual character in the process of moving around the target obstacle based on the target detour path.

[0116] In an exemplary embodiment of the present disclosure, controlling the first virtual character to move from a first current scene position to a next target point in the game scene until reaching an end point of the path includes: determining a 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 a 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 reaching the end point of the path.

[0117] In an exemplary embodiment of the present 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 between the second nearest coordinate point and the next target point, and determining the intersection between the target line and the target convex hull block and / or other convex hull block vertex lines corresponding to the target obstacle; determining the target interaction mode between the first virtual character and the target obstacle at the next target point based on the intersection.

[0118] In an exemplary embodiment of the present disclosure, the target interaction mode between the first virtual character and the target obstacle at the next target point is determined based on the intersection, including: if the intersection exists, calculating the distance between the intersection 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, determining that the target interaction mode between the first virtual character and the target obstacle at the next target point is to jump over the target obstacle; if the intersection does not exist or the intersection exists but the distance between the intersection and the next target point is greater than or equal to the preset distance threshold, determining that the target interaction mode between the first virtual character and the target obstacle at the next target point is normal movement.

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

[0120] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.

[0121] In addition, although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.

[0122] In an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided. A person skilled in the art will appreciate that various aspects of the present disclosure may be implemented as a system, method, or program product. Therefore, various aspects of the present disclosure may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or an implementation combining hardware and software aspects, which may be collectively referred to herein as a circuit, module, or system.

[0123] Refer to the following Fig. 9 The electronic device 900 according to this embodiment of the present disclosure is described. Fig. 9 The electronic device 900 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

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

[0125] The storage unit stores a program code, which can be executed by the processing unit 910, so that the processing unit 910 performs the steps according to various exemplary embodiments of the present disclosure described in the above “Exemplary Method” section of this specification. For example, the processing unit 910 can perform the following steps: Figure 1The step S110 shown in the figure is: according to the first current scene position of the first virtual character in the game scene, determining a candidate detour path for the first virtual character to detour around the candidate obstacles in the game scene; step S120: determining the first target farthest coordinate point 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 first target farthest coordinate point, determining a target detour path from the candidate detour paths, and determining a target obstacle from the candidate obstacles according to the target detour path; step S140: controlling the first virtual character to move around the target obstacle based on the target detour path in the game scene to avoid the second virtual character.

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

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

[0128] Bus 930 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0129] The electronic device 900 may also communicate with one or more external devices 1000 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 900, and / or communicate with any device that enables the electronic device 900 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 950. Furthermore, the electronic device 900 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 960. As shown, the network adapter 960 communicates with other modules of the electronic device 900 via a bus 930. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the 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, etc.

[0130] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.

[0131] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present disclosure may also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary implementations of the present disclosure described in the above "Exemplary Method" section of the present specification.

[0132] According to the program product for implementing the above method in the embodiment of the present disclosure, it can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be 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, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.

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

[0134] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0135] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.

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

[0137] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present disclosure, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.

[0138] Other embodiments of the present disclosure will be readily apparent to those skilled in the art after considering the specification and practicing the inventions invented herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not invented by the present disclosure. The specification and examples are to be considered merely exemplary, and the true scope and spirit of the present disclosure are indicated by the claims.

Claims

1. A method for controlling a virtual character, characterized in that: include: Determining, according to a first current scene position of a first virtual character in a game scene, a candidate detour path for the first virtual character to detour around a candidate obstacle in the game scene; Determine the farthest coordinate point of a first target corresponding to a second virtual character in the candidate detour path; the first virtual character and the second virtual character are in an adversarial relationship; Based on the farthest coordinate point of the first target, determine a target detour path from candidate detour paths, and determine a target obstacle from candidate obstacles according to the target detour path; 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.

2. The method for controlling a virtual character according to claim 1, characterized in that: Determining, according to a first current scene position of a first virtual character in a game scene, a candidate detour path for the first virtual character to detour around a candidate obstacle in the game scene, comprising: Acquire a first current scene position of the first virtual character in the game scene, and match candidate obstacles from the game scene according to the first current scene position; A candidate interaction coordinate point corresponding to the first virtual character near the candidate obstacle is obtained, and a candidate detour path for the first virtual character to detour the candidate obstacle in the game scene is generated based on the candidate interaction coordinate point.

3. The method for controlling a virtual character according to claim 2, characterized in that: Generating a candidate detour path for the first virtual character to detour around a candidate obstacle in the game scene based on the candidate interaction coordinate point includes: Performing convex hull decomposition on the virtual obstacle model corresponding to the candidate obstacle to obtain first original convex hull blocks, and determining positional relationships between the first original convex hull blocks according to block positions of the first original convex hull blocks in the virtual obstacle model; Determine the target convex hull block where the candidate interaction coordinate point is located from the first original convex hull block, and use the candidate interaction coordinate point as the path starting point and the path end point, and determine other convex hull blocks corresponding to the target convex hull block based on the positional relationship; Determine the path inflection points in the other convex hull blocks, and generate a candidate detour path for the first virtual character to detour around the candidate obstacles in the game scene based on the path starting point, the path end point and the path inflection point.

4. The method for controlling a virtual character according to claim 3, characterized in that: Performing convex hull decomposition on the virtual obstacle model corresponding to the candidate obstacle to obtain a first original convex hull block, including: Traversing the virtual obstacle model corresponding to the candidate obstacle, extracting a first polyhedron included in the virtual obstacle model, and calculating a first internal angle sum of the first polyhedron; Determining a first model concave area of ​​the virtual obstacle model based on the first inner angle and calculating a first concave distance of the first model concave area; Sorting the first concave distances according to the sizes of the first concave distances to obtain a first concave distance sorting result, and configuring a first area weight value for the first model concave area according to the first concave distance sorting result; The virtual obstacle model is subjected to convex hull decomposition based on the first region weight value and the first model concave region to obtain first original convex hull blocks.

5. The method for controlling a virtual character according to claim 1, characterized in that: 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 a plurality of target interpolation points, and acquiring a second current scene position of the second virtual character in the game scene; Calculate the target position distances between the second current scene position and the path starting point, the path turning point, each of the target interpolation points and the path end point, and determine the first target farthest coordinate point corresponding to the second virtual character in the candidate detour path based on the target position distances.

6. The method for controlling a virtual character according to claim 5, characterized in that: The candidate detour path is interpolated to obtain a plurality of target interpolation points, including: Traversing the path starting point, path turning point and path end point in the candidate detour path, calculating the starting point-turning point interval between the path starting point and the path turning point, the turning point-turning point interval between the path turning points, and the turning point-end point interval between the path turning point and the path end point; Determine a target interval to be interpolated from the start point-inflection point interval, the inflection point-inflection point interval, and the inflection point-end point interval, and determine the number of original interpolation points to be interpolated in the target interval; The target interval is interpolated based on the number of original interpolation points to obtain an interpolation result, and the original interpolation points included in the interpolation result are filtered to obtain a plurality of target interpolation points.

7. The method for controlling a virtual character according to claim 6, characterized in that: Determine the number of raw interpolation points that need to be interpolated in the target interval, including: Acquire a first moving speed of the first virtual character in the game scene and a game tick of the game scene, and determine a standard interval according to the first moving speed and the game tick; Based on the target interval and the standard interval, the number of original interpolation points that need to be interpolated in the target interval is determined.

8. The method for controlling a virtual character according to claim 1, characterized in that: Determining a target detour path from candidate detour paths based on the farthest coordinate point of the first target includes: Determine a first moving time of the first virtual character from a first current scene position to a first target farthest coordinate point; Determine a second moving time of the second virtual character from the second current scene position to the farthest coordinate point of the first target; A target detour path is determined from the candidate detour paths according to the first moving time and the second moving time.

9. The method for controlling a virtual character according to claim 8, characterized in that: Determining a first moving time of the first virtual character moving from a first current scene position to a first target farthest coordinate point includes: Determine a first nearest coordinate point corresponding to the first virtual character in the candidate detour path, and determine a 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 passed when moving from the first closest coordinate point to the first target farthest coordinate point, and determine the second distance to be traveled according to the number of first target coordinate points; The first moving time is determined according to the first distance to be traveled, the second distance to be traveled, and a first moving speed of the first virtual character in the game scene.

10. The method for controlling a virtual character according to claim 9, characterized in that: Determining the number of first target coordinate points that need to be passed when moving from the first nearest coordinate point to the first target farthest coordinate point includes: Determine the number of first clockwise coordinate points that need to be passed when moving from the first closest coordinate point to the first target farthest coordinate point along the clockwise direction; Determine the number of first counterclockwise coordinate points that need to be passed when moving from the first closest coordinate point to the first target farthest coordinate point along the 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.

11. 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 based on the target detour path in the game scene to avoid the second virtual character includes: determining a target detour direction of the first virtual character in a process of moving around the target obstacle based on the target detour path, and determining a next target point position of the first virtual character according to the target detour direction; The first virtual character is controlled to move from a first current scene position to a next target point in the game scene until the path end is reached, so as to move around the target obstacle and avoid the second virtual character.

12. The method for controlling a virtual character according to claim 11, characterized in that: Determining a target detour direction of the first virtual character in a process of moving around the target obstacle based on the target detour path includes: Determine a second closest coordinate point corresponding to the first virtual character and a second target 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 passed when moving from the second closest coordinate point to the second target farthest coordinate point along the clockwise direction; Determine the number of second counterclockwise coordinate points that need to be passed when moving from the second closest coordinate point to the second target farthest coordinate point along the counterclockwise direction; Based on the number of the second clockwise coordinate points and the number of the second counterclockwise coordinate points, a target detour direction of the first virtual character in a process of moving around the target obstacle based on the target detour path is determined.

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

14. The method for controlling a virtual character according to claim 13, characterized in that: Determining a target interaction mode between the first virtual character and the target obstacle at the next target point includes: Constructing a target line between the second closest coordinate point and the next target point, and determining the intersection of the target line with the target convex hull block corresponding to the target obstacle and / or the vertex lines of other convex hull blocks; A target interaction mode between the first virtual character and the target obstacle at the next target point is determined according to the intersection.

15. The method for controlling a virtual character according to claim 14, characterized in that: Determining a target interaction mode between the first virtual character and the target obstacle at the next target point according to the intersection includes: 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, determining that the target interaction mode between the first virtual character and the target obstacle at the next target point is to jump over the target obstacle; If the intersection does not exist or the intersection exists but the distance between the intersection and the next target point is greater than or equal to the preset distance threshold, it is determined that the target interaction mode between the first virtual character and the target obstacle at the next target point is normal movement.

16. A control device for a virtual character, characterized in that: include: A candidate detour path determination module, configured to determine, according to a first current scene position of a first virtual character in a game scene, a candidate detour path for the first virtual character to detour around a candidate obstacle in the game scene; A coordinate point determination module, 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; a target detour path determination module, configured to determine a target detour path from the candidate detour paths based on the farthest coordinate point of the first target, and determine a target obstacle from the candidate obstacles according to the target detour path; The virtual character control module is used to control the first virtual character to move around the target obstacle based on the target detour path in the game scene to avoid the second virtual character.

17. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for controlling a virtual character according to any one of claims 1 to 15 is implemented.

18. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; Wherein, the processor is configured to execute the method for controlling a virtual character according to any one of claims 1 to 15 by executing the executable instructions.

Citation Information

Patent Citations

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

    CN113082714A

  • Way-finding control method and device for game, processing equipment and storage medium

    CN113101663A

  • Automatic labeling method and device for characters in electronic map, and electronic equipment

    CN113838198A

  • Digital twinning system for gantry robot

    CN114460904A

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

    CN116943210A