Virtual object control method and device, computer equipment and storage medium

By automatically calculating the relative position parameters of NPCs on the terminal, the NPC synchronization problem caused by network latency was solved, and the synchronous following and real-time control of virtual objects were realized.

CN121846676APending Publication Date: 2026-04-14TENCENT TECH SHANGHAI
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-12
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

In video games, due to network latency between the server and the client, the position synchronization of NPCs is difficult to update in a timely manner, resulting in lag or failure to follow virtual objects in time, which affects the real-time control.

Method used

The terminal calculates the relative position parameters between virtual objects to determine the movement position of the second virtual object, avoiding the impact of network latency and achieving synchronous following.

Benefits of technology

It improves the real-time performance of virtual object control, avoids lag and untimely tracking issues, and ensures that NPCs move synchronously with the main virtual object.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121846676A_ABST
    Figure CN121846676A_ABST
Patent Text Reader

Abstract

The invention discloses a virtual object control method and device, computer equipment and a storage medium, and belongs to the technical field of computers. The method comprises the steps that a first virtual object and a second virtual object are displayed, the first virtual object is a virtual object controlled by a terminal, and the second virtual object is a virtual object moving along with the first virtual object; determining a first position to which the first virtual object needs to be moved based on a moving operation on the first virtual object; based on a relative position parameter and the first position, a second position to which the second virtual object needs to be moved is determined, and the relative position parameter represents the relative position between the second virtual object and the first virtual object in the process of moving along with the first virtual object; and controlling the first virtual object to move to the first position, and controlling the second virtual object to move to the second position. According to the method and the device, synchronous following between the virtual objects is realized, the situation of lagging or untimely following can be avoided, and the real-time performance of controlling the virtual objects is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a virtual object control method, apparatus, computer device, and storage medium. Background Technology

[0002] In video games, virtual objects are provided that users can control to move. To enhance the fun, NPCs (Non-Player Characters) are also often provided, which can automatically follow the user-controlled virtual objects.

[0003] In related technologies, the server drives the NPC to move along with a virtual object and synchronizes the NPC's position with the client, which then renders the game screen based on the NPC's position. However, due to network latency between the server and the client, the client may have difficulty obtaining the NPC's position in a timely manner, leading to situations where the NPC lags or fails to follow the virtual object promptly. Summary of the Invention

[0004] This application provides a virtual object control method, apparatus, computer device, and storage medium, which enables synchronous following between virtual objects, avoiding lag or untimely following, and improving the real-time performance of virtual object control. The technical solution is as follows:

[0005] On the one hand, a method for controlling virtual objects is provided, the method comprising:

[0006] Display a first virtual object and a second virtual object, wherein the first virtual object is a virtual object controlled by the terminal, and the second virtual object is a virtual object that moves along with the first virtual object;

[0007] Based on the movement operation of the first virtual object, the first position to which the first virtual object needs to be moved is determined;

[0008] Based on the relative position parameter and the first position, the second position to which the second virtual object needs to move is determined, wherein the relative position parameter represents the relative position between the second virtual object and the first virtual object during the process of the second virtual object moving with the first virtual object;

[0009] Control the first virtual object to move to the first position, and control the second virtual object to move to the second position.

[0010] On the other hand, a virtual object control device is provided, the device comprising:

[0011] The display module is used to display a first virtual object and a second virtual object, wherein the first virtual object is a virtual object controlled by the terminal, and the second virtual object is a virtual object that moves with the first virtual object;

[0012] The first determining module is used to determine the first position to which the first virtual object needs to be moved based on the movement operation of the first virtual object;

[0013] The second determining module is used to determine the second position to which the second virtual object needs to move based on the relative position parameter and the first position, wherein the relative position parameter represents the relative position between the second virtual object and the first virtual object during the process of the second virtual object moving with the first virtual object;

[0014] The control module is used to control the first virtual object to move to the first position, and to control the second virtual object to move to the second position.

[0015] Optionally, the relative position parameters include relative distance and relative direction; the second determining module is used for:

[0016] Based on the first position and the relative direction, determine the target direction;

[0017] The position in the target direction whose distance from the first position is equal to the relative distance is determined as the second position.

[0018] Optionally, the second determining module is configured to:

[0019] A first ray is determined with the first position as its endpoint and pointing towards a reference direction, wherein the reference direction is the opposite direction to the movement direction of the first virtual object;

[0020] Keeping the endpoint of the first ray unchanged, the direction in which the first ray points is offset from the relative direction to obtain a second ray, and the direction in which the second ray points is determined as the target direction.

[0021] Optionally, the control module is used for:

[0022] If the distance between the first position and the position of the second virtual object is greater than a first preset distance, then control the first virtual object to move to the first position and control the second virtual object to move to the second position.

[0023] Optionally, the control module is further configured to:

[0024] If the distance between the first position and the position of the second virtual object is not greater than the first preset distance, then control the first virtual object to move to the first position, while keeping the position of the second virtual object unchanged.

[0025] Optionally, the control module is used for:

[0026] Control the first virtual object to move to the first position;

[0027] If the second virtual object meets the following / lagging condition, then the second virtual object will be displayed at the second position.

[0028] Optionally, the control module is configured to perform any of the following:

[0029] If the distance between the second virtual object and the first virtual object is greater than the second preset distance for a duration that reaches a preset duration, then the second virtual object will be displayed at the second position;

[0030] If the distance between the second virtual object and the first virtual object is greater than the second preset distance and the second virtual object does not move within the preset time period, then the second virtual object will be displayed at the second position.

[0031] Optionally, the control module is used for:

[0032] Control the first virtual object to move to the first position within m screen frames;

[0033] The step of displaying the second virtual object at the second position if the second virtual object satisfies the follow-behind condition includes:

[0034] If the second virtual object satisfies the following-lagging condition, then the second virtual object is rendered to the second position in the nth frame, where the nth frame is any frame after the second virtual object is determined to satisfy the following-lagging condition; where m is a positive integer greater than 1 and n is a positive integer not greater than m.

[0035] Optionally, in the direction of movement of the first virtual object, the second position is located behind the first position; the control module is configured to:

[0036] If the second virtual object satisfies the following and lagging condition, then a reference line perpendicular to the movement direction of the first virtual object and including the second position is determined, and the number of frame frames that the first virtual object needs to pass through to move to the reference line is determined.

[0037] Based on the number of frames, the second virtual object is rendered to the second position in the nth frame; where n is a positive integer greater than the number of frames and not greater than m.

[0038] Optionally, the second determining module is configured to:

[0039] If the first virtual object is in a running or flying state, the second position is determined based on the relative position parameter and the first position.

[0040] Optionally, the second determining module is configured to:

[0041] If the first virtual object is in the running state or the flying state, then after determining the first position that the first virtual object needs to move to in the first frame, the second position that the second virtual object needs to move to in the first frame is determined based on the relative position parameter and the first position.

[0042] The control module is used for:

[0043] The first virtual object is rendered to the first position in the first screen frame, and the second virtual object is rendered to the second position in the first screen frame.

[0044] Optionally, the device further includes:

[0045] The sending module is used to send the updated position of the first virtual object to the server whenever the position of the first virtual object is updated. The server is used to determine the third position that the second virtual object needs to move to based on the relative position parameter and the updated position of the first virtual object, and return the third position to the terminal.

[0046] The control module is further configured to, if the first virtual object exits the running state or the flying state, obtain the latest third position returned by the server and control the second virtual object to move to the latest returned third position.

[0047] Optionally, the device further includes:

[0048] The control module is further configured to control the first virtual object to move to the first position if the first virtual object is in a walking state;

[0049] A sending module is used to send the first location to a server, and the server is used to determine the second location based on the relative location parameter and the first location, and return the second location to the terminal;

[0050] A receiving module is used to receive the second location sent by the server;

[0051] The control module is also used to control the second virtual object to move to the second position.

[0052] Optionally, the control module is configured to render the first virtual object to the first position in the second screen frame after determining the first position that the first virtual object needs to move to in the second screen frame if the first virtual object is in the walking state.

[0053] The sending module is used to send the first location to the server;

[0054] The control module is used to render the second virtual object to the second position in the third screen frame after receiving the second position sent by the server, wherein the third screen frame is the screen frame after the second screen frame.

[0055] Optionally, the device further includes:

[0056] The sending module is used to send the second location to the server, and the server is used to verify the second location and return the verification result to the terminal;

[0057] The control module is used to control the first virtual object to move to the first position;

[0058] A receiving module is used to receive the verification result;

[0059] The control module is configured to control the second virtual object to move to the second position if the verification result indicates that the second position verification has passed.

[0060] Optionally, the device further includes:

[0061] The sending module is used to send the second location to the server, and the server is used to verify the second location and return the verification result to the terminal;

[0062] A receiving module is used to receive the verification result;

[0063] The control module is further configured to, if the verification result indicates that the second position verification has failed, correct the position of the second virtual object to the position indicated by the verification result.

[0064] On the other hand, a computer device is provided, the computer device including a processor and a memory, the memory storing at least one computer program, the at least one computer program being loaded and executed by the processor to perform the operations performed by the virtual object control method as described above.

[0065] On the other hand, a computer-readable storage medium is provided that stores at least one computer program, which is loaded and executed by a processor to perform the operations performed by the virtual object control method as described above.

[0066] On the other hand, a computer program product is provided, including a computer program that is loaded and executed by a processor to perform the operations performed by the virtual object control method as described above.

[0067] The solution provided in this application embodiment involves a first virtual object that moves according to terminal control, with a second virtual object automatically following its movement. When a movement operation is performed on the first virtual object, the terminal determines the first position to which the first virtual object needs to move based on the movement operation. Before controlling the first virtual object to move, the terminal also determines the second position to which the second virtual object needs to move based on the first position and the relative position between the two virtual objects. Since the second position is determined by the terminal, it is not affected by network latency. Therefore, the time point at which the second position is obtained is very close to the time point at which the first position is obtained. The terminal can simultaneously move the first virtual object to the first position and the second virtual object to the second position without causing any lag. This achieves synchronous movement control of the second virtual object and the first virtual object, avoiding lag or failure to follow the first virtual object in time, and improving the real-time performance of virtual object control. Attached Figure Description

[0068] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0069] Figure 1 This is a schematic diagram of an implementation environment provided in an embodiment of this application;

[0070] Figure 2 This is a flowchart of a virtual object control method provided in an embodiment of this application;

[0071] Figure 3 This is a flowchart of another virtual object control method provided in the embodiments of this application;

[0072] Figure 4 This is a schematic diagram of a relative position provided in an embodiment of this application;

[0073] Figure 5 This is a schematic diagram illustrating another relative position provided in an embodiment of this application;

[0074] Figure 6 This is a schematic diagram illustrating another relative position provided in an embodiment of this application;

[0075] Figure 7 This is a flowchart of another virtual object control method provided in the embodiments of this application;

[0076] Figure 8 This is a flowchart of another virtual object control method provided in the embodiments of this application;

[0077] Figure 9 This is a flowchart of another virtual object control method provided in the embodiments of this application;

[0078] Figure 10 This is a flowchart of another virtual object control method provided in the embodiments of this application;

[0079] Figure 11 This is a flowchart of another virtual object control method provided in the embodiments of this application;

[0080] Figure 12 This is a flowchart of another virtual object control method provided in the embodiments of this application;

[0081] Figure 13 This is a flowchart of another virtual object control method provided in the embodiments of this application;

[0082] Figure 14 This is a schematic diagram of the structure of a virtual object control device provided in an embodiment of this application;

[0083] Figure 15 This is a schematic diagram of another virtual object control device provided in an embodiment of this application;

[0084] Figure 16 This is a schematic diagram of the structure of a terminal provided in an embodiment of this application;

[0085] Figure 17 This is a schematic diagram of the structure of a server provided in an embodiment of this application. Detailed Implementation

[0086] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.

[0087] It is understood that the terms "first," "second," etc., used in this application may be used to describe various concepts herein, but unless otherwise stated, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another. For example, without departing from the scope of this application, a first virtual object may be referred to as a second virtual object, and similarly, a second virtual object may be referred to as a first virtual object.

[0088] "At least one" refers to one or more virtual objects. For example, at least one virtual object can be one, two, three, or any integer number of virtual objects greater than or equal to one. "Multiple" refers to two or more virtual objects. For example, multiple virtual objects can be two, three, or any integer number of virtual objects greater than or equal to two. "Each" refers to each of the at least one virtual object. For example, each virtual object refers to each of the multiple virtual objects. If the multiple virtual objects are three virtual objects, then each virtual object refers to each of the three virtual objects.

[0089] It should be noted that the information (including but not limited to user equipment information, user personal information, etc.), data (including but not limited to data used for analysis, data stored, data displayed, etc.) and signals (including but not limited to signals transmitted between user terminals and other devices) involved in this application have all been fully authorized by the user or relevant parties, and the collection, use and processing of the relevant data shall comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0090] For example, the virtual objects and location data involved in this application are all fully authorized by the user or relevant parties, and the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0091] Virtual Scene: A virtual scene is a scene displayed (or provided) by the client when running on the terminal. This virtual scene can be a simulation of the real world, a semi-simulated / semi-fictional environment, or a purely fictional environment. The virtual scene can be any of a two-dimensional, 2.5-dimensional, or three-dimensional virtual scene; this application embodiment does not limit the dimension of the virtual scene. For example, a virtual scene may include the sky, land, ocean, etc., and the land may include environmental elements such as deserts and cities. Users can control virtual objects to move within this virtual scene. Optionally, the virtual scene can provide a battle environment for virtual objects, containing virtual resources available for use by the virtual objects. These virtual resources include virtual items needed for battle, virtual medicines needed for treatment, virtual items needed for upgrades, and virtual coins needed for trading.

[0092] In open-world games, players can freely control virtual objects to roam in virtual scenes and freely choose when and how to complete game tasks. The virtual objects controlled by players can interact with other virtual objects in the virtual scene.

[0093] Virtual objects refer to movable objects in a virtual scene. These movable objects can be virtual characters, virtual animals, virtual sprites, anime characters, etc. A virtual object can be a virtual avatar representing the user within the virtual scene. A virtual scene can include multiple virtual objects, each with its own shape and volume, occupying a portion of the virtual scene's space. Optionally, when the virtual scene is a three-dimensional virtual scene, the virtual object can be a three-dimensional model, which can be a three-dimensional character constructed based on three-dimensional human skeleton technology. The same virtual object can display different appearances by wearing different skins. In some embodiments, virtual objects can also be implemented using 2.5D or 2D models; this application does not limit this.

[0094] A variety of virtual objects can exist within a virtual scene. For example, virtual objects may include player characters controlled through client-side operations, artificial intelligence (AI) trained and configured for virtual scene battles, and non-player characters (NPCs) interacting within the virtual scene. Optionally, the virtual object may be a virtual character competing within the virtual scene. Optionally, the number of virtual objects participating in the interaction within the virtual scene may be pre-set or dynamically determined based on the number of clients joining the interaction.

[0095] RPG games, or Role-Playing Games, are a genre of games where players immerse themselves in a virtual world, taking on a specific role and completing various tasks. In RPGs, players control virtual characters to freely roam the virtual environment. Furthermore, players can choose different character types to role-play, explore new locations, solve puzzles, form new groups, or participate in the story. Players advance the game's narrative by completing quests, exploring the virtual world, and developing their virtual characters' skills and attributes. These games typically feature complex plots and world-building, and players have the freedom to choose their virtual characters' behavior and development paths.

[0096] MMORPG (Multiplayer Online Role-Playing Game) is a type of RPG. It's a multiplayer game played online, designed to simulate virtual worlds such as ancient or modern fantasy worlds. Players can choose virtual characters to undertake specific adventure quests and explore these virtual worlds together through multiplayer online connections. In MMORPGs, multiple players are matched to participate in the same game within the same virtual world. During the game, different players can control virtual characters to attack each other, compete for game resources, or cooperate to win game resources.

[0097] The virtual object control method provided in this application can be used in a terminal. Optionally, the terminal can be a smartphone, tablet computer, laptop computer, desktop computer, smart speaker, smartwatch, smart voice interaction device, smart home appliance, vehicle terminal, aircraft, etc., but is not limited to these. This application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, and assisted driving.

[0098] Figure 1 This is a schematic diagram of an implementation environment provided in an embodiment of this application. See also... Figure 1 The implementation environment includes: terminal 101 and server 102. Terminal 101 and server 102 are connected via a wireless or wired network.

[0099] Terminal 101 has a client 111 installed and running. This client 111 can be a social application client, online payment client, online shopping client, game client, medical service client, video client, etc. When terminal 101 runs client 111, the user interface of client 111 is displayed on the screen of terminal 101. Terminal 101 is the terminal used by user 121.

[0100] Optionally, terminal 101 may include: smartphones, tablets, laptops, desktop computers, smart voice interaction devices, smart home appliances, in-vehicle terminals, aircraft, VR (Virtual Reality) devices, AR (Augmented Reality) devices, etc., but is not limited to these.

[0101] Figure 1Only one terminal is shown in the diagram, but in different embodiments, multiple other terminals 103 can access the server 102. Optionally, one or more terminals 103 may also be terminals corresponding to developers, on which a client development and editing platform is installed. Developers can edit and update the client on the terminal 103 and transmit the updated client installation package to the server 102 via wired or wireless network. Terminal 101 can download the client installation package from the server 102 to update the client.

[0102] Terminal 101 and other terminals 103 are connected to server 102 via wired or wireless networks.

[0103] Server 102 includes at least one of a single server, multiple servers, a cloud computing platform, and a virtualization center. Server 102 is used to provide backend services to clients. Optionally, server 102 undertakes the primary computing work, and terminal 101 undertakes the secondary computing work; or, server 102 undertakes the secondary computing work, and terminal 101 undertakes the primary computing work; or, server 102 and terminal 101 collaborate on computing using a distributed computing architecture.

[0104] In this embodiment, terminal 101 and server 102 collaboratively calculate the position that the second virtual object needs to move to to follow the first virtual object. For example, when the first virtual object is in a running or flying state, the terminal calculates the position that the second virtual object needs to move to to follow the first virtual object. When the first virtual object is in a walking state, the server calculates the position that the second virtual object needs to move to to follow the first virtual object.

[0105] It should be noted that the above implementation environment is only an example. The method provided in this application embodiment can also be executed by terminal 101 or server 102 alone, or by other computer devices. This application embodiment does not limit this.

[0106] Figure 2 This is a flowchart of a virtual object control method provided in an embodiment of this application. This embodiment is executed by a terminal. See also... Figure 2 The method includes:

[0107] 201. The terminal displays a first virtual object and a second virtual object. The first virtual object is a virtual object controlled by the terminal, and the second virtual object is a virtual object that moves with the first virtual object.

[0108] In this embodiment of the application, the terminal displays a first virtual object and a second virtual object.

[0109] The first virtual object is a virtual object controlled by the terminal. It can be understood as a virtual object controlled by the user; the user performs actions on the terminal, causing the terminal to manipulate the virtual object accordingly. The user can control the first virtual object to move, jump, run, attack, etc., through the terminal.

[0110] The second virtual object is one that moves along with the first virtual object. This can be understood as a virtual object not controlled by user interaction; the user cannot directly control the second virtual object through actions performed on the terminal. The second virtual object can only automatically follow the first virtual object's movement but is not directly controlled by user actions. For example, this second virtual object could be an NPC (Non-Player Character) summoned by the first virtual object.

[0111] 202. Based on the movement operation of the first virtual object, the terminal determines the first position to which the first virtual object needs to be moved.

[0112] The movement operation of the first virtual object refers to the operation performed by the user on the terminal to instruct the first virtual object to move. In response to the movement operation, the terminal determines the first position to which the first virtual object needs to be moved, based on the instruction of the movement operation.

[0113] For example, the movement operation can be a leftward movement operation or a rightward movement operation. Alternatively, the movement operation can also be a walking operation, a running operation, or a flying operation. Different movement operations can correspond to different movement speeds, movement directions, and movement postures.

[0114] 203. The terminal determines the second position to which the second virtual object needs to move based on the relative position parameter and the first position. The relative position parameter represents the relative position between the second virtual object and the first virtual object during the process of the second virtual object moving with the first virtual object.

[0115] The terminal obtains the relative position parameter corresponding to the second virtual object. This relative position parameter represents the relative position between the second virtual object and the first virtual object during the movement of the second virtual object following the first virtual object. It can be understood that this relative position parameter represents the desired relative position between the second and first virtual objects. Therefore, during the movement of the first virtual object, the second virtual object can be controlled to move synchronously based on this relative position parameter, so that the second virtual object and the first virtual object are equal to or close to the relative position represented by the relative position parameter, thereby achieving the effect of the second virtual object automatically following the first virtual object.

[0116] It is important to emphasize that in step 203, the terminal acts as the executing entity, performing the process of determining the second position based on the relative position parameters and the first position. In other words, the terminal calculates the second position itself, without the server needing to calculate and return it to the terminal. Since this is not affected by network latency during communication between the terminal and the server, it significantly improves the efficiency of the terminal obtaining the second position.

[0117] 204. The terminal controls the first virtual object to move to the first position and controls the second virtual object to move to the second position.

[0118] Once the terminal determines the first virtual object's desired location, it can control the first virtual object to move to that location. Similarly, once the terminal determines the second virtual object's desired location, it can control the second virtual object to move to that location.

[0119] In this embodiment, since the second position to which the second virtual object needs to move is calculated by the terminal itself, it will not be affected by the network delay caused by communication with the server. Therefore, there will be no significant delay between the time point when the terminal obtains the second position and the time point when it obtains the first position. Thus, it can be considered that the time point when the terminal controls the movement of the first virtual object is the same as or very close to the time point when it controls the movement of the second virtual object, thereby achieving the effect of the second virtual object moving synchronously with the first virtual object.

[0120] The method provided in this application embodiment involves a first virtual object that moves according to terminal control, and a second virtual object that automatically follows the second virtual object. When a movement operation is performed on the first virtual object, the terminal determines the first position to which the first virtual object needs to move based on the movement operation. Before controlling the first virtual object to move, the terminal also determines the second position to which the second virtual object needs to move based on the first position and the relative position between the two virtual objects. Since the second position is determined by the terminal, it is not affected by network latency. Therefore, the time point at which the second position is obtained is very close to the time point at which the first position is obtained. The terminal can simultaneously move the first virtual object to the first position and the second virtual object to the second position without causing lag. This achieves synchronous movement control of the second virtual object and the first virtual object, avoiding lag or failure to follow the second virtual object in time when it moves with the first virtual object, and improving the real-time performance of virtual object control.

[0121] The above Figure 2 The embodiments described herein are merely brief illustrations of the virtual object control method. For a detailed explanation of how the terminal controls the second virtual object to move synchronously with the first virtual object, please refer to the following... Figure 3 Examples of implementations. Figure 3This is a flowchart of another virtual object control method provided in this application embodiment. This application embodiment is executed by a terminal. See also... Figure 3 The method includes:

[0122] 301. The terminal displays a first virtual object and a second virtual object. The first virtual object is a virtual object controlled by the terminal, and the second virtual object is a virtual object that moves with the first virtual object.

[0123] In one possible implementation, the terminal displays a virtual scene interface for showcasing a virtual scene, which includes a first virtual object and a second virtual object. Therefore, the virtual scene interface displays both the first virtual object and the second virtual object.

[0124] Optionally, the first virtual object is a virtual object created in a virtual scene by the account logged in on the local terminal. The first virtual object belongs to the account, and the user of the account can control the first virtual object by performing operations on the terminal.

[0125] Optionally, the second virtual object is a virtual object summoned by the first virtual object. The virtual object summoned by the first virtual object is used to follow the first virtual object. For example, in an RPG game, the first virtual object is the game character played by the user, and the second virtual object is an NPC character summoned by the first virtual object. The NPC character is used to play the role of the first virtual object's follower, mutual follower, or pet.

[0126] Optionally, the virtual scene interface is used to display the virtual scene within the field of view of the first virtual object. The first virtual scene may also include rivers, grass, land, buildings, etc. The virtual scene interface may include a mini-map, other action buttons, a virtual joystick area, and other control buttons. The virtual joystick area is used to control the first virtual object to walk, run, and adjust its field of view within the first virtual scene. The multiple action buttons are used to control the first virtual object to perform corresponding actions within the first virtual scene. The mini-map displays the position of the first virtual object within the first virtual scene, allowing the user to control the first virtual object through the virtual scene interface.

[0127] Optionally, the virtual scene interface may also display other virtual objects besides the first and second virtual objects. These other virtual objects may be game characters or NPC characters controlled by other users.

[0128] 302. Based on the movement operation of the first virtual object, the terminal determines the first position to which the first virtual object needs to be moved.

[0129] In one possible implementation, the terminal determines the direction and speed of movement indicated by the movement operation on the first virtual object, and determines the first position to which the first virtual object needs to be moved based on the current position of the first virtual object, the direction and speed of movement indicated by the movement operation.

[0130] In one possible implementation, the terminal displays a virtual joystick area for controlling a first virtual object to walk, run, and fly in a first virtual scene. The user can drag the virtual joystick in the virtual joystick area, and the terminal, in response to the dragging operation, determines the movement speed and direction indicated by the dragging operation based on the dragging direction and amplitude.

[0131] In one possible implementation, the terminal displays walking, running, and flying controls. The user instructs the terminal to control a first virtual object to walk, run, or fly by triggering the walking, running, or flying controls. The first virtual object has its own movement speed for each of the walking, running, and flying states. The user instructs the terminal to adjust the movement direction of the first virtual object by performing a swipe operation on the terminal screen. Therefore, the terminal can determine the movement speed of the first virtual object based on the user's triggering operations on the walking, running, or flying controls, and determine the movement direction of the first virtual object based on the user's swipe operations on the screen.

[0132] 303. The terminal obtains relative position parameters, which include relative distance and relative direction. The relative position parameters represent the relative position between the second virtual object and the first virtual object during the process of the second virtual object moving with the first virtual object.

[0133] The terminal stores relative position parameters corresponding to the second virtual object, which represent the relative position between the second virtual object and the first virtual object. These relative position parameters include relative distance and relative direction. The relative distance indicates the distance between the second and first virtual objects, and the relative direction indicates the direction in which the second virtual object is located relative to the first virtual object, such as in front of or behind it.

[0134] In one possible implementation, the number of second virtual objects that move with the first virtual object can be one or more. When there are multiple second virtual objects, all of them move with the first virtual object, each with its own relative position parameter, and these parameters are different for each second virtual object. Optionally, each second virtual object has the same relative distance, meaning the distance between the multiple second virtual objects moving with the first virtual object is the same. Optionally, each second virtual object has a different relative direction, meaning the multiple second virtual objects moving with the first virtual object are located in different directions from the first virtual object.

[0135] Figure 4 This is a schematic diagram of a relative position provided in an embodiment of this application. The terminal displays a first virtual object 401, a second virtual object 402, and a second virtual object 403 on a virtual scene interface. The second virtual object 402 and the second virtual object 403 move following the first virtual object 401. Figure 4 As shown, the second virtual object 402 is located to the left rear of the first virtual object 401, and the second virtual object 403 is located to the right rear of the first virtual object 401.

[0136] Figure 5 This is a schematic diagram of another relative position provided in an embodiment of this application. The terminal displays a first virtual object 501, a second virtual object 502, and a second virtual object 503 on the virtual scene interface. The second virtual object 502 and the second virtual object 503 move following the first virtual object 501, as shown below. Figure 5 As shown, the second virtual object 502 is located directly behind the first virtual object 501, and the second virtual object 503 is located directly in front of the first virtual object 501.

[0137] It should be noted that, for ease of understanding, the following steps in this embodiment are only described as controlling one second virtual object to move synchronously with the first virtual object. In reality, the principle of each second virtual object moving synchronously with the first virtual object is the same. When there are multiple second virtual objects, the terminal can simultaneously control multiple second virtual objects to move synchronously with the first virtual object.

[0138] 304. The terminal determines the target direction based on the first position and the relative direction, and determines the position on the target direction whose distance from the first position is equal to the relative distance as the second position.

[0139] After determining the first position to which the first virtual object needs to move, the terminal determines the second position to which the second virtual object needs to move based on the first position. The relative direction between the second position to which the second virtual object needs to move and the first position to which the first virtual object needs to move should be the relative direction in the relative position parameters, and the relative distance between the second position and the first position should be the relative distance in the relative position parameters.

[0140] The terminal first uses a first position as a reference point to perform a directional offset to obtain the target direction, ensuring that the relative direction between the target direction and the first position is equal to the relative direction in the relative position parameter. After determining the target direction, a second position is determined along that target direction, ensuring that the distance between the second position and the first position is equal to the relative position. Therefore, it is guaranteed that the relative direction between the second position and the first position is equal to the relative direction in the relative position parameter, and the relative distance between the second position and the first position is equal to the relative distance in the relative position parameter.

[0141] In one possible implementation, the terminal determines a first ray with a first position as its endpoint and pointing in a reference direction, where the reference direction is the opposite direction to the movement direction of the first virtual object; keeping the endpoint of the first ray unchanged, the direction in which the first ray points is offset relative to the direction to obtain a second ray, and the direction in which the second ray points is determined as the target direction.

[0142] The relative direction can be represented by an offset direction and an offset angle. The offset direction can be clockwise or counterclockwise, and the offset angle can be a value between 0 degrees and 360 degrees. After determining the first ray, the terminal offsets the direction pointed to by the first ray according to the offset direction and offset angle, thereby obtaining the second ray. The direction pointed to by the second ray is the target direction. The endpoint of the second ray is the same as the endpoint of the first ray, and the angle between the second ray and the first ray is equal to the offset angle.

[0143] Figure 6 This is a schematic diagram of another relative position provided in an embodiment of this application, such as... Figure 6 As shown, the first virtual object is a game character, and there are four second virtual objects that move with this game character: NPC 1, NPC 2, NPC 3, and NPC 4. Taking NPC 1 as an example... Figure 6The position that the game character needs to move to is denoted as the first position, and the position that NPC1 needs to move to is denoted as the second position. The offset direction corresponding to NPC1 is clockwise, the offset angle is α, and the relative distance is R. The terminal determines a first ray with the first position as the endpoint and pointing in the opposite direction to the movement direction of the first virtual object. The first ray is offset clockwise by α to obtain a second ray. The second position is located in the direction pointed by the second ray and the distance between it and the first position is equal to R.

[0144] In this embodiment, given the first position of the first virtual object, the direction of the second virtual object can be deduced based on the relative direction between the two virtual objects. Furthermore, the position of the second virtual object can be deduced based on the relative distance between the two virtual objects. This helps to improve the positional accuracy of the second virtual object and enhances the accuracy of controlling the virtual object to follow the movement.

[0145] 305. The terminal controls the first virtual object to move to the first position and controls the second virtual object to move to the second position.

[0146] Once the terminal determines the first virtual object's desired location, it can control the first virtual object to move to that location. Similarly, once the terminal determines the second virtual object's desired location, it can control the second virtual object to move to that location.

[0147] In one possible implementation, if the distance between the first location and the location of the second virtual object is greater than a first preset distance, the terminal controls the first virtual object to move to the first location and controls the second virtual object to move to the second location.

[0148] In another embodiment, if the distance between the first location and the location of the second virtual object is not greater than a first preset distance, the terminal controls the first virtual object to move to the first location, while keeping the location of the second virtual object unchanged.

[0149] In other words, after determining the second position, the terminal first checks whether the distance between the current position of the second virtual object and the first position to which the first virtual object needs to move is greater than a first preset distance. If it is greater than the first preset distance, the terminal executes the steps of controlling the first virtual object to move to the first position and controlling the second virtual object to move to the second position. If it is not greater than the first preset distance, the terminal only executes the step of moving the first virtual object to the first position and does not execute the step of controlling the second virtual object to move, keeping the position of the second virtual object unchanged.

[0150] In this embodiment of the application, if the distance between the first position to which the first virtual object needs to move and the position where the second virtual object is located is greater than a preset distance, it indicates that the movement range of the first virtual object is relatively large. Therefore, in this case, controlling the second virtual object to move synchronously with the first virtual object is beneficial to avoid the situation where the second virtual object lags behind, and ensures that the second virtual object can follow the first virtual object in a timely manner.

[0151] Furthermore, if the distance between the first position to which the first virtual object needs to move and the position of the second virtual object is not greater than the preset distance, it means that the movement range of the first virtual object is relatively small. Therefore, in this case, the second virtual object can be kept still to prevent the first virtual object from moving even with a small movement of the first virtual object, which would result in a poor following effect. This can also reduce the processing load to a certain extent and save processing resources.

[0152] In one possible implementation, the terminal controls the first virtual object to move to a first position, and if the second virtual object meets the following condition, the second virtual object is displayed at a second position.

[0153] The terminal first controls the first virtual object to move to the first position, and then determines whether the second virtual object currently meets the follow-behind condition. If the follow-behind condition is met, the process of the second virtual object gradually moving from the current position to the second position is directly omitted, and the second virtual object is directly displayed in the second position, presenting the effect of the second virtual object flashing or teleporting from the current position to the second position.

[0154] Here, "following behind" refers to the second virtual object being in a state where it lags behind the first virtual object. This "following behind" condition is a preset condition; when the second virtual object meets this condition, it can be considered that it is currently lagging behind the first virtual object, meaning it has not caught up with it in time. In this situation, if the second virtual object is still gradually moved to the second position, it may fall further and further behind the first virtual object. Therefore, the second virtual object is directly displayed in the second position to save movement time, allowing it to catch up with the first virtual object in a timely manner.

[0155] In this embodiment, if the second virtual object falls behind during the process of following the second virtual object, the second virtual object is directly displayed in the second position, omitting the process of moving the second virtual object to the second position. This avoids the situation where the second virtual object falls behind for a long time, affecting the following effect, and improves the accuracy of controlling the virtual object to follow the movement, which helps to reduce the error rate.

[0156] Optionally, if the second virtual object is detected to meet the follow-lag condition, the second virtual object is displayed in the second position, including any of the following:

[0157] (1) If the distance between the second virtual object and the first virtual object is greater than the second preset distance for a duration of a preset duration, then the second virtual object will be displayed in the second position.

[0158] That is, the following condition is that the distance between the second virtual object and the first virtual object is greater than the second preset distance for a certain period of time.

[0159] If the distance between the second virtual object and the first virtual object is greater than the second preset distance for an extended period, it indicates that the second virtual object has failed to keep up with the first virtual object in a timely manner. For example, obstacles may have appeared on the movement path of the second virtual object, affecting its movement speed and causing it to lag behind the first virtual object.

[0160] (2) If the distance between the second virtual object and the first virtual object is greater than the second preset distance and the second virtual object does not move within the preset time period, then the second virtual object will be displayed in the second position.

[0161] That is, the following condition is that the distance between the second virtual object and the first virtual object is greater than the second preset distance and the second virtual object does not move within the preset time.

[0162] If the distance between the second virtual object and the first virtual object is greater than the second preset distance and the second virtual object does not move for a long time, it indicates that the second virtual object is stuck. For example, the first virtual object has moved to the roof, but the second virtual object is still on the ground, causing the second virtual object to lag behind the first virtual object.

[0163] In this embodiment, two following lag conditions are set, covering the situations where the second virtual object moves too slowly and fails to keep up with the first virtual object in time, and the situations where the second virtual object gets stuck and cannot continue moving. This helps to solve the problem of the second virtual object getting stuck or trailing when following the first virtual object in a timely manner, reduces the error rate, and improves the accuracy of controlling the virtual object to follow the movement.

[0164] Optionally, the terminal controls the first virtual object to move to the first position within m frame frames. If the second virtual object meets the follow-lag condition, the second virtual object is rendered to the second position in the nth frame. The nth frame is any frame after the second virtual object is determined to meet the follow-lag condition. Here, m is a positive integer greater than 1, and n is a positive integer not greater than m.

[0165] In this embodiment of the application, the first virtual object moves to the first position within m screen frames. This can be understood as follows: in the first screen frame, the first virtual object is located at its current position. Following the movement path from the current position to the first position, the first virtual object moves a certain distance along the movement path for each screen frame refreshed, until the first screen frame, when the first virtual object moves to the first position.

[0166] For example, the current position is denoted as position A, and the first position is denoted as position B. Based on the size of m, the average interpolation of the movement path between position A and position B is performed to obtain m-2 position points. Starting from position A, every time a screen frame is refreshed, the terminal displays the first virtual object at the next position point after the current position point, thus forming the effect that the first virtual object gradually moves from position A to position B within m screen frames.

[0167] If the second virtual object has fallen behind the first virtual object, the second virtual object will no longer be controlled to move to the second position frame by frame, but will be directly displayed at the second position.

[0168] Optionally, in the direction of movement of the first virtual object, the second position is located behind the first position. If the second virtual object satisfies the following-behind condition, a reference line perpendicular to the direction of movement of the first virtual object and including the second position is determined, and the number of frame frames that the first virtual object needs to pass through to move to the reference line is determined; based on the number of frame frames, the second virtual object is rendered to the second position in the nth frame; where n is a positive integer greater than the number of frame frames and not greater than m.

[0169] When the first virtual object moves to the reference line, the first virtual object is aligned with the first position. For example, the first virtual object may be located at the first position, or it may be located to the left or right of the first position.

[0170] If the second position is behind the first position, then the second virtual object is behind the first virtual object, meaning it moves behind the first virtual object and follows its movement. However, when the condition for the second virtual object to follow behind is determined, it might not yet be aligned with the first position. If the second virtual object is immediately displayed in the second position, it might appear in front of the first virtual object, contradicting the expected following behavior. Therefore, to avoid this problem, when the condition for the second virtual object to follow behind is determined, the second virtual object is rendered in the second position only after the first virtual object has moved to be aligned with the first position. This ensures that the first virtual object is always in front of the second virtual object.

[0171] In this embodiment, the first virtual object is moved to the first position within m frame frames. If the second virtual object is currently lagging behind, after determining that the second virtual object is lagging behind, the second virtual object is directly rendered to the second position in the nth frame within the m frame frames. Therefore, even if the second virtual object is lagging behind, it can still be guaranteed that the second virtual object reaches the second position within m frame frames, avoiding the situation where the second virtual object cannot reach the second position in time due to lagging behind. This further ensures that the second virtual object can move synchronously with the first virtual object smoothly, improving the accuracy of controlling the virtual object to follow the movement.

[0172] Furthermore, when the second position is behind the first position, the frame in which the second virtual object is rendered to the second position is determined based on the number of frames the first virtual object needs to pass through to move to the reference line where the second position is located. This ensures that the second virtual object is rendered to the second position only after the first virtual object has moved to the front of the second position, thus avoiding the situation where the second virtual object flashes in front of the first virtual object and improving the accuracy of controlling the virtual object to follow the movement.

[0173] It should be noted that the above implementation method is only illustrated by taking the first virtual object moving to the first position within m screen frames as an example. In another implementation method, the first virtual object can move to the first position in the next screen frame, which is equivalent to rendering the first virtual object to the first position directly in the next screen frame.

[0174] In one possible implementation, the first virtual object is a virtual object created by the account. This first virtual object has the ability to summon virtual objects, which then follow the first virtual object's movement. The second virtual object is the virtual object summoned by the first virtual object, and the first virtual object can summon multiple second virtual objects simultaneously. The process of the first virtual object summoning second virtual objects, and the second virtual objects automatically following the first virtual object, can be found in [reference needed]. Figure 7 , Figure 7 This is a flowchart of another virtual object control method provided in the embodiments of this application. Figure 7 The first virtual object is called a game character, and the second virtual object is called an NPC character. For example... Figure 7 As shown, the method includes the following steps.

[0175] (1) In response to a follow-summon command for a game character, summon one or more NPC characters for the game character.

[0176] (2) Register the summoned NPC characters into the slots of the game character's follower formation. Each game character has a corresponding follower formation with multiple slots. Each slot is used to register one NPC character, and the number of summoned NPC characters cannot exceed the number of slots in the follower formation. Optionally, if the number of summoned NPC characters is less than the number of slots, the summoned NPC characters are registered into the slots closest to the game character, based on the principle of proximity.

[0177] (3) For each slot in the following formation, determine whether there is an NPC character registered in that slot. If not, do not process that slot. If there is, process it according to the following steps (4)-(7).

[0178] (4) During the movement of the game character, update the position of the slot with the NPC character according to the relative position parameters between the slot and the game character and the movement position of the game character.

[0179] (5) Control the NPC character to move to the updated slot position. If the distance between the current position of the NPC character and the position that the game character needs to move to is not greater than the first preset distance, there is no need to move the NPC character to prevent the NPC character from following the game character's slight movement.

[0180] (6) Check if the NPC character meets the following and lagging conditions. If the following and lagging conditions are met, the NPC character will be displayed directly in the updated slot position without needing to be moved to the slot position step by step.

[0181] (7) If the game character recalls the NPC character, or the game character goes offline, the NPC character will be removed from the slot of the following formation and the NPC will be destroyed.

[0182] The method provided in this application embodiment involves a first virtual object that moves according to terminal control, and a second virtual object that automatically follows the second virtual object. When a movement operation is performed on the first virtual object, the terminal determines the first position to which the first virtual object needs to move based on the movement operation. Before controlling the first virtual object to move, the terminal also determines the second position to which the second virtual object needs to move based on the first position and the relative position between the two virtual objects. Since the second position is determined by the terminal, it is not affected by network latency. Therefore, the time point at which the second position is obtained is very close to the time point at which the first position is obtained. The terminal can simultaneously move the first virtual object to the first position and the second virtual object to the second position without causing lag. This achieves synchronous movement control of the second virtual object and the first virtual object, avoiding lag or failure to follow the second virtual object in time when it moves with the first virtual object, and improving the real-time performance of virtual object control.

[0183] In this embodiment, the process of controlling the second virtual object to follow the movement of the first virtual object can be divided into two modes: terminal takeover and server takeover. Terminal takeover refers to the terminal calculating the required position of the second virtual object, while server takeover refers to the server calculating the required position of the second virtual object and notifying the terminal of that position.

[0184] The switching between terminal takeover and server takeover states is driven by the state of the first virtual object. If the first virtual object is in a walking state, it switches to server takeover state; if the first virtual object is in a running or flying state, it switches to terminal takeover state. The following uses terminal takeover and server takeover states as examples to illustrate the control process of the virtual object.

[0185] In some embodiments, when the first virtual object is in a running or flying state, the terminal determines the second position based on relative position parameters and the first position. The process of controlling the first and second virtual objects is described below. Figure 8 Examples of implementations. Figure 8 This is a flowchart of another virtual object control method provided in this application embodiment. This application embodiment is executed by a terminal. See also... Figure 8 The method includes:

[0186] 801. The terminal displays a first virtual object and a second virtual object. The first virtual object is a virtual object controlled by the terminal, and the second virtual object is a virtual object that moves with the first virtual object.

[0187] 802. Based on the movement operation of the first virtual object, the terminal determines the first position that the first virtual object needs to move to in the first screen frame.

[0188] The process of steps 801-802 is the same as that of steps 301-302 above, and will not be described again here.

[0189] 803. If the first virtual object is in a running or flying state, the terminal, after determining the first position that the first virtual object needs to move to in the first frame, determines the second position that the second virtual object needs to move to in the first frame based on the relative position parameters and the first position.

[0190] If the first virtual object is in a running or flying state, after determining the first position that the first virtual object needs to move to in the first frame, the terminal will calculate the second position that the second virtual object needs to move to in the first frame based on the relative position parameters and the first position.

[0191] 804. The terminal renders the first virtual object to the first position in the first screen frame and renders the second virtual object to the second position in the first screen frame.

[0192] After determining the first position to which the first virtual object needs to move and the second position to which the second virtual object needs to move, the terminal renders the first virtual object to the first position and the second virtual object to the second position respectively within the same frame, thereby achieving the effect of the second virtual object moving synchronously with the first virtual object.

[0193] It should be noted that in this embodiment, after the terminal determines the first position, it waits until the second position is determined before simultaneously rendering the first virtual object to the first position and the second virtual object to the second position. Since the terminal calculates the second position itself in this embodiment, it is not affected by communication delays with the server. Therefore, the time from when the user performs a movement operation on the first virtual object to when the terminal determines the second position is very short, and consequently, the time from when the user performs a movement operation on the first virtual object to when the first virtual object moves to the first position is also very short. In other words, waiting for the terminal to calculate the second position before moving the first virtual object does not significantly delay the movement process of the first virtual object, and the solution in this embodiment does not affect the movement process of the first virtual object.

[0194] 805. Whenever the terminal updates the position of the first virtual object, it sends the updated position of the first virtual object to the server.

[0195] The terminal needs to report the position of the first virtual object to the server in real time. Whenever the server receives the position of the first virtual object sent by the terminal, it determines the third position that the second virtual object needs to move to based on the relative position parameters and the updated position of the first virtual object, and returns the third position to the terminal.

[0196] Optionally, the server maintains position data for a first virtual object and position data for a second virtual object. The position data for the first virtual object records its position, and the position data for the second virtual object records its position. After calculating the third position that the second virtual object needs to move to, the server updates the position data for the second virtual object maintained by the server with this third position.

[0197] In one possible implementation, when the first virtual object is in a running or flying state, the server returns a first data packet carrying a third location to the terminal, and when the first virtual object exits the running or flying state, the server returns a second data packet carrying a third location to the terminal.

[0198] The first data packet and the second data packet have different formats; either the first data packet carries a target identifier while the second data packet does not, or the first data packet does not carry a target identifier while the second data packet does. The terminal can identify and distinguish between the first data packet and the second data packet.

[0199] When the terminal receives the first data packet, it is currently in a terminal takeover state. The terminal calculates the second position itself, so it can ignore the first data packet, that is, it does not use the third position in the first data packet. When the terminal receives the second data packet, it switches to a server takeover state. In this case, the terminal needs to hand over the takeover authority to the server. The terminal performs the following step 806.

[0200] 806. If the first virtual object exits the running or flying state, obtain the latest third position returned by the server and control the second virtual object to move to the latest third position returned by the server.

[0201] When the first virtual object exits the running or flying state, it needs to switch from terminal takeover to server takeover. In this case, the terminal obtains the latest third position returned by the server and controls the second virtual object to move to the latest third position. This ensures that the position of the second virtual object displayed on the terminal is consistent with the position of the second virtual object recorded in the server, preventing dragging and thus improving the smoothness of the state switch.

[0202] In one possible implementation, when the first virtual object exits the running or flying state, the server returns a second data packet carrying a third location to the terminal. Therefore, the third location in this second data packet is the latest third location returned by the server after the first virtual object exits the running or flying state.

[0203] In one possible implementation, the terminal controls the second virtual object to move to the recently returned third position at a preset speed to ensure that the second virtual object can quickly reach the third position. Optionally, this preset speed is greater than the movement speed of the first virtual object when it is running or flying.

[0204] The method provided in this application embodiment allows for the following when the first virtual object is in a running or flying state, with a relatively high movement speed. In this case, the terminal determines the position that the second virtual object needs to move to in order to follow the first virtual object. Since there is no network latency caused by communication with the server, it is possible to control the second virtual object to move synchronously with the first virtual object. This avoids the situation where the second virtual object cannot keep up in time due to the high movement speed of the first virtual object. Even if the first virtual object moves very fast, it can still ensure that the second virtual object moves synchronously with the first virtual object, thus improving the accuracy and timeliness of controlling the virtual object to follow the movement when the movement speed is relatively high.

[0205] Furthermore, after determining the first position that the first virtual object needs to move to and the second position that the second virtual object needs to move to, the first virtual object is rendered to the first position and the second virtual object is rendered to the second position in the same frame. This allows the positions of the first and second virtual objects to be updated simultaneously in the same frame, enabling the second virtual object to move synchronously with the first virtual object and greatly improving the real-time performance of controlling the virtual object to follow the movement.

[0206] In some embodiments, when the first virtual object is in a walking state, the terminal controls the first virtual object to move to a first position and send the first position to the server. The server determines a second position based on relative position parameters and the first position and returns the second position to the terminal. When the terminal receives the second position sent by the server, it controls the second virtual object to move to the second position. The process of controlling the first and second virtual objects is described below. Figure 9 Examples of implementations. Figure 9 This is a flowchart of another virtual object control method provided in this application embodiment. This application embodiment is executed by a terminal and a server. See also... Figure 9 The method includes:

[0207] 901. The terminal displays a first virtual object and a second virtual object. The first virtual object is a virtual object controlled by the terminal, and the second virtual object is a virtual object that moves with the first virtual object.

[0208] 902. Based on the movement operation of the first virtual object, the terminal determines the first position that the first virtual object needs to move to in the second screen frame.

[0209] The process of steps 901-902 is the same as that of steps 301-302 above, and will not be described again here.

[0210] 903. If the first virtual object is in a walking state, the terminal will render the first virtual object to the first position in the second screen frame after determining the first position that the first virtual object needs to move to in the second screen frame, and send the first position to the server.

[0211] If the first virtual object is in a walking state, after the terminal determines the first position that the first virtual object needs to move to in the first screen frame, it first renders the first virtual object to the first position in the second screen frame and sends the first position to the server, which then calculates the second position that the second virtual object needs to move to.

[0212] Optionally, when rendering the first frame, the terminal can determine the position to which the second virtual object needs to be rendered in the first frame, based on the position to which the second virtual object needs to move in the previous frame sent by the server.

[0213] It should be noted that, since the second position is calculated by the server in this embodiment, it is affected by communication latency with the server. Therefore, the time between the user performing a movement operation on the first virtual object and the terminal receiving the second position is quite long. If the second position is waited for before synchronously updating the positions of the first and second virtual objects, the time between the user performing a movement operation on the first virtual object and the first virtual object moving to the first position will be even longer, resulting in a significant delay in the movement process of the first virtual object. Therefore, in this case, there is no need to wait for the second position to be obtained; the terminal first renders the first virtual object to the first position.

[0214] 904. Based on the relative position parameter and the first position, the server determines the second position and returns the second position to the terminal. The relative position parameter represents the relative position between the second virtual object and the first virtual object during the process of the second virtual object moving with the first virtual object.

[0215] In step 904, the method by which the server determines the second location is the same as the method by which the terminal determines the second location, and will not be described again here.

[0216] 905. After receiving the second location sent by the server, the terminal renders the second virtual object to the second location in the third screen frame. The third screen frame is the screen frame following the second screen frame.

[0217] Once the terminal receives the second position, the first virtual object has already been rendered to the first position in the second screen frame. At this point, the terminal can only render the second virtual object to the second position in the third screen frame after the second screen frame.

[0218] If the user does not perform any movement operation on the first virtual object after it has been rendered to the first position, the terminal will still render the first virtual object to the first position in the third frame. If the user continues to perform movement operation on the first virtual object after it has been rendered to the first position, the terminal will determine the position that the first virtual object needs to move to in the third frame according to the current movement operation, and render the first virtual object to that position in the third frame.

[0219] In this embodiment, when the first virtual object is in a walking state, its movement speed is relatively slow. In this case, the server determines the position that the second virtual object needs to move to to follow the first virtual object. The terminal controls the second virtual object according to the position returned by the server. This saves the terminal's processing resources, avoids terminal calculation errors, and prevents the terminal from performing unconventional control on the second virtual object, thus improving the accuracy and compliance of controlling the virtual object to follow the movement.

[0220] Figure 10 This is a flowchart of another virtual object control method provided in the embodiments of this application, such as... Figure 10 As shown, the method is as follows.

[0221] When the game character is walking, the server calculates the second position that the NPC character needs to move to, and synchronizes the second position of the NPC character with the terminal. The terminal controls the NPC character to move synchronously with the game character based on the second position returned by the server.

[0222] When the game character is running or flying, the server calculates the third position the NPC character needs to move to and sends a first data packet carrying this third position to the terminal. The terminal ignores the first data packet sent by the server, calculates the second position the NPC character needs to move to independently, and controls the NPC character to move synchronously with the game character based on the independently calculated second position.

[0223] When a game character exits running or flying mode, the server calculates the third location the NPC character needs to move to. When the game character stops running or flying, the server sends a second data packet carrying the third location to the terminal. The terminal then controls the NPC character to quickly move to the third location carried in the second data packet.

[0224] In related technologies, the server always calculates the NPC's position and notifies it to the terminal. After receiving the NPC's position, the terminal controls the NPC to move accordingly. Due to the communication delay between the terminal and the server, the NPC's movement following the game character has a certain lag. Furthermore, when the game character is moving rapidly, such as running or flying, the lag is more pronounced. This lag accumulates over time, causing the NPC to fall significantly behind the game character, severely impacting the player experience.

[0225] In the technical solution of this application embodiment, when the game character is moving slowly (such as walking), the server still calculates the NPC character's position and notifies the terminal. Because the movement speed is slow, this usually ensures that the NPC character can keep up with the game character's pace and doesn't fall behind by a significant distance. When the game character is moving quickly (such as running or flying), the terminal calculates the NPC character's position itself, avoiding network latency caused by communication with the server. This ensures that the NPC character can still keep up with the game character even during rapid movement, improving the player experience.

[0226] It should be noted that the above embodiments are only illustrated using terminal takeover and server takeover states as examples. In another embodiment, the terminal can take over the entire process, that is, regardless of the state of the first virtual object (game character), the terminal calculates the position of the second virtual object (NPC character).

[0227] When the terminal calculates the required location for the second virtual object to move to, in order to ensure the accuracy of the control process, the server needs to verify the location calculated by the terminal. Therefore, the process of controlling the movement of the virtual object can be divided into the following steps: Figure 11 and Figure 12 There are two scenarios in the implementation examples.

[0228] Figure 11 This is a flowchart of another virtual object control method provided in this application embodiment. This application embodiment is executed by a terminal and a server. See also... Figure 11 The method includes:

[0229] 1101. The terminal displays a first virtual object and a second virtual object. The first virtual object is a virtual object controlled by the terminal, and the second virtual object is a virtual object that moves with the first virtual object.

[0230] 1102. Based on the movement operation of the first virtual object, the terminal determines the first position that the first virtual object needs to move to in the first screen frame.

[0231] 1103. The terminal determines the second position to which the second virtual object needs to move based on the relative position parameter and the first position. The relative position parameter represents the relative position between the second virtual object and the first virtual object during the process of the second virtual object moving with the first virtual object.

[0232] 1104. The terminal controls the first virtual object to move to the first position, and the terminal sends the second position to the server.

[0233] After calculating the second location, the terminal does not immediately control the second virtual object to move to the second location, but instead sends the second location to the server for verification.

[0234] 1105. The server verifies the second location and returns the verification result to the terminal.

[0235] After receiving the second location, the server verifies it based on factors such as the current location of the first virtual object, the current location of the second virtual object, the movement speed of the first virtual object, and the movement speed of the second object. For example, if the speed at which the second virtual object moves to the second location is unreasonable, or if the second location is not a location that the second virtual object can move to, the second location verification will fail.

[0236] After determining the verification result, the server returns the verification result to the terminal, indicating whether the second location verification passed. Optionally, after the verification result passes, the server can also broadcast the second location to the terminals of other virtual objects, so that the terminals of other virtual objects can display the second virtual object in the second location. Here, other virtual objects refer to virtual objects controlled by other accounts located in the same virtual scene as the first and second virtual objects.

[0237] 1106. The terminal receives the verification result. If the verification result indicates that the second position verification is successful, the terminal controls the second virtual object to move to the second position.

[0238] If the verification result indicates that the second position verification passed, the second virtual object is controlled to move to the second position. If the verification result fails, the verification result may also carry the third position that the second virtual object needs to move to, and the terminal controls the second virtual object to move to the third position indicated by the verification result.

[0239] In this embodiment, when the terminal calculates the location to which the second virtual object needs to move, the server verifies the location calculated by the terminal. Only after the verification is passed is it allowed to control the second virtual object to move to that location, thus ensuring the accuracy and compliance of the location and improving the accuracy of controlling the virtual object.

[0240] Figure 12This is a flowchart of another virtual object control method provided in this application embodiment. This application embodiment is executed by a terminal and a server. See also... Figure 12 The method includes:

[0241] 1201. The terminal displays a first virtual object and a second virtual object. The first virtual object is a virtual object controlled by the terminal, and the second virtual object is a virtual object that moves with the first virtual object.

[0242] 1202. Based on the movement operation of the first virtual object, the terminal determines the first position that the first virtual object needs to move to in the first screen frame.

[0243] 1203. The terminal determines the second position to which the second virtual object needs to move based on the relative position parameter and the first position. The relative position parameter represents the relative position between the second virtual object and the first virtual object during the process of the second virtual object moving with the first virtual object.

[0244] 1204. The terminal sends the second location to the server.

[0245] 1205. The terminal controls the first virtual object to move to the first position and controls the second virtual object to move to the second position.

[0246] In this embodiment of the application, after sending the second location to the server, before receiving the verification result returned by the server, the terminal first controls the second virtual object to move to the second location.

[0247] 1206. The server verifies the second location and returns the verification result to the terminal.

[0248] 1207. The terminal receives the verification result. If the verification result indicates that the second position verification failed, the position of the second virtual object is corrected to the position indicated by the verification result.

[0249] In this embodiment, when the terminal calculates the required location for the second virtual object, the server verifies the location calculated by the terminal. While waiting for the verification result, the terminal first controls the second virtual object to move to that location. If the verification fails, the location of the second virtual object is then corrected. On the one hand, this facilitates timely control of the second virtual object's movement, ensuring that the second virtual object can move synchronously with the first virtual object. On the other hand, it facilitates timely correction when the location is incorrect, ensuring the accuracy and compliance of the location, thereby improving the accuracy of controlling the virtual object.

[0250] The virtual object control method provided in this application can be applied to any scenario where virtual objects are controlled to automatically follow each other. For example, when applied to a scenario of controlling a game character in a game client, the virtual object control process is as follows. Figure 13 . Figure 13 This is a flowchart of another virtual object control method provided in an embodiment of this application, which includes the following steps.

[0251] 1301. The terminal displays a virtual scene on the game client. The virtual scene includes game characters and NPC characters. The game characters are virtual characters controlled by the user, and the NPC characters are virtual characters not controlled by the user. The NPC characters are virtual characters that move with the game characters.

[0252] The terminal has a user account logged in to the game client, and the game character is a virtual character created by the user account in the virtual scene.

[0253] Optionally, the virtual character has the skill to summon NPC characters. When the user performs the skill to summon an NPC, the terminal determines the display position of the NPC character based on the current position of the game character and relative position parameters, and the NPC character is displayed at that position. The relative position parameters represent the relative position between the NPC character and the game character as the NPC character moves alongside the game character.

[0254] 1302. Based on the movement operation of the game character, the terminal determines the first position that the game character needs to move to in the virtual scene.

[0255] 1303. Based on the relative position parameters and the first position, the terminal determines the second position that the NPC character needs to move to in the virtual scene.

[0256] 1304. The terminal controls the game character to move to the first position in the virtual scene, and controls the NPC character to move to the second position in the virtual scene.

[0257] Figure 14 This is a schematic diagram of the structure of a virtual object control device provided in an embodiment of this application. See also... Figure 14 The device includes:

[0258] Display module 1401 is used to display a first virtual object and a second virtual object. The first virtual object is a virtual object controlled by the terminal, and the second virtual object is a virtual object that moves with the first virtual object.

[0259] The first determining module 1402 is used to determine the first position to which the first virtual object needs to be moved based on the movement operation of the first virtual object;

[0260] The second determining module 1403 is used to determine the second position to which the second virtual object needs to move based on the relative position parameter and the first position. The relative position parameter represents the relative position between the second virtual object and the first virtual object during the process of the second virtual object moving with the first virtual object.

[0261] The control module 1404 is used to control the first virtual object to move to the first position and to control the second virtual object to move to the second position.

[0262] The virtual object control device provided in this application embodiment includes a first virtual object that moves according to terminal control, and a second virtual object that automatically follows the second virtual object. When a movement operation is performed on the first virtual object, the terminal determines the first position to which the first virtual object needs to move based on the movement operation. Before controlling the first virtual object to move, the terminal also determines the second position to which the second virtual object needs to move based on the first position and the relative position between the two virtual objects. Since the second position is determined by the terminal, it is not affected by network latency. Therefore, the time point of obtaining the second position is very close to the time point of obtaining the first position. The terminal can simultaneously move the first virtual object to the first position and the second virtual object to the second position without causing lag. This achieves synchronous movement control of the second virtual object and the first virtual object, avoiding lag or failure to follow the second virtual object in time when it moves with the first virtual object, and improving the real-time performance of virtual object control.

[0263] Optionally, see Figure 15 The relative position parameters include relative distance and relative direction; the second determining module 1403 is used for:

[0264] Determine the target direction based on the initial position and relative orientation;

[0265] The position in the target direction whose distance from the first position is equal to the relative distance is determined as the second position.

[0266] Optionally, see Figure 15 The second determining module 1403 is used for:

[0267] Determine a first ray with the first position as its endpoint and pointing towards a reference direction, where the reference direction is the opposite direction to the movement direction of the first virtual object;

[0268] Keeping the endpoint of the first ray unchanged, shift the direction in which the first ray points relative to the direction to obtain the second ray, and determine the direction in which the second ray points as the target direction.

[0269] Optionally, see Figure 15 Control module 1404 is used for:

[0270] If the distance between the first position and the position of the second virtual object is greater than the first preset distance, then control the first virtual object to move to the first position and control the second virtual object to move to the second position.

[0271] Optionally, see Figure 15 The control module 1404 is also used for:

[0272] If the distance between the first position and the position of the second virtual object is not greater than the first preset distance, then control the first virtual object to move to the first position, while keeping the position of the second virtual object unchanged.

[0273] Optionally, see Figure 15 Control module 1404 is used for:

[0274] Control the first virtual object to move to the first position;

[0275] If the second virtual object meets the following condition, then the second virtual object will be displayed in the second position.

[0276] Optionally, see Figure 15 Control module 1404 is used to perform any of the following:

[0277] If the distance between the second virtual object and the first virtual object is greater than the second preset distance for a duration that reaches the preset duration, then the second virtual object will be displayed in the second position.

[0278] If the distance between the second virtual object and the first virtual object is greater than the second preset distance and the second virtual object does not move within the preset time period, then the second virtual object will be displayed in the second position.

[0279] Optionally, see Figure 15 Control module 1404 is used for:

[0280] Control the first virtual object to move to the first position within m screen frames;

[0281] If the second virtual object meets the follow-behind condition, then the second virtual object will be displayed in the second position, including:

[0282] If the second virtual object satisfies the follow-lag condition, then the second virtual object is rendered to the second position in the nth frame. The nth frame is any frame after the second virtual object is determined to satisfy the follow-lag condition; where m is a positive integer greater than 1 and n is a positive integer not greater than m.

[0283] Optionally, see Figure 15 In the direction of movement of the first virtual object, the second position is located behind the first position; control module 1404 is used for:

[0284] If the second virtual object meets the following and lagging condition, then a reference line that is perpendicular to the movement direction of the first virtual object and includes the second position is determined, and the number of frame frames that the first virtual object needs to pass through to move to the reference line is determined.

[0285] Based on the frame number, the second virtual object is rendered to the second position in the nth frame; where n is a positive integer greater than the frame number and not greater than m.

[0286] Optionally, see Figure 15 The second determining module 1403 is used for:

[0287] If the first virtual object is in a running or flying state, the second position is determined based on the relative position parameters and the first position.

[0288] Optionally, see Figure 15 The second determining module 1403 is used for:

[0289] If the first virtual object is in a running or flying state, after determining the first position that the first virtual object needs to move to in the first frame, the second position that the second virtual object needs to move to in the first frame is determined based on the relative position parameters and the first position.

[0290] Control module 1404 is used for:

[0291] The first virtual object is rendered to the first position in the first screen frame, and the second virtual object is rendered to the second position in the first screen frame.

[0292] Optionally, see Figure 15 The device also includes:

[0293] The sending module 1405 is used to send the updated position of the first virtual object to the server whenever the position of the first virtual object is updated. The server is used to determine the third position that the second virtual object needs to move to based on the relative position parameters and the updated position of the first virtual object, and return the third position to the terminal.

[0294] The control module 1404 is also used to obtain the latest third position returned by the server if the first virtual object exits the running state or the flying state, and control the second virtual object to move to the latest returned third position.

[0295] Optionally, see Figure 15 The device also includes:

[0296] The control module 1404 is also used to control the first virtual object to move to the first position if the first virtual object is in a walking state;

[0297] The sending module 1405 is used to send a first position to the server, and the server is used to determine a second position based on the relative position parameters and the first position, and return the second position to the terminal.

[0298] Receiver module 1406 is used to receive the second location sent by the server;

[0299] The control module 1404 is also used to control the second virtual object to move to the second position.

[0300] Optionally, see Figure 15 The control module 1404 is used to render the first virtual object to the first position in the second screen frame after determining the first position that the first virtual object needs to move to in the second screen frame if the first virtual object is in a walking state.

[0301] The sending module 1405 is used to send the first location to the server;

[0302] The control module 1404 is used to render the second virtual object to the second position in the third screen frame after receiving the second position sent by the server. The third screen frame is the screen frame after the second screen frame.

[0303] Optionally, see Figure 15 The device also includes:

[0304] The sending module 1405 is used to send the second location to the server, and the server uses the second location to verify it and return the verification result to the terminal.

[0305] Control module 1404 is used to control the first virtual object to move to the first position;

[0306] Receiver module 1406 is used to receive verification results;

[0307] The control module 1404 is used to control the second virtual object to move to the second position if the verification result indicates that the second position verification is successful.

[0308] Optionally, see Figure 15 The device also includes:

[0309] The sending module 1405 is used to send the second location to the server, and the server uses the second location to verify it and return the verification result to the terminal.

[0310] Receiver module 1406 is used to receive verification results;

[0311] The control module 1404 is also used to correct the position of the second virtual object to the position indicated by the verification result if the verification result indicates that the second position verification has failed.

[0312] It should be noted that the virtual object control device provided in the above embodiments is only an example of the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the computer device can be divided into different functional modules to complete all or part of the functions described above. In addition, the virtual object control device and the virtual object control method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.

[0313] This application also provides a computer device, which includes a processor and a memory. The memory stores at least one computer program, which is loaded and executed by the processor to implement the operations performed in the virtual object control method of the above embodiments.

[0314] Optionally, the computer device is provided as a terminal. Figure 16 A schematic diagram of the structure of a terminal 1600 provided in an exemplary embodiment of this application is shown.

[0315] Terminal 1600 includes a processor 1601 and a memory 1602.

[0316] Processor 1601 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. Processor 1601 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), and PLA (Programmable Logic Array). Processor 1601 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 1601 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, processor 1601 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.

[0317] Memory 1602 may include one or more computer-readable storage media, which may be non-transitory. Memory 1602 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in memory 1602 are used to store at least one computer program, which is used by processor 1601 to implement the virtual object control method provided in the method embodiments of this application.

[0318] In some embodiments, the terminal 1600 may also optionally include: a peripheral device interface 1603 and at least one peripheral device. The processor 1601, memory 1602, and peripheral device interface 1603 can be connected via a bus or signal line. Each peripheral device can be connected to the peripheral device interface 1603 via a bus, signal line, or circuit board. Optionally, the peripheral device includes at least one of: a radio frequency circuit 1604, a display screen 1605, a camera assembly 1606, an audio circuit 1607, and a power supply 1608.

[0319] Peripheral interface 1603 can be used to connect at least one I / O (Input / Output) related peripheral device to processor 1601 and memory 1602. In some embodiments, processor 1601, memory 1602 and peripheral interface 1603 are integrated on the same chip or circuit board; in some other embodiments, any one or two of processor 1601, memory 1602 and peripheral interface 1603 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.

[0320] The radio frequency (RF) circuit 1604 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 1604 communicates with communication networks and other communication devices via electromagnetic signals. The RF circuit 1604 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, the RF circuit 1604 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, etc. The RF circuit 1604 can communicate with other devices through at least one wireless communication protocol. This wireless communication protocol includes, but is not limited to: metropolitan area networks (MANs), various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks (WLANs), and / or WiFi (Wireless Fidelity) networks. In some embodiments, the RF circuit 1604 may also include circuitry related to NFC (Near Field Communication), which is not limited in this application.

[0321] Display screen 1605 is used to display a UI (User Interface). This UI may include graphics, text, icons, videos, and any combination thereof. When display screen 1605 is a touch display screen, it also has the ability to collect touch signals on or above its surface. These touch signals can be input as control signals to processor 1601 for processing. In this case, display screen 1605 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, there may be one display screen 1605, disposed on the front panel of terminal 1600; in other embodiments, there may be at least two display screens, disposed on different surfaces of terminal 1600 or in a folded design; in still other embodiments, display screen 1605 may be a flexible display screen, disposed on a curved or folded surface of terminal 1600. Furthermore, display screen 1605 may be configured as a non-rectangular, irregular shape, i.e., a non-rectangular screen. The display screen 1605 can be made of materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).

[0322] The camera assembly 1606 is used to acquire images or videos. Optionally, the camera assembly 1606 includes a front-facing camera and a rear-facing camera. The front-facing camera is disposed on the front panel of the terminal 1600, and the rear-facing camera is disposed on the back of the terminal 1600. In some embodiments, there are at least two rear-facing cameras, which are any one of a main camera, a depth-sensing camera, a wide-angle camera, and a telephoto camera, to achieve background blurring by fusion of the main camera and the depth-sensing camera, panoramic shooting by fusion of the main camera and the wide-angle camera, VR (Virtual Reality) shooting, or other fusion shooting functions. In some embodiments, the camera assembly 1606 may also include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cool light flash, which can be used for light compensation at different color temperatures.

[0323] The audio circuit 1607 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, converting them into electrical signals that are input to the processor 1601 for processing, or to the radio frequency circuit 1604 for voice communication. For stereo sound acquisition or noise reduction purposes, multiple microphones may be used, each positioned at a different location on the terminal 1600. The microphone may also be an array microphone or an omnidirectional microphone. The speaker is used to convert electrical signals from the processor 1601 or the radio frequency circuit 1604 into sound waves. The speaker may be a conventional diaphragm speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can convert electrical signals not only into audible sound waves but also into inaudible sound waves for purposes such as distance measurement. In some embodiments, the audio circuit 1607 may also include a headphone jack.

[0324] Power supply 1608 is used to power the various components in terminal 1600. Power supply 1608 can be AC ​​power, DC power, a disposable battery, or a rechargeable battery. When power supply 1608 includes a rechargeable battery, the rechargeable battery can support wired or wireless charging. The rechargeable battery can also be used to support fast charging technology.

[0325] In some embodiments, the terminal 1600 further includes one or more sensors 1609. The one or more sensors 1609 include, but are not limited to: an accelerometer 1610, a gyroscope 1611, a pressure sensor 1612, an optical sensor 1613, and a proximity sensor 1614.

[0326] Accelerometer 1610 can detect the magnitude of acceleration along the three axes of a coordinate system established by terminal 1600. For example, accelerometer 1610 can be used to detect the components of gravitational acceleration along the three axes. Processor 1601 can control display screen 1605 to display the user interface in either a landscape or portrait view based on the gravitational acceleration signal acquired by accelerometer 1610. Accelerometer 1610 can also be used for games or for acquiring user motion data.

[0327] The gyroscope sensor 1611 can detect the orientation and rotation angle of the terminal 1600. The gyroscope sensor 1611 can work in conjunction with the accelerometer sensor 1610 to collect the user's 3D movements on the terminal 1600. Based on the data collected by the gyroscope sensor 1611, the processor 1601 can perform the following functions: motion sensing (e.g., changing the UI based on the user's tilt), image stabilization during shooting, game control, and inertial navigation.

[0328] The pressure sensor 1612 can be disposed on the side bezel of the terminal 1600 and / or on the lower layer of the display screen 1605. When the pressure sensor 1612 is disposed on the side bezel of the terminal 1600, it can detect the user's grip signal on the terminal 1600, and the processor 1601 can perform left / right hand recognition or quick operation based on the grip signal collected by the pressure sensor 1612. When the pressure sensor 1612 is disposed on the lower layer of the display screen 1605, the processor 1601 can control the operable controls on the UI interface based on the user's pressure operation on the display screen 1605. The operable controls include at least one of button controls, scroll bar controls, icon controls, and menu controls.

[0329] An optical sensor 1613 is used to collect ambient light intensity. In one embodiment, the processor 1601 can control the display brightness of the display screen 1605 based on the ambient light intensity collected by the optical sensor 1613. Optionally, when the ambient light intensity is high, the display brightness of the display screen 1605 is increased; when the ambient light intensity is low, the display brightness of the display screen 1605 is decreased. In another embodiment, the processor 1601 can also dynamically adjust the shooting parameters of the camera assembly 1606 based on the ambient light intensity collected by the optical sensor 1613.

[0330] The proximity sensor 1614, also known as the distance sensor, is installed on the front panel of the terminal 1600. The proximity sensor 1614 is used to detect the distance between the user and the front of the terminal 1600. In one embodiment, when the proximity sensor 1614 detects that the distance between the user and the front of the terminal 1600 is gradually decreasing, the processor 1601 controls the display screen 1605 to switch from a screen-on state to a screen-off state; when the proximity sensor 1614 detects that the distance between the user and the front of the terminal 1600 is gradually increasing, the processor 1601 controls the display screen 1605 to switch from a screen-off state to a screen-on state.

[0331] Those skilled in the art will understand that Figure 16 The structure shown does not constitute a limitation on terminal 1600 and may include more or fewer components than shown, or combine certain components, or use different component arrangements.

[0332] Optionally, the computer device is provided as a server. Figure 17 This is a schematic diagram of a server structure provided in an embodiment of this application. The server 1700 can vary significantly due to different configurations or performance. It may include one or more Central Processing Units (CPUs) 1701 and one or more memories 1702. The memories 1702 store at least one computer program, which is loaded and executed by the processor 1701 to implement the methods provided in the various method embodiments described above. Of course, the server may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input and output. The server may also include other components for implementing device functions, which will not be elaborated upon here.

[0333] This application also provides a computer-readable storage medium storing at least one computer program, which is loaded and executed by a processor to implement the operations performed by the virtual object control method of the above embodiments.

[0334] This application also provides a computer program product, including a computer program that is loaded and executed by a processor to perform operations as described in the virtual object control method of the above embodiments.

[0335] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.

[0336] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present application should be included within the protection scope of the present application.

Claims

1. A method for controlling virtual objects, characterized in that, The method includes: Display a first virtual object and a second virtual object, wherein the first virtual object is a virtual object controlled by the terminal, and the second virtual object is a virtual object that moves along with the first virtual object; Based on the movement operation of the first virtual object, the first position to which the first virtual object needs to be moved is determined; Based on the relative position parameter and the first position, the second position to which the second virtual object needs to move is determined, wherein the relative position parameter represents the relative position between the second virtual object and the first virtual object during the process of the second virtual object moving with the first virtual object; Control the first virtual object to move to the first position, and control the second virtual object to move to the second position.

2. The method according to claim 1, characterized in that, The relative position parameters include relative distance and relative direction; determining the second position to which the second virtual object needs to move based on the relative position parameters and the first position includes: Based on the first position and the relative direction, determine the target direction; The position in the target direction whose distance from the first position is equal to the relative distance is determined as the second position.

3. The method according to claim 2, characterized in that, Determining the target direction based on the first position and the relative direction includes: A first ray is determined with the first position as its endpoint and pointing towards a reference direction, wherein the reference direction is the opposite direction to the movement direction of the first virtual object; Keeping the endpoint of the first ray unchanged, the direction in which the first ray points is offset from the relative direction to obtain a second ray, and the direction in which the second ray points is determined as the target direction.

4. The method according to claim 1, characterized in that, The steps of controlling the first virtual object to move to the first position and controlling the second virtual object to move to the second position include: If the distance between the first position and the position of the second virtual object is greater than a first preset distance, then control the first virtual object to move to the first position and control the second virtual object to move to the second position.

5. The method according to claim 4, characterized in that, The method further includes: If the distance between the first position and the position of the second virtual object is not greater than the first preset distance, then control the first virtual object to move to the first position, while keeping the position of the second virtual object unchanged.

6. The method according to claim 1, characterized in that, The steps of controlling the first virtual object to move to the first position and controlling the second virtual object to move to the second position include: Control the first virtual object to move to the first position; If the second virtual object meets the following / lagging condition, then the second virtual object will be displayed at the second position.

7. The method according to claim 6, characterized in that, If the second virtual object satisfies the follow-behind condition, then the second virtual object will be displayed at the second position, including any of the following: If the distance between the second virtual object and the first virtual object is greater than the second preset distance for a duration that reaches a preset duration, then the second virtual object will be displayed at the second position; If the distance between the second virtual object and the first virtual object is greater than the second preset distance and the second virtual object does not move within the preset time period, then the second virtual object will be displayed at the second position.

8. The method according to claim 6, characterized in that, The control of the first virtual object to move to the first position includes: Control the first virtual object to move to the first position within m screen frames; The step of displaying the second virtual object at the second position if the second virtual object satisfies the follow-behind condition includes: If the second virtual object satisfies the following-lagging condition, then the second virtual object is rendered to the second position in the nth frame, where the nth frame is any frame after the second virtual object is determined to satisfy the following-lagging condition; where m is a positive integer greater than 1 and n is a positive integer not greater than m.

9. The method according to claim 8, characterized in that, In the direction of movement of the first virtual object, the second position is located behind the first position; if the second virtual object satisfies the following lag condition, then rendering the second virtual object to the second position in the nth frame includes: If the second virtual object satisfies the following and lagging condition, then a reference line perpendicular to the movement direction of the first virtual object and including the second position is determined, and the number of frame frames that the first virtual object needs to pass through to move to the reference line is determined. Based on the number of frames, the second virtual object is rendered to the second position in the nth frame; where n is a positive integer greater than the number of frames and not greater than m.

10. The method according to any one of claims 1-9, characterized in that, The step of determining the second position to which the second virtual object needs to move based on the relative position parameter and the first position includes: If the first virtual object is in a running or flying state, the second position is determined based on the relative position parameter and the first position.

11. The method according to claim 10, characterized in that, If the first virtual object is in a running or flying state, determining the second position based on the relative position parameter and the first position includes: If the first virtual object is in the running state or the flying state, then after determining the first position that the first virtual object needs to move to in the first frame, the second position that the second virtual object needs to move to in the first frame is determined based on the relative position parameter and the first position. Moving the first virtual object to the first position and moving the second virtual object to the second position includes: The first virtual object is rendered to the first position in the first screen frame, and the second virtual object is rendered to the second position in the first screen frame.

12. The method according to claim 10, characterized in that, The method further includes: Whenever the position of the first virtual object is updated, the updated position of the first virtual object is sent to the server. The server is used to determine the third position that the second virtual object needs to move to based on the relative position parameter and the updated position of the first virtual object, and return the third position to the terminal. If the first virtual object exits the running state or the flying state, the latest third position returned by the server is obtained, and the second virtual object is controlled to move to the latest returned third position.

13. The method according to claim 10, characterized in that, The method further includes: If the first virtual object is in a walking state, then the first virtual object is controlled to move to the first position and the first position is sent to the server. The server is used to determine the second position based on the relative position parameter and the first position and return the second position to the terminal. Receive the second location sent by the server, and control the second virtual object to move to the second location.

14. The method according to claim 13, characterized in that, If the first virtual object is in a walking state, controlling the first virtual object to move to the first location and sending the first location to the server includes: If the first virtual object is in the walking state, after determining the first position that the first virtual object needs to move to in the second screen frame, the first virtual object is rendered to the first position in the second screen frame, and the first position is sent to the server. Receiving the second location sent by the server and moving the second virtual object to the second location includes: After receiving the second position sent by the server, the second virtual object is rendered to the second position in the third screen frame, which is the screen frame after the second screen frame.

15. The method according to any one of claims 1-9, characterized in that, The method further includes: The second location is sent to the server, which verifies the second location and returns the verification result to the terminal. The steps of controlling the first virtual object to move to the first position and controlling the second virtual object to move to the second position include: Control the first virtual object to move to the first position; If the verification result indicates that the second position verification is successful, then control the second virtual object to move to the second position.

16. The method according to any one of claims 1-9, characterized in that, The method further includes: The second location is sent to the server, which verifies the second location and returns the verification result to the terminal. After controlling the first virtual object to move to the first position and controlling the second virtual object to move to the second position, the method further includes: If the verification result indicates that the second position verification failed, the position of the second virtual object is corrected to the position indicated by the verification result.

17. A virtual object control device, characterized in that, The device includes: The display module is used to display a first virtual object and a second virtual object, wherein the first virtual object is a virtual object controlled by the terminal, and the second virtual object is a virtual object that moves with the first virtual object; The first determining module is used to determine the first position to which the first virtual object needs to be moved based on the movement operation of the first virtual object; The second determining module is used to determine the second position to which the second virtual object needs to move based on the relative position parameter and the first position, wherein the relative position parameter represents the relative position between the second virtual object and the first virtual object during the process of the second virtual object moving with the first virtual object; The control module is used to control the first virtual object to move to the first position, and to control the second virtual object to move to the second position.

18. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing at least one computer program, which is loaded and executed by the processor to perform the operations performed by the virtual object control method as described in any one of claims 1 to 16.

19. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one computer program, which is loaded and executed by a processor to perform the operations performed by the virtual object control method as described in any one of claims 1 to 16.

20. A computer program product, comprising a computer program, characterized in that, The computer program is loaded and executed by a processor to perform the operations performed by the virtual object control method as described in any one of claims 1 to 16.