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

By determining the movement parameters of the target game character avoiding the target area in the game and controlling its movement to the target position, the problem that the game agent is easily recognized near the enemy game character is solved, and the intelligence level and player experience of the agent are improved.

CN119770977APending Publication Date: 2025-04-08NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510007306.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-02
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

In competitive games, when the game agent is near the enemy's game characters, it is easy to be recognized by the player, reducing the player's gaming experience.

Method used

By determining that the target game character in the game scene will enter the target area where the target virtual object is located, based on the location of the target game character and the location of the target virtual object, the target motion parameters of the target game character avoiding the target area, including the target motion direction. Then, based on these parameters, a target position located outside the target area is determined and the target game character is controlled to move to that position.

Benefits of technology

It improves the intelligence of the game agent, making it difficult to be easily recognized by players, thereby improving the player's gaming experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119770977A_ABST
    Figure CN119770977A_ABST
Patent Text Reader

Abstract

The invention discloses a virtual character control method and device, electronic equipment and a readable storage medium, and the method comprises the steps: responding to a target region where a target game character in a game scene is about to enter a target virtual object, and obtaining the target virtual object based on the position of the target game character and the position of the target virtual object. Target motion parameters of the target game role avoiding the target area are determined, the target motion parameters at least comprise the target motion direction of the target game role, a target position located outside the target area is determined based on the target motion parameters, and the target game role is controlled to move towards the target position. The intelligent degree of the target game role can be improved, so that the target game role is not easily recognized by a player, and the game experience of the player is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of game technology, and in particular to a virtual character control method, device, electronic device and readable storage medium. Background Art

[0002] With the Internet, there are more and more ways to play games. For example, in competitive games, if the game lacks game characters, game agents can be added to the game to participate in the game.

[0003] However, when controlling the game agent through the current control method, even if the game agent is near the enemy game character, it will move according to the originally designed route, making the game agent easy to be identified by the player, reducing the player's gaming experience. Summary of the invention

[0004] The embodiments of the present application provide a virtual character control method, device, electronic device and readable storage medium, which can improve the intelligence level of game agents, make the game agents not easily recognized by players, and improve the player's gaming experience.

[0005] In a first aspect, an embodiment of the present application provides a method for controlling a virtual character, the method comprising:

[0006] In response to determining that a target game character in the game scene will enter a target area where a target virtual object is located, based on a position of the target game character and a position of the target virtual object, a target motion parameter of the target game character to avoid the target area is determined, wherein the target motion parameter at least includes a target motion direction of the target game character;

[0007] Based on the target motion parameters, determining a target position outside the target area;

[0008] Control the target game character to move toward the target position.

[0009] In a second aspect, an embodiment of the present application further provides a virtual character control device, the device comprising:

[0010] A first determination module is used for, in response to determining that a target game character in a game scene will enter a target area where a target virtual object is located, determining a target motion parameter of the target game character to avoid the target area based on a position of the target game character and a position of the target virtual object, wherein the target motion parameter at least includes a target motion direction of the target game character;

[0011] A second determination module is used to determine the target position outside the target area based on the target motion parameter;

[0012] The character control module is used to control the target game character to move toward the target position.

[0013] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a memory storing a plurality of instructions; the processor loads instructions from the memory to execute any one of the virtual character control methods provided in the embodiments of the present application.

[0014] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for loading by a processor to execute any one of the virtual character control methods provided in the embodiments of the present application.

[0015] In an embodiment of the present application, in response to determining that a target game character in a game scene is about to enter a target area where a target virtual object is located, target motion parameters of the target game character avoiding the target area are determined based on the position of the target game character and the position of the target virtual object, the target motion parameters at least including the target motion direction of the target game character, and based on the target motion parameters, a target position outside the target area is determined, and the target game character is controlled to move toward the target position, so that when the target game character is near the target virtual object, it can avoid the target virtual object, thereby improving the intelligence of the target game character, making it difficult for the target game character to be recognized by the player, and improving the player's gaming experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0017] Figure 1 is a schematic diagram of a virtual character control system provided in an embodiment of the present application;

[0018] Figure 2 This is a flow chart of an embodiment of a virtual character control method provided in an embodiment of the present application;

[0019] Figure 3 is a schematic diagram of the target motion direction provided in the embodiments of the present application;

[0020] Figure 4 is another schematic diagram of the target motion direction provided in the embodiments of the present application;

[0021] Figure 5 is another schematic diagram of the target motion direction provided in the embodiments of the present application;

[0022] Figure 6 is a schematic diagram of a preset position and a candidate position provided in an embodiment of the present application;

[0023] Figure 7 is a schematic diagram of the target direction provided in the embodiments of the present application;

[0024] Figure 8 is a schematic diagram of a target point provided in an embodiment of the present application;

[0025] Fig. 9 is another embodiment flow chart of the virtual character control method provided in the embodiments of the present application;

[0026] Fig.10 is a structural schematic diagram of a virtual character control device provided in an embodiment of the present application;

[0027] Fig.11 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0028] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0029] Before explaining the embodiments of the present application in detail, some terms involved in the embodiments of the present application are first explained.

[0030] Among them, in the description of the embodiments of the present application, the terms "first", "second", etc. may be used in this article to describe various concepts, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another concept. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0031] The embodiments of the present application provide a virtual character control method, device, electronic device and computer readable storage medium. Specifically, the virtual character control method of the embodiments of the present application can be executed by an electronic device, wherein the electronic device can be a terminal or a server.

[0032] The terminal can be a terminal device such as a smart phone, a tablet computer, a laptop computer, a touch screen, a game console, a personal computer (PC), a personal digital assistant (PDA), etc. The terminal can also include a client, which can be a game application client, a browser client carrying a game program, or an instant messaging client, etc.

[0033] The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), as well as big data and artificial intelligence platforms.

[0034] For example, Figure 1 As shown, the electronic device is explained by taking terminal 10 as an example. The terminal 10 displays a game scene through a graphical user interface. The game scene includes a target game character and a target virtual object. In response to determining that the target game character will enter a target area where the target virtual object is located, the server 20 determines target motion parameters for the target game character to avoid the target area based on the position of the target game character and the position of the target virtual object. The target motion parameters include at least a target motion direction of the target game character. Based on the target motion parameters, a target position outside the target area is determined, and the target position is sent to the terminal 10. The terminal 10 controls the target game character to move toward the target position.

[0035] The following is a detailed description of the embodiments in conjunction with the accompanying drawings. It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments. Although the logical order is shown in the flow chart, in some cases, the steps shown or described may be performed in an order different from that shown in the accompanying drawings.

[0036] In this embodiment, a terminal is used as an example for description. This embodiment provides a method for controlling a virtual character, such as Figure 2 As shown, the specific process of the virtual character control method can be as follows:

[0037] 201. In response to determining that a target game character in a game scene will enter a target area where a target virtual object is located, based on a position of the target game character and a position of the target virtual object, determine a target motion parameter for the target game character to avoid the target area, wherein the target motion parameter includes at least a target motion direction of the target game character.

[0038] The game scene is a virtual scene displayed (or provided) when the application is running on a terminal or server. Optionally, the virtual scene is a simulation environment of the real world, or a semi-simulation and semi-fictitious virtual environment, or a purely fictitious virtual environment. The virtual scene is any one of a two-dimensional virtual scene and a three-dimensional virtual scene.

[0039] The target game character refers to a game character in the game scene that is not controlled by the player, which can be a game agent or a non-player character (NPC).

[0040] The target virtual object refers to a virtual object in the game scene that can affect the target game character to perform the target task. The type of the target virtual object can be set according to the actual situation. For example, the target virtual object can be a game character, a virtual pet, or a dynamic obstacle.

[0041] When the target virtual object is a game character, the target virtual object can be called the first game character, and the first game character and the target game character belong to different game camps. When the target virtual object is a dynamic obstacle, the target virtual object can be an obstacle dynamically set by the first game character in the game scene. The dynamically set obstacle can be, for example, a virtual wall, which is used to block the target game character's path or cause damage to the target game character. When the target virtual object is a virtual pet, the virtual pet can be the pet of the first game character, and the virtual pet can damage the target game character or expose the target game character's position to the first game character.

[0042] The target task can be set according to the actual situation. For example, the target task can be a task to rescue teammates of the target game character, or the target task can be a cipher machine, which is not limited in this embodiment.

[0043] The target area where the target virtual object is located refers to an area centered on the target virtual object and within a certain distance from the target virtual object. Its shape can be set according to actual conditions. For example, the target area can be a circular area or a rectangular area, which is not limited in this embodiment.

[0044] Since the target virtual object affects the target game character in performing the target task, the target area is the area that affects the target game character in performing the target task. For example, when the target virtual object is the first game character or the virtual pet, if the target game character is in the target area, the first game character or the virtual pet can detect the target game character, and the first game character or the virtual pet can attack the target game character. When the target virtual object is a dynamic obstacle, if the target game character is in the target area, the dynamic obstacle will hinder the target game character from moving forward or cause damage to the target game character.

[0045] Therefore, the target game character needs to avoid the target area. Therefore, when the terminal controls the target game character to perform the target task, it can predict whether the target game character will enter the target area. When it is predicted that the target game character will enter the target area, the terminal controls the target game character to avoid the target area.

[0046] Optionally, the terminal may obtain a target distance between the target game character and the target virtual object while controlling the target game character to perform a target task, and determine whether the target game character will enter a target area where the target virtual object is located based on the target distance.

[0047] For example, when the target distance is less than the second preset distance, it is determined that the target game character will enter the target area where the target virtual object is located. The second preset distance may be greater than the size of the target area. When the target area is a circular area, the size of the target area is the radius of the target area.

[0048] The position of the target game character refers to the position of the target game character in the game scene when it is detected that the target game character in the game scene is about to enter the target area where the target virtual object is located. The position of the target virtual object refers to the position of the target virtual object in the game scene when it is detected that the target game character in the game scene is about to enter the target area where the target virtual object is located.

[0049] The target motion parameter for the target game character to avoid the target area can be understood as when the target game character is controlled to move according to the target motion parameter, the target game character can avoid the target area. The type of the target motion parameter can be set according to actual conditions, for example, the target motion parameter can be at least one of the target motion direction, the target motion speed or the target motion displacement, which is not limited in this embodiment.

[0050] When the target motion parameter is the target motion speed or the target motion displacement, the direction of the target motion speed is the target motion direction, and the direction of the target motion displacement is also the target motion direction. Therefore, the target motion parameter at least includes the target motion direction of the target game character.

[0051] In some embodiments, based on the position of the target game character and the position of the target virtual object, determining the target motion parameter of the target game character avoiding the target area includes:

[0052] Determine a distance vector between the target game character and the target virtual object based on the position of the target game character and the position of the target virtual object;

[0053] Based on the distance vector, target motion parameters of the target game character avoiding the target area are determined.

[0054] The position of the target game character and the position of the target virtual object can be represented by coordinates, and the coordinates of the target game character and the coordinates of the target virtual object are subtracted to obtain a distance vector between the target game character and the target virtual object.

[0055] In this embodiment, based on the position of the target game character and the position of the target virtual object, the distance vector between the target game character and the target virtual object is determined, and based on the distance vector, the target motion parameters of the target game character avoiding the target area are determined, thereby achieving the goal of determining the target motion parameters of the target game character avoiding the target area through the distance vector.

[0056] In some embodiments, the target motion parameter is the target motion direction, and based on the distance vector, determining the target motion parameter of the target game character avoiding the target area includes:

[0057] The direction or the opposite direction of the distance vector is determined as the target movement direction of the target game character to avoid the target area, or,

[0058] Based on the size of the distance vector and the target area, a target movement direction of the target game character avoiding the target area is determined.

[0059] The target motion direction may be the direction of the target motion speed and / or the direction of the target motion displacement. Since the target motion direction is the direction away from the target virtual object, when the direction or the opposite direction of the distance vector is determined as the target motion direction of the target game character avoiding the target area, the target motion direction is the direction in which the target virtual object points to the target game character.

[0060] Specifically, if the distance vector is obtained by subtracting the coordinates of the target game character from the coordinates of the target virtual object, then the direction opposite to the direction of the distance vector is determined as the target movement direction of the target game character avoiding the target area. If the distance vector is obtained by subtracting the coordinates of the target virtual object from the coordinates of the target game character, then the direction of the distance vector is determined as the target movement direction of the target game character avoiding the target area.

[0061] For example, when the target virtual object and the target game character are Figure 3 When the target motion direction is shown, Figure 3 shown.

[0062] When the target movement direction of the target game character avoiding the target area is determined based on the size of the distance vector and the target area, the target movement direction of the target game character avoiding the target area can be determined based on the size of the distance vector and the size of the target area.

[0063] In this embodiment, the direction or the opposite direction of the distance vector is determined as the target movement direction of the target game character to avoid the target area, so that after the target game character is controlled based on the target movement direction, not only can the target game character avoid the target area, but also the efficiency of determining the target movement direction can be improved. The target movement direction of the target game character to avoid the target area is determined based on the size of the distance vector and the target area, so that after the target game character is controlled based on the target movement direction, not only can the target game character avoid the target area, but also the target movement direction and the direction where the target task is located will not deviate greatly.

[0064] In some embodiments, determining the direction or the opposite direction of the distance vector as the target movement direction of the target game character avoiding the target area includes:

[0065] If the magnitude of the distance vector is less than the first preset distance, the direction of the distance vector or the opposite direction is determined as the target movement direction of the target game character avoiding the target area.

[0066] The first preset distance is a preset value, which can be set according to actual conditions. The size of the distance vector can be called the target distance.

[0067] In this embodiment, if the size of the distance vector is less than the first preset distance, it means that the target game character will soon enter the target area, and the target game character needs to be immediately controlled to avoid the target area. Therefore, the direction of the distance vector is directly determined as the target movement direction of the target game character to avoid the target area, so as to quickly determine the target movement direction, thereby ensuring that the target game character can avoid the target area.

[0068] In some embodiments, based on the size of the distance vector and the target area, determining the target movement direction of the target game character to avoid the target area includes:

[0069] If the size of the distance vector is between the first preset distance and the second preset distance, the target movement direction of the target game character avoiding the target area is determined based on the size of the distance vector and the target area, and the first preset distance is smaller than the second preset distance.

[0070] The second preset distance is a preset value, which can be set according to actual conditions. The size of the distance vector is between the first preset distance and the second preset distance, which can be expressed as r1≤r≤r2, where r1 represents the first preset distance, r represents the size of the distance vector, and r2 represents the second preset distance.

[0071] In this embodiment, if the size of the distance vector is between the first preset distance and the second preset distance, it means that the target game character will not enter the target area soon, and there is no need to immediately control the target game character to avoid the target area. Therefore, based on the size of the distance vector and the target area, the target movement direction of the target game character to avoid the target area is determined, so that after the target game character is controlled based on the target movement direction, not only can the target game character avoid the target area, but also the target movement direction and the direction where the target task is located will not deviate greatly.

[0072] In some embodiments, based on the size of the distance vector and the target area, determining the target movement direction of the target game character to avoid the target area includes:

[0073] Determine the tangent point of the tangent line that passes through the position of the target game character and is tangent to the target area;

[0074] Based on the tangent point and the position of the target game character, a target movement direction of the target game character avoiding the target area is determined.

[0075] When the target area is a circular area, the size of the target area is the radius of the target area. The tangent, the line segment where the radius is located, and the line segment representing the distance vector can form a triangle. The triangle can be formed as follows Figure 4 As shown in the triangle CAU and the triangle CBU, at this time, the tangent includes the line segment CA and the line segment CB, the line segment where the radius is located is the line segment UA or the line segment UB, and the line segment representing the distance vector is the line segment CU.

[0076] In the formed triangle, the length of the line segment representing the distance vector is the size of the distance vector, and the length of the line segment where the radius is located is the size of the radius. Therefore, according to the size of the distance vector and the size of the radius, the angle between the line segment representing the distance vector and the line segment where the radius is located can be determined. Then, based on the angle and the direction of the distance vector, the direction of the line segment where the radius is located is determined. The direction of the line segment where the radius is located is represented by the target unit vector. The target unit vector and the size of the radius are multiplied to obtain the line segment vector where the radius is located. Finally, based on the line segment vector and the position of the target virtual object, the tangent point of the tangent line passing through the position of the target game character and tangent to the target area is obtained.

[0077] For example, when the triangle is composed of Figure 4 When shown, the angle between the line segment representing the distance vector and the line segment where the radius is located can be expressed as Figure 4As shown in , the size of the distance vector is CU, and the size of the radius is R. The cosine value is determined according to CU and R, and θ can be obtained based on the cosine value. Then, based on the direction of θ and CU, the direction of UA and the direction of UB are determined. Based on the direction and radius of UA, the line segment vector UA is determined. Based on the direction and radius of UB, the line segment vector UB is determined. Based on the line segment vector UA and the position of the target virtual object, the tangent point A is determined. Based on the line segment vector UB and the position of the target virtual object, the tangent point B is determined.

[0078] After obtaining the tangent point, the terminal subtracts the coordinates of the target game character from the coordinates of the tangent point to obtain the motion vector, and the direction of the motion vector is the target motion direction.

[0079] In this embodiment, the tangent point of the tangent line that passes through the position of the target game character and is tangent to the target area is determined, and based on the tangent point and the position of the target game character, the target movement direction of the target game character to avoid the target area is determined. This not only allows the target game character to avoid the target area, but also ensures that the target movement direction and the direction of the target task do not deviate too much.

[0080] In some embodiments, based on the tangent point and the position of the target game character, determining the target movement direction of the target game character to avoid the target area includes:

[0081] Based on the tangent point and the position of the target game character, determining a first motion vector and a second motion vector of the target game character avoiding the target area;

[0082] Based on the distance vector, the direction of the first motion vector or the direction of the second motion vector is determined as the target motion direction of the target game character avoiding the target area.

[0083] Among them, since there can be two tangent points, the coordinates of the target game character are subtracted from the coordinates of the two tangent points respectively to obtain the first motion vector and the second motion vector, and then the distance vector and the first motion vector are cross-multiplied to obtain the first cross product result. If the first cross product result is greater than 0, it means that the direction of the first motion vector is in the counterclockwise direction of the target virtual object. If the first cross product result is less than 0, it means that the direction of the first motion vector is in the clockwise direction of the target virtual object. Alternatively, the distance vector and the second motion vector are cross-multiplied to obtain the second cross product result. If the second cross product result is greater than 0, it means that the direction of the second motion vector is in the counterclockwise direction of the target virtual object. If the second cross product result is less than 0, it means that the direction of the second motion vector is in the clockwise direction of the target virtual object.

[0084] For example, the distance vector is CU, the first motion vector is CA, the second motion vector is CB, CU=(x u ,y u ), CA=(xA ,y A ), CB=(x B ,y B ), the first cross product result and the second cross product result are:

[0085] c1=CU*CA=x u *y A -y u *x A (1)

[0086] c2=CU*CB=x u *y B -y u *x B (2)

[0087] Among them, c1 represents the first cross product result, c2 represents the second cross product result, and x u The result of subtracting the horizontal coordinate of the target game character's position from the horizontal coordinate of the target virtual object, y u Indicates the result of subtracting the ordinate of the target game character's position from the ordinate of the target virtual object, x A The result of subtracting the horizontal coordinate of the target game character's position from the horizontal coordinate of the tangent point A, x A The result of subtracting the ordinate of the target game character's position from the ordinate of the tangent point A, x B The result of subtracting the abscissa of the target game character's position from the abscissa of the tangent point B, x B It represents the result of subtracting the ordinate of the target game character's position from the ordinate of the tangent point B.

[0088] The terminal may pre-set the direction of the motion vector in the clockwise direction or the counterclockwise direction of the target virtual object as the target motion direction. Specifically, when the direction of the motion vector in the counterclockwise direction of the target virtual object is pre-set as the target motion direction, if the first cross product result is greater than 0, the direction of the first motion vector is determined as the target motion direction. Figure 4 As shown, if the first cross product result is less than 0, the direction of the second motion vector is determined as the target motion direction.

[0089] In this embodiment, the direction of the motion vector in the clockwise direction or counterclockwise direction of the target virtual object is pre-set to be determined as the target motion direction, and then based on the tangent point and the position of the target game character, the first motion vector and the second motion vector for the target game character to avoid the target area are determined, and based on the distance vector, the direction of the first motion vector or the direction of the second motion vector is determined as the target motion direction for the target game character to avoid the target area, so that the direction of the counterclockwise motion vector or the clockwise motion vector of the target virtual object can be determined as the target motion direction, avoiding frequent switching between the counterclockwise and clockwise directions, which reduces the avoidance efficiency of the target game character.

[0090] In some embodiments, when the target virtual object includes at least two, the target motion parameter is the target motion direction, and the target motion direction is determined based on the first motion direction and the second motion direction, based on the distance vector, determining the direction of the first motion vector or the direction of the second motion vector as the target motion direction for the target game character to avoid the target area includes:

[0091] determining a positional relationship between at least two target virtual objects;

[0092] Based on the position relationship and the distance vector, a target motion direction is determined from the first motion direction and the second motion direction.

[0093] The target movement direction is a direction that is not located between at least two target virtual objects.

[0094] For example, the at least two target virtual objects include a target virtual object g1 and a target virtual object g2, and the positional relationship between the target virtual object g1 and the target virtual object g2 is that the target virtual object g1 is located to the left of the target virtual object g2, such as Figure 5As shown, the direction of the first motion vector of the target game character avoiding the target area where the target virtual object g2 is located is the motion direction f1, and the direction of the second motion vector avoiding the target area where the target virtual object g2 is located is the motion direction f2. A first cross product result is obtained by cross-multiplying the distance vector between the target game character and the target virtual object g2 and the first motion vector. The first cross product result is less than 0, indicating that the motion direction f1 is the clockwise direction of the target virtual object g2, and the motion direction f2 is the counterclockwise direction of the target virtual object g2. The direction of the first motion vector of the target game character avoiding the target area where the target virtual object g1 is located is the motion direction f3, and the direction of the second motion vector avoiding the target area where the target virtual object g1 is located is the motion direction f4. Based on the distance vector between the target game character and the target virtual object g1, the first cross product result is obtained by cross-multiplying the distance vector between the target game character and the target virtual object g1. The first motion vector is cross-multiplied to obtain a first cross product result. The first cross product result is less than 0, indicating that the motion direction f3 is the clockwise direction of the target virtual object g1, and the motion direction f4 is the counterclockwise direction of the target virtual object g1. Since the positional relationship between the target virtual object g1 and the target virtual object g2 is that the target virtual object g1 is located to the left of the target virtual object g2, the direction that is not located between at least two target virtual objects is the clockwise direction of the target virtual object g2 and the counterclockwise direction of the target virtual object g1. Therefore, the direction of the first motion vector in the clockwise direction of the target virtual object g2 or the direction of the second motion vector in the counterclockwise direction of the target virtual object g1 can be determined as the target motion direction. That is, the motion direction f1 or the motion direction f4 can be determined as the target motion direction.

[0095] 202. Determine a target position outside the target area based on the target motion parameter.

[0096] When the target motion parameter is the target motion direction and the target motion direction is the direction of the target motion speed, the target position can be determined based on the speed of the target game character, the target motion direction and the preset time.

[0097] Specifically, a unit vector can be generated based on the target movement direction, and the direction of the unit vector is the target movement direction, so that the target movement direction is indicated by the unit vector, and then the speed, the unit vector and the preset time are multiplied to obtain the first displacement, and finally the first displacement and the position of the target game character are added to obtain the target position. The preset time can be set according to the game tick, and the game tick represents the period of the game engine updating the game status.

[0098] In some embodiments, determining the position of the target outside the target area based on the target motion parameter includes:

[0099] Get the target number;

[0100] Based on the target motion parameters and the target times, the target position outside the target area is determined.

[0101] The target number indicates the number of times the target position is determined, and is used to adjust the displacement between the target position and the target game character. For example, when the target position is determined for the first time, the target number is 1, and when the target position is determined for the second time, the target number is 2.

[0102] Specifically, the terminal can generate a unit vector based on the target movement direction, the direction of the unit vector is the target movement direction, and then multiply the speed, unit vector, preset time and target number to obtain a first displacement, and finally add the first displacement and the position of the target game character to obtain the target position.

[0103] It is understandable that there may be a preset maximum value for the target number. When the target number is less than or equal to the maximum value, the target position outside the target area is determined based on the target motion parameters and the target number.

[0104] In some embodiments, determining the position of the target outside the target area based on the target motion parameter includes:

[0105] Based on the target motion parameter, determining a candidate position outside the target area;

[0106] Determine whether there are obstacles at the candidate position;

[0107] If there is no obstacle at the candidate position, the candidate position is determined as the target position.

[0108] Since the target game character cannot pass through the candidate position when there is an obstacle at the candidate position, in this embodiment, based on the target motion parameters, the candidate position outside the target area is determined, and it is judged whether there is an obstacle at the candidate position. If there is no obstacle at the candidate position, the candidate position is determined as the target position to ensure that the target game character can pass through the candidate position.

[0109] In some embodiments, after determining whether there is an obstacle at the candidate position, the method further includes:

[0110] If there is an obstacle at the candidate position, obtaining at least one preset position;

[0111] Determine a preset position whose distance from the candidate position meets a preset distance condition and has no obstacles as a first target position;

[0112] Control the target game character to move toward the first target position.

[0113] Among them, at least one preset position is a waypoint pre-set for the target game character in the game scene. Meeting the preset distance condition may mean that the distance between the candidate position and the target position is within a preset distance range, for example, a circle is drawn with a preset radius with the candidate position as the center, the first target position is a preset position without obstacles in the circle, and the preset distance range is the preset radius.

[0114] The first target position may be located outside the target area or within the target area.

[0115] For example, Figure 6 As shown, the candidate position is position d1, and there is an obstacle "stone" at position d1. At this time, the first target position may be position a1 or position a2. When the first target position is position a1, the first target position is outside the target area. When the first target position is position a2, the second target position is within the target area.

[0116] Optionally, in order to make the first target position as far as possible outside the target area, the preset distance range is as small as possible.

[0117] It can be understood that when the distance between the candidate position and the preset distance condition is satisfied and there are multiple preset positions without obstacles, the preset position with the shortest distance between the candidate position and the preset position can be determined as the first target position.

[0118] In this embodiment, if there is an obstacle at the candidate position, at least one preset position is obtained, and the preset position whose distance from the candidate position meets the preset distance condition and has no obstacles is determined as the first target position, and the target game character is controlled to move toward the first target position, so that when there is an obstacle at the candidate position, the target game character can also avoid the target area as much as possible.

[0119] In some embodiments, the present embodiment further includes:

[0120] If there is an obstacle at the candidate position, and there is no preset position whose distance from the candidate position meets the preset distance condition, the candidate position is updated based on the target motion parameter;

[0121] Return to the step of determining whether there is an obstacle at the candidate position.

[0122] Here, if there is an obstacle at the candidate position, and there is also an obstacle at a preset position whose distance from the candidate position satisfies a preset distance condition, the candidate position is updated based on the target motion parameter.

[0123] In the process of returning to execute the step of determining whether there is an obstacle at the candidate position, the candidate position is the updated candidate position.

[0124] For example, based on the target motion parameters, the candidate position outside the target area is determined to be position d1. Figure 6 As shown, it is determined whether there is an obstacle at position d1. If there is an obstacle at position d1, at least one preset position is obtained. If there is no preset position whose distance from position d1 meets the preset distance condition and there is no obstacle, the candidate position is updated. The updated candidate position is position d2. It is determined whether there is an obstacle at position d2. If there is no obstacle at position d2 (at this time, position d2 can be as shown in FIG. Figure 6 As shown), position d2 is determined as the target position. If there is an obstacle at position d2, at least one preset position is obtained, and a preset position whose distance to position d2 meets the preset distance condition and has no obstacles is determined as the first target position.

[0125] In this embodiment, if there is an obstacle at the candidate position and there is no preset position whose distance from the candidate position meets the preset distance condition, the candidate position is updated based on the target motion parameters, and the step of determining whether there is an obstacle at the candidate position is returned to ensure that the target game character can avoid the target area.

[0126] In some embodiments, determining a candidate position outside the target area based on the target motion parameter includes:

[0127] Determine the current update count;

[0128] If the current update number is less than or equal to the preset number, the candidate position is updated based on the target motion parameters and the current update number.

[0129] Among them, the current update number indicates the number of times the candidate position is updated, which is used to adjust the displacement between the target position and the target game character. When determining the candidate position, the candidate position can also be determined according to the current update number. When determining the candidate position, the current update number can be understood as 1, and when the candidate position is updated for the first time, the current update number is 2. The preset number is a pre-set value, which represents the maximum value of the update number.

[0130] Specifically, the target motion parameter is the target motion direction and the target motion direction is the target speed direction. The terminal can generate a unit vector based on the target motion direction, and the direction of the unit vector is the target motion direction. Then, the speed magnitude, the unit vector, the preset time and the current update number are multiplied to obtain a first displacement. Finally, the first displacement and the position of the target game character are added to obtain an updated candidate position. That is, the speed magnitude, the unit vector, the preset time and the current update number are substituted into formula (3) for calculation to obtain the first displacement:

[0131] pos=speed*t*ver*multipier (3)

[0132] Among them, pos is the first displacement, speed represents the speed, t represents the preset time, multipier represents the current update number, and ver represents the unit vector.

[0133] After obtaining the first displacement, the terminal may add the first displacement and the position of the target game character to obtain an updated candidate position.

[0134] It is understandable that if the current update number is greater than the preset number, the first preset position is determined as the first target position. The first preset position is a waypoint preset for the target game character in the current tick.

[0135] In this embodiment, the current update number is determined. If the current update number is less than or equal to the preset number, the candidate position is updated based on the target motion parameter and the current update number, thereby updating the candidate position by the update number.

[0136] In some embodiments, the target motion parameter is the target motion direction, and determining the target position outside the target area based on the target motion parameter includes:

[0137] Determine the target direction based on the position of the target virtual object and the final position of the target game character;

[0138] If the angle between the target motion direction and the target direction does not satisfy a preset condition, the target position outside the target area is determined based on the target motion direction.

[0139] At this time, the present embodiment further includes:

[0140] If the angle between the target movement direction and the target direction meets a preset condition, the target game character is controlled to move toward a first preset position.

[0141] Among them, the final position of the target game character refers to the position where the target task is executed. For example, when the target task is to rescue teammates, the final position refers to the position of the teammates. When the target task is to decipher a cipher machine, the final position refers to the position of the cipher machine.

[0142] The first preset position is a waypoint preset for the target game character in the current tick. It is understandable that the first preset position can be the end position or a position close to the end position.

[0143] The terminal can subtract the position of the target virtual object from the end position to obtain the target vector. The direction of the target vector is the target direction, and the target direction is the direction from the target virtual object to the end position. For example, the target direction and the target motion direction can be expressed as follows: Figure 7 shown.

[0144] The preset condition refers to that the angle between the target movement direction and the target direction is less than a certain threshold value or the cosine value of the angle between the target movement direction and the target direction is greater than a certain threshold value. When the angle between the target movement direction and the target direction does not meet the preset condition, it means that the target movement direction and the target direction are far apart. At this time, the target position outside the target area can be determined based on the target movement direction. When the angle between the target movement direction and the target direction meets the preset condition, it means that the target movement direction and the target direction are relatively close. At this time, the target game character is no longer controlled to avoid the target area, but is controlled to move to the first preset position.

[0145] The terminal may determine the first target vector based on the target motion direction, and determine the angle between the target motion direction and the target direction based on the target vector and the first target vector, wherein the direction of the first target vector is the target motion direction, and the length of the first target vector may be set according to actual conditions.

[0146] Specifically, the target vector and the first target vector can be substituted into formula (4) to calculate and obtain the cosine value:

[0147]

[0148] Among them, σ represents the angle between the target motion direction and the target direction, represents the target vector, represents the first target vector.

[0149] In this embodiment, the target direction is determined based on the position of the target virtual object and the terminal position of the target game character. If the angle between the target movement direction and the target direction does not meet the preset conditions, the target position outside the target area is determined based on the target movement direction. If the angle between the target movement direction and the target direction meets the preset conditions, the target game character is controlled to move to the first preset position, which not only saves the time for the target game character to perform the target task and improves the execution efficiency of the target task, but also allows the target game character to avoid the target area.

[0150] In some embodiments, when the target virtual objects include at least two, the target motion parameters also include at least two, and determining the target position outside the target area based on the target motion parameters includes:

[0151] determining an average motion parameter of at least two target motion parameters;

[0152] Based on the average motion parameters, the locations of the targets outside the target area are determined.

[0153] In some embodiments, when the target virtual object is a game character, this embodiment further includes:

[0154] Obtain the game rank of the target virtual object;

[0155] Determine the size of the target area based on the game level.

[0156] The higher the game level of the target virtual object, the stronger the ability of the target virtual object to perceive the target game character, so the larger the target area, and the lower the game level of the target virtual object, the weaker the ability of the target virtual object to perceive the target game character, so the smaller the target area. The target area can be used to determine the target motion parameters.

[0157] In this embodiment, when the target virtual object is a game character, the game rank of the target virtual object is obtained, and the size of the target area is determined based on the game rank. The higher the game rank of the target virtual object, the larger the target area, and the lower the game rank of the target virtual object, the smaller the target area. The size of the target area is determined according to the game rank of the target virtual object, so that the target game character controlled by the target motion parameters determined based on the target area is more intelligent, further improving the gaming experience.

[0158] In some embodiments, the present embodiment further includes:

[0159] In the process of controlling the target game character to move toward the target position, recording a first duration that the target game character continues to be within the visual range of the target virtual object and / or a second duration that the target game character continues to be outside the visual range of the target virtual object;

[0160] Based on the first duration and / or the second duration, the target area is updated, and the step of returning to execute, in response to the target game character in the game scene entering the target area where the target virtual object is located, determining the target motion parameters of the target game character to avoid the target area based on the position of the target game character and the position of the target virtual object.

[0161] When the target game character is within the visible range of the target virtual object, it means that the target virtual object can see the target game character.

[0162] Optionally, the terminal may first update the target area based on the first duration and / or the second duration, and then return to execute the step of determining target motion parameters for the target game character to avoid the target area based on the position of the target game character and the position of the target virtual object in response to the target game character in the game scene entering the target area where the target virtual object is located, or the terminal may first return to execute the step of determining target motion parameters for the target game character to avoid the target area based on the position of the target game character and the position of the target virtual object in response to the target game character in the game scene entering the target area where the target virtual object is located, and then update the target area based on the first duration and / or the second duration.

[0163] For example, when it is determined for the first time that the target game character in the game scene will enter the target area where the target virtual object is located, the target area determined based on the game level of the target virtual object is area D1, and based on the position of the target game character, the position of the target virtual object and area D1, a target motion parameter v1 for the target game character to avoid the target area is determined, and the target position determined based on the target motion parameter v1 is position d3, and the target game character is controlled to move to position d3. In the process of controlling the target game character to move to position d3, a first time duration that the target game character continues to be within the visible range of the target virtual object and / or a second time duration that the target game character continues to be not within the visible range of the target virtual object is recorded. When it is determined for the second time that the target game character in the game scene will enter the target area where the target virtual object is located, the target area is updated based on the first time duration and / or the second time duration to obtain area D2, and based on the position of the target game character, the position of the target virtual object and area D2, a target motion parameter v2 for the target game character to avoid the target area is determined, and the target position determined based on the target motion parameter v2 is position d4, and the target game character is controlled to move to position d4, and the process is repeated until the target game character reaches the end position.

[0164] It is understandable that the terminal can continuously determine whether the target game character will enter the target area where the target virtual object is located during the process of the target game character moving toward the target position. If it is determined that the target game character will enter the target area where the target virtual object is located, the target area is updated based on the first duration and / or the second duration, and the terminal returns to execute the step of determining the target motion parameters for the target game character to avoid the target area based on the position of the target game character and the position of the target virtual object in response to the target game character in the game scene entering the target area where the target virtual object is located. Alternatively, it can also be that when the target game character reaches the target position and moves, it is determined whether the target game character will enter the target area where the target virtual object is located. If it is determined that the target game character will enter the target area where the target virtual object is located, the target area is updated based on the first duration and / or the second duration, and the terminal returns to execute the step of determining the target motion parameters for the target game character to avoid the target area based on the position of the target game character and the position of the target virtual object in response to the target game character in the game scene entering the target area where the target virtual object is located.

[0165] It can be understood that when returning to execute the step of determining the target motion parameters of the target game character to avoid the target area based on the position of the target game character and the position of the target virtual object in response to the target game character in the game scene entering the target area where the target virtual object is located, the terminal is in a new tick of the game.

[0166] In this embodiment, in the process of controlling the target game character to move to the target position, the first duration that the target game character continues to be within the visible range of the target virtual object and / or the second duration that the target game character continues to be not within the visible range of the target virtual object are recorded, the target area is updated based on the first duration and / or the second duration, and the step of determining the target motion parameters of the target game character to avoid the target area based on the position of the target game character and the position of the target virtual object in response to the target game character in the game scene entering the target area where the target virtual object is located is returned to execute, so that when responding to the target game character in the game scene entering the target area where the target virtual object is located for the first time, the target area is determined based on the game level of the target virtual object, and when responding to the target game character in the game scene entering the target area where the target virtual object is located for not the first time, the target area is updated based on the first duration that the target game character continues to be within the visible range of the target virtual object and / or the second duration that the target game character continues to be not within the visible range of the target virtual object during the last movement of the target game character to the target position, so that the target game character controlled based on the target motion parameters determined by the target area is more intelligent, and the gaming experience is further improved.

[0167] In some embodiments, updating the target area based on the first duration and the second duration includes:

[0168] If the first duration is equal to or greater than the first preset duration, enlarging the target area;

[0169] If the second time duration is equal to or greater than the second preset time duration, the target area is reduced.

[0170] Among them, the first preset time length and the second preset time length are both pre-set time lengths, which can be set according to actual conditions. The first preset time length and the second preset time length can be the same or different.

[0171] It is understandable that the magnitude of the target area being increased each time may be the same or different. When the magnitude of the target area being increased each time is different, for example, the target area is a circular area, when the target area is increased for the first time, the radius of the target area may be increased by 5, and when the target area is increased for the second time, the radius of the target area may be increased by 10, and at this time, the magnitude of each increase gradually increases.

[0172] The magnitude of shrinking the target area each time can be the same or different. When the magnitude of shrinking the target area each time is different, for example, the target area is a circular area, when the target area is shrunk for the first time, the radius of the target area can be reduced by 5, and when the target area is shrunk for the second time, the radius of the target area can be reduced by 15, and at this time, the magnitude of each reduction gradually increases.

[0173] It can be understood that when the enlarged target area is the preset maximum area and / or the reduced target area is the preset minimum area, the target area is no longer enlarged or reduced.

[0174] In this embodiment, if the first duration is equal to or greater than the first preset duration, the target area is enlarged so that the time that the target game character controlled by the target motion direction determined based on the enlarged target area is within the visible range of the target virtual object is reduced; if the second duration is equal to or greater than the second preset duration, the target area is reduced so that the target game character controlled by the target motion direction determined based on the reduced target area can reach the end position of executing the target task more quickly, thereby further improving the intelligence of the target game character and improving the gaming experience.

[0175] In some embodiments, the method for determining whether the target game character is within the visible range of the target virtual object can be set according to actual conditions, and this embodiment does not limit this.

[0176] For example, a ray tracing method may be used to determine whether the target game character is within the visible range of the target virtual object. For another example, the process of recording the first duration that the target game character is within the visible range of the target virtual object and / or the second duration that the target game character is not within the visible range of the target virtual object is as follows:

[0177] Get at least one target point on the target game character;

[0178] Based on collision detection of rays between at least one target point and the center of the target virtual object, determine a first duration that the target game character continues to be within the visible range of the target virtual object and / or a second duration that the target game character continues to be not within the visible range of the target virtual object.

[0179] The number of at least one target point can be set according to actual conditions, for example, the number of at least one target point is 3 or 4, which is not limited in this embodiment. The position of at least one target point on the target game character can be set according to actual conditions, for example, at least one target point can be located on the head, shoulder or waist of the target game character, which is not limited in this embodiment.

[0180] When the at least one target point includes three and is located on the head and waist of the target game character, the at least one target point can be, for example, Figure 8 shown.

[0181] After determining the ray between at least one target point and the center of the target virtual object, the terminal can detect whether each ray collides with the virtual object in the game scene. If there are rays that do not collide with the virtual object, it indicates that the target game character is within the visible range of the target virtual object. If all rays collide with the virtual object, it indicates that the target game character is not within the visible range of the target virtual object.

[0182] The terminal may determine, based on whether the target game character is within the visible range of the target virtual object, a first duration for which the target game character is within the visible range of the target virtual object and / or a second duration for which the target game character is not within the visible range of the target virtual object.

[0183] In this embodiment, at least one target point on the target game character is obtained, and based on the collision detection of the ray between the at least one target point and the center of the target virtual object, the first duration that the target game character continues to be within the visible range of the target virtual object and / or the second duration that the target game character continues to be not within the visible range of the target virtual object is determined, so as to determine whether the target game character is within the visible range of the target virtual object through the ray.

[0184] 203. Control the target game character to move toward the target position.

[0185] After determining the target location, the terminal can control the target game character to move toward the target location.

[0186] In this embodiment, a target position outside the target area is determined, and a target game character is controlled to move toward the target position, so that when the target game character is near a target virtual object, the target virtual object can be avoided, thereby improving the intelligence of the target game character, making it difficult for the target game character to be recognized by the player, thereby improving the player's gaming experience, and based on the position of the target game character and the position of the target virtual object, target motion parameters for the target game character to avoid the target area are determined, and based on the target motion parameters, a method for determining the target position outside the target area is achieved, without requiring a large amount of calculation, thereby achieving the goal of controlling the target game character to avoid the target virtual object with a low amount of calculation.

[0187] From the above content, it can be seen that in an embodiment of the present application, in response to determining that the target game character in the game scene will enter the target area where the target virtual object is located, based on the position of the target game character and the position of the target virtual object, the target motion parameters of the target game character avoiding the target area are determined, and the target motion parameters at least include the target motion direction of the target game character. Based on the target motion parameters, the target position outside the target area is determined, and the target game character is controlled to move toward the target position, so that when the target game character is near the target virtual object, it can avoid the target virtual object, thereby improving the intelligence of the target game character, making it difficult for the target game character to be recognized by the player, and improving the player's gaming experience.

[0188] According to the following Fig. 9 , the virtual character control method provided by the present application is further described. In this embodiment, the first game character is used as the target virtual object for example, and the target motion direction is used as the target motion parameter for example.

[0189] 901. When controlling a target game character to execute a target task, the terminal obtains a distance vector between the target game character and a first game character.

[0190] 902. When the size of the distance vector is less than the second preset distance, the terminal determines that the target game character will enter the target area where the first game character is located.

[0191] 903. When the size of the distance vector is between the first preset distance and the second preset distance, the terminal determines whether it is the first time for the terminal to enter the target area where the first game character is located.

[0192] The second preset distance is greater than the first preset distance.

[0193] 904. If it is the first time to enter the target area where the first game character is located, the terminal determines the target area based on the game level of the first game character, and determines the target movement direction of the target game character to avoid the target area based on the size of the distance vector and the target area.

[0194] Among them, whether it is the first time to enter the target area where the first game character is located refers to whether it is the first time to enter the target area where the first game character is located in the current game match, that is, the first time here means that the size of the distance vector is between the first preset distance and the second preset distance for the first time.

[0195] Optionally, based on the size of the distance vector and the target area, the process of determining the target movement direction of the target game character to avoid the target area may be:

[0196] Determine the tangent point of the tangent line that passes through the position of the target game character and is tangent to the target area;

[0197] Based on the tangent point and the position of the target game character, a target movement direction of the target game character avoiding the target area is determined.

[0198] 905. If it is not the first time to enter the target area where the first game character is located, the terminal obtains a first duration that the target game character is continuously in the visual range of the first game character and a second duration that the target game character is continuously not in the visual range of the first game character in the process of controlling the historical movement of the target game character, and updates the target area based on the first duration and the second duration.

[0199] The historical movement of the target game character may refer to the movement of the target game character to the last determined target position, or may refer to the movement of the target game character to the first target position.

[0200] 906. The terminal determines a target movement direction of the target game character to avoid the target area based on the size of the distance vector and the updated target area.

[0201] 907. When the size of the distance vector is less than the first preset distance, the terminal determines the direction of the distance vector or the opposite direction as the target movement direction of the target game character avoiding the target area.

[0202] 908. The terminal determines a target direction based on the position of the target virtual object and the end position of the target game character.

[0203] 909. If the angle between the target motion direction and the target direction does not satisfy a preset condition, the terminal determines a candidate position outside the target area based on the target motion direction.

[0204] 9010. The terminal determines whether there is an obstacle at the candidate position.

[0205] 9011. If there is no obstacle at the candidate position, the terminal determines the candidate position as a target position outside the target area, and controls the target game character to move toward the target position.

[0206] 9012. If there is an obstacle at the candidate position, the terminal obtains at least one preset position and determines whether there is a preset position whose distance from the candidate position meets a preset distance condition and has no obstacles.

[0207] 9013. If so, the terminal determines a preset position whose distance from the candidate position meets a preset distance condition and has no obstacles as the first target position, and controls the target game character to move toward the first target position.

[0208] 9014. If it does not exist, the terminal updates the candidate position based on the target movement direction and the current update number, and returns to execute step 9010.

[0209] 9015. If the angle between the target movement direction and the target direction meets a preset condition, the target game character is controlled to move to a first preset position.

[0210] The specific implementation direction and corresponding beneficial effects of this embodiment can be specifically referred to the above method embodiment, and this embodiment will not be described in detail here.

[0211] In order to better implement the above method, the embodiment of the present application also provides a virtual character control device, which can be integrated into an electronic device, such as a computer device, which can be a terminal, server or other device.

[0212] Among them, the terminal can be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop computer, a personal computer and other devices; the server can be a single server or a server cluster composed of multiple servers.

[0213] For example, in this embodiment, the method of the embodiment of the present application is described in detail by taking the virtual character control device specifically integrated in the terminal as an example. This embodiment provides a virtual character control device, such as Fig.10 As shown, the virtual character control device may include:

[0214] The first determination module 1001 is used to determine, in response to determining that a target game character in a game scene will enter a target area where a target virtual object is located, target motion parameters for the target game character to avoid the target area based on the position of the target game character and the position of the target virtual object, wherein the target motion parameters at least include a target motion direction of the target game character.

[0215] The second determination module 1002 is used to determine the target position outside the target area based on the target motion parameter.

[0216] The character control module 1003 is used to control the target game character to move to the target position.

[0217] In some embodiments, the second determining module 1002 is specifically configured to:

[0218] Based on the target motion parameter, determining a candidate position outside the target area;

[0219] Determine whether there are obstacles at the candidate position;

[0220] If there is no obstacle at the candidate position, the candidate position is determined as the target position.

[0221] In some embodiments, the second determining module 1002 is specifically configured to:

[0222] If there is an obstacle at the candidate position, obtaining at least one preset position;

[0223] Determine a preset position whose distance from the candidate position meets a preset distance condition and has no obstacles as a first target position;

[0224] The character control module 1003 is also used to execute:

[0225] Control the target game character to move toward the first target position.

[0226] In some embodiments, the second determining module 1002 is specifically configured to:

[0227] If there is an obstacle at the candidate position, and there is no preset position whose distance from the candidate position meets the preset distance condition, the candidate position is updated based on the target motion parameter;

[0228] Return to the step of determining whether there is an obstacle at the candidate position.

[0229] In some embodiments, the second determining module 1002 is specifically configured to:

[0230] Determine the current update count;

[0231] If the current update number is less than or equal to the preset number, the candidate position is updated based on the target motion parameters and the current update number.

[0232] In some embodiments, the second determining module 1002 is specifically configured to:

[0233] Determine the target direction based on the position of the target virtual object and the final position of the target game character;

[0234] If the angle between the target motion direction and the target direction does not satisfy a preset condition, the target position outside the target area is determined based on the target motion direction.

[0235] In some embodiments, the character control module 1003 is further configured to execute:

[0236] If the angle between the target movement direction and the target direction meets a preset condition, the target game character is controlled to move toward a first preset position.

[0237] In some embodiments, the first determining module 1001 is specifically used to:

[0238] Determine a distance vector between the target game character and the target virtual object based on the position of the target game character and the position of the target virtual object;

[0239] Based on the distance vector, target motion parameters of the target game character avoiding the target area are determined.

[0240] In some embodiments, the target motion parameter is the target motion direction, and the first determination module 1001 is specifically used to:

[0241] The direction or the opposite direction of the distance vector is determined as the target movement direction of the target game character to avoid the target area, or,

[0242] Based on the size of the distance vector and the target area, a target movement direction of the target game character avoiding the target area is determined.

[0243] In some embodiments, the first determining module 1001 is specifically used to:

[0244] If the magnitude of the distance vector is less than the first preset distance, the direction of the distance vector or the opposite direction is determined as the target movement direction of the target game character avoiding the target area.

[0245] In some embodiments, the first determining module 1001 is specifically used to:

[0246] If the size of the distance vector is between the first preset distance and the second preset distance, the target movement direction of the target game character avoiding the target area is determined based on the size of the distance vector and the target area, and the first preset distance is smaller than the second preset distance.

[0247] In some embodiments, the first determining module 1001 is specifically used to:

[0248] Determine the tangent point of the tangent line that passes through the position of the target game character and is tangent to the target area;

[0249] Based on the tangent point and the position of the target game character, a target movement direction of the target game character avoiding the target area is determined.

[0250] In some embodiments, the first determining module 1001 is specifically used to:

[0251] Based on the tangent point and the position of the target game character, determining a first motion vector and a second motion vector of the target game character avoiding the target area;

[0252] Based on the distance vector, the direction of the first motion vector or the direction of the second motion vector is determined as the target motion direction of the target game character avoiding the target area.

[0253] In some embodiments, the first determining module 1001 is further configured to:

[0254] Obtain the game rank of the target virtual object;

[0255] Determine the size of the target area based on the game level.

[0256] In some embodiments, the first determining module 1001 is used to:

[0257] In the process of controlling the target game character to move toward the target position, recording a first duration that the target game character continues to be within the visual range of the target virtual object and / or a second duration that the target game character continues to be outside the visual range of the target virtual object;

[0258] Based on the first duration and / or the second duration, the target area is updated, and the step of returning to execute, in response to the target game character in the game scene entering the target area where the target virtual object is located, determining the target motion parameters of the target game character avoiding the target area based on the position of the target game character and the position of the target virtual object.

[0259] In some embodiments, the first determining module 1001 is used to:

[0260] If the first duration is equal to or greater than the first preset duration, enlarging the target area;

[0261] If the second time duration is equal to or greater than the second preset time duration, the target area is reduced.

[0262] In some embodiments, the first determining module 1001 is used to:

[0263] Get at least one target point on the target game character;

[0264] Based on collision detection of rays between at least one target point and the center of the target virtual object, determine a first duration that the target game character continues to be within the visible range of the target virtual object and / or a second duration that the target game character continues to be not within the visible range of the target virtual object.

[0265] In specific implementation, the above modules can be implemented as independent entities, or can be arbitrarily combined and implemented as the same or several entities. The specific implementation methods and corresponding beneficial effects of the above modules can be found in the previous method embodiments, which will not be repeated here.

[0266] Accordingly, an embodiment of the present application further provides an electronic device, which may be a terminal, and the terminal may be a smart phone, a tablet computer, a laptop computer, a touch screen, a game console, a personal computer (PC), a personal digital assistant (PDA), or other terminal devices. Fig.11 As shown, Fig.11 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device 1100 includes a processor 1101 having one or more processing cores, a memory 1102 having one or more computer-readable storage media, and a computer program stored in the memory 1102 and executable on the processor. The processor 1101 is electrically connected to the memory 1102. It will be understood by those skilled in the art that the electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0267] The processor 1101 is the control center of the electronic device 1100. It uses various interfaces and lines to connect the various parts of the entire electronic device 1100, executes various functions of the electronic device 1100 and processes data by running or loading software programs and / or modules stored in the memory 1102, and calling data stored in the memory 1102, thereby monitoring the electronic device 1100 as a whole.

[0268] In the embodiment of the present application, the processor 1101 in the electronic device 1100 will load instructions corresponding to the processes of one or more application programs into the memory 1102 according to the following steps, and the processor 1101 will run the application programs stored in the memory 1102 to implement various functions, such as:

[0269] In response to determining that a target game character in the game scene will enter a target area where a target virtual object is located, based on a position of the target game character and a position of the target virtual object, a target motion parameter of the target game character avoiding the target area is determined, the target motion parameter including at least a target motion direction of the target game character;

[0270] Based on the target motion parameter, determining the position of the target outside the target area;

[0271] Control the target game character to move to the target position.

[0272] The specific implementation methods and corresponding beneficial effects of the above operations can be found in the detailed description of the virtual character control method above, which will not be elaborated here.

[0273] Optional, such as Fig.11 As shown, the electronic device 1100 further includes: a touch screen 1103, a radio frequency circuit 1104, an audio circuit 1105, an input unit 1106, and a power supply 1107. The processor 1101 is electrically connected to the touch screen 1103, the radio frequency circuit 1104, the audio circuit 1105, the input unit 1106, and the power supply 1107, respectively. Those skilled in the art can understand that Fig.11 The electronic device structure shown in the figure does not constitute a limitation of the electronic device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0274] The touch display screen 1103 can be used to display a graphical user interface and receive operation instructions generated by the user acting on the graphical user interface. The touch display screen 1103 may include a display panel and a touch panel. Among them, the display panel can be used to display information input by the user or information provided to the user and various graphical user interfaces of the electronic device, and these graphical user interfaces can be composed of graphics, text, icons, videos and any combination thereof. Optionally, the display panel can be configured in the form of a liquid crystal display (LCD, Liquid Crystal Display), an organic light-emitting diode (OLED, Organic Light-EmittingDiode) and the like. The touch panel can be used to collect the user's touch operation on or near it (such as the user uses any suitable object or attachment such as a finger, a stylus, etc. on the touch panel or near the touch panel), and generate corresponding operation instructions, and the operation instructions execute corresponding programs. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor 1101, and can receive the command sent by the processor 1101 and execute it. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it is transmitted to the processor 1101 to determine the type of touch event, and then the processor 1101 provides a corresponding visual output on the display panel according to the type of touch event. In an embodiment of the present application, the touch panel and the display panel can be integrated into the touch display screen 1103 to realize the input and output functions. However, in some embodiments, the touch panel and the touch panel can be used as two independent components to realize the input and output functions. That is, the touch display screen 1103 can also be used as a part of the input unit 1106 to realize the input function.

[0275] The radio frequency circuit 1104 may be used to send and receive radio frequency signals, so as to establish wireless communication with a network device or other electronic devices through wireless communication, and to send and receive signals between the network device or other electronic devices.

[0276] The audio circuit 1105 can be used to provide an audio interface between the user and the electronic device through a speaker and a microphone. The audio circuit 1105 can transmit the electrical signal converted from the received audio data to the speaker, which is converted into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 1105 and converted into audio data, and then the audio data is output to the processor 1101 for processing, and then sent to another electronic device through the radio frequency circuit 1104, or the audio data is output to the memory 1102 for further processing. The audio circuit 1105 may also include an earplug jack to provide communication between an external headset and an electronic device.

[0277] The input unit 1106 may be used to receive input numbers, character information or user feature information (such as fingerprint, iris, facial information, etc.), and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.

[0278] The power supply 1107 is used to supply power to various components of the electronic device 1100. Optionally, the power supply 1107 can be logically connected to the processor 1101 through a power management system, so that the power management system can manage charging, discharging, and power consumption. The power supply 1107 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.

[0279] although Fig.11 Not shown, the electronic device 1100 may also include a camera, a sensor, a wireless fidelity module, a Bluetooth module, etc., which will not be described in detail here.

[0280] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0281] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0282] To this end, an embodiment of the present application provides a computer-readable storage medium, in which a plurality of computer programs are stored, and the computer program can be loaded by a processor to execute any virtual character control method provided in the embodiment of the present application. For example, the computer program can execute the following steps:

[0283] In response to determining that a target game character in the game scene will enter a target area where a target virtual object is located, based on a position of the target game character and a position of the target virtual object, a target motion parameter of the target game character avoiding the target area is determined, the target motion parameter including at least a target motion direction of the target game character;

[0284] Based on the target motion parameter, determining the position of the target outside the target area;

[0285] Control the target game character to move to the target position.

[0286] The specific implementation methods and corresponding beneficial effects of the above operations can be found in the detailed description of the virtual character control method above, which will not be elaborated here.

[0287] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0288] Since the computer program stored in the computer-readable storage medium can execute any virtual character control method provided in the embodiments of the present application, the beneficial effects that can be achieved by any virtual character control method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0289] The above is a detailed introduction to a virtual character control method, device, electronic device and computer-readable storage medium provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A virtual character control method, characterized in that: The method comprises: In response to determining that a target game character in a game scene will enter a target area where a target virtual object is located, based on a position of the target game character and a position of the target virtual object, a target motion parameter of the target game character avoiding the target area is determined, the target motion parameter including at least a target motion direction of the target game character; Based on the target motion parameter, determining a target position outside the target area; Control the target game character to move toward the target position.

2. The virtual character control method according to claim 1, characterized in that: The step of determining the target position outside the target area based on the target motion parameter includes: Based on the target motion parameter, determining a candidate position outside the target area; Determine whether there is an obstacle at the candidate position; If the obstacle does not exist at the candidate position, the candidate position is determined as the target position.

3. The virtual character control method according to claim 2, characterized in that: After determining whether there is an obstacle at the candidate position, the method further includes: If the obstacle exists at the candidate position, obtaining at least one preset position; Determine a preset position whose distance from the candidate position meets a preset distance condition and has no obstacles as a first target position; Control the target game character to move toward the first target position.

4. The virtual character control method according to claim 3, characterized in that: The method further comprises: If the obstacle exists at the candidate position and there is no preset position whose distance from the candidate position satisfies the preset distance condition, updating the candidate position based on the target motion parameter; Return to the step of determining whether there is an obstacle at the candidate position.

5. The virtual character control method according to claim 4, characterized in that: The updating of the candidate position based on the target motion parameter includes: Determine the current update count; If the current update number is less than or equal to the preset number, the candidate position is updated based on the target motion parameter and the current update number.

6. The virtual character control method according to claim 1, characterized in that: The target motion parameter is a target motion direction, and determining a target position outside the target area based on the target motion parameter includes: Determining a target direction based on the position of the target virtual object and the end position of the target game character; If the angle between the target movement direction and the target direction does not satisfy a preset condition, a target position outside the target area is determined based on the target movement direction.

7. The virtual character control method according to claim 6, characterized in that: The method further comprises: If the angle between the target movement direction and the target direction meets the preset condition, the target game character is controlled to move toward a first preset position.

8. The virtual character control method according to claim 1, characterized in that: The step of determining a target motion parameter of the target game character to avoid the target area based on the position of the target game character and the position of the target virtual object includes: Determine a distance vector between the target game character and the target virtual object based on the position of the target game character and the position of the target virtual object; Based on the distance vector, target motion parameters of the target game character avoiding the target area are determined.

9. The virtual character control method according to claim 8, characterized in that: The target motion parameter is a target motion direction, and determining the target motion parameter of the target game character avoiding the target area based on the distance vector includes: The direction or the opposite direction of the distance vector is determined as the target movement direction of the target game character avoiding the target area, or, Based on the size of the distance vector and the target area, a target movement direction of the target game character avoiding the target area is determined.

10. The virtual character control method according to claim 9, characterized in that: The step of determining the direction or the opposite direction of the distance vector as the target movement direction of the target game character avoiding the target area includes: If the size of the distance vector is smaller than the first preset distance, the direction of the distance vector or the opposite direction is determined as the target movement direction of the target game character avoiding the target area.

11. The virtual character control method according to claim 9, characterized in that: The step of determining the target movement direction of the target game character to avoid the target area based on the size of the distance vector and the target area includes: If the size of the distance vector is between a first preset distance and a second preset distance, the target movement direction of the target game character avoiding the target area is determined based on the size of the distance vector and the target area, and the first preset distance is smaller than the second preset distance.

12. The virtual character control method according to claim 9, characterized in that: The step of determining the target movement direction of the target game character to avoid the target area based on the size of the distance vector and the target area includes: Based on the size of the distance vector and the target area, determining a tangent point of a tangent line passing through the position of the target game character and tangent to the target area; Based on the tangent point and the position of the target game character, a target movement direction of the target game character avoiding the target area is determined.

13. The virtual character control method according to claim 12, characterized in that: The step of determining a target movement direction of the target game character to avoid the target area based on the tangent point and the position of the target game character includes: Based on the tangent point and the position of the target game character, determining a first motion vector and a second motion vector of the target game character avoiding the target area; Based on the distance vector, the direction of the first motion vector or the direction of the second motion vector is determined as the target motion direction of the target game character avoiding the target area.

14. The virtual character control method according to any one of claims 1 to 13, characterized in that: The target virtual object is a game character, and the method further includes: Obtaining the game rank of the target virtual object; Based on the game level, the size of the target area is determined.

15. The virtual character control method according to claim 14, characterized in that: The method further comprises: In the process of controlling the target game character to move toward the target position, recording a first duration that the target game character continues to be within the visible range of the target virtual object and / or a second duration that the target game character continues to be outside the visible range of the target virtual object; Based on the first duration and / or the second duration, the target area is updated, and the step of returning to execute, in response to a target game character in a game scene entering the target area where a target virtual object is located, determining target motion parameters of the target game character to avoid the target area based on the position of the target game character and the position of the target virtual object.

16. The virtual character control method according to claim 15, characterized in that: The updating of the target area based on the first duration and the second duration includes: If the first duration is equal to or greater than a first preset duration, enlarging the target area; If the second time duration is equal to or greater than a second preset time duration, the target area is reduced in size.

17. The virtual character control method according to claim 15, characterized in that: The recording of a first duration that the target game character is continuously within the visible range of the target virtual object and / or a second duration that the target game character is continuously not within the visible range of the target virtual object includes: Acquire at least one target point on the target game character; Based on collision detection of the ray between the at least one target point and the center of the target virtual object, determine a first duration that the target game character continues to be within the visible range of the target virtual object and / or a second duration that the target game character continues to be not within the visible range of the target virtual object.

18. A virtual character control device, characterized in that: The device comprises: A first determination module is used for, in response to determining that a target game character in a game scene will enter a target area where a target virtual object is located, determining a target motion parameter of the target game character to avoid the target area based on a position of the target game character and a position of the target virtual object, wherein the target motion parameter at least includes a target motion direction of the target game character; A second determination module, configured to determine a target position outside the target area based on the target motion parameter; The character control module is used to control the target game character to move toward the target position.

19. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores a plurality of instructions; the processor loads instructions from the memory to execute the virtual character control method as claimed in any one of claims 1 to 17.

20. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the virtual character control method according to any one of claims 1 to 17.

Citation Information

Cited By

  • Virtual-character control method and apparatus, and electronic device and readable storage medium

    WO2026145026A1