Virtual object control method

By determining NPC positions using relative parameters on a terminal device, the method addresses network latency issues, enabling synchronized and real-time control of virtual objects and NPCs in electronic games.

US20260373608A1Pending Publication Date: 2026-11-26TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
US19/755743
Authority / Receiving Office
US · United States
Patent Type
Applications(United States)
Current Assignee / Owner
Priority Date
2024-10-12
Filing Date
2026-07-27
Publication Date
2026-11-26

AI Technical Summary

Technical Problem

In electronic games, network latency between servers and clients causes non-player characters (NPCs) to lag or fail to follow controlled virtual objects in real-time, leading to synchronization issues.

Method used

A method and apparatus that determine the positions of both a user-controlled virtual object and an accompanying NPC using relative position parameters on a terminal device, allowing synchronous movement without network latency delays.

Benefits of technology

Ensures real-time control of both objects by determining NPC positions locally, eliminating lag and ensuring synchronized movement with the user-controlled object.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure US20260373608A1-D00000_ABST
    Figure US20260373608A1-D00000_ABST
Patent Text Reader

Abstract

In a method for controlling a virtual object, a first virtual object that is controlled by a user and a second virtual object that moves with the first virtual object in a virtual scene are displayed. A user input associated with a move for the first virtual object is received. A first position to move the first virtual object is determined based on the user input. A relative position parameter is determined. The relative position parameter corresponds to a relative position between the first virtual object and the second virtual object while the second virtual object moves with the first virtual object. A second position to move the second virtual object to is determined based on the relative position parameter and the first position. The first virtual object is moved to the first position and the second virtual object is moved to the second position.
Need to check novelty before this filing date? Find Prior Art

Description

CROSS REFERENCE TO RELATED APPLICATIONS

[0001] The present application is a continuation of International Application No. PCT / CN2025 / 118537, filed on Sep. 2, 2025, which claims priority to Chinese Patent Application No. 202411427101.7, filed on Oct. 12, 2024. The entire disclosures of the prior applications are hereby incorporated by reference.FIELD OF THE TECHNOLOGY

[0002] Embodiments of this disclosure relate to the field of computer technologies, including a method and apparatus for controlling a virtual object, a computer device, and a non-transitory storage medium.BACKGROUND OF THE DISCLOSURE

[0003] In an electronic game, virtual objects may be controlled by user operations. The users can control such virtual objects to move. To enhance the fun, the electronic game may include non-player characters (NPCs) which can automatically move with the virtual objects controlled by user operations.

[0004] In the related art, the NPCs may be driven by a server to follow the virtual objects, and the positions of the NPCs are synchronized to clients, which then render game pictures based on the positions of the NPCs. However, due to a network latency between the server and a client, it may be difficult for the client to obtain the positions of the NPCs in time, leading to issues such as NPC lagging or the NPCs failing to follow the virtual objects in time.SUMMARY

[0005] Embodiments of this disclosure include a method and apparatus for controlling a virtual object, a computer device, and a non-transitory storage medium to implement synchronous following between virtual objects, so as to avoid lagging or failing to follow in time, thereby achieving improved real-time control on the virtual objects. The technical solutions of the embodiments of this disclosure may be implemented in the following manners.

[0006] An embodiment of this disclosure provides a method for controlling a virtual object in a virtual scene of a game application. A first virtual object that is controlled by a user and a second virtual object that moves with the first virtual object in the virtual scene are displayed. A user input associated with a move for the first virtual object is received. A first position to move the first virtual object is determined based on the user input. A relative position parameter is determined. The relative position parameter corresponds to a relative position between the first virtual object and the second virtual object while the second virtual object moves with the first virtual object. A second position to move the second virtual object to is determined by processing circuitry based on the relative position parameter and the first position. The first virtual object is moved to the first position and the second virtual object is moved to the second position.

[0007] An embodiment of this disclosure provides an apparatus for controlling a virtual object in a virtual scene of a game application. The apparatus includes processing circuitry configured to display a first virtual object that is controlled by a user and a second virtual object that moves with the first virtual object in the virtual scene. The processing circuitry is configured to receive a user input associated with a move for the first virtual object. The processing circuitry is configured to determine, based on the user input, a first position to move the first virtual object to. The processing circuitry is configured to determine a relative position parameter. The relative position parameter corresponds to a relative position between the first virtual object and the second virtual object while the second virtual object moves with the first virtual object. The processing circuitry is configured to determine, by the processing circuitry based on the relative position parameter and the first position, a second position to move the second virtual object to. The processing circuitry is configured to move the first virtual object to the first position and the second virtual object to the second position.

[0008] An embodiment of this disclosure provides a non-transitory computer-readable storage medium storing instructions which when executed by a processor cause the processor to perform a method for controlling a virtual object in a virtual scene of a game application.

[0009] In an embodiment, a method for controlling a virtual object, applied to a terminal device includes: displaying a first virtual object that is a virtual object manipulated by a user via the terminal device, and a second virtual object that is a virtual object moving with the first virtual object; receiving a moving operation inputted by the user for the first virtual object, and determining, based on the moving operation, a first position to which the first virtual object needs to move; acquiring a relative position parameter corresponding to the second virtual object, and determining, based on the relative position parameter and the first position, a second position to which the second virtual object needs to move, the relative position parameter indicating a relative position between the first virtual object and the second virtual object during a process of moving with the first virtual object; and controlling the first virtual object to move to the first position and the second virtual object to move to the second position.

[0010] In another embodiment, an apparatus for controlling a virtual object, applied to a terminal device includes: a display module configured to display a first virtual object that is a virtual object manipulated by a user via the terminal device, and a second virtual object that is a virtual object moving with the first virtual object; a first determination module configured to receive a moving operation inputted by the user for the first virtual object, and determine, based on the moving operation, a first position to which the first virtual object needs to move; a second determination module configured to acquire a relative position parameter corresponding to the second virtual object, and determine, based on the relative position parameter and the first position, a second position to which the second virtual object needs to move, the relative position parameter indicating a relative position between the first virtual object and the second virtual object during a process of moving with the first virtual object; and a control module configured to control the first virtual object to move to the first position and the second virtual object to move to the second position.

[0011] In one embodiment, the relative position parameter includes a relative distance and a relative direction between the second virtual object and the first virtual object; and the second determination module is configured to: determine, based on the first position and the relative direction, a target direction; and determine, as the second position, a position at a distance equal to the relative distance from the first position in the target direction.

[0012] In one embodiment, the second determination module is configured to: determine a first ray that uses the first position as an endpoint and points to a reference direction, the reference direction referring to an opposite direction to a moving direction of the first virtual object; and offset the direction to which the first ray points from the relative direction while keeping the endpoint of the first ray unchanged, to obtain a second ray, and determine a direction to which the second ray points as the target direction.

[0013] In one embodiment, the control module is configured to: control the first virtual object to move to the first position and the second virtual object to move to the second position if a distance between the first position and a position of the second virtual object is greater than a first preset distance.

[0014] In one embodiment, the control module is further configured to: control the first virtual object to move to the first position and keep the position of the second virtual object unchanged if the distance between the first position and the position of the second virtual object is not greater than the first preset distance.

[0015] In one embodiment, the control module is configured to: control the first virtual object to move toward the first position; and display the second virtual object at the second position if the second virtual object meets a condition for falling behind in following.

[0016] In one embodiment, the control module is configured to perform any one of: displaying the second virtual object in the second position if a duration during which a distance between the second virtual object and the first virtual object is greater than a second preset distance reaches a preset duration; and displaying the second virtual object 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 duration.

[0017] In one embodiment, the control module is configured to: control the first virtual object to move to the first position within m picture frames; and the displaying the second virtual object at the second position if the second virtual object meets a condition for falling behind in following includes: rendering the second virtual object to the second position in an nth picture frame if the second virtual object meets the condition for falling behind in following, the nth picture frame being any picture frame after determining that the second virtual object meets the condition for falling behind in following, where m is a positive integer greater than 1 and n is a positive integer not greater than m.

[0018] In one embodiment, the second position is behind the first position in the moving direction of the first virtual object; and the control module is configured to: determine a reference line that is perpendicular to the moving direction of the first virtual object and includes the second position and determine a number of picture frames through which the first virtual object needs to move to the reference line if the second virtual object meets the condition for falling behind in following; and render the second virtual object to the second position in the nth picture frame based on the number of picture frames, where n is a positive integer greater than the number of picture frames and not greater than m.

[0019] In one embodiment, the second determination module is configured to: determine the second position based on the relative position parameter and the first position if the first virtual object is in a running state or a flying state.

[0020] In one embodiment, the second determination module is configured to: determine, based on the relative position parameter and the first position, the second position to which the second virtual object needs to move in a first picture frame, after determining the first position to which the first virtual object needs to move in the first picture frame, if the first virtual object is in the running state or the flying state; and the control module is configured to: render the first virtual object to the first position in the first picture frame and the second virtual object to the second position in the first picture frame.

[0021] In one embodiment, the apparatus further includes: a transmission module configured to transmit an updated position of the first virtual object to a server each time a position of the first virtual object is updated, the server being configured to determine, based on the relative position parameter and the updated position of the first virtual object, a third position to which the second virtual object needs to move, and return the third position to the terminal device; and the control module is further configured to acquire the third position most recently returned by the server and control the second virtual object to move to the most recently returned third position if the first virtual object exits the running state or the flying state.

[0022] In one embodiment, the apparatus further includes: the control module further configured to control the first virtual object to move to the first position if the first virtual object is in a walking state; the transmission module configured to transmit the first position to the server, the server being configured to determine the second position based on the relative position parameter and the first position, and return the second position to the terminal device; a receiving module configured to receive the second position transmitted by the server; and the control module further configured to control the second virtual object to move to the second position.

[0023] In one embodiment, the control module is configured to render the first virtual object to the first position in a second picture frame after determining the first position to which the first virtual object needs to move in the second picture frame if the first virtual object is in the walking state; the transmission module is configured to transmit the first position to the server; and the control module is configured to render the second virtual object to the second position in a third picture frame after receiving the second position transmitted by the server, the third picture frame being a picture frame after the second picture frame.

[0024] In one embodiment, the apparatus further includes: the transmission module configured to transmit the second position to the server, the server being configured to verify the second position and return a verification result to the terminal device; the control module configured to control the first virtual object to move to the first position; the receiving module configured to receive the verification result; and the control module configured to control the second virtual object to move to the second position if the verification result indicates that verification of the second position is successful.

[0025] In one embodiment, the apparatus further includes: the transmission module configured to transmit the second position to the server, the server being configured to verify the second position and return a verification result to the terminal device; the receiving module configured to receive the verification result; and the control module configured to correct the position of the second virtual object to a position indicated by the verification result if the verification result indicates that the verification of the second position fails.

[0026] In another embodiment, a computer device, includes a processor and a memory. The memory has at least one computer program stored therein, and the at least one computer program is loaded and executed by the processor to implement operations performed in the method for controlling a virtual object as described in the above embodiments.

[0027] In another embodiment, a non-transitory computer-readable storage medium has at least one computer program stored therein. The at least one computer program is loaded and executed by a processor to implement operations performed in the method for controlling a virtual object as described in the above aspects.

[0028] In another embodiment, a computer program product includes a computer program which is loaded and executed by a processor to implement operations performed in the method for controlling a virtual object as described in the above embodiments.

[0029] According to the solutions provided in the embodiments of this disclosure, the first virtual object is configured to move according to the manipulation of the terminal device, and the second virtual object is configured to automatically move with the first virtual object. When the moving operation is performed on the first virtual object, the terminal device determines, according to the moving operation, the first position to which the first virtual object needs to move. Before controlling the first virtual object to move, the terminal device further determines, according to the first position and the relative position between the two virtual objects, the second position to which the second virtual object needs to move. Since the second position is determined by the terminal device and would not be affected by a network latency, the time point when the second position is obtained is very close to the time point when the first position is obtained. The terminal device may synchronously move the first virtual object to the first position and move the second virtual object to the second position without causing lagging, so that the second virtual object is controlled to synchronously move with the first virtual object, thereby avoiding lagging or failing to follow in time when the second virtual object moves with the first virtual object, and achieving improved real-time control on the virtual objects.BRIEF DESCRIPTION OF THE DRAWINGS

[0030] To describe the technical solutions in the examples of this disclosure, the following briefly introduces the accompanying drawings for describing the examples. The accompanying drawings in the following description show some examples of this disclosure, and those of ordinary skill in the art may still derive other drawings from these accompanying drawings.

[0031] FIG. 1 is a schematic diagram of an implementation environment according to an embodiment of this disclosure.

[0032] FIG. 2 is a flowchart of a method for controlling a virtual object according to an embodiment of this disclosure.

[0033] FIG. 3 is a flowchart of another method for controlling a virtual object according to an embodiment of this disclosure.

[0034] FIG. 4 is a schematic diagram of a relative position according to an embodiment of this disclosure.

[0035] FIG. 5 is a schematic diagram of another relative position according to an embodiment of this disclosure.

[0036] FIG. 6 is a schematic diagram of another relative position according to an embodiment of this disclosure.

[0037] FIG. 7 is a flowchart of another method for controlling a virtual object according to an embodiment of this disclosure.

[0038] FIG. 8 is a flowchart of another method for controlling a virtual object according to an embodiment of this disclosure.

[0039] FIG. 9 is a flowchart of another method for controlling a virtual object according to an embodiment of this disclosure.

[0040] FIG. 10 is a flowchart of another method for controlling a virtual object according to an embodiment of this disclosure.

[0041] FIG. 11 is a flowchart of another method for controlling a virtual object according to an embodiment of this disclosure.

[0042] FIG. 12 is a flowchart of another method for controlling a virtual object according to an embodiment of this disclosure.

[0043] FIG. 13 is a flowchart of another method for controlling a virtual object according to an embodiment of this disclosure.

[0044] FIG. 14 is a schematic structural diagram of an apparatus for controlling a virtual object according to an embodiment of this disclosure.

[0045] FIG. 15 is a schematic structural diagram of another apparatus for controlling a virtual object according to an embodiment of this disclosure.

[0046] FIG. 16 is a schematic structural diagram of a terminal device according to an embodiment of this disclosure.

[0047] FIG. 17 is a schematic structural diagram of a server according to an embodiment of this disclosure.DETAILED DESCRIPTION

[0048] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the implementations of this disclosure will be further described in further detail in combination with the accompanying drawings.

[0049] The terms “first”, “second”, and the like used in this disclosure may be used for describing herein various concepts which, however, are not limited by these terms unless otherwise specified. The terms are merely used for distinguishing one concept from another concept. By way of example, without departing from the scope of this disclosure, 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. “At least one” refers to one or more. For example, “at least one virtual object” may include virtual objects of any integer number greater than or equal to one, such as one virtual object, two virtual objects, or three virtual objects. “A plurality of” refers to two or more. For example, “a plurality of virtual objects” may include virtual objects of any integer number greater than or equal to two, such as two virtual objects or three virtual objects. “Each” refers to every one of “at least one”. For example, “each virtual object” refers to every virtual object of “a plurality of virtual objects”. If “a plurality of virtual objects” includes three virtual objects, “each virtual object” refers to every virtual object of the three virtual objects.

[0050] For example, data such as virtual objects and positions involved in this disclosure are all authorized by users or fully authorized by all parties, and collection, use, and processing of relevant data need to comply with relevant laws, regulations, and standards of relevant countries and regions.

[0051] Examples of terms involved in the embodiments of the disclosure are briefly introduced. The descriptions of the terms are provided as examples only and are not intended to limit the scope of the disclosure.

[0052] Virtual scene: May refer to a virtual scene displayed (or provided) when a client runs on a terminal device. The virtual scene may be a simulated environment of the real world, may be a semi-simulated and semi-fictional environment, or may be a purely fictional virtual environment. The virtual scene may be any one of a two-dimensional virtual scene, a 2.5-dimensional virtual scene, or a three-dimensional virtual scene. The dimensions of the virtual scene are not limited in the embodiments of the present disclosure. For example, the virtual scene may include sky, land, sea, etc. The land may include environmental elements such as desert and city. A user can control the virtual object to move in the virtual scene. In one embodiment, the virtual scene may provide a game environment for virtual objects, and there are virtual resources available for use by the virtual objects in the virtual scene. For example, the virtual resources include virtual items required in a game, virtual potions required for healing, virtual items required for leveling up, virtual gold coins required for trading, and the like.

[0053] In an open-world game, a player may freely control a virtual object to roam in a virtual scene, and may freely select a time point and a manner of completing a game task. The virtual object controlled by the player may interact with another virtual object in the virtual scene.

[0054] Virtual object: May refer to a movable object in the virtual scene. The movable object may be a virtual person, a virtual animal, a virtual elf, a cartoon character, or the like. The virtual object may be a virtual image for representing a user in the virtual scene. The virtual scene may include a plurality of virtual objects therein, and each virtual object has a shape and a volume in the virtual scene, and occupies some space in the virtual scene. In one embodiment, when the virtual scene is a three-dimensional virtual scene, the virtual object may be, for example, a three-dimensional model. The three-dimensional model may be a three-dimensional character built based on a three-dimensional human skeleton technology. The same virtual object may show different external appearances by wearing different skins. In some embodiments, the virtual object may alternatively be implemented by using a 2.5-dimensional model or 2-dimensional model, which is not limited in the embodiments of this disclosure.

[0055] There may be a plurality of different virtual objects in the virtual scene. For example, the virtual object may include a player character controlled via operations on a client, or may include artificial intelligence (AI) set in a game in the virtual scene by training, or may include a non-player character (NPC) set in interactions in the virtual scene. In one embodiment, the virtual object may be a virtual person for playing in the virtual scene. In one embodiment, a number of virtual objects participating in interactions in the virtual scene may be preset, or may be dynamically determined based on a number of clients participating in the interactions.

[0056] RPG: May refer to a role playing game, which is a game type in which players are placed into a virtual scene where they assume specific roles and complete various tasks. In an RPG, a player may control a virtual object to freely roam in the virtual scene. In addition, the player may further play a role by selecting virtual objects of different identity types, or may explore a new place in the virtual world, solve a puzzle, establish a new group, or participate in a story. By completing game tasks, exploring the virtual scene, and developing skills and attributes of the virtual object, the player advances the game story within the virtual scene. Such games typically feature complex plots and worldviews. The player may freely select the behaviors and development direction of the virtual object.

[0057] A multiplayer online role playing game (MMORPG) is one of the RPGs. MMORPG is a multiplayer game conducted over the Internet, which may be designed to simulate a virtual world such as an ancient world or a modern magic world. A player may select a virtual object in the virtual scene to go through a specific adventure task, and may explore the virtual scene together with a plurality of players online. In an MMORPG, by means of matching, a plurality of players may participate in the same game scene within the virtual scene. During the game, different players may manipulate virtual objects to interact with (e.g., attack) one another and contend for game resources and the like in the virtual scene. Alternatively, different players may manipulate virtual objects to cooperate with one another to obtain game resources and the like in the virtual scene.

[0058] The method for controlling a virtual object provided in the embodiments of this disclosure can be used on a terminal device. In one embodiment, the terminal device is a smartphone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smartwatch, an intelligent voice interaction device, an intelligent household electrical appliance, an in-vehicle terminal device, an aircraft, or the like, but is not limited thereto. The embodiments of this disclosure may be applied to various scenarios, including but not limited to cloud technologies, artificial intelligence, intelligent transportation, assisted driving, and the like.

[0059] FIG. 1 is a schematic diagram of an implementation environment according to an embodiment of this disclosure. Referring to FIG. 1, the implementation environment includes a terminal device 101 and a server 102. The terminal device 101 and the server 102 may be connected via a wireless or wired network.

[0060] A client 111 is installed and run on the terminal device 101. The client 111 may be of a type such as a social application client, an online payment client, an online shopping client, a game client, a medical service client, or a video client. When the terminal device 101 runs the client 111, a user interface of the client 111 is displayed on a screen of the terminal device 101. The terminal device 101 is a terminal device used by a user 121.

[0061] In one embodiment, the terminal device 101 includes a smartphone, a tablet computer, a notebook computer, a desktop computer, an intelligent voice interaction device, an intelligent household electrical appliance, an in-vehicle terminal device, an aircraft, a virtual reality (VR) apparatus, an augmented reality (AR) apparatus, or the like, but is not limited thereto.

[0062] Only one terminal device is shown in FIG. 1. However, in different embodiments, there may be a plurality of other terminal devices 103 that can access the server 102. In one embodiment, there are alternatively one or more terminal devices 103 that correspond to a developer. A development and editing platform for a client is installed on the terminal device 103. The developer may edit and update the client on the terminal device 103, and transmit an updated client installation package to the server 102 over a wired or wireless network. The terminal device 101 may download the client installation package from the server 102 to update the client.

[0063] The terminal device 101 and the other terminal devices 103 are connected to the server 102 via a wired network or a wireless network.

[0064] The server 102 is implemented as at least one of a single server, a plurality of servers, a cloud computing platform, and a virtualization center. The server 102 is configured to provide a background service for the client. In one embodiment, the server 102 undertakes main computing work, while the terminal device 101 undertakes secondary computing work. Alternatively, the server 102 undertakes the secondary computing work, while the terminal device 101 undertakes the main computing work. Alternatively, the server 102 and the terminal device 101 perform collaborative computing by using a distributed computing architecture.

[0065] In this embodiment of this disclosure, the terminal device 101 and the server 102 are configured for collaborative computing of a position to which the second virtual object needs to move with the first virtual object. For example, when the first virtual object is in a running state or a flying state, the terminal device computes a position to which the second virtual object needs to move with the first virtual object. When the first virtual object is in a walking state, the server computes a position to which the second virtual object needs to move with the first virtual object.

[0066] The implementation environment described above is merely an example. The method provided in this embodiment of this disclosure may alternatively be performed solely by the terminal device 101 or the server 102, or be performed by another computer device, without limitation in this embodiment of this disclosure.

[0067] FIG. 2 is a flowchart of a method for controlling a virtual object according to an embodiment of this disclosure. This embodiment of this disclosure is performed by a terminal device. Referring to FIG. 2, the method includes the following operations.

[0068] Operation 201: The terminal device displays a first virtual object that is a virtual object manipulated by a user via the terminal device, and a second virtual object that is a virtual object moving with the first virtual object. In an example, displaying a first virtual object that is controlled by a user and a second virtual object that moves with the first virtual object in the virtual scene.

[0069] In this embodiment of this disclosure, the terminal device displays the first virtual object and the second virtual object.

[0070] The first virtual object is a virtual object manipulated by the terminal device. The first virtual object is a virtual object controlled by a user operation via the terminal device. The user performs an operation on the terminal device such that the terminal device manipulates the virtual object according to the operation of the user. The user may control, via the terminal device, the first virtual object to move, jump, run, attack, and the like.

[0071] The second virtual object is a virtual object that moves with the first virtual object. The second virtual object is not a virtual object controlled via a user operation. The user cannot directly control the second virtual object by performing an operation on the terminal device. The second virtual object can only automatically move with the first virtual object, but is not directly controlled by the user operation. For example, the second virtual object is a non-player character (NPC) summoned by the first virtual object.

[0072] Operation 202: The terminal device receives a moving operation inputted by the user for the first virtual object, and determines, based on the moving operation, a first position to which the first virtual object needs to move. In an example, receiving a user input associated with a move for the first virtual object and determining, based on the user input, a first position to move the first virtual object to.

[0073] The moving operation for the first virtual object is an operation that is performed by the user on the terminal device to instruct the first virtual object to move.

[0074] In an example, the user inputs the moving operation for the first object on the terminal device. For example, the moving operation may be an operation of moving left or an operation of moving right. Alternatively, the moving operation may be a walking operation, a running operation, a flying operation, or the like. Different moving operations may correspond to different moving speeds, moving directions, moving postures, or the like. The terminal device determines, in response to the moving operation and according to an indication of the moving operation, the first position to which the first virtual object needs to move.

[0075] Operation 203: The terminal device acquires a relative position parameter corresponding to the second virtual object, and determines, based on the relative position parameter and the first position, a second position to which the second virtual object needs to move, the relative position parameter indicating a relative position between the first virtual object and the second virtual object during a process of moving with the first virtual object. For example, a relative position parameter is determined. The relative position parameter corresponds to a relative position between the first virtual object and the second virtual object while the second virtual object moves with the first virtual object. Based on the relative position parameter and the first position, a second position to move the second virtual object to is determined.

[0076] The terminal device acquires the relative position parameter corresponding to the second virtual object, the relative position parameter indicating the relative position between the second virtual object and the first virtual object during the process of moving with the first virtual object. The relative position parameter indicates a relative position that is expected to be maintained between the second virtual object and the first virtual object. Thus, in the moving process of the first virtual object, the second virtual object may be controlled to synchronously move according to the relative position parameter, so that the relative position between the second virtual object and the first virtual object is equal to or close to that indicated by the relative position parameter, thereby achieving an effect that the second virtual object automatically follows the first virtual object.

[0077] In operation 203, the terminal device serves as an execution body to perform the process of determining the second position based on the relative position parameter and the first position. To be specific, the terminal device computes the second position by itself, and the server does not need to compute the second position and then return it to the terminal device. Because this is not affected by a network latency of communication between the terminal device and the server, the efficiency of obtaining the second position by the terminal device can be improved.

[0078] Operation 204: The terminal device controls the first virtual object to move to the first position and the second virtual object to move to the second position. For example, the first virtual object moves to the first position and the second virtual object moves to the second position.

[0079] After determining the first position to which the first virtual object needs to move, the terminal device may control the first virtual object to move to the first position. After determining the second position to which the second virtual object needs to move, the terminal device may control the second virtual object to move to the second position.

[0080] In this embodiment of this disclosure, since the second position to which the second virtual object needs to move is computed by the terminal device itself and would not be affected by a network latency generated during the communication with the server, there is no relatively large delay between a time point when the terminal device obtains the second position and a time point when the terminal device obtains the first position. It thus may be considered that a time point when the terminal device controls the first virtual object to move is the same as or very close to a time point when the terminal device controls the second virtual object to move, thereby achieving an effect that the second virtual object synchronously moves with the first virtual object.

[0081] According to the method provided in this embodiment of this disclosure, the first virtual object is configured to move according to the manipulation of the terminal device, and the second virtual object is configured to automatically move with the first virtual object. When the moving operation is performed on the first virtual object, the terminal device determines, according to the moving operation, the first position to which the first virtual object needs to move. Before controlling the first virtual object to move, the terminal device further determines, according to the first position and the relative position between the two virtual objects, the second position to which the second virtual object needs to move. Since the second position is determined by the terminal device and would not be affected by a network latency, the time point when the second position is obtained is very close to the time point when the first position is obtained. The terminal device may synchronously move the first virtual object to the first position and move the second virtual object to the second position without causing lagging, so that the second virtual object is controlled to synchronously move with the first virtual object, thereby avoiding lagging or failing to follow in time when the second virtual object moves with the first virtual object, and achieving improved real-time control on the virtual objects.

[0082] The embodiment of FIG. 2 described above is a brief description of the method for controlling a virtual object. For a process in which the terminal device controls the second virtual object to synchronously move with the first virtual object, reference is made to the following embodiment of FIG. 3. FIG. 3 is a flowchart of another method for controlling a virtual object according to an embodiment of this disclosure. This embodiment of this disclosure is performed by a terminal device. Referring to FIG. 3, the method includes the following operations.

[0083] Operation 301: The terminal device displays a first virtual object that is a virtual object manipulated by a user via the terminal device, and a second virtual object that is a virtual object moving with the first virtual object.

[0084] In a possible implementation, the terminal device displays a virtual scene interface. The virtual scene interface is configured to show a virtual scene which includes the first virtual object and the second virtual object. Therefore, the virtual scene interface displays the first virtual object and the second virtual object therein.

[0085] In one embodiment, the first virtual object is a virtual object created in the virtual scene by a locally logged-in account. The first virtual object is a virtual object that belongs to the account, and a user of the account may control the first virtual object by performing operations on the terminal device.

[0086] In one embodiment, the second virtual object is a virtual object summoned by the first virtual object. The virtual object summoned by the first virtual object is configured to follow the first virtual object. For example, in an RPG, the first virtual object is a game character played by the user, and the second virtual object is an NPC summoned by the first virtual object. The NPC is configured to act as a follower, a guard, or a following pet of the first virtual object, among others.

[0087] In one embodiment, the virtual scene interface is configured to display the virtual scene within a view angle range of the first virtual object. The first virtual scene may further include a river, grass, land, a building, and the like therein. The virtual scene interface may include a minimap, other action buttons, a virtual joystick area, other control buttons, and the like. The virtual joystick area is configured to control the first virtual object to walk and run in the first virtual scene, and adjust a view angle direction of the first virtual object. A plurality of action buttons are configured to control the first virtual object to perform corresponding actions in the first virtual scene. The minimap displays a position of the first virtual object in the first virtual scene so that the user can control the first virtual object via the virtual scene interface.

[0088] In one embodiment, the virtual scene interface further displays other virtual objects than the first virtual object and the second virtual object, and the other virtual objects may be game characters, NPCs, or the like controlled by other users.

[0089] Operation 302: The terminal device receives a moving operation inputted by the user for the first virtual object, and determines, based on the moving operation, a first position to which the first virtual object needs to move.

[0090] In a possible implementation, the terminal device determines, based on the moving operation for the first virtual object, a moving direction and a moving speed indicated by the moving operation, and then determines, based on a current position of the first virtual object, and the moving direction and the moving speed indicated by the moving operation, the first position to which the first virtual object needs to move.

[0091] In a possible implementation, the terminal device displays a virtual joystick area that is configured to control the first virtual object to walk, run, and fly in the first virtual scene. The user may perform a dragging operation on a virtual joystick in the virtual joystick area. The terminal device determines, in response to the dragging operation on the virtual joystick and based on a dragging direction and a dragging amplitude of the dragging operation, a moving speed and a moving direction indicated by the dragging operation.

[0092] In a possible implementation, the terminal device displays a walking control, a running control, and a flying control. The user instructs, by performing a triggering operation on the walking control, the running control, or the flying control, the terminal device to control the first virtual object to walk, run, or fly. The first virtual object correspondingly has respective moving speeds in a walking state, a running state, and a flying state. A user instructs, by performing a sliding operation on a screen of the terminal device, the terminal device to adjust a moving direction of the first virtual object. Therefore, the terminal device may determine a moving speed of the first virtual object according to the triggering operation of the user on the walking control, the running control, or the flying control, and determine the moving direction of the first virtual object according to the sliding operation of the user on the screen.

[0093] Operation 303: The terminal device acquires a relative position parameter corresponding to the second virtual object, the relative position parameter including a relative distance and a relative direction between the second virtual object and the first virtual object.

[0094] The terminal device has the relative position parameter corresponding to the second virtual object stored thereon, and the relative position parameter can indicate a relative position between the second virtual object and the first virtual object. The relative position parameter includes the relative distance and the relative direction between the second virtual object and the first virtual object. The relative distance indicates a distance between the second virtual object and the first virtual object, and the relative direction indicates which direction the second virtual object is located relative to the first virtual object, such as front or rear.

[0095] In a possible implementation, there may be one or more second virtual objects that move with the first virtual object. When there are a plurality of second virtual objects, the plurality of second virtual objects all move with the first virtual object. Each second virtual object correspondingly has a respective relative position parameter, and the relative position parameter of each second virtual object is not exactly the same. In one embodiment, a relative distance corresponding to each second virtual object is the same. To be specific, distances between the plurality of second virtual objects that move with the first virtual object and the first virtual object are the same. In one embodiment, a relative direction corresponding to each second virtual object is different. To be specific, the plurality of second virtual objects that move with the first virtual object are respectively located in different directions relative to the first virtual object. In one embodiment, the relative distance corresponding to each second virtual object is different. To be specific, the distances between the plurality of second virtual objects that move with the first virtual object and the first virtual object are different. In one embodiment, a relative direction corresponding to each second virtual object is different. To be specific, the plurality of second virtual objects that move with the first virtual object are respectively located in different directions relative to the first virtual object. In one embodiment, the relative direction corresponding to each second virtual object is the same. To be specific, the plurality of second virtual objects that move with the first virtual object are located in the same direction relative to the first virtual object.

[0096] FIG. 4 is a schematic diagram of a relative position according to an embodiment of this disclosure. The terminal device displays the first virtual object 401, the second virtual object 402, and the second virtual object 403 in the virtual scene interface. The second virtual object 402 and the second virtual object 403 move with the first virtual object 401. As shown in FIG. 4, the second virtual object 402 is located at the left rear relative to the first virtual object 401, and the second virtual object 403 is located at the right rear relative to the first virtual object 401.

[0097] FIG. 5 is schematic diagram of another relative position according to an embodiment of this disclosure. The terminal device displays the first virtual object 501, the second virtual object 502, and the second virtual object 503 in the virtual scene interface. The second virtual object 502 and the second virtual object 503 move with the first virtual object 501. As shown in FIG. 5, the second virtual object 502 is located right behind the first virtual object 501, and the second virtual object 503 is located right in front of the first virtual object 501.

[0098] For ease of understanding, the following operations in this embodiment of this disclosure are described only by taking the process of controlling one second virtual object to move synchronously with the first virtual object as an example. Actually, the principle for each second virtual object to synchronously move with the first virtual object is the same. In case of a plurality of second virtual objects, the terminal device may simultaneously control the plurality of second virtual objects to synchronously move with the first virtual object.

[0099] Operation 304: The terminal device determines, based on the first position and the relative direction, a target direction, and determines, as the second position, a position at a distance equal to the relative distance from the first position in the target direction.

[0100] After determining the first position to which the first virtual object needs to move, the terminal device determines, based on the first position, the second position to which the second virtual object needs to move. A 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 is to be the relative direction in the relative position parameter, and a relative distance between the second position and the first position is to be the relative distance in the relative position parameter.

[0101] The terminal device first offsets the direction with the first position as a reference point to obtain the target direction, so as to ensure that a relative direction between the target direction and the first position is equal to the relative direction in the relative position parameter. After the target direction is determined, the second position is determined in the target direction, to ensure that the distance between the second position and the first position is equal to the relative position. Thus, it can be ensured 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.

[0102] In a possible implementation, the terminal device: determines a first ray that uses the first position as an endpoint and points to a reference direction, the reference direction referring to an opposite direction to the moving direction of the first virtual object; and offsets the direction to which the first ray points from the relative direction while keeping the endpoint of the first ray unchanged, to obtain a second ray, and determines a direction to which the second ray points as the target direction.

[0103] The relative direction may be represented by an offset direction and an offset angle. The offset direction includes a clockwise direction and an anticlockwise direction, and the offset angle may be a value between 0 and 360 degrees, or the like. After determining the first ray, the terminal device offsets, according to the offset direction and the offset angle, the direction to which the first ray points, to obtain the second ray. The direction to which the second ray points is the target direction. An endpoint of the second ray is the same as the endpoint of the first ray, and an included angle between the second ray and the first ray is equal to the offset angle.

[0104] FIG. 6 is schematic diagram of another relative position according to an embodiment of this disclosure. As shown in FIG. 6, the first virtual object is a game character, and the number of second virtual objects moving with the game character is 4, which are respectively NPC No. 1, NPC No. 2, NPC No. 3, and NPC No. 4. By taking NPC No. 1 as an example, in FIG. 6, a position to which the game character needs to move is denoted as the first position, while a position to which NPC No. 1 needs to move is denoted as the second position; the offset direction corresponding to NPC No. 1 is the clockwise direction; the offset angle is α; and the relative distance is R. The terminal device determines the first ray that uses the first position as the endpoint and that points to the opposite direction to the moving direction of the first virtual object, and offsets the first ray by α along the clockwise direction to obtain the second ray. The second position is located in the direction to which the second ray points and at a distance R from the first position.

[0105] In this embodiment of this disclosure, when the first position of the first virtual object is known, the direction in which the second virtual object is located may be inferred according to the relative direction between the two virtual objects. Then, the position of the second virtual object may be inferred according to the relative distance between the two virtual objects. This is conducive to improving the position accuracy of the second virtual object, thereby improving the accuracy of controlling a virtual object to follow a movement.

[0106] Operation 305: The terminal device controls the first virtual object to move to the first position and the second virtual object to move to the second position.

[0107] After determining the first position to which the first virtual object needs to move, the terminal device may control the first virtual object to move to the first position. After determining the second position to which the second virtual object needs to move, the terminal device may control the second virtual object to move to the second position.

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

[0109] In another embodiment, if the distance between the first position and the position of the second virtual object is not greater than the first preset distance, the terminal device controls the first virtual object to move to the first position and keeps the position of the second virtual object unchanged.

[0110] To be specific, after determining the second position, the terminal device first determines whether a 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 the first preset distance, and if the distance is greater than the first preset distance, performs the operation of controlling the first virtual object to move to the first position and the second virtual object to move to the second position. If the distance is not greater than the first preset distance, only the operation of moving the first virtual object to the first position is performed, while the operation of controlling the second virtual object to move is not performed, and the position of the second virtual object remains unchanged.

[0111] In this embodiment of this disclosure, 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 greater than a preset distance, a movement amplitude of the first virtual object is relatively large. Therefore, in this case, controlling the second virtual object to synchronously move with the first virtual object is conducive to avoiding a case in which the second virtual object falls behind in following, thereby ensuring that the second virtual object can follow the first virtual object in time.

[0112] 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, the movement amplitude of the first virtual object is relatively small. Therefore, in this case, the second virtual object may be kept from moving, and a small-amplitude movement of the first virtual object is prevented from causing the first virtual object to follow the movement, leading to a poor following effect. Moreover, the processing volume can be reduced to some extent, and processing resources can be saved.

[0113] In a possible implementation, the terminal device controls the first virtual object to move toward the first position, and displays the second virtual object at the second position if the second virtual object meets a condition for falling behind in following.

[0114] The terminal device first controls the first virtual object to move toward the first position, and determines whether the second virtual object currently meets the condition for falling behind in following. If the second virtual object currently meets the condition for falling behind in following, the terminal device directly omits the process in which the second virtual object gradually moves from the current position to the second position, and directly displays the second virtual object at the second position, so as to present a representation effect of blinking or teleporting of the second virtual object from the current position to the second position.

[0115] Falling behind in following refers to the second virtual object being in a state of falling behind the first virtual object. The condition for falling behind in following is a preset condition. When the second virtual object meets the condition for falling behind in following, the second virtual object is considered as currently falling behind the first virtual object, i.e., not following the first virtual object in time. Then, in this case, if the terminal device still controls the second virtual object to gradually move to the second position, the second virtual object may fall behind the first virtual object further. Therefore, the terminal device directly displays the second virtual object at the second position to reduce moving time, so that the second virtual object can follow the first virtual object in time.

[0116] In this embodiment of this disclosure, if the second virtual object falls behind in the process of following the second virtual object, the terminal device directly displays the second virtual object at the second position, and omits the process of the second virtual object moving to the second position, thereby avoiding that the second virtual object falls behind for a long time to affect the following effect, improving the accuracy of controlling the virtual object to follow a movement, and helping reduce an error rate.

[0117] In one embodiment, if the terminal device detects that the second virtual object meets the condition for falling behind in following, displaying the second virtual object at the second position includes any one of the following:

[0118] (1) The terminal device displays the second virtual object at the second position if a duration during which the distance between the second virtual object and the first virtual object is greater than a second preset distance reaches a preset duration.

[0119] To be specific, the condition for falling behind in following is that the duration during which the distance between the second virtual object and the first virtual object is greater than the second preset distance reaches the preset duration.

[0120] If the distance between the second virtual object and the first virtual object is greater than the second preset distance for a long time, the second virtual object fails to stay close to the first virtual object in time. For example, an obstacle appears in a moving path of the second virtual object, affecting the moving speed of the second virtual object and the like, and causing the second virtual object to fall behind the first virtual object.

[0121] (2) The terminal device displays the second virtual object 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 duration.

[0122] To be specific, the condition for falling behind in following 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 duration.

[0123] 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, the second virtual object undergoes a lag. For example, the first virtual object has moved to the roof, but the second virtual object still stays on the ground. Consequently, the second virtual object falls behind the first virtual object.

[0124] In this embodiment of this disclosure, two conditions for falling behind in following are set, covering both the case where the second virtual object fails to follow the first virtual object in time due to a low moving speed, and the case where the second virtual object undergoes a lag and cannot continue moving. This facilitates timely resolution of issues such as lagging or trailing during the process of the second virtual object following the first virtual object, thereby reducing the error rate and improving the accuracy of controlling the virtual object to follow the movement.

[0125] In one embodiment, the terminal device controls the first virtual object to the first position within m picture frames, and renders the second virtual object to the second position in an nth picture frame if the second virtual object meets the condition for falling behind in following, the nth picture frame being any picture frame after determining that the second virtual object meets the condition for falling behind in following, where m is a positive integer greater than 1 and n is a positive integer not greater than m.

[0126] In this embodiment of this disclosure, the first virtual object moving to the first position within the m picture frames may be understood as that, in a first picture frame, the first virtual object is located at the current position; according to a moving path from the current position to the first position, each time a picture frame is refreshed, the first virtual object moves by a distance along the moving path until an mth picture frame is refreshed, where the first virtual object moves to the first position.

[0127] For example, the current position is denoted as a position A, and the first position is denoted as a position B. According to a value of m, average interpolation is performed on a moving path between the position A and the position B to obtain m-2 positions. Starting from the position A, each time a picture frame is refreshed, the terminal device displays the first virtual object at a next position to the current position, thereby forming a representation effect that the first virtual object gradually moves from the position A to the position B within the m picture frames.

[0128] If the second virtual object has already fallen behind the first virtual object, the terminal device no longer controls the second virtual object to move to the second position frame by frame, but directly displays the second virtual object at the second position.

[0129] In one embodiment, the second position is behind the first position in the moving direction of the first virtual object. The terminal device determines a reference line that is perpendicular to the moving direction of the first virtual object and includes the second position and determines a number of picture frames through which the first virtual object needs to move to the reference line if the second virtual object meets the condition for falling behind in following; and renders the second virtual object to the second position in the nth picture frame based on the number of picture frames, where n is a positive integer greater than the number of picture frames and not greater than m.

[0130] When the first virtual object moves to the reference line, the first virtual object is flush with the first position. For example, the first virtual object might be located at the first position, or might be located at the left side or right side of the first position, etc.

[0131] If the second position is behind the first position, the second virtual object is located behind the first virtual object. To be specific, the second virtual object moves with the first virtual object behind the first virtual object. Therefore, when the terminal device determines that the second virtual object meets the condition for falling behind in following, the second virtual object might not move to be flush with the first position. If the terminal device immediately displays the second virtual object at the second position, the second virtual object flashes in front of the first virtual object, which is inconsistent with a following manner in which the second virtual object follows behind the first virtual object. Therefore, to avoid this problem, when determining that the second virtual object meets the condition for falling behind in following, the terminal device renders the second virtual object to the second position after the first virtual object moves to be flush with the first position, thereby ensuring that the first virtual object is always located in front of the second virtual object.

[0132] In this embodiment of this disclosure, the terminal device moves the first virtual object to the first position within the m picture frames. If the second virtual object currently falls behind, the terminal device directly renders the second virtual object to the second position in the nth picture frame among the m picture frames after determining that the second virtual object falls behind. Therefore, even when the second virtual object falls behind, it can be ensured that the second virtual object reaches the second position within the m picture frames, thereby avoiding that the second virtual object cannot reach the second position in time because the second virtual object falls behind. It is further ensured that the second virtual object can synchronously move with the first virtual object smoothly, thereby improving the accuracy of controlling the virtual object to follow the movement.

[0133] In addition, when the second position is behind the first position, the terminal device determines a picture frame in which the second virtual object is rendered to the second position according to the number of picture frames through which the first virtual object needs to move to the reference line including the second position. It thus can be ensured that the terminal device renders the second virtual object to the second position only after the first virtual object has moved to be in front of the second position, thereby avoiding that 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.

[0134] The foregoing implementation is described by using only an example in which the first virtual object moves to the first position within the m picture frames. In another implementation, the first virtual object may move to the first position in a next picture frame. This is equivalent to the first virtual object being directly rendered to the first position in the next picture frame.

[0135] In a possible implementation, the first virtual object, which is a virtual object created by an account, has a skill of summoning a virtual object, and the virtual object summoned by the first virtual object is configured to move with the first virtual object. The second virtual object is a virtual object summoned by the first virtual object. The first virtual object may simultaneously summon a plurality of second virtual objects. Therefore, for a process in which the first virtual object summons the second virtual object and the second virtual object automatically follows the first virtual object, reference may be made to FIG. 7. FIG. 7 is a flowchart of another method for controlling a virtual object according to an embodiment of this disclosure. In FIG. 7, the first virtual object is referred to as a game character, and the second virtual object is referred to as an NPC. As shown in FIG. 7, the method includes the following operations.

[0136] (1) The terminal device summons, in response to a follower summoning instruction for a game character, one or more NPCs for the game character.

[0137] (2) The terminal device registers the summoned NPC into a slot of a following lineup for the game character. The game character has a corresponding following lineup that includes a plurality of slots, each configured for registering one NPC. A number of NPCs summoned is not greater than a number of the slots of the following lineup. In one embodiment, when the number of NPCs summoned is less than the number of the slots, the summoned NPCs are registered into the slots closer to the game character according to the principle of the closest distance to the game character.

[0138] (3) For each slot of the following lineup, the terminal device determines whether an NPC is registered in the slot, and if not, skips processing the slot. If so, processing is performed according to the following operations (4) to (7).

[0139] (4) During a moving process of the game character, the terminal device updates, according to a relative position parameter between the slot and the game character and a moving position of the game character, a slot position at which the NPC is registered.

[0140] (5) The terminal device controls the NPC to move to the updated slot position. If a distance between the current position of the NPC and the position to which the game character needs to move is not greater than a first preset distance, the NPC does not need to move, so as to prevent a tiny movement of the game character from causing the NPC to follow the movement.

[0141] (6) The terminal device detects whether the NPC meets a condition for falling behind in following, and if so, directly displays the NPC at the updated slot position without gradually moving to the slot position.

[0142] (7) The terminal device deregisters the NPC from the slot of the following lineup and destroys the NPC if the game character withdraws the NPC or the game character is offline.

[0143] According to the method provided in this embodiment of this disclosure, a first virtual object is configured to move according to the manipulation of the terminal device, and a second virtual object is configured to automatically move with the first virtual object. When a moving operation is performed on the first virtual object, the terminal device determines, according to the moving operation, a first position to which the first virtual object needs to move. Before controlling the first virtual object to move, the terminal device further determines, according to the first position and a relative position between the two virtual objects, a second position to which the second virtual object needs to move. Since the second position is determined by the terminal device and would not be affected by a network latency, the time point when the second position is obtained is very close to the time point when the first position is obtained. The terminal device may synchronously move the first virtual object to the first position and move the second virtual object to the second position without causing lagging, so that the second virtual object is controlled to synchronously move with the first virtual object, thereby avoiding lagging or failing to follow in time when the second virtual object moves with the first virtual object, and achieving improved real-time control on the virtual objects.

[0144] The foregoing describes the process in which the terminal device independently controls virtual objects, i.e., describes the process in which the terminal device determines the first position of the first virtual object and determines the second position to which the second virtual object needs to move.

[0145] The following describes a process in which a terminal device and a server collaboratively complete control on virtual objects. To be specific, in an embodiment of this disclosure, a process of controlling a second virtual object to move with a first virtual object may be implemented in two states: a terminal device takeover state and a server takeover state. The terminal device takeover state refers to the terminal device computing a position to which the second virtual object needs to move. The server takeover state refers to that the server computes a position to which the second virtual object needs to move, and notifies the terminal device of the position to which the second virtual object needs to move.

[0146] Switching between the terminal device takeover state and the server takeover state is driven according to a state of the first virtual object. Switching to the server takeover state is made if the first virtual object is in a walking state, or switching to the terminal device takeover state is made if the first virtual object is in a running state or a flying state. The following describes a process of controlling a virtual object separately by using the terminal device takeover state and the server takeover state as examples.

[0147] In some embodiments, when the first virtual object is in the running state or the flying state, and the terminal device determines the second position based on a relative position parameter and the first position, the process of controlling the first virtual object and the second virtual object is as shown in the following embodiment of FIG. 8. FIG. 8 is a flowchart of another method for controlling a virtual object according to an embodiment of this disclosure. This embodiment of this disclosure is performed by a terminal device. Referring to FIG. 8, the method includes the following operations.

[0148] Operation 801: The terminal device displays a first virtual object that is a virtual object manipulated by the terminal device, and a second virtual object that is a virtual object moving with the first virtual object.

[0149] Operation 802: The terminal device determines, based on a moving operation for the first virtual object, a first position to which the first virtual object needs to move in a first picture frame.

[0150] The process of operations 801 to 802 is the same as the process of operations 301 to 302 described above, which will not be described redundantly here.

[0151] Operation 803: The terminal device determines, based on a relative position parameter and the first position, a second position to which the second virtual object needs to move in the first picture frame, after determining the first position to which the first virtual object needs to move in the first picture frame, if the first virtual object is in a running state or a flying state.

[0152] If the first virtual object is in the running state or the flying state, after determining the first position to which the first virtual object needs to move in the first picture frame, the terminal device itself computes, according to the relative position parameter and the first position, the second position to which the second virtual object needs to move in the first picture frame.

[0153] Operation 804: The terminal device renders the first virtual object to the first position in the first picture frame and the second virtual object to the second position in the first picture frame.

[0154] 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 device respectively renders the first virtual object to the first position and the second virtual object to the second position within the same picture frame. Thus, the effect that the second virtual object synchronously moves with the first virtual object is achieved.

[0155] In this embodiment of this disclosure, after determining the first position, upon successively determining the second position, the terminal device renders the first virtual object to the first position and the second virtual object to the second position at the same time. In this embodiment of this disclosure, the terminal device itself computes the second position, which would not be affected by a communication latency between the terminal device and the server. Therefore, a time length spent from a user performing the moving operation on the first virtual object to the terminal device determining the second position is very short, and a time length spent from the user performing the moving operation on the first virtual object to the first virtual object moving to the first position is also very short. To be specific, waiting for the terminal device to compute the second position and then move the first virtual object does not cause a significant latency to the moving process of the first virtual object. The solution in this embodiment of this disclosure does not affect the moving process of the first virtual object.

[0156] Operation 805: The terminal device transmits an updated position of the first virtual object to the server each time the position of the first virtual object is updated.

[0157] The terminal device needs to report the position of the first virtual object to the server in real time. Each time the position of the first virtual object transmitted by the terminal device is received, the server determines, based on the relative position parameter and the updated position of the first virtual object, a third position to which the second virtual object needs to move, and returns the third position to the terminal device.

[0158] In one embodiment, the server maintains the position data of the first virtual object and the position data of the second virtual object. The position data of the first virtual object is configured for recording the position of the first virtual object, and the position data of the second virtual object is configured for recording the position of the second virtual object. After computing the third position to which the second virtual object needs to move, the server updates the third position to the position data of the second virtual object maintained by the server.

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

[0160] Formats of the first data packet and the second data packet are different. Alternatively, the first data packet carries a target identifier, while the second data packet does not carry the target identifier, or the first data packet does not carry the target identifier, while the second data packet carries the target identifier. The terminal device may identify and distinguish between the first data packet and the second data packet.

[0161] Upon receiving the first data packet, the terminal device is currently in the terminal device takeover state, and computes the second position by itself. Therefore, the terminal device may ignore the first data packet, i.e., not use the third position in the first data packet. When the terminal device receives the second data packet, switching to the server takeover state is currently made, and the terminal device needs to hand over the takeover permission to the server. In this case, the terminal device performs the following operation 806.

[0162] Operation 806: The terminal device obtains the third position most recently returned by the server and controls the second virtual object to move to the most recently returned third position if the first virtual object exits the running state or the flying state.

[0163] When the first virtual object exits the character in the running state or the flying state, the terminal device takeover state needs to be switched to the server takeover state. In this case, the terminal device obtains the third position most recently returned by the server and controls the second virtual object to move to the most recently returned third position. Thus, it is ensured that the position of the second virtual object displayed by the terminal device keeps consistent with the position of the second virtual object recorded on the server, thereby preventing dragging and improving the smoothness of state switching.

[0164] In a possible implementation, when the first virtual object exits the running state or the flying state, the server returns the second data packet carrying the third position to the terminal device. Therefore, the third position in the second data packet is the third position most recently returned by the server after the first virtual object exits the running state or the flying state.

[0165] In a possible implementation, the terminal device controls the second virtual object to move to the most recently returned third position at a preset speed. Thus, it is ensured that the second virtual object can quickly arrive at the third position. In one embodiment, the preset speed is greater than a moving speed of the first virtual object when in the running state or the flying state.

[0166] According to the method provided in this embodiment of this disclosure, when the first virtual object is in the running state or the flying state, the moving speed of the first virtual object is relatively high. In this case, the position to which the second virtual object needs to move with the first virtual object is determined by the terminal device. Because there is no network latency caused by communication with the server, it can be achieved that the second virtual object is controlled to synchronously move with the first virtual object, and it can be avoided that the second virtual object fails to follow in time due to the high moving speed of the first virtual object. Even if the moving speed of the first virtual object is very high, it can be ensured that the second virtual object synchronously moves with the first virtual object. The accuracy and timeliness of controlling a virtual object to follow a movement when the moving speed is relatively high are improved.

[0167] In addition, after 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 are determined, within the same picture frame, the first virtual object is rendered to the first position and the second virtual object is rendered to the second position, so that the positions of the first virtual object and the second virtual object are simultaneously updated in the same picture frame, thereby achieving that the second virtual object synchronously moves with the first virtual object. Thus, improved real-time control on the virtual objects is achieved.

[0168] In some embodiments, when the first virtual object is in a walking state, the terminal device controls the first virtual object to move to the first position and transmits the first position to the server. The server determines the second position based on the relative position parameter and the first position and returns the second position to the terminal device. Upon receiving the second position transmitted by the server, the terminal device controls the second virtual object to move to the second position. The process of controlling the first virtual object and the second virtual object is as shown in the following embodiment of FIG. 9. FIG. 9 is a flowchart of another method for controlling a virtual object according to an embodiment of this disclosure. This embodiment of this disclosure is performed by a terminal device and a server. Referring to FIG. 9, the method includes the following operations.

[0169] Operation 901: The terminal device displays a first virtual object that is a virtual object manipulated by a user via the terminal device, and a second virtual object that is a virtual object moving with the first virtual object.

[0170] Operation 902: The terminal device receives a moving operation inputted by the user for the first virtual object, and determines, based on the moving operation for the first virtual object, a first position to which the first virtual object needs to move in a second picture frame.

[0171] The process of operations 901 to 902 is the same as the process of operations 301 to 302 described above, which will not be described redundantly here.

[0172] Operation 903: The terminal device renders the first virtual object to the first position in the second picture frame after determining the first position to which the first virtual object needs to move in the second picture frame if the first virtual object is in a walking state, and transmits the first position to the server.

[0173] If the first virtual object is in the walking state, after determining the first position to which the first virtual object needs to move in a first picture frame, the terminal device first renders the first virtual object to the first position in the second picture frame and transmits the first position to the server, and the server computes a second position to which the second virtual object needs to move.

[0174] In one embodiment, when rendering the first picture frame, the terminal device may determine the position to which the second virtual object needs to be rendered in the first picture frame according to the position to which the second virtual object needs to move previously transmitted by the server.

[0175] In this embodiment of this disclosure, the second position is computed by the server, which would not be affected by a communication latency between the terminal device and the server. Therefore, a time length spent from the user performing the moving operation on the first virtual object to the terminal device receiving the second position is very long. If the positions of the first virtual object and the second virtual object are synchronously updated after the second position is obtained, a longer time length is spent from the user performing the moving operation on the first virtual object to the first virtual object moving to the first position, which in turn leads to a significant latency during the moving process of the first virtual object. Therefore, in this case, the terminal device first renders the first virtual object to the first position without waiting for obtaining the second position.

[0176] Operation 904: The server acquires a relative position parameter corresponding to the second virtual object, determines the second position based on the relative position parameter and the first position, and returns the second position to the terminal device, the relative position parameter indicating a relative position between the first virtual object and the second virtual object during a process of moving with the first virtual object.

[0177] A manner for the server to determine the second position in operation 904 is the same as a manner for the terminal device to determine the second position, which will not be described redundantly here.

[0178] Operation 905: The terminal device renders the second virtual object to the second position in a third picture frame after receiving the second position transmitted by the server, the third picture frame being a picture frame after the second picture frame.

[0179] After the terminal device receives the second position, the first virtual object has been rendered to the first position in the second picture frame. In this case, the terminal device can render the second virtual object to the second position only in the third picture frame after the second picture frame.

[0180] If the user no longer performs the moving operation on the first virtual object after the first virtual object is rendered to the first position, in the third picture frame, the terminal device still renders the first virtual object to the first position. If the user continues to perform the moving operation on the first virtual object after the first virtual object is rendered to the first position, the terminal device determines, according to the current moving operation, a position to which the first virtual object needs to move in the third picture frame, and renders the first virtual object to the position in the third picture frame.

[0181] In this embodiment of this disclosure, when the first virtual object is in the walking state, a moving speed of the first virtual object is relatively low. In this case, the server determines the position to which the second virtual object needs to move with the first virtual object, and the terminal device controls the second virtual object according to the position returned by the server. On the one hand, processing resources of the terminal device are saved; and on the other hand, it can be avoided that computation of the terminal device is erroneous. Besides, unconventional control of the second virtual object by the terminal device is avoided, and the accuracy and conformity of controlling a virtual object to follow a movement are improved.

[0182] FIG. 10 is a flowchart of another method for controlling a virtual object according to an embodiment of this disclosure. As shown in FIG. 10, the method is as follows.

[0183] When a game character is in a walking state, a server computes a second position to which an NPC needs to move, and synchronizes the second position of the NPC to a terminal device. The terminal device controls, according to the second position returned by the server, the NPC to synchronously move with the game character.

[0184] When the game character is in a running state or a flying state, the server computes a third position to which the NPC needs to move, and transmits a first data packet carrying the third position to the terminal device. The terminal device ignores the first data packet transmitted by the server, computes by itself the second position to which the NPC needs to move, and controls, according to the computed second position, the NPC to synchronously move with the game character.

[0185] When the game character exits the running state or the flying state, the server computes the third position to which the NPC needs to move. When the game character stops running or flying, the server transmits a second data packet carrying the third position to the terminal device. The terminal device controls the NPC to quickly move to the third position carried in the second data packet.

[0186] In a related technology, a position of an NPC is computed by a server and notified to the terminal device. After receiving the position of the NPC, the terminal device controls the NPC to move according to the position. Because of a communication latency between the terminal device and the server, a process in which the NPC moves with a game character may have a lag. In addition, when the game character moves quickly, e.g., in the running state or the flying state, a more significant lag may occur in the process of the NPC moving with the game character. The lag accumulates for a long time, causing the NPC to fall behind the game character, affecting player experience.

[0187] However, in the technical solution of this embodiment of this disclosure, when the game character moves slowly, e.g., in the walking state, the position of the NPC is still computed by the server and notified to the terminal device. Because the moving speed is relatively low, it can usually be ensured that the NPC can smoothly follow the pace of the game character without falling behind by a relatively long distance. When the game character moves quickly, e.g., in the running state or the flying state, the position of the NPC is computed by the terminal device itself, thereby avoiding a network latency caused by communication with the server. Thus, it can be ensured that the NPC can still smoothly follow the game character when moving quickly, thereby improving player experience.

[0188] The foregoing embodiment is described by only using the terminal device takeover state and the server takeover state as examples. In another embodiment, the terminal device may alternatively take over all the way. To be specific, no matter which state the first virtual object (the game character) is in, the position of the second virtual object (the NPC) is computed by the terminal device.

[0189] The foregoing embodiment describes the process in which the terminal device and the server collaboratively control the virtual objects. The process in which the terminal device and the server collaboratively control the virtual objects is further described below with reference to FIG. 14.

[0190] In some embodiments, when the position to which the second virtual object needs to move is computed by the terminal device, in order to ensure the accuracy of the control process, the position computed by the terminal device needs to be verified by the server. In this case, the process of controlling a virtual object to move may be divided into the following two cases in the following embodiments of FIG. 11 and FIG. 12.

[0191] FIG. 11 is a flowchart of another method for controlling a virtual object according to an embodiment of this disclosure. This embodiment of this disclosure is performed by a terminal device and a server. Referring to FIG. 11, the method includes the following operations.

[0192] Operation 1101: The terminal device displays a first virtual object that is a virtual object manipulated by a user via the terminal device, and a second virtual object that is a virtual object moving with the first virtual object.

[0193] Operation 1102: The terminal device receives a moving operation inputted by the user for the first virtual object, and determines, based on the moving operation for the first virtual object, a first position to which the first virtual object needs to move in a first picture frame.

[0194] Operation 1103: The terminal device acquires a relative position parameter corresponding to the second virtual object, and determines, based on the relative position parameter and the first position, a second position to which the second virtual object needs to move, the relative position parameter indicating a relative position between the first virtual object and the second virtual object during a process of moving with the first virtual object.

[0195] Operation 1104: The terminal device controls the first virtual object to move to the first position and transmits the second position to the server.

[0196] After computing the second position, the terminal device temporarily does not control the second virtual object to move to the second position, but first transmits the second position to the server for verification.

[0197] Operation 1105: The server verifies the second position and returns a verification result to the terminal device.

[0198] After receiving the second position, the server verifies the second position according to factors such as a current position of the first virtual object, a current position of the second virtual object, a moving speed of the first virtual object, and a moving speed of the second object. For example, if the speed at which the second virtual object moves to the second position is unreasonable, and the second position is not a position to which the second virtual object may move, the verification of the second position fails.

[0199] After determining the verification result, the server returns the verification result to the terminal device. The verification result is configured for indicating whether the verification of the second position is successful. In one embodiment, after the verification result indicates successful verification, the server may further broadcast the second position to terminal devices of other virtual objects, so that the terminal devices of the other virtual objects display the second virtual object at the second position. The other virtual objects are virtual objects controlled by other accounts in the same virtual scene as the first virtual object and the second virtual object.

[0200] Operation 1106: The terminal device controls the second virtual object to move to the second position if the verification result indicates that the verification of the second position is successful.

[0201] If the verification result indicates that the verification of the second position is successful, the second virtual object is controlled to move to the second position.

[0202] Operation 1107: The terminal device controls the second virtual object to move to a third position indicated by the verification result if the verification result indicates that the verification of the second position fails.

[0203] If the verification result indicates that the verification fails, the verification result may further carry the third position to which the second virtual object needs to move, and the terminal device controls the second virtual object to move to the third position indicated by the verification result.

[0204] In this embodiment of this disclosure, when the position to which the second virtual object needs to move is computed by the terminal device, the position computed by the terminal device is verified by the server, and the second virtual object is controlled to move to the position only after the verification is successful. Thus, the accuracy and conformity of the position are guaranteed, thereby improving the accuracy of controlling the virtual object.

[0205] FIG. 12 is a flowchart of another method for controlling a virtual object according to an embodiment of this disclosure. This embodiment of this disclosure is performed by a terminal device and a server. Referring to FIG. 12, the method includes the following operations.

[0206] Operation 1201: The terminal device displays a first virtual object that is a virtual object manipulated by a user via the terminal device, and a second virtual object that is a virtual object moving with the first virtual object.

[0207] Operation 1202: The terminal device receives a moving operation inputted by the user for the first virtual object, and determines, based on the moving operation for the first virtual object, a first position to which the first virtual object needs to move in a first picture frame.

[0208] Operation 1203: The terminal device acquires a relative position parameter corresponding to the second virtual object, and determines, based on the relative position parameter and the first position, a second position to which the second virtual object needs to move, the relative position parameter indicating a relative position between the first virtual object and the second virtual object during a process of moving with the first virtual object.

[0209] Operation 1204: The terminal device transmits the second position to the server.

[0210] Operation 1205: The terminal device controls the first virtual object to move to the first position and the second virtual object to move to the second position.

[0211] In this embodiment of this disclosure, after transmitting the second position to the server and before receiving a verification result returned by the server, the terminal device first controls the second virtual object to move to the second position.

[0212] Operation 1206: The server verifies the second position and returns the verification result to the terminal device.

[0213] 1207: The terminal device corrects the position of the second virtual object to a position indicated by the verification result if the verification result indicates that the verification of the second position fails.

[0214] In this embodiment of this disclosure, when the position to which the second virtual object needs to move is computed by the terminal device, the position computed by the terminal device is verified by the server. In the process of waiting for the verification result, the terminal device first controls the second virtual object to move to the position, and corrects the position of the second virtual object if the verification fails. On the one hand, this helps control the second virtual object to move in time, thereby ensuring that the second virtual object can synchronously move with the first virtual object in time. On the other hand, this helps perform correction in time when a position error occurs, thereby ensuring the accuracy and conformity of the position and improving the accuracy of controlling the virtual objects.

[0215] The method for controlling a virtual object provided in this embodiment of this disclosure may be applied to any scenario in which a virtual object is controlled to automatically follow. For example, the method is applied to a scenario of controlling a game character in a game client. For the process of controlling a virtual object, reference is made to FIG. 13. FIG. 13 is a flowchart of another method for controlling a virtual object according to an embodiment of this disclosure. The method includes the following operations.

[0216] Operation 1301: A terminal device displays a virtual scene in a game client, the virtual scene including a game character that is a virtual character controlled via a user operation, and an NPC that is a virtual character not controlled via a user operation and moving with the game character.

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

[0218] In one embodiment, the virtual character has a skill of summoning an NPC. When the user performs a casting operation on the skill of summoning an NPC, the terminal device determines a display position of the NPC according to a current position of the game character and a relative position parameter, and displays the NPC at the display position. The relative position parameter indicates a relative position between the game character and the NPC during a process of moving with the game character.

[0219] Operation 1302: The terminal device determines, based on a moving operation for the game character, a first position to which the game character needs to move in the virtual scene.

[0220] Operation 1303: The terminal device determines, based on the relative position parameter and the first position, a second position to which the NPC needs to move in the virtual scene.

[0221] Operation 1304: The terminal device controls the game character to move to the first position in the virtual scene and the NPC to move to the second position in the virtual scene.

[0222] FIG. 14 is a schematic structural diagram of an apparatus for controlling a virtual object according to an embodiment of this disclosure. Referring to FIG. 14, the apparatus is applied to a terminal device and includes:

[0223] a display module 1401 configured to display a first virtual object that is a virtual object manipulated by a user via the terminal device, and a second virtual object that is a virtual object moving with the first virtual object;

[0224] a first determination module 1402 configured to receive a moving operation inputted by the user for the first virtual object, and determine, based on the moving operation for the first virtual object, a first position to which the first virtual object needs to move;

[0225] a second determination module 1403 configured to acquire a relative position parameter corresponding to the second virtual object, and determine, based on the relative position parameter and the first position, a second position to which the second virtual object needs to move, the relative position parameter indicating a relative position between the first virtual object and the second virtual object during a process of moving with the first virtual object; and

[0226] a control module 1404 configured to control the first virtual object to move to the first position and the second virtual object to move to the second position.

[0227] According to the apparatus for controlling a virtual object provided in this embodiment of this disclosure, the first virtual object is configured to move according to the manipulation of the terminal device, and the second virtual object is configured to automatically move with the second virtual object. When the moving operation is performed on the first virtual object, the terminal device determines, according to the moving operation, the first position to which the first virtual object needs to move. Before controlling the first virtual object to move, the terminal device further determines, according to the first position and the relative position between the two virtual objects, the second position to which the second virtual object needs to move. Since the second position is determined by the terminal device and would not be affected by a network latency, the time point when the second position is obtained is very close to the time point when the first position is obtained. The terminal device may synchronously move the first virtual object to the first position and move the second virtual object to the second position without causing lagging, so that the second virtual object is controlled to synchronously move with the first virtual object, thereby avoiding lagging or failing to follow in time when the second virtual object moves with the first virtual object, and achieving improved real-time control on the virtual objects.

[0228] In one embodiment, referring to FIG. 15, the relative position parameter includes a relative distance and a relative direction between the second virtual object and the first virtual object; and the second determination module 1403 is configured to:

[0229] determine, based on the first position and the relative direction, a target direction; and

[0230] determine, as the second position, a position at a distance equal to the relative distance from the first position in the target direction.

[0231] In one embodiment, referring to FIG. 15, the second determination module 1403 is configured to:

[0232] determine a first ray that uses the first position as an endpoint and points to a reference direction, the reference direction referring to an opposite direction to a moving direction of the first virtual object; and

[0233] offset the direction to which the first ray points from the relative direction while keeping the endpoint of the first ray unchanged, to obtain a second ray, and determine a direction to which the second ray points as the target direction.

[0234] In one embodiment, referring to FIG. 15, the control module 1404 is configured to:

[0235] control the first virtual object to move to the first position and the second virtual object to move to the second position if a distance between the first position and a position of the second virtual object is greater than a first preset distance.

[0236] In one embodiment, referring to FIG. 15, the control module 1404 is further configured to:

[0237] control the first virtual object to move to the first position and keep the position of the second virtual object unchanged if the distance between the first position and the position of the second virtual object is not greater than the first preset distance.

[0238] In one embodiment, referring to FIG. 15, the control module 1404 is configured to:

[0239] control the first virtual object to move toward the first position; and

[0240] display the second virtual object at the second position if the second virtual object meets a condition for falling behind in following.

[0241] In one embodiment, referring to FIG. 15, the control module 1404 is configured to perform any one of:

[0242] displaying the second virtual object in the second position if a duration during which a distance between the second virtual object and the first virtual object is greater than a second preset distance reaches a preset duration; and

[0243] displaying the second virtual object 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 duration.

[0244] In one embodiment, referring to FIG. 15, the control module 1404 is configured to:

[0245] control the first virtual object to move to the first position within m picture frames; and

[0246] the displaying the second virtual object at the second position if the second virtual object meets a condition for falling behind in following includes:

[0247] rendering the second virtual object to the second position in an nth picture frame if the second virtual object meets the condition for falling behind in following, the nth picture frame being any picture frame after determining that the second virtual object meets the condition for falling behind in following, where m is a positive integer greater than 1 and n is a positive integer not greater than m.

[0248] In one embodiment, referring to FIG. 15, the second position is behind the first position in the moving direction of the first virtual object; and the control module 1404 is configured to:

[0249] determine a reference line that is perpendicular to the moving direction of the first virtual object and includes the second position and determine a number of picture frames through which the first virtual object needs to move to the reference line if the second virtual object meets the condition for falling behind in following; and

[0250] render the second virtual object to the second position in the nth picture frame based on the number of picture frames, where n is a positive integer greater than the number of picture frames and not greater than m.

[0251] In one embodiment, referring to FIG. 15, the second determination module 1403 is configured to:

[0252] determine the second position based on the relative position parameter and the first position if the first virtual object is in a running state or a flying state.

[0253] In one embodiment, referring to FIG. 15, the second determination module 1403 is configured to:

[0254] determine, based on the relative position parameter and the first position, the second position to which the second virtual object needs to move in a first picture frame, after determining the first position to which the first virtual object needs to move in the first picture frame, if the first virtual object is in the running state or the flying state; and

[0255] the control module 1404 is configured to:

[0256] render the first virtual object to the first position in the first picture frame and the second virtual object to the second position in the first picture frame.

[0257] In one embodiment, referring to FIG. 15, the apparatus further includes:

[0258] a transmission module 1405 configured to transmit an updated position of the first virtual object to a server each time a position of the first virtual object is updated, the server being configured to determine, based on the relative position parameter and the updated position of the first virtual object, a third position to which the second virtual object needs to move, and return the third position to the terminal device; and

[0259] the control module 1404 is further configured to acquire the third position most recently returned by the server and control the second virtual object to move to the most recently returned third position if the first virtual object exits the running state or the flying state.

[0260] In one embodiment, referring to FIG. 15, the apparatus further includes:

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

[0262] the transmission module 1405 configured to transmit the first position to the server, the server being configured to determine the second position based on the relative position parameter and the first position, and return the second position to the terminal device;

[0263] a receiving module 1406 configured to receive the second position transmitted by the server; and

[0264] the control module 1404 further configured to control the second virtual object to move to the second position.

[0265] In one embodiment, referring to FIG. 15, the control module 1404 is configured to render the first virtual object to the first position in a second picture frame after determining the first position to which the first virtual object needs to move in the second picture frame if the first virtual object is in the walking state;

[0266] the transmission module 1405 is configured to transmit the first position to a server; and

[0267] the control module 1404 is configured to render the second virtual object to the second position in a third picture frame after receiving the second position transmitted by the server, the third picture frame being a picture frame after the second picture frame.

[0268] In one embodiment, referring to FIG. 15, the apparatus further includes:

[0269] a transmission module 1405 configured to transmit the second position to the server, the server being configured to verify the second position and return a verification result to the terminal device;

[0270] the control module 1404 configured to control the first virtual object to move to the first position;

[0271] the receiving module 1406 configured to receive the verification result; and

[0272] the control module 1404 configured to control the second virtual object to move to the second position if the verification result indicates that verification of the second position is successful.

[0273] In one embodiment, referring to FIG. 15, the apparatus further includes: a transmission module 1405 configured to transmit the second position to the

[0274] server, the server being configured to verify the second position and return a verification result to the terminal device;

[0275] the receiving module 1406 configured to receive the verification result; and

[0276] the control module 1404 configured to correct the position of the second virtual object to a position indicated by the verification result if the verification result indicates that the verification of the second position fails.

[0277] The division of the above-mentioned functional modules of the apparatus for controlling a virtual object provided in the foregoing embodiments is merely used as an example. In practice, the foregoing functions may be allocated to and completed by different functional modules as required. To be specific, an internal structure of a computer device is divided into different functional modules to complete all or some of the functions described above. In addition, the apparatus for controlling a virtual object provided in the foregoing embodiments belongs to the same conception as the embodiments of the method for controlling a virtual object. For a specific implementation process, a reference is made to the method embodiments, and details are not described here again.

[0278] An embodiment of this disclosure further provides a computer device which includes a processor and a memory. The memory has at least one computer program stored therein, and the at least one computer program is loaded and executed by the processor to implement operations performed in the method for controlling a virtual object of the foregoing embodiments.

[0279] In one embodiment, the computer device is provided as a terminal device. FIG. 16 is a schematic structural diagram of a terminal device 1600 according to an example embodiment of this disclosure.

[0280] The terminal device 1600 includes a processor 1601 and a memory 1602.

[0281] The processor 1601 may include one or more processing cores, such as a 4-core processor or an 8-core processor. The processor 1601 may be implemented in at least one hardware form of digital signal processing (DSP), field programmable gate array (FPGA), and programmable logic array (PLA). The processor 1601 may alternatively include a main processor and a coprocessor. The main processor is a processor configured to process data in an awake state, and is also referred to as a central processing unit (CPU). The coprocessor is a low power consumption processor configured to process the data in a standby state. In some embodiments, the processor 1601 may be integrated with a graphics processing unit (GPU). The GPU is configured to be responsible for rendering and drawing content that a display screen needs to display. In some embodiments, the processors 1601 may further include an artificial intelligence (AI) processor. The AI processor is configured to process computing operations related to machine learning.

[0282] The memory 1602 may include one or more computer-readable storage media, which may be non-transitory. The memory 1602 may further include a high-speed random access memory and a non-volatile memory, such as one or more disk storage devices and flash storage devices. In some embodiments, a non-transitory computer-readable storage medium in the memory 1602 is configured to store at least one computer program, and the at least one program is configured to be executed by the processor 1601 to implement the method for controlling a virtual object provided in the method embodiments of this disclosure.

[0283] In some embodiments, the terminal device 1600 may alternatively include a peripheral interface 1603 and at least one peripheral device. The processor 1601, the memory 1602, and the peripheral interface 1603 may be connected via a bus or a signal cable. Each peripheral device may be connected to the peripheral interface 1603 via a bus, a signal cable, or a circuit board. In one embodiment, the peripheral device includes at least one of a radio frequency (RF) circuit 1604, a display screen 1605, a camera assembly 1606, an audio circuit 1607, and a power supply 1608.

[0284] The peripheral interface 1603 can be configured to connect the at least one peripheral device related to input / output (I / O) to the processor 1601 and the memory 1602. In some embodiments, the processor 1601, the memory 1602, and the peripheral interface 1603 are integrated on the same chip or circuit board. In some other embodiments, any one or two of the processor 1601, the memory 1602, and the peripheral interface 1603 may be implemented on an independent chip or circuit board. This is not limited in this embodiment.

[0285] The RF circuit 1604 is configured to receive and transmit an RF signal, which is also referred to as an electromagnetic signal. The RF circuit 1604 communicates with a communication network and other communication devices via the electromagnetic signal. The RF circuit1604 converts an electric signal into an electromagnetic signal for transmission, or converts a received electromagnetic signal into an electric signal. In one embodiment, 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 chip set, a subscriber identity module card, and the like. The RF circuit 1604 may communicate with other devices via at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: a metropolitan area network, generations of mobile communication networks (2G, 3G, 4G, and 5G), a wireless local area network, and / or a Wi-Fi network. In some embodiments, the RF circuit 1604 may further include a near field communication (NFC)-related circuit. This is not limited in the present disclosure.

[0286] The display screen 1605 is configured to display a user interface (UI). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 1605 is a touch display screen, the display screen 1605 is further capable of collecting a touch signal on or above a surface of the display screen 1605. The touch signal may be inputted as a control signal to the processor 1601 for processing. In this case, the display screen 1605 may be further configured to provide a virtual button and / or a virtual keyboard, which is also referred to as a soft button and / or a soft keyboard. In some embodiments, there may be one display screen 1605 disposed on a front panel of the terminal device 1600. In some other embodiments, there are at least two display screens 1605 that are respectively disposed on different surfaces of the terminal device 1600 or in a folded design. In some other embodiments, the display screen 1605 may be a flexible display screen that is disposed on a curved surface or a folded surface of the terminal device 1600. Even, the display screen 1605 may alternatively be set in a non-rectangular irregular shape, namely a special-shaped screen. The display screen 1605 may be manufactured by using materials such as a liquid crystal display (LCD) or an organic light-emitting diode (OLED).

[0287] The camera assembly 1606 is configured to capture images or videos. In one embodiment, the camera assembly 1606 includes a front-facing camera and a rear-facing camera. The front-facing camera is disposed on a front panel of the terminal device 1600, and the rear-facing camera is disposed on a back surface of the terminal device 1600. In some embodiments, there are at least two rear-facing cameras, which are respectively any one of a main camera, a depth-of-field camera, a wide-angle camera, and a telephoto camera, to implement a background blurring function by fusing the main camera and the depth-of-field camera, and panoramic shooting and virtual reality (VR) shooting functions or other fusing shooting functions by fusing the main camera and the wide-angle camera. In some embodiments, the camera assembly 1606 may further include a flash. The flash may be a single color temperature flash or a double color temperature flash. The double color temperature flash is a combination of a warm light flash and a cold light flash, and may be used for light compensation under different color temperatures.

[0288] The audio circuit 1607 may include a microphone and a speaker. The microphone is configured to acquire sound waves of a user and an environment, and convert the sound waves into electrical signals for inputting to the processor 1601 for processing, or inputting to the RF circuit 1604 for implementing voice communication. For the purpose of stereo sound acquisition or noise reduction, there may be a plurality of microphones, which are respectively disposed at different parts of the terminal device 1600. The microphone may alternatively be an array microphone or an omnidirectional acquisition microphone. The speaker is configured to convert electric signals from the processor 1601 or the RF circuit 1604 into sound waves. The speaker may be a thin-film speaker or a piezoelectric ceramic speaker. When the speaker is the piezoelectric ceramic speaker, electric signals can not only be converted into sound waves audible to humans, but also be converted into sound waves inaudible to humans for ranging and other purposes. In some embodiments, the audio circuit 1607 may further include an earphone jack.

[0289] The power supply 1608 is configured to supply power to the components in the terminal device 1600. The power supply 1608 may be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 1608 includes the rechargeable battery, the rechargeable battery supports wired charging or wireless charging. The rechargeable battery may be further configured to support a fast charge technology.

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

[0291] The acceleration sensor 1610 may detect magnitudes of accelerations on three coordinate axes of a coordinate system established by the terminal device 1600. For example, the acceleration sensor 1610 may be configured to detect components of the gravity acceleration on the three coordinate axes. The processor 1601 may control, according to a gravity acceleration signal collected by the acceleration sensor 1610, the display screen 1605 to display the user interface in a landscape view or a portrait view. The acceleration sensor 1610 may be further configured to collect game or user motion data.

[0292] The gyroscope sensor 1611 may detect a body direction and a rotation angle of the terminal device 1600. The gyroscope sensor 1611 may cooperate with the acceleration sensor 1610 to collect a 3D action performed by the user on the terminal device 1600. The processor 1601 may implement the following functions according to the data collected by the gyroscope sensor 1611: motion sensing (such as changing the UI according to a tilt operation of the user), image stabilization at shooting, game control, and inertial navigation.

[0293] The pressure sensor 1612 may be disposed on a side frame of the terminal device 1600 and / or a lower layer of the display screen 1605. When disposed on the side frame of the terminal device 1600, the pressure sensor 1612 may detect a holding signal of the user on the terminal device 1600, and the processor 1601 performs left and right hand recognition or a shortcut operation according to the holding 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 controls an operable control on the UI interface according to a pressure operation of the user on the display screen 1605. The operable control includes at least one of a button control, a scroll bar control, an icon control and a menu control.

[0294] The optical sensor 1613 is configured to collect an ambient light intensity. In an embodiment, the processor 1601 may control display luminance of the display screen 1605 according to the ambient light intensity collected by the optical sensor 1613. In one embodiment, when the ambient light intensity is relatively high, the display luminance of the display screen 1605 is turned up. When the ambient light intensity is relatively low, the display luminance of the display screen 1605 is turned down. In another embodiment, the processor 1601 may further dynamically adjust a camera parameter of the camera assembly 1606 according to the ambient light intensity collected by the optical sensor 1613.

[0295] The proximity sensor 1614, also referred to as a distance sensor, is disposed on the front panel of the terminal device 1600. The proximity sensor 1614 is configured to collect a distance between the user and the front surface of the terminal device 1600. In one embodiment, when the proximity sensor 1614 detects that the distance between the user and the front surface of the terminal device 1600 gradually decreases, the display screen 1605 is controlled by the processor 1601 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 surface of the terminal device 1600 gradually increases, the display screen 1605 is controlled by the processor 1601 to switch from the screen-off state to the screen-on state.

[0296] A person skilled in the art will understand that the structure shown in FIG. 16 constitutes no limitation on the terminal device 1600, and the terminal device may include more or fewer components than those shown in the figure, or some components may be combined, or a different component arrangement may be adopted.

[0297] In one embodiment, the computer device is provided as a server. FIG. 17 is a schematic structural diagram of a server according to an embodiment of this disclosure. The server 1700 may vary greatly due to different configurations or performance, and may include one or more central processing units (CPUs) 1701 and one or more memories 1702, where the memory 1702 has at least one program stored therein, the at least one program being loaded and executed by the CPU 1701 to implement the method provided in the method embodiments described above. Certainly, the server may also have components such as a wired or wireless network interface, a keyboard, and an input / output interface, for input and output. The server may further include other components for implementing the functions of the device, which will not be described redundantly here.

[0298] One or more modules, submodules, and / or units of the apparatus can be implemented by processing circuitry, software, or a combination thereof, for example. The term module (and other similar terms such as unit, submodule, etc.) in this disclosure may refer to a software module, a hardware module, or a combination thereof. A software module (e.g., computer program) may be developed using a computer programming language and stored in memory or non-transitory computer-readable medium. The software module stored in the memory or medium is executable by a processor to thereby cause the processor to perform the operations of the module. A hardware module may be implemented using processing circuitry, including at least one processor and / or memory. Each hardware module can be implemented using one or more processors (or processors and memory). Likewise, a processor (or processors and memory) can be used to implement one or more hardware modules. Moreover, each module can be part of an overall module that includes the functionalities of the module. Modules can be combined, integrated, separated, and / or duplicated to support various applications. Also, a function being performed at a particular module can be performed at one or more other modules and / or by one or more other devices instead of or in addition to the function performed at the particular module. Further, modules can be implemented across multiple devices and / or other components local or remote to one another. Additionally, modules can be moved from one device and added to another device, and / or can be included in both devices.

[0299] The use of “at least one of” or “one of” in the disclosure is intended to include any one or a combination of the recited elements. For example, references to at least one of A, B, or C; at least one of A, B, and C; at least one of A, B, and / or C; and at least one of A to C are intended to include only A, only B, only C or any combination thereof. References to one of A or B and one of A and B are intended to include A or B or (A and B). The use of “one of” does not preclude any combination of the recited elements when applicable, such as when the elements are not mutually exclusive.

[0300] An embodiment of this disclosure further provides a non-transitory computer-readable storage medium having at least one computer program stored therein. The at least one computer program is loaded and executed by a processor to implement operations performed in the method for controlling a virtual object of the foregoing embodiments.

[0301] An embodiment of this disclosure further provides a computer program product, including a computer program that is loaded and executed by a processor to implement operations performed in the method for controlling a virtual object of the foregoing embodiments.

[0302] A person of ordinary skill in the art may understand that all or some of the operations of the foregoing embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware. The program may be stored in a non-transitory computer-readable storage medium. The aforementioned storage medium may be a read-only memory, a magnetic disk, an optical disc, or the like.

[0303] The above descriptions are merely alternative ones of the embodiments of this disclosure, and are not intended to limit the embodiments of this disclosure. Any modification, equivalent replacement, improvement, or the like made within the spirit and principle of the embodiments of this disclosure falls within the scope of this disclosure.

Claims

1. A method for controlling a virtual object in a virtual scene of a game application, the method comprising:displaying a first virtual object that is controlled by a user and a second virtual object that moves with the first virtual object in the virtual scene;receiving a user input associated with a move for the first virtual object;determining, based on the user input, a first position to move the first virtual object to;determining a relative position parameter, wherein the relative position parameter corresponds to a relative position between the first virtual object and the second virtual object while the second virtual object moves with the first virtual object;determining, by processing circuitry based on the relative position parameter and the first position, a second position to move the second virtual object to; andmoving the first virtual object to the first position and the second virtual object to the second position.

2. The method according to claim 1, whereinthe relative position parameter comprises a relative distance and a relative direction between the second virtual object and the first virtual object; andthe determining the second position comprises:determining, based on the first position and the relative direction, a target direction; anddetermining, as the second position, a position at a distance equal to the relative distance from the first position in the target direction.

3. The method according to claim 2, wherein the determining the target direction comprises:determining a first ray that includes the first position as an endpoint and points to a reference direction that corresponds to an opposite direction to a moving direction of the first virtual object;obtaining a second ray based on offsetting the reference direction to which the first ray points from the relative direction while keeping the endpoint of the first ray unchanged; anddetermining a direction to which the second ray points as the target direction.

4. The method according to claim 1, wherein the moving the first virtual object to the first position and the second virtual object to the second position comprises:moving the first virtual object to the first position and the second virtual object to the second position when a distance between the first position and a position of the second virtual object is greater than a first preset distance.

5. The method according to claim 4, further comprising:moving the first virtual object to the first position and maintaining the position of the second virtual object when the distance between the first position and the position of the second virtual object is not greater than the first preset distance.

6. The method according to claim 1, wherein the moving the first virtual object to the first position and the second virtual object to the second position comprises:moving the first virtual object toward the first position; anddisplaying the second virtual object at the second position when the second virtual object meets a condition for following behind.

7. The method according to claim 6, wherein the displaying the second virtual object at the second position comprises at least one of:displaying the second virtual object in the second position when a duration during which a distance between the second virtual object and the first virtual object is greater than a second preset distance reaches a preset duration; ordisplaying the second virtual object at the second position when 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 duration.

8. The method according to claim 6, wherein the moving the first virtual object toward the first position comprises:controlling the first virtual object to move to the first position within m picture frames; andthe displaying the second virtual object at the second position when the second virtual object meets a condition for following behind comprises:rendering the second virtual object at the second position in an nth picture frame when the second virtual object meets the condition for following behind, wherein 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, wherein the rendering the second virtual object at the second position in the nth picture frame comprises:determining a reference line that is perpendicular to a moving direction of the first virtual object and includes the second position;determining a number of picture frames through which the first virtual object moves to the reference line when the second virtual object meets the condition for following behind; andrendering the second virtual object at the second position in the nth picture frame based on the number of picture frames, wherein n is a positive integer greater than the number of picture frames and not greater than m.

10. The method according to claim 1, wherein the determining the second position comprises:determining the second position based on the relative position parameter and the first position when the first virtual object is in a running state or a flying state.

11. The method according to claim 10, wherein the determining the second position based on the relative position parameter and the first position when the first virtual object is in the running state or the flying state comprises:determining, based on the relative position parameter and the first position, the second position to move the second virtual object to in a first picture frame when the first virtual object is in the running state or the flying state; andmoving the first virtual object to the first position and the second virtual object to the second position comprises:rendering the first virtual object at the first position in the first picture frame and the second virtual object at the second position in the first picture frame.

12. The method according to claim 10, further comprising:transmitting an updated position of the first virtual object to a server each time a position of the first virtual object is updated, the server being configured to determine, based on the relative position parameter and the updated position of the first virtual object, a third position to move the second virtual object to, and return the third position to a terminal device executing the game application; andacquiring the third position most recently returned by the server and moving the second virtual object to the most recently returned third position when the first virtual object exits the running state or the flying state.

13. The method according to claim 12, further comprising:moving the first virtual object to the first position and transmitting the first position to the server when the first virtual object is in a walking state, the server being configured to determine the second position based on the relative position parameter and the first position, and return the second position to the terminal device; andreceiving the second position transmitted by the server and moving the second virtual object to the second position.

14. The method according to claim 13, whereinthe first virtual object is rendered at the first position in a second picture frame; andthe second virtual object is rendered at the second position in a third picture frame after the second picture frame.

15. The method according to claim 12, further comprising:transmitting the second position to the server, the server being configured to verify the second position and return a verification result to the terminal device,wherein the moving the first virtual object to the first position and the second virtual object to the second position comprises:moving the first virtual object to the first position;receiving the verification result; andmoving the second virtual object to the second position when the verification result indicates that verification of the second position is successful.

16. The method according to claim 12, further comprising:transmitting the second position to the server, the server being configured to verify the second position and return a verification result to the terminal device;receiving the verification result; andcorrecting the position of the second virtual object to a position indicated by the verification result when the verification result indicates that the verification of the second position fails.

17. An apparatus for controlling a virtual object in a virtual scene of a game application, the apparatus comprising:processing circuitry configured to:display a first virtual object that is controlled by a user and a second virtual object that moves with the first virtual object in the virtual scene;receive a user input associated with a move for the first virtual object;determine, based on the user input, a first position to move the first virtual object to;determine a relative position parameter, wherein the relative position parameter corresponds to a relative position between the first virtual object and the second virtual object while the second virtual object moves with the first virtual object;determine, based on the relative position parameter and the first position, a second position to move the second virtual object to; andmove the first virtual object to the first position and the second virtual object to the second position.

18. The apparatus of claim 17, whereinthe relative position parameter comprises a relative distance and a relative direction between the second virtual object and the first virtual object; andthe processing circuitry is configured to:determine, based on the first position and the relative direction, a target direction; anddetermine, as the second position, a position at a distance equal to the relative distance from the first position in the target direction.

19. The apparatus of claim 18, wherein the processing circuitry is configured to:determine a first ray that includes the first position as an endpoint and points to a reference direction that corresponds to an opposite direction to a moving direction of the first virtual object;obtain a second ray based on offsetting the reference direction to which the first ray points from the relative direction while keeping the endpoint of the first ray unchanged; anddetermine a direction to which the second ray points as the target direction.

20. A non-transitory computer-readable storage medium storing instructions which when executed by a processor cause the processor to perform:displaying a first virtual object that is controlled by a user and a second virtual object that moves with the first virtual object in a virtual scene;receiving a user input associated with a move for the first virtual object;determining, based on the user input, a first position to move the first virtual object to;determining a relative position parameter, wherein the relative position parameter corresponds to a relative position between the first virtual object and the second virtual object while the second virtual object moves with the first virtual object;determining, by processing circuitry based on the relative position parameter and the first position, a second position to move the second virtual object to; andmoving the first virtual object to the first position and the second virtual object to the second position.