Movement control method and device of virtual throwing object, terminal equipment and server
By maintaining the same calculation frame rate between the client and the server, the difference between the client and the server when calculating the motion trajectory of the virtual throwing object is solved, improving the accuracy and fluency of the movement control and improving the user experience.
Patent Information
- Application Number
- CN202410103074.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-24
- Publication Date
- 2025-07-25
AI Technical Summary
There are differences between the client and the server when calculating the motion trajectory of the virtual throwing object, resulting in a decrease in the accuracy of the client's movement control.
By keeping the calculated frame rates between the client and the server consistent, it is ensured that the client and the server use the same frame rate when calculating the motion information of the virtual throwing object, thereby improving the synchronization of the motion trajectory.
It improves the accuracy of the client's movement control of virtual throwing objects, reduces picture delay and lag, and improves user experience.
Smart Images

Figure CN120361541A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the fields of computer and Internet technologies, and particularly to a method, device, terminal device, and server for controlling the movement of virtual projectiles. Background Art
[0002] With the development of computer technology, users have higher and higher requirements for the control experience of virtual elements.
[0003] In related technologies, the client side and the server side respectively calculate and generate the movement trajectory of a virtual projectile. The client controls the movement of the virtual projectile according to the movement trajectory generated by the client side. Among them, the movement trajectory calculated by the server is the standard and correct movement trajectory, and the movement trajectory calculated by the server is used to determine the movement trajectory of the virtual projectile in each client, while the movement trajectory calculated by the client is only used to control the display of the movement of the virtual projectile in this client.
[0004] In the above related technologies, due to the frequent differences in the calculation of the movement trajectory between the client and the server, the movement trajectory of the virtual projectile displayed in the client does not match the standard movement trajectory calculated by the server, thus affecting the accuracy of the client's control of the movement of the virtual projectile. Summary of the Invention
[0005] Embodiments of the present application provide a method, device, terminal device, and server for controlling the movement of virtual projectiles, which can improve the accuracy of the client's control of the movement of virtual projectiles. The technical solutions provided by the embodiments of the present application are as follows:
[0006] According to one aspect of the embodiments of the present application, a method for controlling the movement of a virtual projectile is provided. The method is executed by a first client, and the method includes:
[0007] Obtain the calculation frame rate of the server for the virtual projectile, where the calculation frame rate refers to the frame rate at which the server calculates the movement information of the virtual projectile;
[0008] After the virtual projectile is thrown, calculate the first movement information of the virtual projectile according to the calculation frame rate. The first movement information includes the movement information of the virtual projectile calculated by the first client in at least one frame, and the movement information is used to indicate the position and speed of the virtual projectile;
[0009] Control the movement of the virtual projectile according to the first movement information.
[0010] According to one aspect of the embodiments of the present application, a method for controlling the movement of a virtual projectile is provided. The method is executed by a server, and the method includes:
[0011] Send the calculation frame rate of the server for the virtual projectile to the first client, where the calculation frame rate refers to the frame rate at which the server calculates the motion information of the virtual projectile. The first client is used to calculate the first motion information of the virtual projectile according to the calculation frame rate after the virtual projectile is thrown, and control the movement of the virtual projectile according to the first motion information. Wherein, the first motion information includes the motion information of the virtual projectile calculated by the first client in at least one frame, and the motion information is used to indicate the position and speed of the virtual projectile;
[0012] Calculate the second motion information of the virtual projectile according to the calculation frame rate, where the second motion information includes the motion information of the virtual projectile calculated by the server in at least one frame;
[0013] Send the second motion information to at least one second client.
[0014] According to one aspect of the embodiments of the present application, a mobile control device for a virtual projectile is provided. The device includes:
[0015] A frame rate acquisition module, configured to acquire the calculation frame rate of the server for the virtual projectile, where the calculation frame rate refers to the frame rate at which the server calculates the motion information of the virtual projectile;
[0016] An information calculation module, configured to calculate the first motion information of the virtual projectile according to the calculation frame rate after the virtual projectile is thrown, where the first motion information includes the motion information of the virtual projectile calculated by the first client in at least one frame, and the motion information is used to indicate the position and speed of the virtual projectile;
[0017] A movement control module, configured to control the movement of the virtual projectile according to the first motion information.
[0018] According to one aspect of the embodiments of the present application, a mobile control device for a virtual projectile is provided. The device includes:
[0019] A frame rate sending module, configured to send the calculation frame rate of the server for the virtual projectile to a first client, where the calculation frame rate refers to the frame rate at which the server calculates the motion information of the virtual projectile, and the first client is configured to, after the virtual projectile is thrown, calculate the first motion information of the virtual projectile according to the calculation frame rate, and control the movement of the virtual projectile according to the first motion information, where the first motion information includes the motion information of the virtual projectile calculated by the first client in at least one frame, and the motion information is used to indicate the position and speed of the virtual projectile;
[0020] An information calculation module, configured to calculate the second motion information of the virtual projectile according to the calculation frame rate, where the second motion information includes the motion information of the virtual projectile calculated by the server in at least one frame;
[0021] An information sending module, configured to send the second motion information to at least one second client.
[0022] According to one aspect of the embodiments of the present application, a terminal device is provided, where the terminal device includes a processor and a memory, and a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the method for controlling the movement of the virtual projectile on the first client side as described above.
[0023] According to one aspect of the embodiments of the present application, a server is provided, where the server includes a processor and a memory, and a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the method for controlling the movement of the virtual projectile on the server side as described above.
[0024] According to one aspect of the embodiments of the present application, a computer-readable storage medium is provided, and a computer program is stored in the computer-readable storage medium, and the computer program is loaded and executed by a processor to implement the method for controlling the movement of the virtual projectile on the first client side as described above, or to implement the method for controlling the movement of the virtual projectile on the server side as described above.
[0025] According to one aspect of the embodiments of the present application, a computer program product is provided, and the computer program product includes a computer program, and the computer program is stored in a computer-readable storage medium. The processor of the terminal device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the terminal device executes the method for controlling the movement of the virtual projectile on the first client side as described above, or executes the method for controlling the movement of the virtual projectile on the server side as described above.
[0026] The technical solution provided by the embodiments of the present application may include the following beneficial effects:
[0027] By keeping the calculation frame rates of the virtual projectile on the client side and the server side the same, the calculation result of the movement trajectory of the virtual projectile on the client side can be made to conform as much as possible to the calculation result of the movement trajectory of the virtual projectile on the server side, thereby improving the accuracy of the movement control of the virtual projectile on the client side.
[0028] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit this application. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 is a schematic diagram of the movement trajectory provided by an embodiment of this application;
[0030] Figure 2 is a schematic diagram of the real-time environment of the solution provided by an embodiment of this application;
[0031] Figure 3 is a flowchart of the method for controlling the movement of a virtual projectile provided by an embodiment of this application;
[0032] Figure 4 is a schematic diagram of the throwing screen of a virtual projectile provided by an embodiment of this application;
[0033] Figure 5 is a schematic diagram of the throwing screen of a virtual projectile provided by another embodiment of this application;
[0034] Figure 6 is a flowchart of the method for controlling the movement of a virtual projectile provided by another embodiment of this application;
[0035] Figure 7 is a flowchart of the method for controlling the movement of a virtual projectile provided by another embodiment of this application;
[0036] Figure 8 is a flowchart of the method for controlling the movement of a virtual projectile provided by another embodiment of this application;
[0037] Figure 9 is a block diagram of the device for controlling the movement of a virtual projectile provided by an embodiment of this application;
[0038] Figure 10 is a block diagram of the device for controlling the movement of a virtual projectile provided by another embodiment of this application;
[0039] Figure 11 is a block diagram of the terminal device provided by an embodiment of this application;
[0040] Figure 12 is a block diagram of the server provided by an embodiment of this application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0041] Exemplary embodiments will be described in detail herein, and examples thereof are shown in the accompanying drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of methods consistent with some aspects of the present application as detailed in the appended claims.
[0042] Please refer to Figure 1 , which shows a schematic diagram of a motion trajectory provided by an embodiment of the present application. The magnitude of the calculated frame rate affects the duration of single-frame calculation, and correspondingly also affects the time step of physical motion calculation for each frame, thereby affecting the physical displacement of a single frame. Generally speaking, in order to ensure the display effect of the picture in the client, the client will maintain a relatively high calculated frame rate, so the calculated frame rate of the client is generally higher than that of the server. If the calculated frame rate is high, more position points at different time points can be calculated within the same time period. The motion trajectory is a broken line formed by connecting multiple position points. In some embodiments, the motion trajectory can also be referred to as a motion path, a movement trajectory, a movement path, etc. In some embodiments, according to the motion information of the virtual projectile (for an explanation of the motion information, please refer to the following content), the motion trajectory of the virtual projectile can be obtained. In some embodiments, the motion information of the virtual projectile includes information representing the position of the virtual projectile at the corresponding moments of each calculated frame. Therefore, according to the motion information of the virtual projectile in each calculated frame, the position points corresponding to the virtual projectile at each moment can be determined, and the position points of the virtual projectile can be connected in chronological order to obtain the motion trajectory of the virtual projectile.
[0043] Such as Figure 1As shown, the motion trajectory 11 is the motion trajectory of a virtual projectile calculated by the client, and the motion trajectory 12 is the motion trajectory of the virtual projectile calculated by the server. The calculation frame rate of the client is higher than that of the server. Taking the movement process of the virtual projectile from the first moment to the second moment as an example, due to the lower calculation frame rate of the server and the larger time step in the calculation process, the server can only calculate the positions where the virtual projectile is located at the first moment and the second moment respectively. The movement trajectory between the first moment and the second moment is uncertain, and only the position points at the first moment and the second moment calculated by the server can be connected by a straight line. Therefore, the movement path of the object calculated by the server from the first moment to the second moment is the straight line segment 121; because the calculation frame rate of the client is relatively higher than that of the server and the time step in the calculation process is relatively smaller than that of the server, for the movement process of the virtual projectile from the first moment to the second moment, the client can not only calculate the positions of the virtual projectile at the first moment and the second moment respectively, but also calculate the position of the virtual projectile at the third moment. The third moment is between the first moment and the second moment. Connecting the positions of the virtual projectile calculated by the client at the first moment, the third moment and the second moment in chronological order, a broken-line movement path composed of two intersecting straight line segments is obtained. That is, the movement path of the virtual projectile from the first moment to the second moment calculated by the client is the broken line segment 111.
[0044] It can be seen that the higher the calculation frame rate, the smaller the single-frame displacement, and the smoother the motion trajectory; the lower the calculation frame rate, the larger the single-frame displacement, and the rougher the motion trajectory. Therefore, if the calculation frame rates of the client and the server are different, during the movement of the virtual projectile in the virtual environment, the motion trajectories of the virtual projectile calculated by the client and the server may also be different.
[0045] In view of this, in the technical solution provided by the embodiments of the present application, the client sets the calculation frame rate of the virtual projectile to the calculation frame rate of the server, keeping the calculation frame rates of the client and the server for the virtual projectile the same. In this way, the time steps for the client and the server to calculate the motion trajectory of the virtual projectile will also be the same. For the movement process of the virtual projectile in the same time period, the possibility that the position points of the virtual projectile calculated by the client and the server at each moment are the same will be higher. Therefore, the possibility that the motion trajectories calculated by the client and the server respectively match will also be higher. Since generally the motion trajectory of the virtual projectile calculated by the server is used as the standard motion trajectory, adopting the technical solution provided by the embodiments of the present application can make the motion trajectory calculated by the client as close as possible to the standard motion trajectory, thereby improving the accuracy of the client in controlling the movement of the virtual projectile.
[0046] Please refer to Figure 2, which shows a schematic diagram of the solution implementation environment provided by an embodiment of the present application. This solution implementation environment can be implemented as a mobile control system for virtual projectiles. As Figure 2 shown, the system 200 may include: a first terminal device 13 and a server 14.
[0047] The target application is installed and running in the first terminal device 13, such as the first client of the target application. Optionally, the first user account is logged in to the first client. The user corresponding to the first user account can control or trigger the throwing of the virtual projectile, such as controlling a virtual character or a virtual throwing prop to throw the virtual projectile through the first user account. The terminal device is an electronic device with data computing, processing, and storage capabilities. The terminal device can be a smart phone, a tablet computer, a PC (Personal Computer), a wearable device, a VR (Virtual Reality) device, an AR (Augmented Reality) device, an MR (Mixed Reality) device, etc. The embodiments of the present application do not limit this. The target application can be a game application, such as a shooting game application, a multiplayer gunfight survival game application, a battle royale survival game application, an LBS (Location Based Service) game application, a MOBA (Multiplayer Online Battle Arena) game application, a party game application, etc. The embodiments of the present application do not limit this. The target application can also be any application with the mobile control function of virtual projectiles, such as a social application, a payment application, a video application, a music application, a shopping application, a news application, etc. In the method provided by the embodiments of the present application, the execution subject of each step can be the first terminal device 13, such as the first client running in the first terminal device 13.
[0048] The server 14 is communicatively connected to the first terminal device 13 (such as a network connection). The server 14 is used to provide background services for the target application. The server can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0049] In some embodiments, the system 200 may further include at least one second terminal device 15, in which a target application is installed and running, such as a second client of the target application. Optionally, a second user account is logged in to the second client. In some embodiments, if there are multiple second terminal devices 15, the user accounts logged in to different second terminal devices 15 are different. At least one second client may, through the server, synchronously display the virtual projectiles controlled or triggered by the first user account and their movements. In some embodiments, the server 14 and the second terminal device 15 are communicatively connected (such as a network connection).
[0050] The step content involved in the technical solution provided by the embodiments of the present application can be executed by the interaction between the first client and the server. Among them, the method on the first client side can be executed by the first client, and the method on the server side can be executed by the server 14.
[0051] Next, the technical solution of the present application will be introduced and illustrated through several embodiments.
[0052] Please refer to Figure 3 , which shows a flowchart of a method for controlling the movement of a virtual projectile provided by an embodiment of the present application. In this embodiment, it is illustrated by taking the method as being executed by the first terminal device (such as the first client in the first terminal device) introduced above. The method may include the following steps (310-330):
[0053] Step 310, obtain the calculation frame rate of the server for the virtual projectile, where the calculation frame rate refers to the frame rate at which the server calculates the motion information of the virtual projectile.
[0054] In some embodiments, during a game session, it is necessary to obtain the calculation frame rate of the server for the virtual projectile, where the calculation frame rate refers to the frequency at which the server calculates the motion information of the virtual projectile. In some embodiments, the calculation frame rate can be expressed as how many times it is calculated per unit time. Whatever the calculation frame rate is, it means that the motion information of the virtual projectile is calculated that many times per unit time. Alternatively, the calculation frame rate can also be expressed by a time step, that is, the motion information of the virtual projectile is calculated once every time step. In some embodiments, the calculation frame rate and the time step can be converted into each other through the following formula: time step = 1 / calculation frame rate.
[0055] In some embodiments, the client or server completes the calculation of a calculation frame each time it calculates the motion information of a virtual projectile. For example, if the server calculates the motion information of the virtual projectile at a frame rate of 24 frames per second, it means that the time step for the server to calculate the motion information of the virtual projectile is 1 / 24 seconds, and the server calculates the motion information of the virtual projectile at the corresponding time point every 1 / 24 seconds, and the server needs to calculate the motion information of the virtual projectile 24 times per second. The movement of an object (such as a virtual projectile) in a virtual environment is generally obtained by calculating to simulate the motion situation in the real world as much as possible. Since computer devices (such as terminal devices and servers) can only execute the calculation logic for the motion information after a certain period of time, that is, they are limited by the calculation frame rate, the position of the object can be updated each time the logic is executed. The distance of the object's movement is equal to the product of time and speed. In each calculation frame, by multiplying the current speed and the time interval between two adjacent calculation frames, the displacement of the object in the calculation frame can be obtained, thereby obtaining the new position to which the object should move in the calculation frame. Visualizing the calculation results of each frame can obtain an approximately smooth motion trajectory. Of course, during the calculation process of each frame, some physical judgments and adjustments will be made between the new position and the original position, such as whether a collision occurs, the influence of gravity acceleration, etc. In some embodiments, during the process of the server calculating the motion information of the virtual projectile, the first calculation frame is based on the initial data and the time step to calculate the motion information of the virtual projectile in this frame; from the second calculation frame onwards, each calculation frame can be based on the motion information and time step calculated by the virtual projectile in the previous frame to calculate the motion information of the virtual projectile in this frame.
[0056] In some embodiments, when the first client starts or joins a game, the first client obtains the server's calculated frame rate for the game. In some embodiments, the server's calculated frame rate for the game is the server's calculated frame rate for virtual projectiles, so as long as the server's calculated frame rate for the game is obtained, the server's calculated frame rate for virtual projectiles is obtained. In some embodiments, the server's calculated frame rate for all virtual elements in the game is the same, and the first client receives frame rate information from the server, which is used to represent the server's calculated frame rate for all virtual elements in the game, including virtual projectiles.
[0057] In some embodiments, there are the following two possibilities for when the first client accepts the frame rate calculation synchronously from the server.
[0058] Opportunity 1: In some embodiments, the first client receives the calculated frame rate synchronized by the server every first time interval.
[0059] In some embodiments, the server synchronizes the computing frame rate of the server in real time to the first client and at least one second client participating in the game. That is, every first time interval, the server synchronizes the computing frame rate of the server to all clients in the game. In some embodiments, the second client is different from the first client. The second client refers to a client participating in the same game as the first client or a client that watches the game participated by the first client in real time. In some embodiments, for the computing frame rate of the server for a virtual projectile received at a certain time, if the computing frame rate of the server has not changed within the most recent first time interval, the computing frame rate of the server for the virtual projectile received this time is the same as the previous one received; if the computing frame rate of the server has changed within the most recent first time interval, the computing frame rate of the server for the virtual projectile received this time will be different from the previous one received. In some embodiments, the first time interval can be 1 second, 5 seconds, 10 seconds, 15 seconds, 30 seconds, 1 minute, 5 minutes, etc. Of course, the specific duration of the first time interval can also be other values, which can be specifically set by relevant technical personnel according to the actual situation, and the embodiments of the present application do not make specific limitations in this regard. In this embodiment, the computing frame rate sent by the receiving server at regular time intervals is received, so that it is possible to continuously confirm whether the computing frame rate of the server has changed and obtain the changed computing frame rate in a relatively short time.
[0060] Timing two: In some embodiments, the first client receives the computing frame rate synchronized by the server when the computing frame rate changes.
[0061] In some embodiments, if the computing frame rate of the server does not change, the server will not repeatedly synchronize the computing frame rate to the client; only when the computing frame rate of the server changes, the server will synchronize the computing frame rate to the client to notify each client of the updated frame rate of the server (i.e., the latest computing frame rate of the server). In this embodiment, only when the computing frame rate of the server changes, the server will synchronize its most recent computing frame rate to the client, and will not repeatedly synchronize the computing frame rate to the client at other times, thereby reducing unnecessary information interaction between the server and the client and saving the transmission resources of the server and the client; at the same time, since the computing frame rate of the server is synchronized to the first client as soon as it changes, it is ensured that the first client can obtain the most recent computing frame rate of the server in a timely manner, thereby further ensuring that the calculation result of the movement trajectory of the virtual projectile by the client is as consistent as possible with the calculation result of the movement trajectory of the virtual projectile by the server.
[0062] In some embodiments, a virtual projectile refers to a virtual element in a virtual environment, which can be moved into the air by means such as throwing, tossing, kicking, hitting, ramming, slapping, and striking in the virtual environment presented on a client (such as the first client). In some embodiments, the virtual projectile can be a virtual throwing attack prop, such as a Molotov cocktail, a grenade, a smoke bomb, a flashbang, a tear gas grenade, etc.; the virtual projectile can also be a virtual ball, such as a football, a basketball, a volleyball, a rubber ball, a badminton, a table tennis ball, a hemisphere, a baseball, a golf ball, a billiard ball, etc.; the virtual projectile can also be other virtual elements that can be thrown, such as a virtual pet, a virtual pebble, a virtual beverage bottle, etc. In some embodiments, the specific type of the virtual projectile can be set by those skilled in the relevant art according to the actual situation, and the embodiments of this application do not make specific limitations thereon.
[0063] In some embodiments, the virtual projectile can be generated or refreshed in the first client, and the virtual projectile can be controlled or triggered to be thrown by the first user account. In some embodiments, the virtual projectile can be thrown by a virtual character controlled by the first user account. For example, the virtual character can throw out the virtual projectile by holding it in the hand (such as holding a Molotov cocktail bomb, a virtual pet, etc. and throwing it out); it can also kick out the virtual projectile with the leg or foot (such as kicking out a football); it can also ram out the virtual projectile with body parts such as the shoulder, abdomen, and head (such as ramming out a football); it can also push out the virtual projectile with body parts such as the shoulder, head, and back (such as pushing out a football in the air); it can also pat or hit out the virtual projectile with body parts such as the palm (such as patting out or hitting out a volleyball).
[0064] In some embodiments, the virtual projectile can be thrown by a virtual throwing prop controlled by the first user account, such as a virtual catapult, a virtual slingshot, a virtual trampoline, a virtual ball machine, a virtual racket, etc. In some embodiments, the virtual projectile can be thrown jointly by a virtual character controlled by the first user account and a virtual throwing prop held by the virtual character. For example, the virtual character controlled by the first user account holds a virtual racket or a virtual bat or a virtual club (such as a virtual badminton racket, a virtual table tennis racket, a virtual baseball bat, a virtual golf club, etc.), and by controlling the virtual character to swing the racket, virtual balls such as badminton, table tennis balls, baseballs, and golf balls can be patted out or hit out.
[0065] In some embodiments, the first client can display a virtual environment generated by a target application. The virtual environment can include, but is not limited to, at least one of the following: virtual mountains, virtual deserts, virtual grasslands, virtual forests, virtual oceans, virtual rainforests, virtual snow-capped mountains, virtual towns and villages. The virtual environment can be three-dimensional, two-dimensional, or 2.5-dimensional, and the embodiments of the present application do not make specific limitations thereto. In some embodiments, the virtual environment may further include other virtual elements besides virtual projectiles, such as virtual characters, virtual props (such as virtual attack props, virtual defense props, virtual vehicles, etc.), virtual pets, virtual buildings (such as virtual houses, virtual towers, virtual statues, virtual walls, virtual fences, virtual fountains, etc.), virtual haystacks, virtual stones, virtual furniture (such as virtual tables, chairs, beds, stools, sofas, etc.). In some embodiments, a virtual character refers to a virtual character controlled by a user account in the target application. Taking the target application as a game application as an example, a virtual character refers to a game character controlled by a user account in the game application. In some embodiments, the virtual character can be displayed in a two-dimensional form or a three-dimensional form. Optionally, when the virtual environment where the virtual character is located is a three-dimensional virtual environment, the virtual character can be a three-dimensional solid model created based on animation skeleton technology. The virtual character has its own shape and volume in the three-dimensional virtual environment and occupies a part of the space in the three-dimensional virtual environment. Optionally, the target application can have a function of simulating a real physical environment. In the virtual environment, the movement laws of each virtual element (such as virtual characters, virtual projectiles) conform to or are close to the physical laws of reality.
[0066] Step 320, after the virtual projectile is thrown, according to the calculation frame rate, calculate the first motion information of the virtual projectile. The first motion information includes the motion information of the virtual projectile calculated by the first client in at least one frame, and the motion information is used to indicate the position and speed of the virtual projectile.
[0067] In some embodiments, when the virtual projectile is thrown, the first client generates the virtual projectile and sets the calculation frame rate of the first client for the virtual projectile to the calculation frame rate of the server for the virtual throw; then, the first client calculates the first motion information of the virtual projectile according to the calculation frame rate of the server for the virtual throw. It can be seen that the first motion information is the motion information of the virtual projectile calculated by the first client; the calculation frame rate of the first client for the virtual projectile is consistent with the calculation frame rate of the server for the virtual throw. Since the calculation frame rate of the first client for the virtual projectile is consistent with the calculation frame rate of the server providing background services for the target application, the time step of the motion information of the virtual projectile for the first client and the server is also consistent.
[0068] In some embodiments, the physical laws in the virtual environment simulate or approximate the physical laws of the real environment, such as simulating the mechanical laws and kinematic laws of the real environment. The forces and motions of each virtual element (including virtual projectiles) in the virtual environment follow or approximate the physical laws of the real environment. In some embodiments, after the virtual projectile is thrown, if the virtual projectile only flies in the air and does not collide with virtual elements in the virtual environment, then the virtual projectile will only be affected by gravity in the virtual environment (of course, if air friction is considered, it will also be affected by the frictional force exerted by the air); after the virtual projectile is thrown, if the virtual projectile collides with other virtual elements in the virtual environment, the virtual projectile will receive the forces exerted by other virtual elements and may thus change its motion path.
[0069] In some possible implementation manners, the method further includes:
[0070] 1. Determine the initial motion information of the virtual projectile when it is thrown, where the initial motion information is used to indicate the initial position and initial velocity of the virtual projectile when it is thrown;
[0071] 2. Send the initial motion information to the server, where the server is used to calculate the second motion information of the virtual projectile according to the initial motion information and the calculation frame rate, and the second motion information includes the motion information of the virtual projectile calculated by the server in at least one frame.
[0072] In some embodiments, the first client determines the initial motion information of the virtual projectile. In some embodiments, when the virtual projectile is thrown, it means that the virtual projectile has just detached from the virtual character or virtual throwing prop and has just stopped being affected by the force exerted by the virtual character or virtual throwing prop. Therefore, the initial position of the virtual projectile when it is thrown is the position when the virtual projectile has just detached from the virtual character or virtual throwing prop and has just stopped being affected by the force exerted by the virtual character or virtual throwing prop. Before the virtual projectile is thrown, it will be affected by the force exerted by the virtual character or virtual throwing prop on the virtual projectile and thus obtain an initial velocity. Before the virtual projectile is thrown, the force exerted by the virtual character or virtual throwing prop on the virtual projectile will give the virtual projectile an acceleration in the direction of this force. The initial velocity of the virtual projectile when it is thrown is the velocity when the virtual projectile has just detached from the virtual character or virtual throwing prop and has just stopped being affected by the force exerted by the virtual character or virtual throwing prop. In some embodiments, the velocity (including the initial velocity) of the virtual projectile is a vector. Therefore, the velocity of the virtual projectile includes the moving speed and moving direction of the virtual projectile.
[0073] In some embodiments, after obtaining the initial motion information of the virtual projectile when it is thrown, the first client can calculate the position and velocity of the virtual projectile in each calculation frame based on the initial motion information, that is, calculate the first motion information of the virtual projectile in each calculation frame.
[0074] In some embodiments, the initial motion information of the virtual projectile is also synchronized by the first client to the server. The first client and the server calculate the position and velocity of the virtual projectile in each calculation frame based on the same initial motion information and calculation frame rate. Among them, the position and velocity of the virtual projectile calculated by the first client in each calculation frame are the first motion information, and the position and velocity of the virtual projectile calculated by the server in each calculation frame are the second motion information. Obviously, in the process of calculating the motion information of the virtual projectile by the first client and the server, the initial motion information and the calculation frame rate used are the same, and the calculation rules (such as calculation formulas, parameters, coefficients, etc.) used by the first client and the server to calculate the motion information of the virtual projectile are also the same, so as to increase the probability that the calculation result of the motion trajectory of the virtual projectile by the client is consistent with that of the server, thereby improving the accuracy of the movement control of the virtual projectile.
[0075] Step 330, control the virtual projectile to move according to the first motion information.
[0076] In some embodiments, after calculating the first motion information of the virtual projectile, the first client controls the virtual projectile to move according to the first motion information calculated by itself. In the technical solution provided by the embodiments of the present application, there is no need to control the virtual projectile to move according to the motion information calculated and sent by the server in real time. Instead, the motion information of the virtual projectile is calculated locally on the client, and the virtual projectile is controlled to move according to the motion information of the virtual projectile calculated locally on the client, thereby avoiding the delay problem caused by the unstable communication connection (such as unstable network connection) between the client and the server, and improving the fluency of the movement control of the virtual projectile in the client; reducing the situation of screen delay and screen freezing after the virtual projectile is thrown, improving the fluency of the client screen, and also improving the user's control experience of the virtual projectile.
[0077] In some embodiments, during or after the movement of the virtual projectile, the movement path of the virtual projectile between the throw point and the landing point is displayed. In some embodiments, the landing point refers to the final landing point of the virtual projectile, that is, the position point where it finally stops or explodes. In some embodiments, during or after the movement of the virtual projectile, the landing point of the virtual projectile is indicated. In some embodiments, the landing point refers to the intermediate landing point (which can also be called the collision point) of the virtual projectile during its movement. After the virtual projectile moves to the intermediate landing point, it can bounce back and then fall or hit another position point (if it bounces vertically upward, it will fall back to the original position point). In some embodiments, there can be only one intermediate landing point of the virtual projectile, or there can be multiple intermediate landing points. In this embodiment, by visualizing the movement path or landing point of the virtual projectile, it helps the user learn, adjust, and optimize the throwing skills of the virtual projectile, such as adjusting the throwing posture, throwing angle, throwing force, throwing direction, etc., thereby further enhancing the user's throwing experience and gaming experience of the virtual projectile.
[0078] In some embodiments, the first motion information can be used to represent the position of the virtual projectile calculated by the first client in each calculation frame. The positions of the virtual projectile calculated in each calculation frame are connected in sequence, and thus the motion trajectory of the virtual projectile calculated by the first client is obtained. As introduced above, the motion trajectory is related to the calculation frame rate (or time step). In the embodiments of the present application, the calculation frame rate of the first client and the server for the virtual projectile is kept consistent, and the time step for each calculation is also the same. After obtaining the initial motion information of the virtual projectile or the motion information of the previous calculation frame, the first client and the server can calculate the motion information corresponding to the current calculation frame according to the same time step. In this way, the motion information of the virtual projectile calculated by the first client and the server in the current calculation frame is also the same. By analogy, the motion information of the virtual projectile calculated by the first client and the server in each calculation frame is the same. Then, the positions of each calculation frame obtained by the first client and the server based on the motion information (that is, the positions at the moments corresponding to each calculation frame) are also the same. Further, the motion trajectories of the virtual projectile obtained by the first client and the server respectively are of course the same.
[0079] In summary, the technical solution provided by the embodiments of the present application, by keeping the calculation frame rates of the client and the server for the virtual projectile the same, enables the calculation result of the motion trajectory of the virtual projectile by the client to be as consistent as possible with the calculation result of the motion trajectory of the virtual projectile by the server, thereby improving the accuracy of the client's movement control of the virtual projectile.
[0080] In addition, in the technical solution provided by the embodiments of the present application, it is not necessary to control the movement of the virtual projectile according to the movement information calculated and sent by the server in real time. Instead, the movement information of the virtual projectile is calculated locally on the client side, and the movement of the virtual projectile is controlled according to the movement information of the virtual projectile calculated locally on the client side, thereby avoiding the delay problem caused by unstable communication connection (such as unstable network connection) between the client and the server, and improving the fluency of the movement control of the virtual projectile in the client; reducing the situation of picture delay and picture jitter after the virtual projectile is thrown, improving the fluency of the client picture, and also improving the user's control experience of the virtual projectile.
[0081] In some embodiments, if the calculation frame rates of the first client and the server for the virtual projectile are different, then, there may be a situation as Figure 4 shown: After the virtual character throws the virtual projectile (such as a Molotov cocktail), according to the movement path 16 of the virtual projectile calculated by the first client, the virtual projectile will successfully fly over the table 17 and land at the position 18 desired by the user.
[0082] However, due to different calculation frame rates, there will be some deviations in the movement information of the virtual projectile between the first client and the server at a certain time point, as Figure 5 shown. According to the movement path 19 of the virtual projectile calculated by the server, the virtual projectile cannot fly over the table 17, but will collide with the table 17 and bounce back to the vicinity of the virtual character 20 along the movement path 19, and it is very likely to accidentally injure the virtual character 20 (such as reducing the health value of the virtual character 20). In this case, since the picture shown by the first client is as Figure 4 shown, it is very difficult for the virtual character 20 to avoid the rebounding virtual projectile.
[0083] By adopting the technical solution provided by the embodiments of the present application, by keeping the calculation frame rates of the client and the server for the virtual projectile the same, the probability that the calculation result of the movement trajectory of the virtual projectile by the client is consistent with that of the server is increased. Even if an attack-type virtual projectile such as a Molotov cocktail rebounds back to the vicinity of the virtual character, the picture of the rebounding virtual projectile will be displayed in time on the client side, so that the virtual character is very likely to avoid the rebounding virtual projectile in time, thereby enhancing the user's control experience of the virtual character.
[0084] In some embodiments, as Figure 6 shown, the method for controlling the movement of the virtual projectile provided by the embodiments of the present application may further include the following steps (610-680):
[0085] Step 610, the server synchronizes the calculation frame rate of the server to the first client and at least one second client in real time.
[0086] In some embodiments, the computing frame rate of the server is the computing frame rate of the server for the virtual projectile.
[0087] Step 620, in response to an instruction to use the virtual projectile, the first client synchronizes the initial motion information of the virtual projectile to the server.
[0088] In some embodiments, when the virtual projectile is thrown, the first client generates an instruction to use the virtual projectile. In some embodiments, when the virtual projectile is thrown or after the virtual projectile is thrown, the first client obtains the initial motion information of the virtual projectile and synchronizes the initial motion information of the virtual projectile to the server.
[0089] Step 630, the first client generates a virtual projectile based on the initial motion information.
[0090] In some embodiments, the first client generates a virtual projectile and assigns the initial motion information to the virtual projectile.
[0091] Step 640, the server generates a virtual projectile based on the initial motion information.
[0092] In some embodiments, the server generates a virtual projectile with the initial motion information based on the initial motion information.
[0093] Step 650, the server synchronizes the initial motion information of the virtual projectile to at least one second client.
[0094] Step 660, each of the at least one second clients synchronously generates a virtual projectile according to the initial motion information.
[0095] In some embodiments, each of the at least one second clients generates a virtual projectile with the initial motion information based on the initial motion information.
[0096] Step 670, the first client sets the computing frame rate of the motion component of the virtual projectile to the computing frame rate of the server.
[0097] In some embodiments, the motion component in the first client is the component in the first client for calculating the motion information of the virtual projectile, and the motion component in the first client can be synchronously generated by the first client when generating the virtual projectile.
[0098] In some embodiments, after the computing frame rate of the motion component in the first client is set to the computing frame rate of the server, the first client calculates the motion information of the virtual projectile at the computing frame rate of the server through the motion component and controls the movement of the virtual projectile based on the motion information.
[0099] Step 680, at least one second client respectively sets the calculation frame rate of the motion component of the virtual projectile to the calculation frame rate of the server.
[0100] In some possible implementation manners, the method further includes the following steps:
[0101] 1. The first client receives the third motion information sent by the server, where the third motion information includes the motion information of the virtual projectile calculated by the server in at least one frame;
[0102] 2. The first client compares the third motion information with the first motion information;
[0103] 3. When the motion information of the first calculation frame in the first motion information is different from the motion information of the third calculation frame in the third motion information, the first client replaces the motion information of the first calculation frame in the first motion information with the motion information of the third calculation frame to obtain the corrected motion information of the first calculation frame, where the third calculation frame and the first calculation frame are calculation frames at the same moment;
[0104] 4. Based on the corrected motion information of the first calculation frame, calculate the motion information of the calculation frames after the first calculation frame of the virtual projectile according to the calculation frame rate.
[0105] In some embodiments, after receiving the third motion information sent by the server, the first client compares the third motion information with the first motion information. If the comparison result is consistent, the first client does not need to correct the relevant data of the virtual projectile in the first client.
[0106] In some embodiments, although the initial motion information and the calculation frame rate used by the first client and the server in the process of calculating the motion information of the virtual projectile are the same, during the calculation process, the position or speed of the virtual projectile may be a floating-point number, so floating-point operations will inevitably occur in the calculation. It is difficult to ensure that the calculation of floating-point numbers is exactly the same on different platforms and different devices. This results in the motion trajectories of the virtual projectiles calculated by the first client and the server may still be inconsistent. If there are inconsistent parts in the comparison result, the relevant data of the virtual projectile in the first client needs to be corrected, and the first client needs to calculate the motion information of the calculation frames after the inconsistent calculation frames according to the corrected motion information.
[0107] In some embodiments, when the motion information of each calculation frame included in the third motion information is the same as the motion information of the corresponding calculation frame in the first motion information, it indicates that for these calculation frames, the calculation results of the first client and the server are both consistent, and the comparison between the third motion information and the first motion information is correct. It also indicates that in these calculation frames, the moving trajectory calculated by the server is the same as the moving trajectory calculated by the first client, and the first client does not need to correct the relevant data and information of the virtual projectile.
[0108] In some embodiments, when there are differences between the motion information of each calculation frame included in the third motion information and the motion information of the corresponding calculation frame in the first motion information, it indicates that there is a deviation between the moving path of the virtual projectile calculated by the first client and the moving path of the virtual projectile calculated by the server. Since in the embodiments of the present application, the actual motion information and moving path of the virtual projectile are based on the calculation results of the server, the first client needs to correct the relevant data in the first client in a timely manner, delete the motion information of the calculation frames (such as the first calculation frame) and the subsequent calculation frames that do not match the third motion information in the first client, and calculate the motion information of the calculation frames after the non-matching calculation frames according to the corrected motion information. For example, if the motion information of the first calculation frame in the first motion information is different from the motion information of the third calculation frame in the third motion information, the first client replaces the motion information of the first calculation frame in the first motion information with the motion information of the third calculation frame to obtain the corrected motion information of the first calculation frame. Among them, the motion information of the first calculation frame and the subsequent calculation frames in the original first motion information need to be deleted.
[0109] In the above implementation, the first client compares the third motion information with the first motion information, and corrects in a timely manner the part of the first motion information calculated by the first client that does not match the third motion information calculated by the server, so as to ensure as much as possible that the motion information and moving path of the virtual projectile calculated by the first client are consistent with those calculated by the server, thereby improving the accuracy of the moving control of the virtual projectile.
[0110] In some embodiments, the third motion information is part or all of the second motion information. In some embodiments, the motion information of each calculation frame in the second motion information in the server will be sent by the server to the first client as the third motion information for comparison with the first motion information. In this embodiment, each calculation frame is compared, which ensures the timeliness of correcting the motion information with calculation deviation in the first client.
[0111] In some embodiments, the motion information of every second computing frame is extracted as the third motion information, which not only ensures the timeliness of correcting the motion information with calculation deviation in the first client, but also saves the signaling overhead between the server and the client, and saves the processing resources and processing efficiency of the client.
[0112] In some embodiments, the second time interval is the duration of n computing frames, where n is a positive integer. n can be positive integers such as 1, 2, 3, 5, 10, 20, 23, 35, 47, etc., and the embodiments of the present application do not make specific limitations on this.
[0113] In some embodiments, the third motion information includes the motion information of at least one key frame. A key frame refers to a computing frame in which the server determines that the virtual projectile contacts a virtual element in the virtual environment; comparing the third motion information with the first motion information includes: comparing the motion information of the key frame with the motion information of the corresponding computing frame in the first motion information.
[0114] In some embodiments, the third motion information refers to the motion information of key frames, and the number of key frames can be multiple. In some embodiments, if the server calculates that the virtual projectile contacts a virtual element in the virtual environment, the corresponding computing frame belongs to a key frame.
[0115] In some embodiments, the situation where the calculation results of the motion information of the virtual projectile by the client and the server do not match basically occurs when the virtual projectile contacts a virtual element. That is, it is easy for the first client and the server to have deviations in the calculation of the motion information of key frames such as collisions. Therefore, only the motion information of the key frames determined by the server can be used as the third motion information to be compared with the first motion information calculated by the first client. In the above embodiments, since the number of key frames is generally much less than the total number of computing frames, compared with comparing each frame, while ensuring the timeliness of correcting the motion information with calculation deviation in the first client, it also saves the signaling overhead between the server and the client, and saves the processing resources and processing efficiency of the client.
[0116] In some embodiments, the motion information of the key frame includes at least one of the following: collision point information, stop point information. In some embodiments, the collision point information includes at least one of the following: the collision position, collision speed, and collision attitude corresponding to the computing frame when the virtual projectile collides with the virtual element. In some embodiments, the stop point information includes at least one of the following: the stop position, stop speed, and stop attitude corresponding to the computing frame when the virtual projectile stops.
[0117] In some embodiments, the key frame may be the calculation frame in which a virtual projectile collides with a virtual element, such as when the virtual projectile collides with virtual walls, stones, tables, chairs, beds, stools, sofas, etc. The motion information of the calculation frame after the collision and then leaving the collision point can be referred to as collision point information.
[0118] In some embodiments, the key frame may also be the calculation frame in which the virtual projectile stops moving, such as stopping at positions on the ground, roof, inside a virtual vehicle, etc. The final landing point of the virtual projectile can be referred to as the stop point, and the motion information of the corresponding calculation frame can be referred to as stop point information. In some embodiments, if the virtual projectile is an explosive such as a grenade, the stop point may also be the position where it explodes. The virtual projectile may still have a certain speed before the explosion, so the stop speed of the virtual projectile may be 0 or may not be 0.
[0119] In some embodiments, for the motion information of the key frame, only the positions of each key frame may be compared, that is, the collision position or stop position in the key frame determined by the server is compared with the position of the virtual projectile in the calculation frame corresponding to the first motion information calculated by the client. If they are the same, it means that the key position points calculated by the first client and the server are the same, and the movement trajectories are the same or substantially the same. In this case, it generally has little impact on the time and position of the final stop or explosion of the virtual projectile, and the motion information can be considered to be in agreement. This embodiment reduces the amount of comparison data, saves the signaling overhead between the server and the client, and saves the processing resources and comparison efficiency of the client.
[0120] In some embodiments, for the motion information of the key frame, only the speeds of each key frame may be compared, that is, the collision speed or stop speed in the key frame determined by the server is compared with the speed of the virtual projectile in the calculation frame corresponding to the first motion information calculated by the client (including comparing the magnitude of the rate and the direction of the speed). If they are the same, it means that the speeds of the key position points calculated by the first client and the server are the same. In this case, it generally has little impact on the time and position of the final stop or explosion of the virtual projectile, and the motion information can be considered to be in agreement. This embodiment reduces the amount of comparison data, saves the signaling overhead between the server and the client, and saves the processing resources and comparison efficiency of the client.
[0121] In some embodiments, after the virtual projectile is generated separately in the first client and the server, on the first client and the server, each has an array for recording the position and velocity of the virtual projectile at key frames; when the server or the first client calculates that the virtual projectile collides or stops, the position and velocity information of the collision point or stop point is added to their respective arrays. If the data in the server's array changes, the server synchronizes the data of the array to the first client; after the first client receives the data of the synchronized array from the server, starting from the first element of each frame of data in the server's array, it compares each data with the data of the key frames locally recorded in the array on the first client one by one. If each node (i.e., each key frame) is the same as the server's, it means that the motion information calculated by the first client is correct; if it is found that there are different data, all the data in the local array on the first client after this node (such as the above-mentioned first calculation frame) is deleted, the data of this node is corrected to the data of the corresponding calculation frame in the server's array, and at the same time, according to the corrected data (i.e., the corrected motion information), the position and velocity of the virtual projectile in the first client are set to obtain the corrected position and velocity of the virtual projectile. After that, the first client calculates the motion information of the subsequent calculation frames according to the corrected position and velocity of the virtual projectile.
[0122] In some embodiments, as Figure 7 shown, the method for controlling the movement of the virtual projectile may further include the following steps (710 - 770):
[0123] Step 710, the first client records the collision point information calculated by the first client.
[0124] In some embodiments, when the first client calculates that the virtual projectile collides with a virtual element, it records the motion information of the corresponding calculation frame as the collision point information in the first array.
[0125] Step 720, the server records the collision point information calculated by the server.
[0126] In some embodiments, when the server calculates that the virtual projectile collides with a virtual element, it records the motion information of the corresponding calculation frame as the collision point information in the second array.
[0127] Step 730, the server synchronizes the collision point information calculated by the server to the first client.
[0128] In some embodiments, when there is a data change (such as adding data) in the second array in the server, the server synchronizes the second array to the first client.
[0129] Step 740: The first client compares the collision point information calculated by the first client with the collision point information calculated by the server.
[0130] In some embodiments, the first client compares the data in the first array locally with the data in the second data from the server element by element.
[0131] Step 750: If the collision point information calculated by the first client is the same as the collision point information calculated by the server, the first client continues to execute the above-mentioned step 710.
[0132] In some embodiments, if the first array and the second array are exactly the same, it means that the calculation of the first client has no problem currently, and then the first client continues to execute the above-mentioned step 710.
[0133] Step 760: If there are differences between the collision point information calculated by the first client and the collision point information calculated by the server, the first client deletes the data in the first client that is different from the collision point information calculated by the server.
[0134] In some embodiments, if there are different data between the first array and the second array, the first client deletes the data corresponding to the calculation frames with different data and the subsequent calculation frames in the first array.
[0135] Step 770: The first client corrects and sets the motion information of the virtual projectile to the collision point information calculated by the server in the corresponding calculation frame.
[0136] In some embodiments, the first client sets the position and velocity of the first calculation frame with different data in the first array to the position and velocity of the corresponding calculation frame in the second array to obtain the corrected position and velocity of this calculation frame. After that, based on the corrected position and velocity of this calculation frame, starting from this calculation frame, the first client calculates the subsequent motion information of the virtual projectile.
[0137] In the above implementation, by comparing the third motion information and the first motion information, the part of the first motion information calculated by the first client that does not match the third motion information calculated by the server is corrected in a timely manner, so as to ensure as much as possible that the motion information and movement path of the virtual projectile calculated by the first client are consistent with those calculated by the server, thereby improving the accuracy of the movement control of the virtual projectile.
[0138] Please refer to Figure 8, which shows a flowchart of a method for controlling the movement of a virtual projectile provided by another embodiment of the present application. In this embodiment, it is exemplified that the method is applied to the server introduced above. The method may include the following steps (810-830):
[0139] Step 810, send the calculation frame rate of the server for the virtual projectile to the first client. The calculation frame rate refers to the frame rate at which the server calculates the motion information of the virtual projectile. The first client is used to calculate the first motion information of the virtual projectile according to the calculation frame rate after the virtual projectile is thrown, and control the movement of the virtual projectile according to the first motion information. Among them, the first motion information includes the motion information of the virtual projectile calculated by the first client in at least one frame, and the motion information is used to indicate the position and speed of the virtual projectile.
[0140] In some embodiments, the server will send the calculation frame rate of the server for the virtual projectile to the first client, so that the calculation frame rate of the first client for the virtual projectile is consistent with that of the server.
[0141] In some embodiments, the calculation frame rate is synchronized to the first client every first time interval.
[0142] In some embodiments, when the calculation frame rate changes, the calculation frame rate is synchronized to the first client.
[0143] Step 820, calculate the second motion information of the virtual projectile according to the calculation frame rate. The second motion information includes the motion information of the virtual projectile calculated by the server in at least one frame.
[0144] In some embodiments, step 820 may further include the following steps:
[0145] 1. Receive the initial motion information synchronized by the first client. The initial motion information is used to indicate the initial position and initial speed of the virtual projectile when it is thrown;
[0146] 2. Calculate the second motion information according to the initial motion information and the calculation frame rate.
[0147] Step 830, send the second motion information to at least one second client.
[0148] In some embodiments, the method further includes: sending third motion information to the first client, where the third motion information includes the motion information of the virtual projectile calculated by the server in at least one frame; wherein, the third motion information is used to compare with the first motion information, and in the case that the motion information of the first calculation frame in the first motion information is different from the motion information of the third calculation frame in the third motion information, replacing the motion information of the first calculation frame in the first motion information with the motion information of the third calculation frame to obtain the corrected motion information of the first calculation frame, the third calculation frame and the first calculation frame are calculation frames at the same moment, and the corrected motion information of the first calculation frame is used to calculate the motion information of the virtual projectile in the calculation frames after the first calculation frame.
[0149] In some embodiments, the third motion information includes the motion information of at least one key frame, and the key frame refers to the calculation frame when the server determines that the virtual projectile contacts a virtual element in the virtual environment. In some embodiments, the motion information of the key frame is used to compare with the motion information of the corresponding calculation frame in the first motion information.
[0150] In some embodiments, the motion information of the key frame includes at least one of the following: collision point information, stop point information; the collision point information includes at least one of the following: the collision position, collision speed, and collision attitude corresponding to the calculation frame when the virtual projectile collides with the virtual element; the stop point information includes at least one of the following: the stop position, stop speed, and stop attitude corresponding to the calculation frame when the virtual projectile stops.
[0151] For Figure 8 the explanations of the steps of the embodiments, reference can be made to the above Figure 3 content of the embodiments, which will not be elaborated here.
[0152] In summary, the technical solution provided by the embodiments of the present application, by keeping the calculation frame rates of the virtual projectile by the client and the server the same, enables the calculation result of the motion trajectory of the virtual projectile by the client to be as consistent as possible with the calculation result of the motion trajectory of the virtual projectile by the server, thereby improving the accuracy of the client's movement control of the virtual projectile.
[0153] The following is an embodiment of the device of the present application, which can be used to execute the method embodiment of the present application. For the details not disclosed in the embodiment of the device of the present application, please refer to the method embodiment of the present application.
[0154] Please refer to Figure 9, which shows a block diagram of a mobile control device for a virtual projectile provided by an embodiment of the present application. The device has the function of implementing the above-mentioned method for controlling the movement of the virtual projectile on the first client side. This function can be implemented by hardware or by hardware executing corresponding software. The device can be the first terminal device introduced above or can be provided on the first terminal device. The device 900 may include: a frame rate acquisition module 910, an information calculation module 920, and a movement control module 930.
[0155] The frame rate acquisition module 910 is configured to acquire the calculation frame rate of the server for the virtual projectile, where the calculation frame rate refers to the frame rate at which the server calculates the motion information of the virtual projectile.
[0156] The information calculation module 920 is configured to, after the virtual projectile is thrown, calculate the first motion information of the virtual projectile according to the calculation frame rate. The first motion information includes the motion information of the virtual projectile calculated by the first client in at least one frame, and the motion information is used to indicate the position and speed of the virtual projectile.
[0157] The movement control module 930 is configured to control the movement of the virtual projectile according to the first motion information.
[0158] In some embodiments, the device further includes: an information determination module and an information sending module.
[0159] The information determination module is configured to determine the initial motion information of the virtual projectile when it is thrown, and the initial motion information is used to indicate the initial position and initial speed of the virtual projectile when it is thrown.
[0160] The information sending module is configured to send the initial motion information to the server, and the server is configured to calculate the second motion information of the virtual projectile according to the initial motion information and the calculation frame rate. The second motion information includes the motion information of the virtual projectile calculated by the server in at least one frame.
[0161] In some embodiments, the device further includes: an information receiving module, an information comparison module, and an information replacement module.
[0162] The information receiving module is configured to receive the third motion information sent by the server, and the third motion information includes the motion information of the virtual projectile calculated by the server in at least one frame.
[0163] The information comparison module is configured to compare the third motion information with the first motion information.
[0164] The information replacement module is configured to replace the motion information of the first calculation frame in the first motion information with the motion information of the third calculation frame in the third motion information when the motion information of the first calculation frame in the first motion information is different from the motion information of the third calculation frame in the third motion information, so as to obtain the corrected motion information of the first calculation frame, where the third calculation frame and the first calculation frame are calculation frames at the same moment.
[0165] The information calculation module 920 is further configured to calculate the motion information of the calculation frames after the first calculation frame of the virtual projectile based on the corrected motion information of the first calculation frame according to the calculation frame rate.
[0166] In some embodiments, the device further includes: the third motion information includes the motion information of at least one key frame, and the key frame refers to the calculation frame when the server determines that the virtual projectile contacts a virtual element in the virtual environment; the information comparison module is configured to: compare the motion information of the key frame with the motion information of the corresponding calculation frame in the first motion information.
[0167] In some embodiments, the motion information of the key frame includes at least one of the following: collision point information, stop point information;
[0168] The collision point information includes at least one of the following: the collision position, collision speed, and collision attitude corresponding to the calculation frame when the virtual projectile collides with the virtual element;
[0169] The stop point information includes at least one of the following: the stop position, stop speed, and stop attitude corresponding to the calculation frame when the virtual projectile stops.
[0170] In some embodiments, the frame rate acquisition module 910 is configured to:
[0171] Receive the calculation frame rate synchronously sent by the server at every first time interval; or, receive the calculation frame rate synchronously sent by the server when the calculation frame rate changes.
[0172] In summary, the technical solution provided by the embodiments of the present application makes the calculation result of the motion trajectory of the virtual projectile by the client as consistent as possible with the calculation result of the motion trajectory of the virtual projectile by the server by keeping the calculation frame rates of the virtual projectile by the client and the server the same, thereby improving the accuracy of the client's movement control of the virtual projectile.
[0173] Please refer to Figure 10, which shows a block diagram of a mobile control device for a virtual projectile provided by another embodiment of the present application. The device has the functions of implementing the method example for controlling the movement of the virtual projectile on the server side, and the functions can be implemented by hardware or by hardware executing corresponding software. The device can be the server introduced above or can be set on the server. The device 1000 may include: a frame rate sending module 1010, an information calculation module 1020, and an information sending module 1030.
[0174] The frame rate sending module 1010 is configured to send the calculation frame rate of the server for the virtual projectile to a first client. The calculation frame rate refers to the frame rate at which the server calculates the motion information of the virtual projectile. The first client is configured to, after the virtual projectile is thrown, calculate the first motion information of the virtual projectile according to the calculation frame rate, and control the movement of the virtual projectile according to the first motion information. Wherein, the first motion information includes the motion information of the virtual projectile calculated by the first client in at least one frame, and the motion information is used to indicate the position and speed of the virtual projectile.
[0175] The information calculation module 1020 is configured to calculate the second motion information of the virtual projectile according to the calculation frame rate. The second motion information includes the motion information of the virtual projectile calculated by the server in at least one frame.
[0176] The information sending module 1030 is configured to send the second motion information to at least one second client.
[0177] In some embodiments, the information calculation module 1020 is configured to:
[0178] Receive the initial motion information synchronized by the first client, where the initial motion information is used to indicate the initial position and initial speed of the virtual projectile when it is thrown;
[0179] Calculate the second motion information according to the initial motion information and the calculation frame rate.
[0180] In some embodiments, the information sending module 1030 is further configured to send third motion information to the first client, where the third motion information includes the motion information of the virtual projectile calculated by the server in at least one frame; wherein, the third motion information is used to compare with the first motion information, and when the motion information of the first calculation frame in the first motion information is different from the motion information of the third calculation frame in the third motion information, replace the motion information of the first calculation frame in the first motion information with the motion information of the third calculation frame to obtain the corrected motion information of the first calculation frame, the third calculation frame and the first calculation frame are calculation frames at the same moment, and the corrected motion information of the first calculation frame is used to calculate the motion information of the virtual projectile in the calculation frames after the first calculation frame.
[0181] In some embodiments, the third motion information includes the motion information of at least one key frame, and the key frame refers to the calculation frame when the server determines that the virtual projectile contacts a virtual element in the virtual environment; the comparing the third motion information with the first motion information includes: comparing the motion information of the key frame with the motion information of the corresponding calculation frame in the first motion information.
[0182] In some embodiments, the motion information of the key frame includes at least one of the following: collision point information, stop point information;
[0183] The collision point information includes at least one of the following: the collision position, collision speed, and collision attitude corresponding to the calculation frame when the virtual projectile collides with the virtual element;
[0184] The stop point information includes at least one of the following: the stop position, stop speed, and stop attitude corresponding to the calculation frame when the virtual projectile stops.
[0185] In some embodiments, the frame rate sending module 1010 is configured to:
[0186] Synchronize the calculation frame rate to the first client every first time interval; or, synchronize the calculation frame rate to the first client when the calculation frame rate changes.
[0187] In summary, the technical solution provided by the embodiments of the present application makes the calculation result of the motion trajectory of the virtual projectile by the client as consistent as possible with the calculation result of the motion trajectory of the virtual projectile by the server by keeping the calculation frame rates of the virtual projectile by the client and the server the same, thereby improving the accuracy of the client's movement control of the virtual projectile.
[0188] It should be noted that, when the device provided in the above embodiment realizes its functions, only the division of the above functional modules is used for illustration. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device provided in the above embodiment and the method embodiment belong to the same concept. For the specific implementation process, please refer to the method embodiment and will not be elaborated here.
[0189] Please refer to Figure 11 , which shows a structural block diagram of a terminal device 1100 provided in an embodiment of the present application. The terminal device 1100 may be an electronic device such as a mobile phone, a tablet computer, a game console, an e-book reader, a multimedia playback device, a wearable device, a PC, etc. The terminal device is used to implement the method for controlling the movement of the virtual projectile on the first client side provided in the above embodiment. The terminal device may be Figure 2 the first terminal device 13 in the shown implementation environment. Specifically:
[0190] Generally, the terminal device 1100 includes a processor 1101 and a memory 1102.
[0191] The processor 1101 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 1101 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), and PLA (Programmable Logic Array). The processor 1101 may also include a main processor and a coprocessor. The main processor is a processor used to process data in the wake state, also known as the CPU (Central Processing Unit); the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 1101 may be integrated with a GPU (Graphics Processing Unit), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1101 may also include an AI (Artificial Intelligence) processor, and the AI processor is used to process computational operations related to machine learning.
[0192] The memory 1102 may include one or more computer-readable storage media, which may be non-transitory. The memory 1102 may further include high-speed random access memory, as well as non-volatile memory, such as one or more disk storage devices and flash storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 1102 is used to store a computer program and is configured to be executed by one or more processors to implement the above-mentioned method for controlling the movement of the virtual projectile on the first client side.
[0193] In some embodiments, the terminal device 1100 may further optionally include: a peripheral device interface 1103 and at least one peripheral device. The processor 1101, the memory 1102, and the peripheral device interface 1103 may be connected through a bus or signal lines. Each peripheral device may be connected to the peripheral device interface 1103 through a bus, signal lines, or a circuit board. Specifically, the peripheral devices include at least one of a radio frequency circuit 1104, a display screen 1105, an audio circuit 1106, and a power supply 1107.
[0194] Those skilled in the art can understand that Figure 11 the structure shown in
[0195] does not constitute a limitation on the terminal device 1100, and it may include more or fewer components than shown in the figure, or combine certain components, or adopt a different component layout. Figure 12 Please refer to
[0196] which shows a block diagram of the structure of a server provided in an embodiment of the present application. The server is used to implement the method for controlling the movement of the virtual projectile on the server side provided in the above-mentioned embodiment. Specifically:
[0197] The basic input / output system 1206 includes a display 1208 for displaying information and input devices 1209 such as a mouse, keyboard, etc. for user input of information. Both the display 1208 and the input devices 1209 are connected to the central processing unit 1201 through an input / output controller 1210 connected to the system bus 1205. The basic input / output system 1206 may also include an input / output controller 1210 for receiving and processing inputs from multiple other devices such as a keyboard, mouse, or electronic stylus. Similarly, the input / output controller 1210 also provides outputs to a display screen, printer, or other types of output devices.
[0198] The mass storage device 1207 is connected to the central processing unit 1201 through a mass storage controller (not shown) connected to the system bus 1205. The mass storage device 1207 and its associated computer-readable medium provide non-volatile storage for the server 1200. That is, the mass storage device 1207 may include computer-readable media (not shown) such as a hard disk or a CD-ROM (Compact Disc Read-Only Memory) drive.
[0199] Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media includes volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules, or other data. Computer storage media includes RAM, ROM, EPROM (Erasable Programmable Read Only Memory), EEPROM (Electrically Erasable Programmable Read Only Memory), flash memory or other solid-state memories, CD-ROM, DVD (Digital Video Disc) or other optical storage, magnetic tape cartridges, tapes, disk storage or other magnetic storage devices. Of course, those skilled in the art know that the computer storage media is not limited to the above several. The above system memory 1204 and mass storage device 1207 may be collectively referred to as memory.
[0200] According to various embodiments of the present application, the server 1200 can also run on a remote computer on the network through a network such as the Internet. That is, the server 1200 can be connected to the network 1212 through the network interface unit 1211 connected to the system bus 1205. Or rather, the network interface unit 1211 can also be used to connect to other types of networks or remote computer systems (not shown).
[0201] In an exemplary embodiment, there is also provided a computer-readable storage medium storing a computer program, which when executed by a processor, implements the above-mentioned method for controlling the movement of the virtual projectile on the first client side, or implements the above-mentioned method for controlling the movement of the virtual projectile on the server side.
[0202] Optionally, the computer-readable storage medium may include: ROM (Read-Only Memory), RAM (Random-Access Memory), SSD (Solid State Drives), or optical discs, etc. Among them, the random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).
[0203] In an exemplary embodiment, there is also provided a computer program product, which includes a computer program stored in a computer-readable storage medium. The processor of the computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the above-mentioned method for controlling the movement of the virtual projectile on the first client side, or executes the above-mentioned method for controlling the movement of the virtual projectile on the server side.
[0204] It should be noted that, before and during the collection of relevant data of the user, this application can display a prompt interface, a pop-up window or output a voice prompt message, which is used to prompt the user that their relevant data is currently being collected. This application only starts to execute the relevant steps of obtaining the user's relevant data after obtaining the confirmation operation of the user on the prompt interface or the pop-up window. Otherwise (that is, when the confirmation operation of the user on the prompt interface or the pop-up window is not obtained), the relevant steps of obtaining the user's relevant data are ended, that is, the relevant data of the user is not obtained. In other words, all user data collected by this application is collected with the consent and authorization of the user, and the collection, use and processing of the relevant user data need to comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0205] It should be understood that "a plurality of" mentioned herein means two or more. The character " / " represents a fraction symbol, the number before the character " / " is the numerator, and the number after the character " / " is the denominator.
[0206] The above are only exemplary embodiments of this application and are not intended to limit this application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of this application shall be included in the protection scope of this application.
Claims
1. A method for controlling the movement of a virtual projectile, characterized in that The method is executed by a first client, and the method includes: Obtaining a calculation frame rate of the server for the virtual projectile, where the calculation frame rate refers to the frame rate at which the server calculates the motion information of the virtual projectile; After the virtual projectile is thrown, according to the calculation frame rate, calculating first motion information of the virtual projectile, where the first motion information includes the motion information of the virtual projectile calculated by the first client in at least one frame, and the motion information is used to indicate the position and speed of the virtual projectile; Controlling the movement of the virtual projectile according to the first motion information.
2. The method according to claim 1, wherein The method further includes: Determining initial motion information of the virtual projectile when it is thrown, where the initial motion information is used to indicate the initial position and initial speed of the virtual projectile when it is thrown; Sending the initial motion information to the server, and the server is used to calculate second motion information of the virtual projectile according to the initial motion information and the calculation frame rate, where the second motion information includes the motion information of the virtual projectile calculated by the server in at least one frame.
3. The method according to claim 1, wherein The method further includes: Receiving third motion information sent by the server, where the third motion information includes the motion information of the virtual projectile calculated by the server in at least one frame; Comparing the third motion information with the first motion information; In the case where the motion information of the first calculation frame in the first motion information is different from the motion information of the third calculation frame in the third motion information, replacing the motion information of the first calculation frame in the first motion information with the motion information of the third calculation frame to obtain corrected motion information of the first calculation frame, where the third calculation frame and the first calculation frame are calculation frames at the same moment; Based on the corrected motion information of the first calculation frame, calculating the motion information of the calculation frames of the virtual projectile after the first calculation frame according to the calculation frame rate.
4. The method according to claim 3, wherein The third motion information includes the motion information of at least one key frame, and the key frame refers to the calculation frame when the server determines that the virtual projectile contacts a virtual element in the virtual environment; The comparing the third motion information with the first motion information includes: Comparing the motion information of the key frame with the motion information of the corresponding calculation frame in the first motion information.
5. The method according to claim 4, wherein The motion information of the key frame includes at least one of the following: collision point information, stop point information; The collision point information includes at least one of the following: the collision position, collision speed, and collision attitude corresponding to the calculation frame when the virtual projectile collides with the virtual element; The stop point information includes at least one of the following: the stop position, stop speed, and stop attitude corresponding to the calculation frame when the virtual projectile stops.
6. The method according to any one of claims 1 to 5, characterized in that The obtaining the calculation frame rate of the server for the virtual projectile includes: Receiving the calculation frame rate synchronized by the server at every first time interval; Or, Receiving the calculation frame rate synchronized by the server when the calculation frame rate changes.
7. A method for controlling the movement of a virtual projectile, characterized in that, The method is executed by a server, and the method includes: Sending the calculation frame rate of the server for the virtual projectile to a first client, where the calculation frame rate refers to the frame rate at which the server calculates the motion information of the virtual projectile. The first client is used to calculate the first motion information of the virtual projectile according to the calculation frame rate after the virtual projectile is thrown, and control the movement of the virtual projectile according to the first motion information. Among them, the first motion information includes the motion information of the virtual projectile calculated by the first client in at least one frame, and the motion information is used to indicate the position and speed of the virtual projectile; Calculating the second motion information of the virtual projectile according to the calculation frame rate, where the second motion information includes the motion information of the virtual projectile calculated by the server in at least one frame; Sending the second motion information to at least one second client.
8. The method according to claim 7, wherein The calculating the second motion information of the virtual projectile according to the calculation frame rate includes: Receiving the initial motion information synchronized by the first client, where the initial motion information is used to indicate the initial position and initial speed of the virtual projectile when it is thrown; Calculating the second motion information according to the initial motion information and the calculation frame rate.
9. The method according to claim 7, wherein The method further includes: Sending third motion information to the first client, where the third motion information includes the motion information of the virtual projectile calculated by the server in at least one frame; among them, the third motion information is used to compare with the first motion information, and when the motion information of the first calculation frame in the first motion information is different from the motion information of the third calculation frame in the third motion information, replacing the motion information of the first calculation frame in the first motion information with the motion information of the third calculation frame to obtain the corrected motion information of the first calculation frame. The third calculation frame and the first calculation frame are calculation frames at the same moment, and the corrected motion information of the first calculation frame is used to calculate the motion information of the virtual projectile in the calculation frames after the first calculation frame.
10. The method according to claim 9, characterized in that, The third motion information includes the motion information of at least one key frame, where the key frame refers to the calculation frame when the server determines that the virtual projectile contacts a virtual element in the virtual environment; among them, the motion information of the key frame is used to compare with the motion information of the corresponding calculation frame in the first motion information.
11. The method according to claim 10, wherein, The motion information of the key frame includes at least one of the following: collision point information, stop point information; The collision point information includes at least one of the following: the collision position, collision speed, and collision attitude corresponding to the calculation frame when the virtual projectile collides with the virtual element; The stop point information includes at least one of the following: the stop position, stop speed, and stop attitude corresponding to the calculation frame when the virtual projectile stops.
12. The method according to any one of claims 7 to 11, characterized in that The sending the calculation frame rate of the server for the virtual projectile to the first client includes: Synchronizing the calculation frame rate to the first client at every first time interval; Or, When the calculated frame rate changes, synchronize the calculated frame rate to the first client.
13. A mobile control device for a virtual projectile, characterized in that The device includes: A frame rate acquisition module, configured to acquire the calculated frame rate of the server for the virtual projectile, where the calculated frame rate refers to the frame rate at which the server calculates the motion information of the virtual projectile; An information calculation module, configured to, after the virtual projectile is thrown, calculate first motion information of the virtual projectile according to the calculated frame rate, where the first motion information includes the motion information of the virtual projectile calculated by the first client in at least one frame, and the motion information is used to indicate the position and speed of the virtual projectile; A movement control module, configured to control the movement of the virtual projectile according to the first motion information.
14. A movement control device for a virtual projectile, characterized in that, The device includes: A frame rate sending module, configured to send the calculated frame rate of the server for the virtual projectile to a first client, where the calculated frame rate refers to the frame rate at which the server calculates the motion information of the virtual projectile, and the first client is configured to, after the virtual projectile is thrown, calculate first motion information of the virtual projectile according to the calculated frame rate, and control the movement of the virtual projectile according to the first motion information, where the first motion information includes the motion information of the virtual projectile calculated by the first client in at least one frame, and the motion information is used to indicate the position and speed of the virtual projectile; An information calculation module, configured to calculate second motion information of the virtual projectile according to the calculated frame rate, where the second motion information includes the motion information of the virtual projectile calculated by the server in at least one frame; An information sending module, configured to send the second motion information to at least one second client.
15. A terminal device, characterized in that, The terminal device includes a processor and a memory, and a computer program is stored in the memory. The computer program is loaded and executed by the processor to implement the method for controlling the movement of a virtual projectile according to any one of claims 1 to 6.
16. A server, characterized in that, The server includes a processor and a memory, and a computer program is stored in the memory. The computer program is loaded and executed by the processor to implement the method for controlling the movement of a virtual projectile according to any one of claims 7 to 12.
17. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium. The computer program is loaded and executed by a processor to implement the method for controlling the movement of a virtual projectile according to any one of claims 1 to 6, or to implement the method for controlling the movement of a virtual projectile according to any one of claims 7 to 12.
18. A computer program product, characterized in that, The computer program product includes a computer program. The computer program is stored in a computer-readable storage medium, and the processor reads and executes the computer program from the computer-readable storage medium to implement the method for controlling the movement of a virtual projectile according to any one of claims 1 to 6, or to implement the method for controlling the movement of a virtual projectile according to any one of claims 7 to 12.