Method, device and electronic equipment for determining a movement path in a game

By determining target locations and adjusting movement paths within the game scene, the lack of human-like qualities in AI characters was addressed, resulting in a more immersive gaming experience.

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

Patent Information

Application Number
CN202310268820.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-13
Publication Date
2026-02-24
Estimated Expiration
2043-03-13

AI Technical Summary

Technical Problem

In existing technologies, the way AI characters determine their movement paths in games fails to effectively improve human-likeness, making it easy for player characters to identify non-player characters and reducing the gaming experience.

Method used

By determining the target location in the game scene, the initial movement path is determined based on the target location and the turning point. When the turning point is on the same side as the player character, the path is adjusted to a straight line. The target movement path is determined by combining the intermediate location point, thus avoiding encounters with the player character and improving the anthropomorphism.

Benefits of technology

It enhances the anthropomorphism of non-player characters, reduces the likelihood of players recognizing them, and improves the overall gaming experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116328307B_ABST
    Figure CN116328307B_ABST
Patent Text Reader

Abstract

The application provides a method and device for determining a moving path in a game and electronic equipment. If a second virtual character exists in a specified range of a first virtual character and the first virtual character and the second virtual character are on different sides of a specified game prop, a target position point is determined, and an initial moving path is determined according to the target position point. If a turning point of the initial moving path is on the same side of the specified game prop as the second virtual character, a straight line path is determined. An intermediate position point is determined in the straight line path, and a target moving path is determined according to the intermediate position point and the target position point. The straight line path determined in this way is on the different side of the specified game prop from the second virtual character, and the target moving path is determined based on the position point on the straight line path and the target position point, thereby avoiding the first virtual character from meeting the second virtual character when moving to the target position point, improving the personification of non-player characters, reducing the possibility of a player character recognizing the non-player characters, and improving the game experience of the player.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of game technology, and in particular to a method, apparatus, and electronic device for determining movement paths in games. Background Technology

[0002] In some games, there are often situations where AI (Artificial Intelligence) characters (i.e., non-player characters) engage in chases with opposing player characters. Related technologies typically require pathfinding calculations based on terrain features and designated game items. Players control the non-player character's movement within the game environment, using items to hinder the player character's pursuit or to delay the enemy character's progress, thus buying more time for the non-player character's teammates. However, this method only considers the shortest path, which may result in the non-player character encountering the player character, failing to create chasing pressure. Furthermore, the non-human nature of the non-player character allows the player character to recognize it as such, leading to a poor gaming experience. Summary of the Invention

[0003] In view of this, the purpose of the present invention is to provide a method, apparatus and electronic device for determining movement paths in a game, so as to improve the anthropomorphism of non-player characters and thus improve the player's gaming experience.

[0004] In a first aspect, embodiments of the present invention provide a method for determining a movement path in a game. The method includes: in response to the existence of a second virtual character within a specified range of a first virtual character, and the first and second virtual characters being located on opposite sides of a specified game item, determining a target location point in a game scene; wherein the first virtual character is a non-player-controlled virtual character, and the second virtual character is a player character; determining an initial movement path for the first virtual character to move to the target location point based on the target location point; wherein the initial movement path includes at least one inflection point; in response to the inflection point being located on the same side of the specified game item as the second virtual character, determining a straight path for the first virtual character; wherein the second virtual character cannot move on the scene plot where the specified game item is located; the location points included in the straight path being located on opposite sides of the specified game item as the second virtual character; determining an intermediate location point in the straight path; and determining a target movement path for the first virtual character based on the intermediate location point and the target location point.

[0005] Secondly, embodiments of the present invention provide a device for determining a movement path in a game. The device includes: a target location point determination module, configured to determine a target location point in a game scene in response to the existence of a second virtual character within a specified range of a first virtual character, and the first and second virtual characters being located on opposite sides of a specified game item; wherein the first virtual character is a non-player-controlled virtual character, and the second virtual character is a player character; the second virtual character cannot move on the scene plot where the specified game item is located; an initial movement path determination module, configured to determine an initial movement path for the first virtual character to move to the target location point based on the target location point; wherein the initial movement path includes at least one inflection point; a straight path determination module, configured to determine a straight path for the first virtual character in response to the inflection point being on the same side of the specified game item as the second virtual character; wherein the location points included in the straight path are located on opposite sides of the specified game item as the second virtual character; and a target movement path determination module, configured to determine an intermediate location point in the straight path, and determine the target movement path of the first virtual character based on the intermediate location point and the target location point.

[0006] Thirdly, embodiments of the present invention provide an electronic device, including a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the method for determining a movement path in a game according to any one of the first aspects.

[0007] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are invoked and executed by a processor, the computer-executable instructions cause the processor to implement the method for determining the movement path in the game according to any one of the first aspects.

[0008] The embodiments of the present invention bring the following beneficial effects:

[0009] This invention provides a method, apparatus, and electronic device for determining movement paths in a game. If a second virtual character exists within a specified range of a first virtual character and the first and second virtual characters are on opposite sides of a specified game item, a target location point is determined, and an initial movement path is determined based on the target location point. If the inflection point of the initial movement path is on the same side of the specified game item as the second virtual character, a straight path is determined. An intermediate location point is determined within the straight path, and a target movement path is determined based on the intermediate location point and the target location point. This method ensures that the straight path determined is on opposite sides of the specified game item as the second virtual character, and the target movement path is determined based on the location points on the straight path and the target location point. This avoids the first virtual character encountering the second virtual character when moving to the target location point, improves the anthropomorphism of non-player characters, reduces the likelihood of player characters recognizing non-player characters, and enhances the player's gaming experience.

[0010] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.

[0011] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0012] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0013] Figure 1 A flowchart illustrating a method for determining a movement path in a game, provided as an embodiment of the present invention;

[0014] Figure 2 A schematic diagram of an initial movement path provided in an embodiment of the present invention;

[0015] Figure 3 A schematic diagram of another initial movement path provided in an embodiment of the present invention;

[0016] Figure 4 A schematic diagram of a straight path provided for an embodiment of the present invention;

[0017] Figure 5 A schematic diagram of an intermediate position point provided in an embodiment of the present invention;

[0018] Figure 6 This is a schematic diagram of another intermediate position point provided in an embodiment of the present invention;

[0019] Figure 7 This is a schematic diagram illustrating the determination of the positions of a first virtual character and a second virtual character relative to a specified game item, provided as an embodiment of the present invention.

[0020] Figure 8 This is a schematic diagram illustrating the determination of position information for a first virtual character and a second virtual character, provided as an embodiment of the present invention.

[0021] Figure 9 This is a schematic diagram illustrating another method for determining the position information of a first virtual character and a second virtual character, provided by an embodiment of the present invention.

[0022] Figure 10 A schematic diagram of a device for determining a movement path in a game, provided as an embodiment of the present invention;

[0023] Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0024] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0025] In many current games, character-based battles often involve imbalances in the number of characters. For example, in a 1v4 game, one hunter faces four survivors. The survivors' main objective is to open the exit gates and escape the manor as quickly as possible to achieve victory. If the number of players choosing to play as survivors is the same as the number choosing to play as hunters, there might not be enough survivors during matchmaking, leading to long wait times for hunters to join the game. Therefore, due to this player imbalance, it's necessary to match survivors of varying skill levels. However, due to the inherent imbalance of asymmetrical gameplay, survivors (non-player characters) can use items and terrain to delay the hunter as much as possible, thus buying more time for their escape. Specifically, they can use specific items to hinder the hunter's pursuit or utilize terrain to delay the hunter's progress, giving their non-player teammates more time to escape.

[0026] Specifically, if a survivor's item hits the hunter, the hunter usually needs time to recover. Therefore, survivors can make full use of items and terrain to buy more escape time for their team. However, the number of items in each game is limited and cannot be regenerated; they can only be consumed. Therefore, it is necessary to maximize the benefit of each item. After the items in the current scene area are consumed, the survivor needs to move to the next location (where there are items) to continue using items to buy more escape time.

[0027] However, existing pathfinding methods typically use the open-source RecastNavigation library. Since the A* algorithm only considers the shortest path, it is very likely that when the survivor moves along the calculated path, they will encounter the hunter. This can also be understood as returning to the location where the last item was placed and encountering the hunter. This makes it impossible to put pressure on the hunter or make full use of the terrain to cause trouble for the stronger party. This greatly reduces the anthropomorphism of the AI ​​and the fun it brings to the player. At the same time, because the survivor is not anthropomorphic, the hunter can recognize the survivor as a non-player character, resulting in a poor gaming experience for the player.

[0028] In related technologies, since game scenes are composed of multiple scene tiles, a coarse calculation method can be used to determine the target scene tile among these multiple scene tiles. This target scene tile is involved in pathfinding, meaning the character in the game cannot move on this target scene tile. This avoids including the target scene tile when calculating movement paths, thus preventing encounters between survivors and hunters. However, since scene tile sizes vary, if the determined target scene tile is large, it may prevent the survivor from moving. Alternatively, a precise calculation method can be used to regenerate new scene tiles, which can avoid the problem of survivors being unable to move. However, this method requires additional computation, resulting in a higher computational cost.

[0029] Additionally, encounters between survivors and hunters can be avoided by dynamically modifying the relocation target. However, the decision to determine the relocation target is a high-level decision, while the decision on how to determine the movement path to the relocation target is a low-level decision. The way low-level decisions influence high-level decisions is unstable and will lead to overall instability.

[0030] Based on this, embodiments of the present invention provide a method, apparatus, and electronic device for determining movement paths in games, which can be applied to mobile phones, computers, laptops, tablets, etc.

[0031] To facilitate understanding of this embodiment, a method for determining a movement path in a game, as disclosed in this embodiment of the invention, will first be described in detail, such as... Figure 1 As shown, the method includes the following steps:

[0032] Step S102: In response to the existence of a second virtual character within a specified range of the first virtual character, and the first and second virtual characters being located on opposite sides of a specified game item, a target location point is determined in the game scene; wherein, the first virtual character is a non-player-controlled virtual character, and the second virtual character is a player character; the second virtual character cannot move on the scene tile where the specified game item is located;

[0033] The aforementioned game scenario typically includes a first virtual character and a second virtual character. The first virtual character is a non-player character controlled by the system, while the second virtual character is a player character controlled by a terminal device. The first and second virtual characters belong to different game factions. The number of first virtual characters is usually greater than the number of second virtual characters. The target location can be a location within the game scene with specified terrain, such as a maze location or a location with elevated terrain, or it can include a location containing specified game items. These specified game items can be virtual planks, virtual doors, or windows, used to block the movement of the second virtual character or to temporarily prevent the second virtual character from moving. The specified range can be pre-configured and can be set as needed, such as a circular area centered on the first virtual character with a radius equal to the target distance.

[0034] Specifically, after the game system controls the first virtual character to move to the previous target location, or after the first virtual character performs a specific action on a designated game item (such as knocking down a plank to prevent the second virtual character from crossing it to chase the first virtual character), the positional relationship between the first and second virtual characters is determined based on their current positions in the game scene. If the first and second virtual characters are close together, and are located on opposite sides of the designated game item—meaning the second virtual character cannot cross the item to continue chasing the first virtual character—then the first virtual character is temporarily safe, and the next target location can be determined in the game scene based on the current position of the second virtual character.

[0035] Step S104: Determine the initial movement path of the first virtual character to the target location point based on the target location point; wherein the initial movement path includes at least one turning point;

[0036] Specifically, the A* algorithm can be used to calculate the initial movement path of the first virtual character to the target location, based on the target location and the current location of the first virtual character. The aforementioned inflection points refer to the points where the first virtual character needs to change its movement direction during the movement.

[0037] For example, such as Figure 2 and Figure 4 The diagram shows the initial movement path. The solid black line in the diagram represents the initial movement path, and the black circles on this initial movement path are the aforementioned inflection points. Figure 2 and Figure 3 Each includes three inflection points. These inflection points may or may not include the target location point. Additionally, Figure 2 and Figure 3 The gray rectangles in the image represent obstacles that the virtual character cannot pass through. Figure 2 and Figure 3 The black rhombus in the image represents the aforementioned game item, used to block the passage of the second virtual character.

[0038] Alternatively, after determining the initial movement path, if there is no second virtual character within the specified range of the first virtual character, it means that the first virtual character is safe. In this case, the initial movement path can be directly determined as the target movement path, and the first virtual character can be controlled to move to the target location point according to the target movement path.

[0039] Another possible approach is that if a second virtual character exists within the specified range of the first virtual character, and the first and second virtual characters are located on the same side of the specified game item, it indicates that the first virtual character is currently in a very unsafe situation and may need to engage in combat with the second virtual character, or it may be necessary to determine the first virtual character's movement path through other means in order to get the first virtual character out of danger.

[0040] Step S106: In response to the inflection point and the second virtual character being located on the same side of the designated game item, determine the straight path of the first virtual character; wherein, the straight path includes position points that are located on the opposite side of the designated game item as the second virtual character.

[0041] The aforementioned straight path typically starts from the first virtual character and moves in the direction of the target location or points within a vicinity of the target location. If the turning point is on the same side of the designated game item as the second virtual character, it means that if the first virtual character moves along the initial path, it will inevitably encounter the second virtual character, putting the first virtual character in a dangerous situation. Therefore, the game system determines that it will not control the first virtual character to move along the initial path, but needs to redetermine the movement path.

[0042] Specifically, a straight path can be determined on the opposite side of the designated game prop, opposite to the side of the second virtual character. In practice, a straight line can be defined with the first virtual character as the starting point and the target location as the ending point. If the points on this line are opposite to the second virtual character on the designated game prop, this line can be directly defined as the aforementioned straight path. If some points on this line are on the same side of the second virtual character as the designated game prop, the ending point of the line can be changed. Points near the target location can be defined as the ending point of the line until the points on this line are opposite to the second virtual character on the designated game prop. Specifically, a vertical line parallel to the scene ground is first defined. Then, nearby points farther from the designated game prop are determined within this vertical line and defined as points near the target location.

[0043] The above straight path can also be determined based on the specified game prop and target location. Specifically, an initial straight line can be determined based on the location of the specified game prop and the target location. Based on the initial straight line, a parallel straight line parallel to the initial straight line is determined with the first virtual character as the starting point of the straight path. This parallel straight line is then determined as the above straight path.

[0044] Step S108: Determine the intermediate position point in the straight path, and determine the target movement path of the first virtual character based on the intermediate position point and the target position point.

[0045] The scene tile where the aforementioned intermediate position point is located is a scene tile where the virtual character can move. In other words, the virtual character can move on the scene tile where the intermediate position point is located. Specifically, a position point can be arbitrarily determined along a straight path, or a position point can be determined along a straight path based on a preset distance, such as a position point determined at a preset distance from the first virtual character. Then, the state of this position point is determined. If the virtual character can move on the scene tile where this position point is located, then this position point can be determined as the intermediate position point; if the virtual character cannot move on the scene tile where this position point is located, then position points can continue to be determined along the straight path until the state of the currently determined position point is such that the virtual character can move on the scene tile where the currently determined position point is located. Then, the currently determined position point is determined as the aforementioned intermediate position point.

[0046] After determining the intermediate position, we can first determine the first target movement path for the first virtual character to move to the intermediate position, and then determine the second target movement path for the first virtual character to move to the target position. This method avoids the first virtual character taking unnecessary paths, providing players with a better gaming experience. By increasing the anthropomorphism of non-player characters and their similarity to players, they are less likely to be identified as non-player characters.

[0047] This invention provides a method for determining a movement path in a game. In response to the existence of a second virtual character within a specified range of a first virtual character, and the first and second virtual characters being located on opposite sides of a specified game item, a target location point is determined in the game scene. The first virtual character is a non-player-controlled virtual character, and the second virtual character is a player character. An initial movement path is determined based on the target location point, where the initial movement path includes at least one inflection point. In response to the inflection point being on the same side as the second virtual character within the specified game item, a straight path for the first virtual character is determined. The second virtual character cannot move on the scene area where the specified game item is located. The location points along the straight path are located on opposite sides of the second virtual character within the specified game item. An intermediate location point is determined along the straight path. Based on the intermediate location point and the target location point, the target movement path for the first virtual character is determined. In this method, the determined straight path is located on the opposite side of the designated game item from the second virtual character. The target movement path is determined based on the position points on the straight path and the target position point, which avoids the first virtual character from encountering the second virtual character when moving to the target position point. This improves the anthropomorphism of the non-player character, reduces the possibility of the player character recognizing the non-player character, and enhances the player's gaming experience.

[0048] In step S106 above, the step of determining the straight path of the first virtual character can be implemented as follows: a first straight line is determined based on a specified game item and a target location point, and the first straight line passes through the specified game item and the target location point; the straight path of the first virtual character is determined based on the first straight line; wherein, the starting point of the straight path is the first virtual character, and the straight path is parallel to the first straight line.

[0049] Specifically, based on the coordinates of a specified game item, it can be represented as panel_pos = (x p ,y p ,z p The coordinates of the target location point, and panel_pos', can be represented as panel_pos' = (x p’ ,y p‘ ,z p’ ), calculate the first straight line mentioned above, specifically using the formula dir p→p′ =(x p’ -x p ,y p‘ -y p ,z p’ -z p The first straight line is calculated. Then, a straight line is determined starting from the first virtual character, parallel to the first straight line, to obtain the straight path of the first virtual character. For example,... Figure 4As shown, the dashed line represents the first straight line, and the solid line parallel to the dashed line represents the straight path. In this method, the first straight line is determined by a specified game item and a target location point, and the straight path parallel to the first straight line is determined. This ensures that the location point on the straight path is on the opposite side of the specified game item from the second virtual character, thereby preventing the first virtual character from meeting the second virtual character and improving the anthropomorphic effect of the non-player character.

[0050] In step S108 above, the step of determining the intermediate position point in the straight path and determining the target movement path of the first virtual character based on the intermediate position point and the target position point is implemented as follows: (1) Determine the first initial position point in the straight path according to the preset distance threshold.

[0051] The aforementioned preset distance threshold can be set according to game needs, specifically determined by the movement speed of the first virtual character. For example, since the first virtual character's movement speed is 45 yards / s, the preset distance can be set to approximately 45 yards. Specifically, a point on a straight path at a distance from the first virtual character's distance threshold can be determined, and this point can be designated as the initial position point. For example,... Figure 5 As shown, the pentagram represents the first initial position point, and the distance between the pentagram and the first virtual character is the preset distance threshold.

[0052] (2) Determine whether the scene tile where the first initial position point is located is a scene tile that allows the virtual character to move, and determine the intermediate position point based on the determination result;

[0053] Examples such as Figure 5 As shown, the scene tile where the first initial position point is located is a scene tile that allows the virtual character to move; that is, the virtual character can move within the scene tile where the first initial position point is located. For example, as... Figure 6 As shown, the scene tile where the first initial position point is located is a scene tile that the virtual character cannot move, that is, the virtual character cannot move from the scene tile where the first initial position point is located.

[0054] One possible implementation:

[0055] Determine whether the scene tile where the first initial position point is located is a scene tile that allows the virtual character to move; if so, determine the first initial position point as the intermediate position point;

[0056] If not, determine a second initial position point in a straight path according to a preset distance threshold; wherein the distance between the first initial position point and the first virtual character is different from the distance between the second initial position point and the first virtual character; continue to execute the step of determining whether the scene plot where the second initial position point is located is a scene plot that allows the virtual character to move, until the scene plot where the second initial position point is located is a scene plot that allows the virtual character to move, and determine the second initial position point as the intermediate position point.

[0057] Specifically, the distance between the first initial position and the first virtual character is usually less than the distance between the second initial position and the first virtual character; that is, the second initial position is usually determined at a position farther away from the first virtual character. Of course, it can also be determined at a position closer to the first virtual character. After determining the second initial position, it is necessary to further determine whether the scene tile where the second initial position is located is a scene tile where the virtual character can move. If so, the second initial position is determined as an intermediate position; if not, a third initial position is determined along a straight path based on a preset distance threshold, until the scene tile where the final position is located is a scene tile where the virtual character can move, and this final position is determined as the aforementioned intermediate position.

[0058] If a scene plot is one that the virtual character cannot move, then the scene plot can contain obstacles or be a pre-set plot without waypoints.

[0059] (3) Determine the target movement path of the first virtual character based on the intermediate position point and the target position point. In the above method, by continuously taking points on the straight path and judging the state of the scene plot where the point is located, the virtual character can move on the scene plot where the intermediate position point is located, which improves the feasibility and accuracy of the target movement path.

[0060] One possible implementation: Determine a first movement path for the first virtual character to move to the intermediate position point based on the intermediate position point; if the position points in the first movement path are on the opposite side of the designated game item from the second virtual character, or the second virtual character is not within the designated range of the first virtual character, determine the first movement path as the target movement path for the first virtual character to move to the intermediate position point; if some position points in the first movement path are on the same side of the designated game item as the second virtual character, and the second virtual character exists within the designated range of the first virtual character, and the first and second virtual characters are on opposite sides of the designated game item, continue with the steps of determining the intermediate position point in the straight path, and determining the target movement path for the first virtual character based on the intermediate position point and the target position point.

[0061] The method for determining the first movement path of the first virtual character to the intermediate position point based on the intermediate position point is the same as the method for determining the initial movement path of the first virtual character to the target position point based on the target position point in step S104 above, and will not be repeated here. That is to say, the position point in the first movement path may be on the opposite side or the same side as the second virtual character on the designated game item.

[0062] After determining the first movement path, first determine whether the position point in the first movement path is on the opposite side of the second virtual character from the designated game item. If the position point in the first movement path is on the opposite side of the second virtual character from the designated game item, it means that the first movement path is safe, and the first virtual character can be controlled to move to the middle position point according to the first movement path.

[0063] If some points in the first movement path are on the same side of the designated game item as the second virtual character, it is necessary to determine whether the second virtual character exists within the designated range of the first virtual character. If so, it is necessary to determine whether the first and second virtual characters are on opposite sides of the designated game item. If so, it is possible for the first virtual character to be relatively safe at present. If the first virtual character moves along the first movement path, it will encounter the second virtual character, which will put the first virtual character in a dangerous state. At this time, the steps of determining the intermediate position point on the straight path and determining the target movement path of the first virtual character based on the intermediate position point and the target position point will continue.

[0064] If the second virtual character is not within the specified range of the first virtual character, it means that the first virtual character is safe now. Regardless of where the position point on the first movement path is, the first movement path is directly determined as the target movement path for the first virtual character to move to the middle position point.

[0065] After the step of determining the first movement path as the target movement path for the first virtual character to move to the intermediate position point if the position point in the first movement path is on the opposite side of the designated game item and the second virtual character is not within the designated range of the first virtual character, the above method further includes: controlling the first virtual character to move to the intermediate position point; and in response to the first virtual character moving to the intermediate position point, determining the target movement path for the first virtual character to move to the target position point based on the target position point.

[0066] Since the first virtual character moves to the middle position, the recalculated movement path at this point usually will not encounter the second virtual character, thus enhancing the anthropomorphism of the first virtual character.

[0067] The following describes an implementation method for determining whether the first virtual character and the second virtual character are located on opposite sides of a specified game item:

[0068] Furthermore, in step S102 above, in response to the existence of a second virtual character within a specified range of the first virtual character, and the first and second virtual characters being located on opposite sides of a specified game item, before the step of determining the target location point in the game scene, the method further includes:

[0069] In response to the first virtual character performing a specified action on a specified game item, the relative positions of the first virtual character and the second virtual character with respect to the specified game item are determined based on the first position information of the first virtual character, the second position information of the second virtual character, the third position information of the specified game item, and the orientation information of the specified game item.

[0070] The specified action can knock down a designated game item to prevent a second virtual character from passing through it. Specifically, when the first virtual character passes the location of the designated game item, the game item is knocked down. Then, the first position information of the current first virtual character, civi_pos = (x c ,y c ,z c ), the second virtual character's second position information butcher_pos = (x b ,y b ,z b ), specifying the third position information of the game item panel_pos=(x p ,y p ,z p ) and the orientation information of the specified game item panel_dir=(x d ,y d ,z d Based on the aforementioned location and orientation information, the relative positions of the first and second virtual characters with respect to the designated game item are determined. By determining the relative positions of the first and second virtual characters with respect to the designated game item, it is determined whether the first virtual character is currently safe.

[0071] One possible implementation:

[0072] Step 1: Calculate the first direction vector from the specified game item to the first virtual character based on the first position information and the third position information; calculate the second direction vector from the specified game item to the second virtual character based on the second position information and the third position information.

[0073] Specifically, using the formula dir p2c =(x c -x p ,yc -y p ,z c -z p ), calculate the first direction vector from the specified game item to the first virtual character; using the formula dir p2b =(x b -x p ,y b -y p ,z b -z p ), calculate the second direction vector from the specified game item to the second virtual character.

[0074] For example, such as Figure 7 The line segment b shown is the first direction vector mentioned above, ① is the first virtual character, ② is the second virtual character, and line segment c is the second direction vector mentioned above.

[0075] Step 2: Determine the relative positions of the first virtual character and the second virtual character with respect to the specified game item based on the first direction vector, the second direction vector, and the orientation vector of the specified game item.

[0076] For example, such as Figure 7 The line segment 'a' shown is the orientation vector of the specified game item.

[0077] One possible approach:

[0078] (1) Based on the first direction vector, the second direction vector and the orientation vector of the specified game item, calculate the first angle between the first direction vector and the orientation vector, and calculate the second angle between the second direction vector and the orientation vector;

[0079] For example, such as Figure 7 As shown, angle 1 is the first included angle mentioned above, and angle 2 is the second included angle mentioned above.

[0080] The cosine value of the first included angle is calculated as follows:

[0081]

[0082] Where α is the first included angle;

[0083] The cosine value of the second included angle is calculated as follows:

[0084]

[0085] Where β is the second included angle.

[0086] (2) Determine the relative positions of the first virtual character and the second virtual character with respect to the specified game item based on the first included angle and the second included angle.

[0087] Specifically, calculate the product of the cosine of the first included angle and the cosine of the second included angle; if the product is less than zero, determine that the first virtual character and the second virtual character are on opposite sides of the specified game item; if the product is greater than zero, determine that the first virtual character and the second virtual character are on the same side of the specified game item; if the product is equal to zero, determine that the first virtual character or the second virtual character is on the specified game item.

[0088] When cosα·cosβ<0, the first virtual character and the second virtual character are determined to be on opposite sides of the specified game item; when cosα·cosβ>0, the first virtual character and the second virtual character are determined to be on the same side of the specified game item.

[0089] If the cosine of the first included angle is zero (cosα = 0), then the first virtual character is located on the specified game item; if the cosine of the second included angle is zero (cosβ = 0), then the second virtual character is located on the specified game item. For example, either the first or second virtual character is on the cross-section of the plank. Generally, the product equals zero only when the plank is not placed.

[0090] The following describes an implementation method for determining whether a second virtual character exists within a specified range of a first virtual character:

[0091] Before the step of determining the target location point in the game scene, provided that a second virtual character exists within a specified range in response to a first virtual character, and the first and second virtual characters are located on opposite sides of a specified game item, the method further includes:

[0092] In response to the first virtual character performing a specified action on a specified game item, a first distance between the first virtual character and the second virtual character is determined based on the first position information of the first virtual character and the second position information of the second virtual character; and the position information of the first virtual character relative to the second virtual character is determined based on the first distance.

[0093] One possible implementation: If the first distance is greater than a preset distance, it is determined that there is no second virtual character within the specified range of the first virtual character; if the first distance is less than or equal to the preset distance, it is determined that there is a second virtual character within the specified range of the first virtual character. The preset distance can be set in advance according to game needs. For example, such as... Figure 8 As shown, line segment h represents the first distance mentioned above.

[0094] The following describes another possible implementation of the step of determining the straight path of the first virtual character in response to the inflection point being on the same side as the second virtual character being located on the designated game item:

[0095] Based on the first position information of the first virtual character and the second position information of the second virtual character, a first distance between the first virtual character and the second virtual character is determined; based on the position information of the inflection point and the second position information, a second distance between the inflection point and the second virtual character is determined; in response to the first distance being less than or equal to the second distance, and the inflection point and the second virtual character being located on the same side of the specified game item, a straight path of the first virtual character is determined.

[0096] In addition, if the second distance is greater than the first distance, and the inflection point is on the opposite side of the designated game item from the second virtual character, then the initial movement path is determined as the target movement path of the first virtual character, that is, it is not necessary to determine the straight path of the first virtual character.

[0097] For example, such as Figure 8 The line segment h shown represents the first distance mentioned above, and line segments e, f, and g represent the second distance mentioned above. For example, as... Figure 9 The line segment i shown represents the first distance mentioned above, and the line segment j represents the second distance mentioned above.

[0098] Specifically, if the second distance is greater than the first distance, and the inflection point is located on the opposite side of the designated game item from the second virtual character, the initial movement path is determined as the target movement path of the first virtual character; that is, it is not necessary to determine the straight-line path of the first virtual character. For example, such as... Figure 8 As shown, line segments e, f, and g are all greater than line segment h, and all inflection points are located on the opposite side of the designated game item from the second virtual character. At this time, the first virtual character will not collide with the second virtual character according to the initial movement path. Therefore, the initial movement path can be directly determined as the target movement path of the first virtual character.

[0099] However, if the second distance is less than or equal to the first distance, and the inflection point is on the same side of the designated game item as the second virtual character, it is necessary to determine the straight-line path of the first virtual character. For example, such as... Figure 9 As shown, line segments j and k are less than line segment i. It can be determined that the inflection points corresponding to line segments j and k are on the same side of the designated game item as the second virtual character. At this time, the first virtual character will inevitably collide with the second virtual character according to the initial movement path. Therefore, it is necessary to redetermine a new movement path, that is, to determine the straight path of the first virtual character.

[0100] Corresponding to the above method embodiments, this invention provides a device for determining movement paths in a game, such as... Figure 10 As shown, the device includes:

[0101] The target location point determination module 1001 is used to determine a target location point in the game scene in response to the existence of a second virtual character within a specified range of the first virtual character, and the first virtual character and the second virtual character being located on opposite sides of a specified game prop; wherein, the first virtual character is a non-player-controlled virtual character, and the second virtual character is a player character; the second virtual character cannot move on the scene plot where the specified game prop is located;

[0102] The initial movement path determination module 1002 is used to determine the initial movement path of the first virtual character to the target location point based on the target location point; wherein the initial movement path includes at least one turning point;

[0103] The straight path determination module 1003 is used to determine the straight path of the first virtual character in response to the inflection point being on the same side of the designated game item as the second virtual character; wherein the straight path includes position points that are on opposite sides of the designated game item as the second virtual character.

[0104] The target movement path determination module 1004 is used to determine the intermediate position point in a straight path, and determine the target movement path of the first virtual character based on the intermediate position point and the target position point.

[0105] This invention provides a device for determining a movement path in a game. In response to the existence of a second virtual character within a specified range of a first virtual character, and the first and second virtual characters being located on opposite sides of a specified game item, a target location point is determined in the game scene. The first virtual character is a non-player-controlled virtual character, and the second virtual character is a player character. An initial movement path is determined based on the target location point, where the initial movement path includes at least one inflection point. In response to the inflection point being on the same side as the second virtual character within the specified game item, a straight path for the first virtual character is determined. The second virtual character cannot move on the scene area where the specified game item is located. The location points along the straight path are located on opposite sides of the specified game item as the second virtual character. An intermediate location point is determined along the straight path, and the target movement path for the first virtual character is determined based on the intermediate location point and the target location point. In this method, the determined straight path is located on the opposite side of the designated game item from the second virtual character. The target movement path is determined based on the position points on the straight path and the target position point, which avoids the first virtual character from encountering the second virtual character when moving to the target position point. This improves the anthropomorphism of the non-player character, reduces the possibility of the player character recognizing the non-player character, and enhances the player's gaming experience.

[0106] The aforementioned straight path determination module is also used to: determine a first straight line based on a specified game item and a target location point, wherein the first straight line passes through the specified game item and the target location point; determine the straight path of the first virtual character based on the first straight line; wherein the starting point of the straight path is the first virtual character, and the straight path is parallel to the first straight line.

[0107] The aforementioned target movement path determination module is also used to: determine a first initial position point in a straight path according to a preset distance threshold; determine whether the scene plot where the first initial position point is located is a scene plot that allows the virtual character to move, and determine an intermediate position point according to the determination result; and determine the target movement path of the first virtual character according to the intermediate position point and the target position point.

[0108] The aforementioned target movement path determination module is further configured to: determine whether the scene plot where the first initial position point is located is a scene plot where the virtual character can move; if so, determine the first initial position point as an intermediate position point; if not, determine the second initial position point in a straight path according to a preset distance threshold; wherein, the distance between the first initial position point and the first virtual character is different from the distance between the second initial position point and the first virtual character; continue to execute the step of determining whether the scene plot where the second initial position point is located is a scene plot where the virtual character can move, until the scene plot where the second initial position point is located is a scene plot where the virtual character can move, and determine the second initial position point as an intermediate position point.

[0109] The aforementioned target movement path determination module is further configured to: determine a first movement path for the first virtual character to move to the intermediate position point based on the intermediate position point; if the position points in the first movement path are on the opposite side of the designated game item and the second virtual character, or the second virtual character is not within the designated range of the first virtual character, determine the first movement path as the target movement path for the first virtual character to move to the intermediate position point; if some position points in the first movement path are on the same side of the designated game item as the second virtual character, and the second virtual character exists within the designated range of the first virtual character, and the first virtual character and the second virtual character are on the opposite side of the designated game item, continue to execute the steps of determining the intermediate position point in the straight path, and determining the target movement path of the first virtual character based on the intermediate position point and the target position point.

[0110] The aforementioned target movement path determination module is also used to: control the first virtual character to move to the intermediate position point; and in response to the first virtual character moving to the intermediate position point, determine the target movement path of the first virtual character to move to the target position point based on the target position point.

[0111] The aforementioned device further includes a relative position determination module, configured to: in response to the first virtual character performing a specified action on a specified game item, determine the relative positions of the first virtual character and the second virtual character relative to the specified game item based on the first position information of the first virtual character, the second position information of the second virtual character, the third position information of the specified game item, and the orientation information of the specified game item.

[0112] The aforementioned relative position determination module is also used to: calculate a first direction vector from the specified game item to the first virtual character based on the first position information and the third position information; calculate a second direction vector from the specified game item to the second virtual character based on the second position information and the third position information; and determine the relative positions of the first virtual character and the second virtual character with respect to the specified game item based on the first direction vector, the second direction vector, and the orientation vector of the specified game item.

[0113] The aforementioned relative position determination module is also used to: calculate the first angle between the first direction vector and the orientation vector based on the first direction vector, the second direction vector, and the orientation vector of the specified game item; and calculate the second angle between the second direction vector and the orientation vector; and determine the relative positions of the first virtual character and the second virtual character relative to the specified game item based on the first angle and the second angle.

[0114] The aforementioned relative position determination module is also used to: calculate the product of the cosine of the first included angle and the cosine of the second included angle; if the product is less than zero, determine that the first virtual character and the second virtual character are located on opposite sides of the specified game item; if the product is greater than zero, determine that the first virtual character and the second virtual character are located on the same side of the specified game item; if the product is equal to zero, determine that the first virtual character or the second virtual character is located on the specified game item.

[0115] The aforementioned relative position determination module is also used to: determine that the first virtual character is located on a designated game item if the cosine value of the first included angle is zero; and determine that the second virtual character is located on a designated game item if the cosine value of the second included angle is zero.

[0116] The aforementioned device further includes a first position information determination module, configured to: in response to a first virtual character performing a specified action on a specified game item, determine a first distance between the first virtual character and the second virtual character based on the first position information of the first virtual character and the second position information of the second virtual character; and determine the position information of the first virtual character relative to the second virtual character based on the first distance.

[0117] The aforementioned first location information determination module is further configured to: if the first distance is greater than a preset distance, determine that there is no second virtual character within the specified range of the first virtual character; if the first distance is less than or equal to the preset distance, determine that there is a second virtual character within the specified range of the first virtual character.

[0118] The aforementioned straight path determination module is further configured to: determine a first distance between the first virtual character and the second virtual character based on the first position information of the first virtual character and the second position information of the second virtual character; determine a second distance between the inflection point and the second virtual character based on the position information of the inflection point and the second position information; and determine a straight path for the first virtual character in response to the first distance being less than or equal to the second distance and the inflection point and the second virtual character being located on the same side of the specified game item.

[0119] The aforementioned straight path determination module is also used to: in response to the second distance being greater than the first distance, and the inflection point being located on the opposite side of the specified game item from the second virtual character, determine the initial movement path as the target movement path of the first virtual character.

[0120] The first and second virtual characters mentioned above belong to different game factions.

[0121] The device for determining movement paths in games provided in this embodiment of the invention has the same technical features as the method for determining movement paths in games provided in the above embodiments, so it can also solve the same technical problems and achieve the same technical effects.

[0122] This embodiment also provides an electronic device, including a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor. The processor executes the machine-executable instructions to implement the method for determining the movement path in the aforementioned game. This electronic device can be a server or a terminal device.

[0123] See Figure 11 As shown, the electronic device includes a processor 100 and a memory 101. The memory 101 stores machine-executable instructions that can be executed by the processor 100. The processor 100 executes the machine-executable instructions to implement the method for determining the movement path in the game described above.

[0124] Furthermore, Figure 11 The electronic device shown also includes a bus 102 and a communication interface 103, with the processor 100, the communication interface 103 and the memory 101 connected via the bus 102.

[0125] The memory 101 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 103 (which can be wired or wireless), such as the Internet, wide area network, local area network, or metropolitan area network. The bus 102 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 11 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

[0126] Processor 100 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 100 or by instructions in software form. Processor 100 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a mature storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 101. The processor 100 reads information from memory 101 and, in conjunction with its hardware, completes the steps of the method for determining the movement path in the game as described in the aforementioned embodiment. These steps specifically include:

[0127] In response to the existence of a second virtual character within a specified range of a first virtual character, and the first and second virtual characters being located on opposite sides of a specified game item, a target location point is determined in the game scene; wherein the first virtual character is a non-player-controlled virtual character, and the second virtual character is a player character; an initial movement path is determined for the first virtual character to move to the target location point based on the target location point; wherein the initial movement path includes at least one inflection point; in response to the inflection point being located on the same side of the specified game item as the second virtual character, a straight path for the first virtual character is determined; wherein the second virtual character cannot move on the scene tile where the specified game item is located; the location points included in the straight path are located on opposite sides of the specified game item as the second virtual character; an intermediate location point is determined in the straight path, and the target movement path for the first virtual character is determined based on the intermediate location point and the target location point. The method determines a straight path that is opposite to the second virtual character on the designated game item. The target movement path is determined based on the position points on the straight path and the target position point. This avoids the first virtual character from encountering the second virtual character when moving to the target position point, improves the anthropomorphism of the non-player character, reduces the possibility of the player character recognizing the non-player character, and enhances the player's gaming experience.

[0128] The steps for determining the straight path of the first virtual character include: determining a first straight line based on a specified game item and a target location point, the first straight line passing through the specified game item and the target location point; determining the straight path of the first virtual character based on the first straight line; wherein the starting point of the straight path is the first virtual character, and the straight path is parallel to the first straight line. Determining the first straight line using the specified game item and the target location point, and determining a straight path parallel to the first straight line, ensures that the location points on the straight path are on the opposite side of the specified game item from the second virtual character, thereby preventing the first virtual character from encountering the second virtual character and improving the anthropomorphic effect of the non-player character.

[0129] The steps described above—determining an intermediate point on a straight path and determining the target movement path of the first virtual character based on the intermediate point and the target point—include: determining a first initial point on the straight path based on a preset distance threshold; determining whether the scene plot where the first initial point is located is a scene plot where the virtual character can move; determining an intermediate point based on the determination result; and determining the target movement path of the first virtual character based on the intermediate point and the target point. By continuously taking points on the straight path and determining the state of the scene plots where those points are located, the virtual character can move on the scene plots where the intermediate points are located, thus improving the feasibility and accuracy of the target movement path.

[0130] The steps described above for determining whether the scene plot where the first initial position point is located is a scene plot where the virtual character can move, and determining the intermediate position point based on the determination result, include: determining whether the scene plot where the first initial position point is located is a scene plot where the virtual character can move; if yes, determining the first initial position point as the intermediate position point; if no, determining the second initial position point in a straight path according to a preset distance threshold; wherein, the distance between the first initial position point and the first virtual character is different from the distance between the second initial position point and the first virtual character; continuing to execute the step of determining whether the scene plot where the second initial position point is located is a scene plot where the virtual character can move, until the scene plot where the second initial position point is located is a scene plot where the virtual character can move, and determining the second initial position point as the intermediate position point.

[0131] The above-mentioned step of determining the target movement path of the first virtual character based on the intermediate position point and the target position point includes: determining a first movement path for the first virtual character to move to the intermediate position point based on the intermediate position point; if the position points in the first movement path are on the opposite side of the designated game item and the second virtual character, or the second virtual character is not within the designated range of the first virtual character, the first movement path is determined as the target movement path for the first virtual character to move to the intermediate position point; if some position points in the first movement path are on the same side of the designated game item and the second virtual character is within the designated range of the first virtual character, and the first virtual character and the second virtual character are on the opposite side of the designated game item, the step of determining the intermediate position point in the straight path and determining the target movement path of the first virtual character based on the intermediate position point and the target position point continues.

[0132] After the step of determining the first movement path as the target movement path for the first virtual character to move to the intermediate position point if the position point in the first movement path is on the opposite side of the designated game item and the second virtual character is not within the designated range of the first virtual character, the above method further includes: controlling the first virtual character to move to the intermediate position point; and in response to the first virtual character moving to the intermediate position point, determining the target movement path for the first virtual character to move to the target position point based on the target position point.

[0133] Before the step of determining the target location point in the game scene in response to the existence of a second virtual character within a specified range of the first virtual character, and the first and second virtual characters being located on opposite sides of a specified game prop, the method further includes: in response to the first virtual character performing a specified action on the specified game prop, determining the relative positions of the first virtual character and the second virtual character relative to the specified game prop based on the first position information of the first virtual character, the second position information of the second virtual character, the third position information of the specified game prop, and the orientation information of the specified game prop.

[0134] The steps described above, which determine the relative positions of the first virtual character and the second virtual character relative to the specified game item based on the first position information of the first virtual character, the second position information of the second virtual character, the third position information of the specified game item, and the orientation information of the specified game item, include: calculating a first direction vector from the specified game item to the first virtual character based on the first and third position information; calculating a second direction vector from the specified game item to the second virtual character based on the second and third position information; and determining the relative positions of the first virtual character and the second virtual character relative to the specified game item based on the first direction vector, the second direction vector, and the orientation vector of the specified game item.

[0135] The steps described above for determining the relative positions of the first virtual character and the second virtual character relative to the specified game item based on the first direction vector, the second direction vector, and the orientation vector of the specified game item include: calculating a first angle between the first direction vector and the orientation vector, and calculating a second angle between the second direction vector and the orientation vector; and determining the relative positions of the first virtual character and the second virtual character relative to the specified game item based on the first angle and the second angle.

[0136] The steps described above for determining the relative positions of the first virtual character and the second virtual character relative to the specified game item based on the first included angle and the second included angle include: calculating the product of the cosine of the first included angle and the cosine of the second included angle; if the product is less than zero, determining that the first virtual character and the second virtual character are located on opposite sides of the specified game item; if the product is greater than zero, determining that the first virtual character and the second virtual character are located on the same side of the specified game item; if the product is equal to zero, determining that the first virtual character or the second virtual character is located on the specified game item.

[0137] The above steps for determining whether the first virtual character or the second virtual character is located on a designated game item if the product is equal to zero include: determining that the first virtual character is located on a designated game item if the cosine of the first included angle is zero; and determining that the second virtual character is located on a designated game item if the cosine of the second included angle is zero.

[0138] Before the step of determining the target location point in the game scene in response to the existence of a second virtual character within a specified range of the first virtual character, and the first and second virtual characters being located on opposite sides of a specified game prop, the method further includes: in response to the first virtual character performing a specified action on the specified game prop, determining a first distance between the first virtual character and the second virtual character based on the first position information of the first virtual character and the second position information of the second virtual character; and determining the position information of the first virtual character relative to the second virtual character based on the first distance.

[0139] The above-mentioned step of determining the position information of the first virtual character relative to the second virtual character based on the first distance includes: if the first distance is greater than a preset distance, determining that there is no second virtual character within a specified range of the first virtual character; if the first distance is less than or equal to the preset distance, determining that there is a second virtual character within a specified range of the first virtual character.

[0140] After determining the initial movement path of the first virtual character to the target location point based on the target location point, the method further includes: determining a first distance between the first virtual character and the second virtual character based on the first location information of the first virtual character and the second location information of the second virtual character; determining a second distance between the inflection point and the second virtual character based on the location information of the inflection point and the second location information; and determining a straight path of the first virtual character in response to the first distance being less than or equal to the second distance, and the inflection point and the second virtual character being located on the same side of the designated game item.

[0141] The method further includes: in response to the second distance being greater than the first distance, and the inflection point being located on the opposite side of the designated game item from the second virtual character, determining the initial movement path as the target movement path of the first virtual character.

[0142] The first and second virtual characters mentioned above belong to different game factions.

[0143] This embodiment also provides a machine-readable storage medium storing machine-executable instructions. When these machine-executable instructions are invoked and executed by a processor, they cause the processor to implement the method for determining the movement path in the aforementioned game. This method specifically includes:

[0144] In response to the existence of a second virtual character within a specified range of a first virtual character, and the first and second virtual characters being located on opposite sides of a specified game item, a target location point is determined in the game scene; wherein the first virtual character is a non-player-controlled virtual character, and the second virtual character is a player character; an initial movement path is determined for the first virtual character to move to the target location point based on the target location point; wherein the initial movement path includes at least one inflection point; in response to the inflection point being located on the same side of the specified game item as the second virtual character, a straight path for the first virtual character is determined; wherein the second virtual character cannot move on the scene tile where the specified game item is located; the location points included in the straight path are located on opposite sides of the specified game item as the second virtual character; an intermediate location point is determined in the straight path, and the target movement path for the first virtual character is determined based on the intermediate location point and the target location point. The method determines a straight path that is opposite to the second virtual character on the designated game item. The target movement path is determined based on the position points on the straight path and the target position point. This avoids the first virtual character from encountering the second virtual character when moving to the target position point, improves the anthropomorphism of the non-player character, reduces the possibility of the player character recognizing the non-player character, and enhances the player's gaming experience.

[0145] The steps for determining the straight path of the first virtual character include: determining a first straight line based on a specified game item and a target location point, the first straight line passing through the specified game item and the target location point; determining the straight path of the first virtual character based on the first straight line; wherein the starting point of the straight path is the first virtual character, and the straight path is parallel to the first straight line. Determining the first straight line using the specified game item and the target location point, and determining a straight path parallel to the first straight line, ensures that the location points on the straight path are on the opposite side of the specified game item from the second virtual character, thereby preventing the first virtual character from encountering the second virtual character and improving the anthropomorphic effect of the non-player character.

[0146] The steps described above—determining an intermediate point on a straight path and determining the target movement path of the first virtual character based on the intermediate point and the target point—include: determining a first initial point on the straight path based on a preset distance threshold; determining whether the scene plot where the first initial point is located is a scene plot where the virtual character can move; determining an intermediate point based on the determination result; and determining the target movement path of the first virtual character based on the intermediate point and the target point. By continuously taking points on the straight path and determining the state of the scene plots where those points are located, the virtual character can move on the scene plots where the intermediate points are located, thus improving the feasibility and accuracy of the target movement path.

[0147] The steps described above for determining whether the scene plot where the first initial position point is located is a scene plot where the virtual character can move, and determining the intermediate position point based on the determination result, include: determining whether the scene plot where the first initial position point is located is a scene plot where the virtual character can move; if yes, determining the first initial position point as the intermediate position point; if no, determining the second initial position point in a straight path according to a preset distance threshold; wherein, the distance between the first initial position point and the first virtual character is different from the distance between the second initial position point and the first virtual character; continuing to execute the step of determining whether the scene plot where the second initial position point is located is a scene plot where the virtual character can move, until the scene plot where the second initial position point is located is a scene plot where the virtual character can move, and determining the second initial position point as the intermediate position point.

[0148] The above-mentioned step of determining the target movement path of the first virtual character based on the intermediate position point and the target position point includes: determining a first movement path for the first virtual character to move to the intermediate position point based on the intermediate position point; if the position points in the first movement path are on the opposite side of the designated game item and the second virtual character, or the second virtual character is not within the designated range of the first virtual character, the first movement path is determined as the target movement path for the first virtual character to move to the intermediate position point; if some position points in the first movement path are on the same side of the designated game item and the second virtual character is within the designated range of the first virtual character, and the first virtual character and the second virtual character are on the opposite side of the designated game item, the step of determining the intermediate position point in the straight path and determining the target movement path of the first virtual character based on the intermediate position point and the target position point continues.

[0149] After the step of determining the first movement path as the target movement path for the first virtual character to move to the intermediate position point if the position point in the first movement path is on the opposite side of the designated game item and the second virtual character is not within the designated range of the first virtual character, the above method further includes: controlling the first virtual character to move to the intermediate position point; and in response to the first virtual character moving to the intermediate position point, determining the target movement path for the first virtual character to move to the target position point based on the target position point.

[0150] Before the step of determining the target location point in the game scene in response to the existence of a second virtual character within a specified range of the first virtual character, and the first and second virtual characters being located on opposite sides of a specified game prop, the method further includes: in response to the first virtual character performing a specified action on the specified game prop, determining the relative positions of the first virtual character and the second virtual character relative to the specified game prop based on the first position information of the first virtual character, the second position information of the second virtual character, the third position information of the specified game prop, and the orientation information of the specified game prop.

[0151] The steps described above, which determine the relative positions of the first virtual character and the second virtual character relative to the specified game item based on the first position information of the first virtual character, the second position information of the second virtual character, the third position information of the specified game item, and the orientation information of the specified game item, include: calculating a first direction vector from the specified game item to the first virtual character based on the first and third position information; calculating a second direction vector from the specified game item to the second virtual character based on the second and third position information; and determining the relative positions of the first virtual character and the second virtual character relative to the specified game item based on the first direction vector, the second direction vector, and the orientation vector of the specified game item.

[0152] The steps described above for determining the relative positions of the first virtual character and the second virtual character relative to the specified game item based on the first direction vector, the second direction vector, and the orientation vector of the specified game item include: calculating a first angle between the first direction vector and the orientation vector, and calculating a second angle between the second direction vector and the orientation vector; and determining the relative positions of the first virtual character and the second virtual character relative to the specified game item based on the first angle and the second angle.

[0153] The steps described above for determining the relative positions of the first virtual character and the second virtual character relative to the specified game item based on the first included angle and the second included angle include: calculating the product of the cosine of the first included angle and the cosine of the second included angle; if the product is less than zero, determining that the first virtual character and the second virtual character are located on opposite sides of the specified game item; if the product is greater than zero, determining that the first virtual character and the second virtual character are located on the same side of the specified game item; if the product is equal to zero, determining that the first virtual character or the second virtual character is located on the specified game item.

[0154] The above steps for determining whether the first virtual character or the second virtual character is located on a designated game item if the product is equal to zero include: determining that the first virtual character is located on a designated game item if the cosine of the first included angle is zero; and determining that the second virtual character is located on a designated game item if the cosine of the second included angle is zero.

[0155] Before the step of determining the target location point in the game scene in response to the existence of a second virtual character within a specified range of the first virtual character, and the first and second virtual characters being located on opposite sides of a specified game prop, the method further includes: in response to the first virtual character performing a specified action on the specified game prop, determining a first distance between the first virtual character and the second virtual character based on the first position information of the first virtual character and the second position information of the second virtual character; and determining the position information of the first virtual character relative to the second virtual character based on the first distance.

[0156] The above-mentioned step of determining the position information of the first virtual character relative to the second virtual character based on the first distance includes: if the first distance is greater than a preset distance, determining that there is no second virtual character within a specified range of the first virtual character; if the first distance is less than or equal to the preset distance, determining that there is a second virtual character within a specified range of the first virtual character.

[0157] After determining the initial movement path of the first virtual character to the target location point based on the target location point, the method further includes: determining a first distance between the first virtual character and the second virtual character based on the first location information of the first virtual character and the second location information of the second virtual character; determining a second distance between the inflection point and the second virtual character based on the location information of the inflection point and the second location information; and determining a straight path of the first virtual character in response to the first distance being less than or equal to the second distance, and the inflection point and the second virtual character being located on the same side of the designated game item.

[0158] The method further includes: in response to the second distance being greater than the first distance, and the inflection point being located on the opposite side of the designated game item from the second virtual character, determining the initial movement path as the target movement path of the first virtual character.

[0159] The first and second virtual characters mentioned above belong to different game factions.

[0160] The computer program products of the method, apparatus, electronic device and system for determining movement paths in games provided in the embodiments of the present invention include a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.

[0161] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and apparatus described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0162] Furthermore, in the description of the embodiments of the present invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the present invention based on the specific circumstances.

[0163] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0164] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0165] Finally, it should be noted that the above embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for determining a movement path in a game, characterized in that, The method includes: In response to the existence of a second virtual character within a specified range of the first virtual character, and the first and second virtual characters being located on opposite sides of a specified game item, a target location is determined in the game scene; wherein, the first virtual character is a non-player-controlled virtual character, and the second virtual character is a player character; the second virtual character cannot move on the scene plot where the specified game item is located; the first virtual character and the second virtual character belong to different game factions; The initial movement path of the first virtual character to the target location is determined based on the target location; wherein the initial movement path includes at least one turning point; Based on the first position information of the first virtual character and the second position information of the second virtual character, a first distance between the first virtual character and the second virtual character is determined; based on the position information of the inflection point and the second position information, a second distance between the inflection point and the second virtual character is determined; in response to the second distance being less than or equal to the first distance, and the inflection point and the second virtual character being located on the same side of the designated game item, a first straight line is determined based on the designated game item and the target position point, the first straight line passing through the designated game item and the target position point; a straight path of the first virtual character is determined based on the first straight line; wherein, the position points included in the straight path are located on the opposite side of the designated game item from the second virtual character; Based on a preset distance threshold, a first initial position point is determined in the straight path; it is determined whether the scene plot where the first initial position point is located is a scene plot that allows the virtual character to move, and based on the determination result, an intermediate position point is determined; The target movement path of the first virtual character is determined based on the intermediate location point and the target location point.

2. The method according to claim 1, characterized in that, The starting point of the straight path is the first virtual character, and the straight path is parallel to the first straight line.

3. The method according to claim 1, characterized in that, The step of determining whether the scene plot where the first initial position point is located is a scene plot where the virtual character can move, and determining the intermediate position point based on the determination result, includes: Determine whether the scene plot where the first initial position point is located is a scene plot that allows the virtual character to move; If so, the first initial position point is determined as the intermediate position point; If not, a second initial position point is determined in the straight path according to the preset distance threshold; wherein the distance between the first initial position point and the first virtual character is different from the distance between the second initial position point and the first virtual character; Continue executing the step of determining whether the scene plot where the second initial position point is located is a scene plot where the virtual character can move, until the scene plot where the second initial position point is located is a scene plot where the virtual character can move, and then determine the second initial position point as the intermediate position point.

4. The method according to claim 1, characterized in that, The step of determining the target movement path of the first virtual character based on the intermediate location point and the target location point includes: Determine the first movement path of the first virtual character to move to the intermediate position point based on the intermediate position point; If the location point in the first movement path is on the opposite side of the second virtual character from the designated game item, or if the second virtual character is not within the designated range of the first virtual character, the first movement path is determined as the target movement path for the first virtual character to move to the intermediate location point. If some points in the first movement path are on the same side of the designated game item as the second virtual character, and the second virtual character exists within a designated range of the first virtual character, and the first virtual character and the second virtual character are on opposite sides of the designated game item, then continue with the step of determining an intermediate point in the straight path and determining the target movement path of the first virtual character based on the intermediate point and the target point.

5. The method according to claim 4, characterized in that, If the location point in the first movement path is on the opposite side of the second virtual character from the designated game item, or the second virtual character is not within the designated range of the first virtual character, after the step of determining the first movement path as the target movement path for the first virtual character to move to the intermediate location point, the method further includes: Control the first virtual character to move to the intermediate position point; In response to the first virtual character moving to the intermediate location point, a target movement path for the first virtual character to move to the target location point is determined based on the target location point.

6. The method according to claim 1, characterized in that, In response to the existence of a second virtual character within a specified range of a first virtual character, and the first and second virtual characters being located on opposite sides of a specified game item, prior to the step of determining the target location point in the game scene, the method further includes: In response to the first virtual character performing a specified action on the specified game item, the relative positions of the first virtual character and the second virtual character with respect to the specified game item are determined based on the first position information of the first virtual character, the second position information of the second virtual character, the third position information of the specified game item, and the orientation information of the specified game item.

7. The method according to claim 6, characterized in that, The step of determining the relative positions of the first virtual character and the second virtual character with respect to the designated game item based on the first position information of the first virtual character, the second position information of the second virtual character, the third position information of the designated game item, and the orientation information of the designated game item includes: Based on the first location information and the third location information, calculate the first direction vector from the designated game item to the first virtual character; Based on the second location information and the third location information, calculate the second direction vector from the designated game item to the second virtual character; Based on the first direction vector, the second direction vector, and the orientation vector of the specified game item, the relative positions of the first virtual character and the second virtual character with respect to the specified game item are determined.

8. The method according to claim 7, characterized in that, The step of determining the relative positions of the first virtual character and the second virtual character with respect to the designated game item based on the first direction vector, the second direction vector, and the orientation vector of the designated game item includes: Based on the first direction vector, the second direction vector, and the orientation vector of the specified game item, calculate the first angle between the first direction vector and the orientation vector, and calculate the second angle between the second direction vector and the orientation vector; The relative positions of the first virtual character and the second virtual character with respect to the designated game item are determined based on the first included angle and the second included angle.

9. The method according to claim 8, characterized in that, The step of determining the relative positions of the first virtual character and the second virtual character relative to the designated game item based on the first included angle and the second included angle includes: Calculate the product of the cosine of the first included angle and the cosine of the second included angle; If the product is less than zero, it is determined that the first virtual character and the second virtual character are located on opposite sides of the specified game item; If the product is greater than zero, it is determined that the first virtual character and the second virtual character are located on the same side of the specified game item; If the product equals zero, it is determined that the first virtual character or the second virtual character is located on the designated game item.

10. The method according to claim 9, characterized in that, If the product equals zero, the step of determining whether the first virtual character or the second virtual character is located on the designated game item includes: If the cosine of the first included angle is zero, then the first virtual character is determined to be located on the designated game item; If the cosine of the second included angle is zero, then the second virtual character is determined to be located on the designated game item.

11. The method according to claim 1, characterized in that, In response to the existence of a second virtual character within a specified range of a first virtual character, and the first and second virtual characters being located on opposite sides of a specified game item, prior to the step of determining the target location point in the game scene, the method further includes: In response to the first virtual character performing a specified action on the specified game item, a first distance between the first virtual character and the second virtual character is determined based on the first position information of the first virtual character and the second position information of the second virtual character; Based on the first distance, the position information of the first virtual character relative to the second virtual character is determined.

12. The method according to claim 11, characterized in that, The step of determining the position information of the first virtual character relative to the second virtual character based on the first distance includes: If the first distance is greater than the preset distance, it is determined that the second virtual character does not exist within the specified range of the first virtual character; If the first distance is less than or equal to the preset distance, it is determined that the second virtual character exists within the specified range of the first virtual character.

13. The method according to claim 1, characterized in that, The method may include: In response to the second distance being greater than the first distance, and the inflection point being located on the opposite side of the designated game item from the second virtual character, the initial movement path is determined as the target movement path of the first virtual character.

14. A device for determining a movement path in a game, characterized in that, The device includes: The target location point determination module is used to determine a target location point in the game scene in response to the existence of a second virtual character within a specified range of a first virtual character, and the first and second virtual characters being located on opposite sides of a specified game item; wherein, the first virtual character is a non-player-controlled virtual character, and the second virtual character is a player character; the second virtual character cannot move on the scene plot where the specified game item is located; the first virtual character and the second virtual character belong to different game factions; An initial movement path determination module is used to determine an initial movement path for the first virtual character to move to the target location point based on the target location point; wherein, the initial movement path includes at least one turning point; A straight path determination module is used to determine a first distance between the first virtual character and the second virtual character based on the first position information of the first virtual character and the second position information of the second virtual character; determine a second distance between the inflection point and the second virtual character based on the position information of the inflection point and the second position information; in response to the second distance being less than or equal to the first distance, and the inflection point and the second virtual character being located on the same side of the designated game item, determine a first straight line based on the designated game item and the target position point, the first straight line passing through the designated game item and the target position point; determine a straight path for the first virtual character based on the first straight line; wherein, the position points included in the straight path are located on the opposite side of the designated game item from the second virtual character; The target movement path determination module is used to determine a first initial position point in the straight path according to a preset distance threshold; determine whether the scene plot where the first initial position point is located is a scene plot that allows the virtual character to move; determine an intermediate position point according to the determination result; and determine the target movement path of the first virtual character according to the intermediate position point and the target position point.

15. An electronic device, characterized in that, The device includes a processor and a memory, the memory storing computer-executable instructions that can be executed by the processor, the processor executing the computer-executable instructions to implement the method for determining a movement path in a game as described in any one of claims 1-13.

16. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the method for determining a movement path in a game as described in any one of claims 1-13.

Citation Information

Patent Citations

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

    CN113082714A

  • Virtual character motion control method and device and electronic equipment

    CN115120977A