Position verification method and apparatus for virtual character, and electronic device and storage medium
By synchronizing the base server time on the server side and calculating the network delay time, the virtual character's position is traced back for verification, which solves the problem of high misjudgment rate of virtual character position verification in the existing technology, improves the verification accuracy, and provides players with Provide a smoother gaming experience.
Patent Information
- Application Number
- PCT/CN2023/113857
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-16
- Filing Date
- 2023-08-18
- Publication Date
- 2024-09-19
AI Technical Summary
The existing virtual character position verification method has a high misjudgment rate due to network delay, which affects the game experience.
By synchronizing the base server time on the server side, calculating the network delay duration, and tracing back the virtual character's position for verification based on the delay duration, misjudgments are reduced and verification accuracy is improved.
It effectively reduces the misjudgment rate caused by network delay, improves the accuracy of virtual character position verification, and provides players with a more stable game competition environment.
Smart Images

Figure CN2023113857_19092024_PF_FP_ABST
Abstract
Description
Method, device, electronic device and storage medium for verifying position of virtual character
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to Chinese patent application filed on March 16, 2023, with application number 202310269509.5, entitled “Method, device, electronic device and storage medium for verifying the position of a virtual character”, the entire contents of which are incorporated herein by reference. Technical Field
[0003] The present disclosure relates to the field of computer technology, and in particular to a method for verifying the position of a virtual character, a device for verifying the position of a virtual character, an electronic device, and a computer-readable storage medium. Background Art
[0004] When running the game, in order to prevent players from using plug-ins to modify the positions of other game characters in the game client to achieve some kind of cheating advantage, the server needs to verify the messages uploaded by the client.
[0005] The current verification method is to add the target location information to the message uploaded by the client. When the server receives the message, it compares the target location recorded in the message with the current target location recorded on the server. If the distance between the two is less than the specified range, the message is considered valid, otherwise it is invalid.
[0006] Due to network latency, simply comparing the target location recorded in the client message with the current target location recorded by the server is prone to misjudgment. This is because there is a network delay when the server synchronizes the location of other players' game characters to the client, and there is also a network delay when the client sends the message to the server. When the total network latency is large, the distance between the target location recorded on the server and the target location recorded in the client message is likely to exceed the specified range, resulting in misjudgment as invalid, thereby reducing the verification accuracy and poor player gaming experience.
[0007] Summary of the Invention
[0008] The present disclosure provides a method for verifying the position of a virtual character, a device for verifying the position of a virtual character, an electronic device, and a computer-readable storage medium.
[0009] According to a first aspect of the present disclosure, a method for verifying the position of a virtual character is provided, which is applied to a server, and the method comprises: synchronizing a base server time of the server to a plurality of clients, wherein the plurality of clients comprise a first client and a second client; upon receiving an interaction request uploaded by the first client, obtaining the current server time of the server; wherein the interaction request comprises detecting by the first client a first position of a virtual character controlled by the second client; calculating a network delay duration according to the current server time and the base server time; calculating a second position of the virtual character controlled by the second client according to the network delay duration; verifying that the first position is a valid position if the distance between the second position and the first position is less than a first distance threshold; and verifying that the first position is an invalid position if the distance between the second position and the first position is greater than or equal to the first distance threshold.
[0010] According to a second aspect of the present disclosure, a device for verifying the position of a virtual character is provided, which is applied to a server, and the device includes: a reference server time synchronization module, which is used to synchronize the reference server time of the server to multiple clients, wherein the multiple clients include a first client and a second client; a current server time acquisition module, which is used to obtain the current server time of the server when receiving an interaction request uploaded by the first client; wherein the interaction request includes a first position of a virtual character detected by the first client and controlled by the second client; a network delay duration calculation module, which is used to calculate the network delay duration based on the current server time and the reference server time; a second position calculation module, which is used to calculate the second position of the virtual character controlled by the second client based on the network delay duration; a first verification module, which is used to verify that the first position is a valid position if the distance between the second position and the first position is less than a first distance threshold; and to verify that the first position is an invalid position if the distance between the second position and the first position is greater than or equal to the first distance threshold.
[0011] According to a third aspect of the present disclosure, an electronic device is provided, comprising a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the steps of the virtual character position verification method of the first aspect are implemented.
[0012] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the virtual character position verification method of the first aspect are implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] FIG1 is a flowchart of a method for verifying the position of a virtual character according to an embodiment of the present disclosure;
[0014] FIG2 is a schematic diagram of the interaction between a server, a first client, and a second client in one embodiment of the present disclosure;
[0015] FIG3 is a structural block diagram of a device for verifying the position of a virtual character according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0016] The following will clearly and completely describe the technical solutions in the embodiments of the present disclosure in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present disclosure without making any creative efforts shall fall within the scope of protection of the present disclosure.
[0017] Game cheats are programs that modify the normal program code or data to alter the client's operating environment and the abilities of game characters. While playing a game, players can use cheats to change the positions of other characters in the client, thereby achieving a cheating advantage. For example, in a multiplayer competitive shooting game, a cheat could be used to attach other characters to the crosshairs, significantly improving the accuracy of shots. Because client programs and data can be tampered with, servers cannot fully trust messages from clients and must verify messages uploaded by clients.
[0018] For the above-mentioned plug-in that modifies the position of other game characters, the current verification method is to add the target's location information to the message sent by the client to the server. When the server receives these messages, it compares the target position recorded in the client message with the target position currently recorded on the server. If the distance between the two is less than the specified range, the message is considered valid, otherwise it is invalid.
[0019] Due to network latency, simply comparing the target location recorded in the client message with the current target location recorded by the server can easily lead to misjudgment. This is because there is network latency when the server synchronizes the location of other players' game characters to the client, and there is also network latency when the client sends messages to the server. When the total network latency is large, the target's location on the server is different from the location recorded in the client message, and the distance between the two is likely to exceed the specified range, thus being judged invalid.
[0020] Therefore, to address the aforementioned issue of a high misjudgment rate due to network latency when verifying the target location in a client message, this embodiment provides a method for verifying the location of a virtual character, which can be run on a server. This method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.
[0021] In an optional embodiment, various cloud applications, such as cloud gaming, can be run under the cloud interaction system. Taking cloud gaming as an example, cloud gaming refers to a gaming method based on cloud computing. In the cloud gaming operating mode, the operating body of the game program and the main body presenting the game screen are separated. The storage and operation of the virtual character position verification method are completed on the cloud gaming server. The client device is used to receive and send data and present the game screen. For example, the client device can be a display device with data transmission capabilities close to the user, such as a mobile terminal, television, computer, PDA, etc.; however, the terminal device that performs the virtual character position verification method is the cloud gaming server in the cloud. When playing the game, the player operates the client device to send operation instructions to the cloud gaming server. The cloud gaming server runs the game according to the operation instructions, encodes and compresses the game screen and other data, and returns it to the client device via the network. Finally, the client device decodes and outputs the game screen.
[0022] In the embodiment of the present disclosure, the server synchronizes the reference server time to the client, so that the server calculates the network delay time for sending data from the server to the client and uploading data from the client to the server based on the current server time and the reference server time. The network delay time is then used to trace back the second position of the virtual character, and the second position calculated by the server is used to verify the first position detected by the client. This can effectively reduce the phenomenon of misjudgment, improve the verification accuracy, and provide players with a more peaceful gaming environment.
[0023] 1 , a flowchart of a method for verifying the position of a virtual character according to an embodiment of the present disclosure is shown. The method is applied to a server and includes the following steps 101 to 105:
[0024] Step 101: Synchronize the base server time of the server to multiple clients, wherein the multiple clients include a first client and a second client.
[0025] In the embodiment of the present disclosure, it can be applied to a server, and the server can provide the status of the game world to the clients of various players participating in the game, including the status of virtual characters and the status of game scenes.
[0026] A game application can be run on the client and a graphical user interface can be rendered on the client's touch display. The content displayed by the graphical user interface at least partially includes a part or all of the game scene. The specific shape of the game scene can be square or other shapes (for example, circle, etc.).
[0027] Specifically, the game scene includes at least one virtual character, which can be a virtual character controlled by a player through a client, and can be presented through a graphical user interface. The content presented can include all or part of the virtual character. For example, in a third-person perspective game, the content presented by the graphical user interface can include the entire virtual character, or in a first-person perspective game, the content presented by the graphical user interface can include part or all of the virtual character.
[0028] After the game starts, the server will first set a corresponding initial position for each avatar, such as the spawn point. The server can then synchronize this initial position to each client, allowing each client to apply the initial position to the corresponding avatar, so that each avatar is located at the corresponding initial position. At this point, players can control their avatar through the client, such as moving their avatar's position or interacting with other players' target avatars.
[0029] Every first period, for example, every 0.1 seconds, each client may upload the fourth position of the virtual character it controls to the server. The fourth position refers to the current position of the virtual character detected by the client every first period. For example, client A controls virtual character a, and client B controls virtual character b. Client A uploads the current position of virtual character a every 0.1 seconds, and client B uploads the current position of virtual character b every 0.1 seconds.
[0030] Each time the server receives the fourth position of the virtual character uploaded by each client, it can verify the fourth position of each virtual character to determine whether the fourth position of each virtual character is allowed, such as whether a virtual character moves too fast, or whether a virtual character moves to an illegal position, etc.
[0031] In a specific implementation, the server can compare the fourth position of the virtual character received in the previous first cycle with the fourth position of the virtual character received in the current first cycle. For example, the server compares the fourth position P of the virtual character a received 0.1s ago with the fourth position P of the virtual character a received 0.1s ago. a1 The fourth position P of the virtual character a received at the current 0.1s a2 Compare, if the distance between the two is within the allowed range, then the fourth position P of the virtual character a a2After the verification is passed, the server can place the fourth position P of the virtual character a a2 Synchronize to other clients so that other clients can synchronize the fourth position P a2 Apply it to the corresponding virtual character a, thereby updating the position of virtual character a on other clients.
[0032] To prevent players from using cheats to modify the positions of other players' avatars, the server needs to verify the interaction requests uploaded by the client. Furthermore, to address the problem of excessive misjudgment rate caused by network delays during the verification process, the disclosed embodiment can synchronize the server's base server time with multiple clients.
[0033] The multiple clients may include a first client and a second client, both of which are clients participating in the same game. A timer may be set on the server, and every second period, for example, every 0.1 second, the server may synchronize a reference server time to the first client and the second client. The reference server time refers to the current server time obtained by the server every second period. For ease of distinction, the current server time obtained by the server every second period is t0, i.e., the reference server time is t0.
[0034] Step 102: upon receiving the interaction request uploaded by the first client, obtaining the current server time of the server; wherein the interaction request includes a first position of the virtual character detected by the first client and controlled by the second client.
[0035] In an embodiment of the present disclosure, when the client receives the reference server time t0, the client can record the reference server time t0 and obtain the reference client time. The reference client time refers to the current client time obtained by the client when it receives the reference server time t0. For ease of distinction, the current client time obtained by the client when it receives the reference server time t0 is set to t1, that is, the reference client time is t1.
[0036] The client can calculate the time difference dt between the reference server time t0 and the reference client time t1, that is, dt = t0 - t1. The time difference dt refers to the time difference between the server and the client.
[0037] Taking the first client as an example, when the first client receives the reference server time t0 synchronized by the server, the first client can record the reference server time t0 and obtain the reference client time t1, and then the first client can calculate the time difference dt between the reference server time t0 and the reference client time t1.
[0038] When a virtual character controlled by a first client interacts with a virtual character controlled by a second client, the first client can detect the first position of the virtual character controlled by the second client at that time. The first position is the position of the virtual character controlled by the second client detected by the first client. The first client can use the first position of the virtual character controlled by the second client as an interaction request. For example, if virtual character a controlled by client A shoots virtual character b controlled by client B, client A can detect the position of virtual character b controlled by client B at that time. Client A uses the detected position of virtual character b controlled by client B as an interaction request, such as a shooting request in an FPS game.
[0039] Step 103: Calculate the network delay duration according to the current server time and the reference server time.
[0040] In the embodiment of the present disclosure, since the server periodically synchronizes the server's reference server time t0 to the first client, the server can calculate the network delay duration for the server to send data to the client and the client to upload data to the server based on the current server time t4 and the reference server time t0, specifically, the network delay duration for the server to send data to the first client and the first client to upload data to the server.
[0041] In an optional embodiment of the present disclosure, the interaction request further includes a relative server time, and the relative server time is calculated based on the reference server time; step 103 may include the following sub-step S11:
[0042] Sub-step S11, calculating the network delay duration according to the current server time and the relative server time.
[0043] When the first client uses the first position of the virtual character controlled by the second client as an interaction request, the first client can calculate the relative server time t3 based on the reference server time t0. In a specific implementation, the first client can obtain the current client time. The current client time refers to the current client time obtained when the first client is preparing to upload the interaction request. For the sake of distinction, the current client time obtained when the first client is preparing to upload the interaction request is set to t2, that is, the current client time is t2. The first client can add the current client time t2 to the above-mentioned time difference dt to obtain the relative server time t3, that is: t3 = t2 + dt. The relative server time t3 refers to the server time calculated by the first client when uploading the interaction request.
[0044] The first client may add the calculated relative server time t3 to the interaction request, thereby sending the interaction request carrying the relative server time t3 to the server.
[0045] In an embodiment of the present disclosure, when the server receives the interaction request uploaded by the first client, the server can obtain the current server time at this time. The current server time refers to the current server time obtained by the server when the server receives the interaction request uploaded by the first client. For the sake of convenience in distinction, the current server time obtained by the server when the server receives the interaction request uploaded by the first client is set to t4, that is, the current server time is t4.
[0046] The server may extract the relative server time t3 from the interaction request, and then calculate the network delay between the server sending data to the first client and the first client uploading data to the server based on the current server time t4 and the relative server time t3.
[0047] In an optional embodiment of the present disclosure, sub-step S11 may include the following sub-steps S21 and S22:
[0048] Sub-step S21, calculating the time difference between the current server time and the relative server time;
[0049] Sub-step S22: determining the time difference between the current server time and the relative server time as the network delay duration.
[0050] In the embodiment of the present disclosure, the server may calculate the time difference lag1 between the current server time t4 and the relative server time t3, that is, lag1 = t4 - t3.
[0051] The server may determine the calculated time difference lag1 as the network delay duration between the server sending data to the first client and the first client uploading data to the server.
[0052] Combining the above formula t3=t2+dt, dt=t0-t1, we can obtain: lag1=t4-t3=(t4-t0)-(t2-t1).
[0053] Among them, t4 and t0 are both server times, t2 and t1 are both client times, so (t4-t0) refers to the time difference between the server sending data and the server receiving data, (t2-t1) refers to the time difference between the first client receiving data and the first client uploading data, then (t4-t0)-(t2-t1) is the network delay lag1 between the server sending data to the first client and the first client uploading data to the server.
[0054] Step 104: Calculate a second position of the virtual character controlled by the second client according to the network delay duration.
[0055] In an embodiment of the present disclosure, after calculating the network delay duration lag1, the server can use the network delay duration lag1 to calculate the second position of the virtual character controlled by the second client. The second position is the interacted position of the virtual character controlled by the second client calculated by the server.
[0056] In an optional embodiment of the present disclosure, step 104 may include the following sub-steps S31 to S34:
[0057] Sub-step S31, determining the message distribution delay duration;
[0058] Sub-step S32, determining the time required for the smooth position transition;
[0059] Sub-step S33, adding the network delay duration, the message distribution delay duration, and the duration required for the smooth position transition to obtain the position delay duration of the virtual character controlled by the second client;
[0060] Sub-step S34: calculating a second position of the virtual character controlled by the second client according to the position delay time.
[0061] In the embodiment of the present disclosure, in addition to the network delay duration lag1, there is also the message distribution delay duration lag2 and the duration required for smooth position transition lag3, so the server needs to determine the message distribution delay duration lag2 and the duration required for smooth position transition lag3.
[0062] The message distribution delay lag2 refers to the time difference between the server message entering the message sending queue and the network sending. The message distribution delay lag2 is relatively stable.
[0063] The duration required for a smooth position transition, lag3, is the time between the first client receiving the server-synchronized fourth position of the virtual character controlled by the second client and setting that fourth position to the corresponding virtual character. If the fourth position is a teleportation position, the corresponding virtual character's position is immediately modified. If the fourth position is a smooth transition position, interpolation is used for a smooth transition, and the duration of this smooth transition is relatively fixed.
[0064] It should be noted that the change in the avatar's position may be derived from the client's own avatar position (the fourth position) uploaded synchronously, or from the position set actively by the server. Generally, the position set actively by the server uses a teleportation method, that is, it does not consider the smooth transition of the avatar's position, while the position uploaded by the client does consider smooth transition.
[0065] Among them, the position actively set by the server is generally related to the gameplay. For example, when a virtual character enters a portal, the server will actively set the position of the virtual character; or, when a virtual character dies and needs to be resurrected at a designated location, the server will actively set the position of the virtual character.
[0066] In an embodiment of the present disclosure, the network delay duration lag1, the message distribution delay duration lag2 and the duration required for smooth position transition lag3 can be added together to obtain the position delay duration lag of the virtual character controlled by the second client. The position delay duration lag is the total delay duration. The server can calculate the second position of the virtual character controlled by the second client based on the position delay duration lag.
[0067] Since the message distribution delay duration lag2 and the time required for smooth position transition lag3 are relatively fixed, the embodiment of the present disclosure can set a preset value A, and replace the message distribution delay duration lag2 and the time required for smooth position transition lag3 with the preset value A. The replaced position delay duration lag = network delay duration lag1 + preset value A.
[0068] In one example, the preset value A may be set to 240ms. Since the degree of network jitter varies, the network delay duration is unstable. The greater the network jitter, the longer the network delay duration.
[0069] In an optional embodiment of the present disclosure, the server records a second historical position sequence of the virtual character controlled by the second client, the second historical position sequence including a plurality of historical positions arranged in sequence, each of the plurality of historical positions having a corresponding recording time; sub-step S34 may include the following sub-steps S41 to S46:
[0070] Sub-step S41, calculating the time difference between the current server time and the location delay time;
[0071] Sub-step S42, determining the time difference between the current server time and the position delay time as the target time for the virtual character controlled by the second client to be at the second position;
[0072] Sub-step S43, determining whether the target time is within the time length of the second historical position sequence;
[0073] Sub-step S44: If the target time is within the time length of the second historical position sequence, determining a first recorded time and a second recorded time adjacent to the target time from the second historical position sequence; wherein the first recorded time is less than or equal to the target time, and the second recorded time is greater than the target time;
[0074] Sub-step S45, obtaining, from the plurality of historical locations, a first historical location corresponding to the first recording time, and obtaining a second historical location corresponding to the second recording time;
[0075] Sub-step S46: calculating a second position of the virtual character controlled by the second client according to the first historical position and the second historical position.
[0076] In the embodiment of the present disclosure, in order to obtain the historical position information of the virtual character at the corresponding time point, the server can maintain the historical position sequence of each virtual character in the latest third period, for example, the server can maintain the historical position sequence of each virtual character in the latest 2 seconds.
[0077] Taking the second historical position sequence of the virtual character controlled by the second client as an example, the second historical position sequence can record multiple historical positions, which are [P1, P2, P3, P4, ..., P n ], where each P is (position, time, type), position refers to the world coordinate position of the virtual character controlled by the second client, time refers to the server time when the server receives the fourth position of its own virtual character uploaded by the second client, and type is marked as teleportation position type or smooth transition position type.
[0078] The number of historical positions n generally depends on the interval at which the client uploads the position of its own virtual character, that is, the size of the first cycle. For example, if the first cycle is set to 0.1s, then under normal circumstances the server can record 20 historical positions in the last 2s.
[0079] In the second historical position sequence, multiple historical positions are arranged in chronological order. Each time a new historical position is added to the end of the second historical position sequence, the server can delete the expired historical position (for example, 2 seconds ago) from the second historical position sequence.
[0080] In a specific implementation, when the server receives the fourth position of its own virtual character uploaded synchronously by the second client, or when the server actively sets the position of the virtual character, the server can uniformly convert the position into world coordinates. For example, when the virtual character is standing on a mobile platform, the second client uploads the position coordinates relative to the mobile platform. At this time, the server needs to convert the position coordinates relative to the mobile platform into world coordinates and record the server time T when the fourth position of its own virtual character uploaded by the second client is received. The server time T is the recording time T. The server can then determine whether the position adopts a smooth transition. Generally, the position actively set by the server adopts a teleportation method, that is, the smooth transition of the virtual character's position is not considered, while the position uploaded by the client takes smooth transition into consideration. Therefore, the server can obtain a sequence of (world coordinate position of the virtual character, recording time T, whether smooth transition is adopted).
[0081] In one example, client A uploads the fourth position P of its own virtual character a every 0.1s. a1 , when the server receives the fourth position P of the virtual character a a1 When the server records the server time T a1 , server time T a1 That is the recording time T a1 , then the server can calculate the fourth position P of the virtual character a a1 If the verification is passed, the server can then place the fourth position P of the virtual character a. a1 Convert to world coordinate position P' a1 Since the position is uploaded synchronously by the client, the server can use the world coordinate position P' of the virtual character a a1 Marked as smooth transition position type, so the server can get (world coordinate position P' a1 , record time T a1 , smooth transition position type) sequence, world coordinate position P' a1 As a new historical position, it is added to the end of the historical position sequence of virtual character a, and the server can delete the expired historical position (for example, 2 seconds ago) from the historical position sequence.
[0082] In another example, when the server actively sets the position of the virtual character a, for example, to P a2 , the server records the server time T at this time a2 , server time T a2 That is the recording time T a2 , then the server can calculate the position P of the virtual character a a2 Convert to world coordinate position P' a2Since the position is set by the server actively, the server can set the world coordinate position P' of the virtual character a a2 Marked as teleport position type, so the server can get (world coordinate position P' a2 , record time T a2 , teleport position type), world coordinate position P' a2 As a new historical position, it is added to the end of the historical position sequence of virtual character a, and the server can delete the expired historical position (for example, 2 seconds ago) from the historical position sequence.
[0083] In the embodiment of the present disclosure, after the server calculates the location delay duration lag, the server may calculate the time difference t between the current server time t4 and the location delay duration lag, that is, t=t4-lag.
[0084] The time difference t refers to the target time t at which the virtual character controlled by the second client is in the second position, that is, the corresponding time point when the virtual character controlled by the second client is in the interacted position calculated by the server. The server can determine whether the target time t is within the time length of the second historical position sequence, that is, whether the target time t exceeds the time length of the second historical position sequence maintained by the server. For example, assuming that the current server time t4 is 9:00:00, the server maintains the second historical position sequence within the last 2 seconds, if the calculated target time t is 8:59:59, then it is determined that the target time t is within the time length of the second historical position sequence; if the calculated target time t is 8:59:57, then it is determined that the target time t is not within the time length of the second historical position sequence.
[0085] In the embodiment of the present disclosure, if the target time t is within the time length of the second historical position sequence, the adjacent first historical position P can be found by covering the target time t through binary search. x and the second historical position P y , where the first historical position P x The time is less than or equal to the target time t, the second historical position P y The time is greater than the target time t.
[0086] In a specific implementation, if the target time t is within the time length of the second historical position sequence, then the first recorded time T adjacent to the target time t can be found from the second historical position sequence. x and the second recording time T y , where the first recording time T x Less than or equal to the target time t, the second recording time T yGreater than the target time t. Then, the first recording time T can be obtained from multiple historical positions in the second historical position sequence. x The corresponding first historical position P x , and obtain the second recording time T y The corresponding second historical position P y Among them, the first historical position P x That is, the adjacent position on the left of the second position of the virtual character controlled by the second client, the second historical position P y That is, the adjacent position to the right of the second position of the virtual character controlled by the second client. The server can x With the second historical position P y A second position of the virtual character controlled by the second client is found.
[0087] In an optional embodiment of the present disclosure, after determining whether the target time is within the time length of the second historical position sequence, the method may further include:
[0088] If the target time is not within the time length of the second historical position sequence, the first historical position is obtained from the second historical position sequence; and the first historical position is determined as the second position of the virtual character controlled by the second client.
[0089] In the embodiment of the present disclosure, if the target time t is not within the time length of the second historical position sequence, it means that the network jitter is severe and exceeds the time length of the second historical position sequence maintained by the server, then the historical position recorded earliest by the server can be directly returned.
[0090] In a specific implementation, if the target time t is not within the time length of the second historical position sequence, then the historical position at the first position can be obtained from the second historical position sequence. For example, the second historical position sequence is [P1, P2, P3, P4, ..., P n ], the historical position at the first position is P1, then the historical position P1 at the first position can be determined as the second position of the virtual character controlled by the second client.
[0091] In an optional embodiment of the present disclosure, sub-step S46 may include the following sub-steps S51 and S52:
[0092] Sub-step S51, determining the location type of the first historical location, and determining the location type of the second historical location;
[0093] Sub-step S52: calculating a second position of the virtual character controlled by the second client based on the position type of the first historical position and the position type of the second historical position.
[0094] In the embodiment of the present disclosure, in the second historical position sequence, each historical position is marked with a corresponding type, which may include any one of a teleportation position type and a smooth transition position type. The server may determine the first historical position P according to the marked type. x The location type, and determine the second historical location P y The position type of the first historical position is determined, and then based on the position type of the first historical position and the position type of the second historical position, a second position of the virtual character controlled by the second client is calculated.
[0095] In an optional embodiment of the present disclosure, sub-step S52 may include the following sub-step S61:
[0096] Sub-step S61: If the first historical position is a teleportation position type and the second historical position is a teleportation position type, the first historical position is determined as a second position of the virtual character controlled by the second client.
[0097] In the embodiment of the present disclosure, if the first historical position P x Belongs to the teleportation position type, and the second historical position P y Belongs to the teleportation position type, indicating that the first historical position P x and the second historical position P y All are changed by the location actively set by the server.
[0098] Under normal circumstances, the server is at the first historical position P x With the second historical position P y Linear interpolation is performed between the two positions, thereby calculating that the second position of the virtual character controlled by the second client is at P x to P y If the second historical position P y is a teleport position, then the second historical position P y It is likely that the server directly sets it to a very far position. At this time, it has no transition, so linear interpolation cannot be performed. Therefore, the server can directly return to the first historical position P x , that is, the first historical position P x A second position of the virtual character controlled by the second client is determined.
[0099] In an optional embodiment of the present disclosure, sub-step S52 may include the following sub-step S71:
[0100] In sub-step S71, if the first historical position is a teleportation position type and the second historical position is a smooth transition position type, linear interpolation is performed using the target time, the first historical position, the first recording time, the second historical position, and the second recording time to obtain the second position of the virtual character controlled by the second client.
[0101] In the embodiment of the present disclosure, if the first historical position P x Belongs to the teleportation position type, but the second historical position P y It belongs to the smooth transition position type, indicating that the first historical position P x The second historical position P is changed by the position set by the server. y It is changed by the location of the client synchronization upload.
[0102] Since the second historical position P y It is a smooth transition position. At this time, it has a transition, so the second position of the virtual character controlled by the second client can be returned by linear interpolation according to time. Specifically, the target time t, the first historical position P x , first recording time T x , the second historical position P y , second recording time T y Perform linear interpolation, that is: P x +(t–T x ) / (T y –T x )*(P x –P y ). Thus, the second position of the virtual character controlled by the second client is obtained.
[0103] In an optional embodiment of the present disclosure, sub-step S52 may include the following sub-step S81:
[0104] Sub-step S81: If the first historical position is a smooth transition position type and the second historical position is a teleport position type, the first historical position is determined as the second position of the virtual character controlled by the second client.
[0105] In the embodiment of the present disclosure, if the first historical position P x It belongs to the smooth transition position type, but the second historical position P y Belongs to the teleportation position type, indicating that the first historical position P x The location uploaded by the client is changed, and the second historical location P y It is changed by the location actively set by the server.
[0106] Since the second historical position P y is a teleport position, then the second historical position P y It is likely that the server directly sets it to a very far position. At this time, it has no transition, so linear interpolation cannot be performed. Therefore, the server can directly return to the first historical position P x , that is, the first historical position P x A second position of the virtual character controlled by the second client is determined.
[0107] In an optional embodiment of the present disclosure, sub-step S52 may include the following sub-step S91:
[0108] Sub-step S91, if the first historical position belongs to the smooth transition position type, and the second historical position belongs to the smooth transition position type, then linear interpolation is performed using the target time, the first historical position, the first recording time, the second historical position, and the second recording time to obtain the second position of the virtual character controlled by the second client.
[0109] In the embodiment of the present disclosure, if the first historical position P x It belongs to the smooth transition position type, and the second historical position P y It belongs to the smooth transition position type, indicating that the first historical position P x and the second historical position P y All of them are changed by the location of client synchronization upload.
[0110] Since the second historical position P y It is a smooth transition position. At this time, it has a transition, so it can be linearly interpolated according to time to return to the second position of the target virtual character. Specifically, the target time t, the first historical position P x , first recording time T x , the second historical position P y , second recording time T y Perform linear interpolation, that is: P x +(t–T x ) / (T y –T x )*(P x –P y ). Thus, the second position of the virtual character controlled by the second client is obtained.
[0111] Step 105: If the distance between the second position and the first position is less than the first distance threshold, verify that the first position is a valid position; if the distance between the second position and the first position is greater than or equal to the first distance threshold, verify that the first position is an invalid position.
[0112] In the embodiment of the present disclosure, the second position is the interactive position of the virtual character controlled by the second client, which is calculated by the server by calculating the network delay time from the server to the first client and then from the first client to the server, and then using the network delay time to calculate. This can solve the problem of excessive misjudgment rate caused by network delay during the verification process. Since the first position is the interactive position of the virtual character controlled by the second client detected by the first client in the interaction request uploaded by the first client, in order to prevent the player from using a plug-in on the first client to modify the position of the virtual character controlled by the second client, the server needs to compare the second position calculated by the server with the first position detected by the first client to verify whether the first position detected by the first client is a valid position.
[0113] In a specific implementation, the server may calculate a distance D1 between the second position calculated by the server and the first position detected by the first client, and then compare the distance D1 with a first distance threshold.
[0114] In one example, if the distance D1 is less than a first distance threshold, that is, the distance between the second position calculated by the server and the first position detected by the first client is less than the first distance threshold, then it can be determined that the first position detected by the first client is a valid position, indicating that the player did not use a plug-in on the first client to modify the interacted position of the virtual character controlled by the second client.
[0115] In another example, if the distance D1 is greater than or equal to the first distance threshold, that is, the distance between the second position calculated by the server and the first position detected by the first client is greater than or equal to the first distance threshold, then it can be determined that the first position detected by the first client is an invalid position, indicating that the player is likely to use a plug-in on the first client to modify the interacted position of the virtual character controlled by the second client.
[0116] In an optional embodiment of the present disclosure, the interaction request further includes a third position of the virtual character controlled by the first client; the server records a first historical position sequence of the virtual character controlled by the first client, and the method may further include:
[0117] Obtain the last historical position from the first historical position sequence; if the distance between the last historical position and the third position is less than a second distance threshold, verify that the third position is a valid position; if the distance between the last historical position and the third position is greater than or equal to the second distance threshold, verify that the third position is an invalid position.
[0118] When the virtual character controlled by the first client interacts with the virtual character controlled by the second client, the player can use plug-ins on the first client to not only modify the interacted position of the virtual character controlled by the second client, but also modify the moving position of the virtual character controlled by the first client.
[0119] To this end, embodiments of the present invention can verify the third position of the virtual character controlled by the first client in the interaction request. The third position refers to the current position of the virtual character controlled by the first client at the moment the first client detects the first position of the virtual character controlled by the second client. The first client can add the third position of the virtual character controlled by the first client to the interaction request.
[0120] The server can extract the third position of the virtual character controlled by the first client from the interaction request. Since the first client will upload the position of the virtual character controlled by it to the server at regular intervals, the third position of the virtual character controlled by the first client is order-preserving. Therefore, when verifying the third position of the virtual character controlled by the first client, the server does not need to consider network delays.
[0121] The server records the first historical position sequence of the virtual character controlled by the first client. The generation process of the first historical position sequence is the same as the generation process of the second historical position sequence. For details, please refer to the generation process of the second historical position sequence, which will not be repeated here.
[0122] In the first historical position sequence, multiple historical positions are arranged in chronological order, so the last historical position is the most recent position recorded by the server. The server can obtain the last historical position from the first historical position sequence and then compare the last historical position with the third position in the interaction request.
[0123] In a specific implementation, the server may calculate the distance D2 between the last historical position and the third position in the interaction request, and then compare the distance D2 with the second distance threshold.
[0124] In one example, if the distance D2 is less than the second distance threshold, that is, the distance between the last historical position and the third position in the interaction request is less than the second distance threshold, then it can be determined that the third position in the interaction request is a valid position, indicating that the player did not use a plug-in on the first client to modify the movement position of the virtual character controlled by the first client.
[0125] In another example, if the distance D2 is greater than or equal to the second distance threshold, that is, the distance between the last historical position and the third position in the interaction request is greater than or equal to the second distance threshold, then it can be determined that the third position in the interaction request is an invalid position, indicating that the player is likely to use a plug-in on the first client to modify the movement position of the virtual character controlled by the first client.
[0126] In an optional embodiment of the present disclosure, the method may further include:
[0127] When the first position is a valid position and the third position is a valid position, generating permission information and sending the permission information to the first client; the permission information is used to instruct the first client to perform an interactive operation on the virtual character controlled by the second client;
[0128] When the first position is an invalid position, and / or the third position is an invalid position, a rejection message is generated and sent to the first client; the rejection message is used to instruct the first client not to perform interactive operations on the virtual character controlled by the second client.
[0129] The first position is the interacted position of the virtual character controlled by the second client detected by the first client, and the third position is the moving position of the virtual character controlled by the first client detected by the first client.
[0130] When the first location is a valid location and the third location is a valid location, the server may generate permission information and send the permission information to the first client, so that the first client, in response to the permission information, performs the interactive operation on the virtual character controlled by the second client. For example, assuming that the interactive request is a shooting request, when the first client receives the permission information returned by the server in response to the shooting request, the first client may, in response to the permission information, perform the shooting operation on the virtual character controlled by the second client.
[0131] When any invalid position exists, the server may generate a rejection message. Specifically, when the first position is a valid position and the third position is an invalid position; or when the third position is a valid position and the first position is an invalid position; or when the first position is an invalid position and the third position is an invalid position, the server may generate a rejection message and send the rejection message to the first client, so that the first client does not perform the interactive operation on the virtual character controlled by the second client in response to the rejection message. For example, assuming that the interactive request is a shooting request, when the first client receives the rejection message returned by the server for the shooting request, the first client may respond to the rejection message and not perform the shooting operation on the virtual character controlled by the second client.
[0132] In summary, in an embodiment of the present disclosure, a server's reference server time is synchronized with multiple clients, wherein the multiple clients include a first client and a second client; upon receiving an interaction request uploaded by the first client, the server's current server time is obtained; wherein the interaction request includes the first client detecting and obtaining a first position of a virtual character controlled by the second client; calculating a network delay duration based on the current server time and the reference server time; calculating a second position of the virtual character controlled by the second client based on the network delay duration; if the distance between the second position and the first position is less than a first distance threshold, verifying the first position as a valid position; and if the distance between the second position and the first position is greater than or equal to the first distance threshold, verifying the first position as an invalid position. In an embodiment of the present disclosure, the server synchronizes the reference server time with the client, so that the server calculates the network delay duration between the server sending data to the client and the client uploading data to the server based on the current server time and the reference server time, thereby using the network delay duration to backtrack the second position of the virtual character, and then using the second position calculated by the server to verify the first position detected by the client, thereby effectively reducing misjudgments, improving verification accuracy, and providing players with a more peaceful gaming environment.
[0133] In order to enable those skilled in the art to better understand the embodiments of the present invention, the embodiments of the present invention are described below through the following examples:
[0134] 2 , there is shown a schematic diagram of interactions among a server, a first client, and a second client in an embodiment of the present invention, wherein the first client controls the operation of a virtual character a, and the second client controls the operation of a virtual character b.
[0135] The specific process of virtual character position verification is as follows:
[0136] 1. Every second period (e.g., 0.1s), the server synchronizes the reference server time t0 to the first and second clients;
[0137] 2. When receiving the reference server time t0, the first client obtains the reference client time t1, and then calculates the time difference dt between the reference server time t0 and the reference client time t1, that is, dt = t0 - t1;
[0138] 3. When virtual character a, controlled by the first client, interacts with virtual character b, controlled by the second client, the first client detects the interacted position of virtual character b at that time, which serves as the first position of virtual character b; the first client also detects the moving position of virtual character a at that time, which serves as the third position of virtual character a; and the first client obtains the current client time t2, and then adds the current client time t2 to the time difference dt calculated in step 2 to obtain the relative server time t3, i.e., t3 = t2 + dt;
[0139] 4. The first client sends the first position of virtual character b, the third position of virtual character a, and the relative server time t3 to the server as an interaction request;
[0140] 5. Upon receiving the interaction request uploaded by the first client, the server obtains the current server time t4, then calculates the time difference between the current server time t4 and the relative server time t3, and determines the time difference between the current server time t4 and the relative server time t3 as the network delay duration lag1, i.e., lag1 = t4 - t3;
[0141] 6. Add the preset value A to the network delay lag1 to obtain the position delay lag, i.e., position delay lag = network delay lag1 + preset value A; where preset value A is the sum of the information distribution delay lag2 and the time required for smooth position transition lag3; then, the server calculates the time difference between the current server time t4 and the position delay lag to obtain the target time t at which the virtual character b, controlled by the second client, is at the second position, i.e., t = t4 - lag;
[0142] 7. The server determines whether the target time t is within the time length of the second historical position sequence; if not, jump to step 8; if so, jump to step 9; wherein the second historical position sequence is the historical position sequence of the virtual character b within the most recent third period maintained by the server;
[0143] 8. If the target time t is not within the time length of the second historical position sequence, the server obtains the first historical position from the second historical position sequence, determines the first historical position as the second position of the virtual character b, and then jumps to step 12;
[0144] 9. If the target time t is within the time length of the second historical location sequence, the server determines a first recorded time and a second recorded time adjacent to the target time t from the second historical location sequence; wherein the first recorded time is less than or equal to the target time t, and the second recorded time is greater than the target time t;
[0145] 10. The server obtains the first historical position corresponding to the first recorded time and the second historical position corresponding to the second recorded time from the second historical position sequence;
[0146] 11. The server calculates the second position of the virtual character b controlled by the second client based on the position type of the first historical position and the position type of the second historical position. Specifically, there are the following four cases (11-1), (11-2), (11-3), and (11-4):
[0147] (11-1) If the first historical position is a teleportation position type and the second historical position is a teleportation position type, determining the first historical position as a second position of the virtual character b controlled by the second client;
[0148] (11-2) If the first historical position is a teleportation position type and the second historical position is a smooth transition position type, linear interpolation is performed using the target time t, the first historical position, the first recorded time, the second historical position, and the second recorded time to obtain the second position of the virtual character b controlled by the second client;
[0149] (11-3) If the first historical position belongs to the smooth transition position type and the second historical position belongs to the teleportation position type, the first historical position is determined as the second position of the virtual character b controlled by the second client;
[0150] (11-4) If the first historical position is a smooth transition position type and the second historical position is a smooth transition position type, linear interpolation is performed using the target time t, the first historical position, the first recorded time, the second historical position, and the second recorded time to obtain the second position of the virtual character b controlled by the second client;
[0151] 12. After obtaining the second position of the virtual character B, the server determines whether the distance between the second position and the first position is less than the first distance threshold; if not, the process jumps to step 13; if so, the process jumps to step 15. It should be noted that the first position is the position of the virtual character B detected by the first client, and the second position is the position of the virtual character B calculated by the server;
[0152] 13. If the distance between the second position and the first position is greater than or equal to the first distance threshold, the server verifies that the first position of the virtual character b is an invalid position. In this case, the server may generate a rejection message and send the rejection message to the first client;
[0153] 14. In response to the rejection information, the first client does not perform the interactive operation on the virtual character b controlled by the second client, and the process ends.
[0154] 15. If the distance between the second position and the first position is less than the first distance threshold, the server verifies that the first position of the virtual character B is a valid position. At this time, the server may further verify the third position of the virtual character A. Specifically, the server obtains the last historical position from the first historical position sequence, and then determines whether the distance between the last historical position and the third position of the virtual character A is less than the second distance threshold. If not, jump to step 16; if so, jump to step 18. The first historical position sequence is the historical position sequence of the virtual character A within the most recent third period maintained by the server.
[0155] 16. If the distance between the last historical position and the third position of the virtual character a is greater than or equal to the second distance threshold, the server verifies that the third position of the virtual character a is an invalid position. In this case, the server may generate a rejection message and send the rejection message to the first client;
[0156] 17. In response to the rejection information, the first client does not perform the interactive operation on the virtual character b controlled by the second client, and the process ends.
[0157] 18. If the distance between the last historical position and the third position of virtual character a is less than a second distance threshold, the server verifies that the third position of virtual character a is a valid position. In this case, both the first position of virtual character b and the third position of virtual character a are valid positions, and the server can generate a permission message and send the permission message to the first client.
[0158] 19. In response to the permission information, the first client performs an interactive operation on the virtual character b controlled by the second client, and the process ends.
[0159] It should be noted that for the method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present disclosure are not limited by the order of the actions described, because according to the embodiments of the present disclosure, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present disclosure.
[0160] 3 shows a block diagram of a virtual character position verification device according to an embodiment of the present disclosure, which is applied to a server and may include the following modules:
[0161] A reference server time synchronization module 301 is configured to synchronize the reference server time of the server to multiple clients, wherein the multiple clients include a first client and a second client;
[0162] The current server time acquisition module 302 is configured to acquire the current server time of the server upon receiving an interaction request uploaded by the first client; wherein the interaction request includes a first position of the virtual character detected by the first client and controlled by the second client; and the relative server time is calculated based on the reference server time.
[0163] A network delay duration calculation module 303 is configured to calculate the network delay duration based on the current server time and the reference server time;
[0164] A second position calculation module 304 is configured to calculate a second position of the virtual character controlled by the second client according to the network delay duration;
[0165] The first verification module 305 is used to verify that the first position is a valid position if the distance between the second position and the first position is less than a first distance threshold; if the distance between the second position and the first position is greater than or equal to the first distance threshold, verify that the first position is an invalid position.
[0166] In an optional embodiment of the present disclosure, the interaction request further includes a relative server time, where the relative server time is calculated based on the reference server time; and the network delay duration calculation module 303 may include:
[0167] The network delay duration calculation submodule is used to calculate the network delay duration according to the current server time and the relative server time.
[0168] In an optional embodiment of the present disclosure, the network delay duration calculation submodule may include:
[0169] A first calculation unit, configured to calculate a time difference between the current server time and the relative server time;
[0170] The network delay duration determining unit is configured to determine the time difference between the current server time and the relative server time as the network delay duration.
[0171] In an optional embodiment of the present disclosure, the second position calculation module 304 may include:
[0172] A message distribution delay duration determination submodule is used to determine the message distribution delay duration;
[0173] A submodule for determining the time required for a smooth position transition, used to determine the time required for a smooth position transition;
[0174] A second calculation submodule is configured to add the network delay duration, the message distribution delay duration, and the duration required for the position smooth transition to obtain a position delay duration of the virtual character controlled by the second client;
[0175] The second position calculation submodule is configured to calculate a second position of the virtual character controlled by the second client according to the position delay duration.
[0176] In an optional embodiment of the present disclosure, the server records a second historical position sequence of the virtual character controlled by the second client, the second historical position sequence including a plurality of historical positions arranged in sequence, each of the plurality of historical positions having a corresponding recording time; and the second position calculation submodule may include:
[0177] a third calculating unit, configured to calculate a time difference between the current server time and the location delay duration;
[0178] a target time determining unit, configured to determine a time difference between the current server time and the position delay time as a target time for the virtual character controlled by the second client to be at the second position;
[0179] a judging unit, configured to judge whether the target time is within the time length of the second historical position sequence;
[0180] an adjacent recording time determining unit, configured to determine, if the target time is within the time length of the second historical position sequence, a first recording time and a second recording time adjacent to the target time from the second historical position sequence; wherein the first recording time is less than or equal to the target time, and the second recording time is greater than the target time;
[0181] a historical position acquisition unit, configured to acquire, from the plurality of historical positions, a first historical position corresponding to the first recording time, and acquire a second historical position corresponding to the second recording time;
[0182] The second position calculation unit is configured to calculate a second position of the virtual character controlled by the second client according to the first historical position and the second historical position.
[0183] In an optional embodiment of the present disclosure, the second position calculation unit may include:
[0184] a location type determination subunit, configured to determine the location type of the first historical location and the location type of the second historical location;
[0185] The second position calculation subunit is configured to calculate a second position of the virtual character controlled by the second client based on the position type of the first historical position and the position type of the second historical position.
[0186] In an optional embodiment of the present disclosure, the second position calculation subunit may be configured to:
[0187] If the first historical position is a teleportation position type and the second historical position is a teleportation position type, the first historical position is determined as a second position of the virtual character controlled by the second client.
[0188] In an optional embodiment of the present disclosure, the second position calculation subunit may be configured to:
[0189] If the first historical position is a teleportation position type and the second historical position is a smooth transition position type, linear interpolation is performed using the target time, the first historical position, the first recording time, the second historical position, and the second recording time to obtain the second position of the virtual character controlled by the second client.
[0190] In an optional embodiment of the present disclosure, the second position calculation subunit may be configured to:
[0191] If the first historical position is a smooth transition position type and the second historical position is a teleportation position type, the first historical position is determined as the second position of the virtual character controlled by the second client.
[0192] In an optional embodiment of the present disclosure, the second position calculation subunit may be configured to:
[0193] If the first historical position is a smooth transition position type and the second historical position is a smooth transition position type, linear interpolation is performed using the target time, the first historical position, the first recorded time, the second historical position, and the second recorded time to obtain the second position of the virtual character controlled by the second client.
[0194] In an optional embodiment of the present disclosure, after determining whether the target time is within the time length of the second historical position sequence, the apparatus may further include:
[0195] a first historical position acquisition module, configured to acquire the first historical position from the second historical position sequence if the target time is not within the time length of the second historical position sequence;
[0196] The second position determining module is configured to determine the historical position at the first position as the second position of the virtual character controlled by the second client.
[0197] In an optional embodiment of the present disclosure, the interaction request further includes a third position of the virtual character controlled by the first client; the server records a first historical position sequence of the virtual character controlled by the first client, and the apparatus may further include:
[0198] a last historical position acquisition module, which acquires the last historical position from the first historical position sequence;
[0199] The second verification module is used to verify that the third position is a valid position if the distance between the last historical position and the third position is less than a second distance threshold; if the distance between the last historical position and the third position is greater than or equal to the second distance threshold, verify that the third position is an invalid position.
[0200] In an optional embodiment of the present disclosure, the apparatus may further include:
[0201] a permission information generating module, configured to generate permission information when the first position is a valid position and the third position is a valid position, and send the permission information to the first client; the permission information is used to instruct the first client to perform an interactive operation on the virtual character controlled by the second client;
[0202] A rejection information generation module is used to generate rejection information when the first position is an invalid position and / or the third position is an invalid position, and send the rejection information to the first client; the rejection information is used to instruct the first client not to perform interactive operations on the virtual character controlled by the second client.
[0203] In summary, in an embodiment of the present disclosure, a server's reference server time is synchronized with multiple clients, wherein the multiple clients include a first client and a second client; upon receiving an interaction request uploaded by the first client, the server's current server time is obtained; wherein the interaction request includes the first client detecting and obtaining a first position of a virtual character controlled by the second client; calculating a network delay duration based on the current server time and the reference server time; calculating a second position of the virtual character controlled by the second client based on the network delay duration; if the distance between the second position and the first position is less than a first distance threshold, verifying the first position as a valid position; and if the distance between the second position and the first position is greater than or equal to the first distance threshold, verifying the first position as an invalid position. In an embodiment of the present disclosure, the server synchronizes the reference server time with the client, so that the server calculates the network delay duration between the server sending data to the client and the client uploading data to the server based on the current server time and the reference server time, thereby using the network delay duration to backtrack the second position of the virtual character, and then using the second position calculated by the server to verify the first position detected by the client, thereby effectively reducing misjudgments, improving verification accuracy, and providing players with a more peaceful gaming environment.
[0204] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0205] The present disclosure also discloses an electronic device, including a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, the steps of the virtual character position verification method described above are implemented.
[0206] The embodiment of the present disclosure further discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the virtual character position verification method described above are implemented.
[0207] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0208] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, devices, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0209] The embodiments of the present disclosure are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present disclosure. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device produce a device for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0210] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0211] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce computer-implemented processing, so that the instructions executed on the computer or other programmable terminal device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0212] Although the preferred embodiments of the present disclosure have been described, those skilled in the art may make additional changes and modifications to these embodiments once they are aware of the basic creative concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present disclosure.
[0213] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or terminal device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or terminal device that includes the element.
[0214] The above is a detailed introduction to the virtual character position verification method, device, electronic device and storage medium provided by the present disclosure. Specific examples are used in this article to illustrate the principles and implementation methods of the present disclosure. The description of the above embodiments is only used to help understand the method and core ideas of the present disclosure. At the same time, for general technical personnel in this field, based on the ideas of the present disclosure, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present disclosure.
Claims
1. A method for verifying the position of a virtual character, applied to a server, the method include: Synchronizing a reference server time of the server to a plurality of clients, wherein the plurality of clients include a first client and a second client; When receiving an interaction request uploaded by the first client, obtaining the current server time of the server; wherein the interaction request includes a first position of the virtual character detected by the first client and controlled by the second client; Calculate the network delay duration according to the current server time and the reference server time; Calculating a second position of the virtual character controlled by the second client according to the network delay duration; If the distance between the second position and the first position is less than a first distance threshold, the first position is verified to be a valid position; if the distance between the second position and the first position is greater than or equal to the first distance threshold, the first position is verified to be an invalid position.
2. The method according to claim 1, in, The interaction request also includes a relative server time, and the relative server time is calculated based on the reference server time; and the calculating of the network delay duration according to the current server time and the reference server time includes: The network delay duration is calculated according to the current server time and the relative server time.
3. The method according to claim 2, in, The calculating the network delay duration according to the current server time and the relative server time includes: Calculating the time difference between the current server time and the relative server time; The time difference between the current server time and the relative server time is determined as the network delay duration.
4. The method according to claim 1, in, The calculating, according to the network delay duration, a second position of the virtual character controlled by the second client comprises: Determine the message distribution delay duration; Determine the time required for smooth position transition; Adding the network delay duration, the message distribution delay duration and the duration required for the position smooth transition to obtain the position delay duration of the virtual character controlled by the second client; According to the position delay duration, a second position of the virtual character controlled by the second client is calculated.
5. The method according to claim 4, in, The server records a second historical position sequence of the virtual character controlled by the second client, the second historical position sequence comprising a plurality of historical positions arranged in sequence, and the plurality of historical positions respectively have corresponding recording times; The step of calculating the second position of the virtual character controlled by the second client according to the position delay time includes: Calculate the time difference between the current server time and the location delay time; Determine the time difference between the current server time and the position delay time as the target time for the virtual character controlled by the second client to be at the second position; Determining whether the target time is within the time length of the second historical position sequence; If the target time is within the time length of the second historical position sequence, determining a first recorded time and a second recorded time adjacent to the target time from the second historical position sequence; wherein the first recorded time is less than or equal to the target time, and the second recorded time is greater than the target time; From the multiple historical positions, obtaining a first historical position corresponding to the first recording time, and obtaining a second historical position corresponding to the second recording time; A second position of the virtual character controlled by the second client is calculated according to the first historical position and the second historical position.
6. The method according to claim 5, in, The calculating, according to the first historical position and the second historical position, a second position of the virtual character controlled by the second client comprises: Determining a location type of the first historical location, and determining a location type of the second historical location; Based on the position type of the first historical position and the position type of the second historical position, a second position of the virtual character controlled by the second client is calculated.
7. The method according to claim 6, in, The calculating, based on the position type of the first historical position and the position type of the second historical position, the second position of the virtual character controlled by the second client comprises: If the first historical position is of the teleportation position type and the second historical position is of the teleportation position type, the first historical position is determined as the second position of the virtual character controlled by the second client.
8. The method according to claim 6, in, The calculating, based on the position type of the first historical position and the position type of the second historical position, the second position of the virtual character controlled by the second client comprises: If the first historical position is a teleportation position type and the second historical position is a smooth transition position type, linear interpolation is performed using the target time, the first historical position, the first recording time, the second historical position, and the second recording time to obtain the second position of the virtual character controlled by the second client.
9. The method according to claim 6, in, The calculating, based on the position type of the first historical position and the position type of the second historical position, the second position of the virtual character controlled by the second client comprises: If the first historical position is of a smooth transition position type and the second historical position is of a teleportation position type, the first historical position is determined as a second position of the virtual character controlled by the second client.
10. The method according to claim 6, in, The calculating, based on the position type of the first historical position and the position type of the second historical position, the second position of the virtual character controlled by the second client comprises: If the first historical position is a smooth transition position type and the second historical position is a smooth transition position type, linear interpolation is performed using the target time, the first historical position, the first recorded time, the second historical position, and the second recorded time to obtain the second position of the virtual character controlled by the second client.
11. The method according to claim 5, in, After determining whether the target time is within the time length of the second historical position sequence, the method further includes: If the target time is not within the time length of the second historical position sequence, obtaining the first historical position from the second historical position sequence; The historical position at the first position is determined as the second position of the virtual character controlled and operated by the second client.
12. The method according to claim 1, in, The interaction request further includes a third position of the virtual character controlled by the first client; the server records a first historical position sequence of the virtual character controlled by the first client, and the method further includes: Obtaining the last historical position from the first historical position sequence; If the distance between the last historical position and the third position is less than the second distance threshold, the third position is verified to be a valid position; if the distance between the last historical position and the third position is greater than or equal to the second distance threshold, the third position is verified to be an invalid position.
13. The method according to claim 12, in, The method further comprises: When the first position is a valid position and the third position is a valid position, generating permission information and sending the permission information to the first client; the permission information is used to instruct the first client to perform an interactive operation on the virtual character controlled by the second client; When the first position is an invalid position, and / or the third position is an invalid position, a rejection message is generated and the rejection message is sent to The rejection information is sent to the first client; the rejection information is used to instruct the first client not to perform interactive operations on the virtual character controlled by the second client.
14. A device for verifying the position of a virtual character, applied to a server, wherein the device include: A reference server time synchronization module, used to synchronize the reference server time of the server to multiple clients, wherein the multiple clients include a first client and a second client; A current server time acquisition module, configured to acquire the current server time of the server when receiving an interaction request uploaded by the first client; wherein the interaction request includes a first position of a virtual character detected by the first client and controlled by the second client; A network delay duration calculation module, used to calculate the network delay duration according to the current server time and the reference server time; A second position calculation module, used for calculating a second position of the virtual character controlled by the second client according to the network delay duration; The first verification module is used to verify that the first position is a valid position if the distance between the second position and the first position is less than a first distance threshold; if the distance between the second position and the first position is greater than or equal to the first distance threshold, verify that the first position is an invalid position.
15. An electronic device comprising a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the steps of the method for verifying the position of a virtual character as claimed in any one of claims 1 to 13.
16. A computer-readable storage medium storing a computer program, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the step of verifying the position of the virtual character according to any one of claims 1 to 13 is implemented.
Citation Information
Patent Citations
Data validation method and related devices
CN107426156A
Virtual character position verification method and device, electronic equipment and storage medium
CN111773680A
Action synchronization method and device in game, electronic equipment and storage medium
CN112206511A
Virtual character position verification method and device, electronic equipment and storage medium
CN116271845A
Apparatus and method of providing location information of online game character using in-client-server
KR1020130049322A
