Multi-player real-time game rollback method and device, computer equipment, readable storage medium and program product
By transmitting frame instructions in real time, generating predicted frames and filtering high interactive frames in multiplayer real-time games, the problem of low rollback computing efficiency caused by network delay is solved, and efficient rollback computing and smooth gaming experience is achieved.
Patent Information
- Application Number
- CN202411922764.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-01
AI Technical Summary
In multiplayer real-time games, due to network delay and packet loss problems, the arrival time of player operation instructions is inconsistent, resulting in large global rollback calculation overhead, affecting system performance.
By transmitting frame instructions in real time, predicted frames are generated, and frames of players with high interaction possibilities are filtered according to preset judgment conditions, only these frames are rolled back to reduce invalid calculations.
It significantly reduces the amount of rollback calculations, improves calculation efficiency, ensures that the impact of delayed instructions on game logic can be corrected in a timely manner, and improves game fairness and interactive experience.
Smart Images

Figure CN119733246A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of real-time game technology, and in particular to a rollback method, apparatus, computer equipment, computer-readable storage medium, and computer program product for a multiplayer real-time game. Background Art
[0002] During the operation of multiplayer real-time games, it is necessary to handle real-time interactions between multiple players. However, due to network delays, packet loss and other issues, the time when different players' operation instructions arrive at the server and other terminals may be inconsistent. In order to maintain logical consistency, the existing technology usually adopts a rollback mechanism to correct the impact of delayed instructions by recalculating the state of historical frames. However, global rollback will lead to a significant increase in computing overhead, especially when there are many players and complex scenes, which will put a heavy burden on system performance, resulting in low efficiency of rollback calculations. Summary of the invention
[0003] Based on this, it is necessary to provide a rollback method, apparatus, computer device, computer-readable storage medium and computer program product for multiplayer real-time games that can improve the rollback calculation efficiency in response to the above technical problems.
[0004] In a first aspect, the present application provides a rollback method for a multiplayer real-time game, comprising:
[0005] Transmitting a frame instruction for a current frame of a current game account to a game server in real time, and simultaneously receiving a frame instruction for a target frame of another game account transmitted from the game server in real time;
[0006] In the case where the target frame is earlier than the current frame, determining the predicted frame of the other game account from the target frame to the current frame according to the frame instruction of the target frame;
[0007] When it is determined, according to a preset determination condition and the prediction frame, that the other game account has a first preset relationship with the current game account, the account status of the other game account is rolled back; the first preset relationship is used to indicate that a possibility of interaction between the other game account and the current game account is higher than a preset threshold.
[0008] In one embodiment, rolling back the account status of the other game account includes:
[0009] When the time interval between the target frame and the current frame is greater than or equal to a preset interval, determining a predicted frame in the middle between the target frame and the current frame as a rollback frame of the other game account;
[0010] When the time interval between the target frame and the current frame is less than the preset interval, determining the target frame as the rollback frame of the other game account;
[0011] The rollback displays the rollback frames of the other game accounts.
[0012] In one embodiment, after rolling back and displaying the rollback frame of the other game account, the method further includes:
[0013] According to a preset step length, starting from the rollback frame, the predicted frames of the other game accounts are displayed at an accelerated speed until the other game accounts are displayed to the current frame.
[0014] In one embodiment, after rolling back and displaying the rollback frame of the other game account, the method further includes:
[0015] When the preset target instruction of the other game account is received, the current frame of the other game account based on the preset target instruction is directly displayed.
[0016] In one embodiment, after receiving in real time the frame instruction of the target frame for other game accounts transmitted from the game server, the method further includes:
[0017] When the target frame is later than the current frame, storing a frame instruction of the target frame;
[0018] When the current frame advances to the target frame, the account status of the current game account and the other game accounts are calculated and determined according to the frame instruction of the target frame.
[0019] In one embodiment, the real-time receiving of a frame instruction for a target frame of another game account transmitted from the game server includes:
[0020] receiving in real time a frame instruction of a target frame for other game accounts and a verification parameter of the target frame transmitted from the game server;
[0021] After rolling back the account status of the other game accounts, the method further includes:
[0022] When the calculated verification parameter does not meet the verification parameter of the target frame, a game data acquisition request is re-initiated to the game server; the calculated verification parameter is the verification parameter calculated and determined by the other game account after the rollback.
[0023] In a second aspect, the present application also provides a rollback device for a multiplayer real-time game, comprising:
[0024] A real-time communication module, used to transmit a frame instruction for a current frame of a current game account to a game server in real time, and simultaneously receive a frame instruction for a target frame of another game account transmitted from the game server in real time;
[0025] A prediction frame generation module, configured to determine, when the target frame is earlier than the current frame, a prediction frame for the other game account between the target frame and the current frame according to a frame instruction of the target frame;
[0026] The state rollback module is used to roll back the account state of the other game account when it is determined, according to a preset determination condition and the prediction frame, that the other game account has a first preset relationship with the current game account; the first preset relationship is used to indicate that the possibility of the other game account interacting with the current game account is higher than a preset threshold.
[0027] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0028] Transmitting a frame instruction for a current frame of a current game account to a game server in real time, and simultaneously receiving a frame instruction for a target frame of another game account transmitted from the game server in real time;
[0029] In the case where the target frame is earlier than the current frame, determining the predicted frame of the other game account from the target frame to the current frame according to the frame instruction of the target frame;
[0030] When it is determined, according to a preset determination condition and the prediction frame, that the other game account has a first preset relationship with the current game account, the account status of the other game account is rolled back; the first preset relationship is used to indicate that a possibility of interaction between the other game account and the current game account is higher than a preset threshold.
[0031] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0032] Transmitting a frame instruction for a current frame of a current game account to a game server in real time, and simultaneously receiving a frame instruction for a target frame of another game account transmitted from the game server in real time;
[0033] In the case where the target frame is earlier than the current frame, determining the predicted frame of the other game account from the target frame to the current frame according to the frame instruction of the target frame;
[0034] When it is determined, according to a preset determination condition and the prediction frame, that the other game account has a first preset relationship with the current game account, the account status of the other game account is rolled back; the first preset relationship is used to indicate that a possibility of interaction between the other game account and the current game account is higher than a preset threshold.
[0035] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0036] Transmitting a frame instruction for a current frame of a current game account to a game server in real time, and simultaneously receiving a frame instruction for a target frame of another game account transmitted from the game server in real time;
[0037] In the case where the target frame is earlier than the current frame, determining the predicted frame of the other game account from the target frame to the current frame according to the frame instruction of the target frame;
[0038] When it is determined, according to a preset determination condition and the prediction frame, that the other game account has a first preset relationship with the current game account, the account status of the other game account is rolled back; the first preset relationship is used to indicate that a possibility of interaction between the other game account and the current game account is higher than a preset threshold.
[0039] The rollback method, apparatus, computer device, computer-readable storage medium and computer program product of the multiplayer real-time game first transmit the frame instruction of the current frame of the current game account to the game server in real time, and simultaneously receive the frame instruction of the target frame of other game accounts transmitted from the game server in real time, so as to ensure the data synchronization between the game server and each terminal and improve the real-time performance of the instruction transmission; then, when the target frame is earlier than the current frame, the predicted frame between the target frame and the current frame of other game accounts is determined according to the frame instruction of the target frame, and the state change of other players is inferred through the prediction algorithm, so as to reduce the invalid calculation of the rollback range, ensure that the picture can still be displayed smoothly even if the delayed instruction arrives, and reduce the calculation cost. The influence of delay on the visual experience of players is calculated; finally, when it is determined that other game accounts have a first preset relationship with the current game account according to the preset judgment conditions and the prediction frame, the account status of other game accounts is rolled back, wherein the first preset relationship is used to indicate that the possibility of other game accounts interacting with the current game account is higher than the preset threshold, and through the preset condition screening, only the player status with a high possibility of interaction with the current player is rolled back, avoiding unnecessary global rollback calculations, thereby significantly reducing the amount of calculations, improving the calculation efficiency, and rolling back for players with high interaction possibilities, ensuring that the influence of delay instructions on the game logic can be corrected in time, while maintaining logical consistency, and improving the fairness of the game and the interactive experience. In the above method, through the generation of prediction frames and the screening of preset judgment conditions, only players with a high possibility of interaction are rolled back, avoiding the high calculation overhead of global rollback, ensuring the consistency and fairness of the game logic, and improving the efficiency of rollback calculations and the smoothness of the screen, effectively optimizing the overall game experience of the players. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0041] Figure 1 A diagram of an application environment of a rollback method for a multiplayer real-time game in one embodiment;
[0042] Figure 2 A schematic flow chart of a rollback method for a multiplayer real-time game in one embodiment;
[0043] Figure 3 A flowchart of steps for rolling back the account status of other game accounts in one embodiment;
[0044] Figure 4A schematic flow chart of a rollback method for a multiplayer real-time game in another embodiment;
[0045] Figure 5 It is a structural block diagram of a rollback device for a multi-player real-time game in one embodiment;
[0046] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0048] The rollback method for a multiplayer real-time game provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the local terminal 102 communicates with the game server 104 through the network. The data storage system can store the data that the game server 104 needs to process. The data storage system can be integrated on the game server 104, or it can be placed on the cloud or other network servers. The local terminal 102 transmits the frame instruction of the current frame for the current game account to the game server 104 in real time, and receives the frame instruction of the target frame for other game accounts (corresponding to other terminals 106) transmitted from the game server 104 in real time; when the target frame is earlier than the current frame, the local terminal 102 determines the predicted frame of other game accounts from the target frame to the current frame according to the frame instruction of the target frame; when the local terminal 102 determines that the other game account has a first preset relationship with the current game account according to the preset judgment condition and the predicted frame, the account status of the other game account is rolled back; the first preset relationship is used to indicate that the possibility of the other game account interacting with the current game account is higher than the preset threshold. Among them, the local terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers and portable wearable devices, and the portable wearable device can be a head-mounted device, etc. The head mounted device may be a virtual reality (VR) device, an augmented reality (AR) device, smart glasses, etc. The game server 104 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0049] It should be noted that in multiplayer real-time battle games, game devices need to frequently transmit and exchange operation instructions to achieve smooth real-time interaction. However, due to the inevitability of network delays, the status of other players displayed in the local terminal (that is, the terminal corresponding to the current game account) is almost always a predicted frame rather than a real real-time state. This predicted frame may be a calculation based on an earlier frame instruction (delayed operation data), or it may be a short-term prediction based on a later frame instruction (the latest received data). The predicted frame uses a certain algorithm to smoothly display the actions of other players to minimize the impact of delays on the picture.
[0050] To solve this problem, rollback network code is introduced in the prior art. Specifically, when a player inputs an operation instruction locally, the instruction will be synchronously transmitted to other players' terminals through the server. Each device processes data at a fixed frequency (for example, 60 frames per second, that is, every 1 / 60 second). If a frame has not received instructions from other players, the system will assume that other players have not input any operations based on the current known state, and calculate a temporary predicted state to complete the data processing of the frame.
[0051] When the delayed operation instruction finally arrives, the system will verify whether the previously predicted state corresponds to the actual instruction. If the prediction is correct, the game state can continue to move forward; if the prediction is wrong, the system will roll back the state to the frame before the predicted instruction takes effect, and recalculate the logical changes from that frame to the current frame. This process is called rollback processing, which aims to correct the state deviation caused by delayed instructions, thereby ensuring the consistency of game logic.
[0052] In an exemplary embodiment, Figure 2 As shown, a rollback method for a multiplayer real-time game is provided, and the method is applied to Figure 1 The local terminal 102 in FIG. 1 is used as an example to illustrate, including:
[0053] Step S201, transmitting a frame instruction of a current frame for a current game account to a game server in real time, and simultaneously receiving a frame instruction of a target frame for other game accounts transmitted from the game server in real time.
[0054] Among them, the current game account refers to the player account corresponding to the local terminal, and its operation instructions are generated by the local device and transmitted to the server.
[0055] The frame instruction of the current frame refers to the operation data generated by the current game account within the current time frame, such as character movement, attack or skill release.
[0056] The game server is the central node responsible for receiving, processing and distributing all player frame instructions, and is used to maintain status synchronization between terminals.
[0057] The frame instruction of the target frame refers to the operation data transmitted from other game accounts and is used to update the status of other players.
[0058] Exemplarily, the local terminal encapsulates the operation instructions of the current game account into a frame data packet within each time frame (e.g., 1 / 60 second), and sends it to the game server in real time after attaching the frame number and timestamp. After receiving the instructions, the game server verifies and stores them, and synchronously forwards these frame instructions to other terminals. After the local terminal receives the target frame instructions transmitted by the server, it updates the game status of other players by parsing these instruction data. If the time corresponding to the target frame instruction is earlier than the local current frame, the local terminal will generate a predicted frame for status display, or trigger a rollback mechanism as needed to ensure the consistency of game logic and the smoothness of the picture.
[0059] Step S202, when the target frame is earlier than the current frame, the predicted frames of other game accounts from the target frame to the current frame are determined according to the frame instruction of the target frame.
[0060] The target frame refers to the time frame corresponding to the instructions of other game accounts transmitted by the server, which may be earlier than the current frame of the local terminal due to network delay.
[0061] The current frame is the time frame that the local terminal is processing, which is used to update and display the game status in real time.
[0062] The predicted frame is the subsequent state of other game accounts inferred by the local terminal based on the target frame instructions and game rules, and is used to fill the state gap caused by the delay.
[0063] For example, when the local terminal receives the target frame instruction of other game accounts, it will determine whether the target frame is earlier than the current frame. If it is earlier than the current frame, the local terminal will start from the state of the target frame, use the operation information of the account (such as the speed, direction and action type of the character) and the game rules, and calculate the continuous state from the target frame to the current frame frame by frame. This series of predicted frames is used to update the display state of other game accounts, so that the delayed operation data will not affect the coherence and smoothness of the picture.
[0064] For example, in the Snake game, suppose the target frame is 90 frames, indicating that the snake head of player B is moving to the right, and the local terminal has already run to 100 frames. According to the moving direction and speed of the target frame, the local terminal will calculate the position of the snake head frame by frame, and generate prediction frames from 91 to 100 frames to show the current state of player B. If the local terminal subsequently receives a state instruction of 92 frames of actual delay of player B, it will correct the prediction frame according to the state and recalculate the state of subsequent frames to ensure logical consistency and picture accuracy. Through this mechanism, the local terminal can effectively alleviate the impact of network delay on the player experience and ensure the smoothness and interaction consistency of the game.
[0065] Step S203: when it is determined that the other game accounts have a first preset relationship with the current game account according to the preset determination condition and the prediction frame, the account status of the other game accounts is rolled back.
[0066] The first preset relationship is used to indicate that the possibility of other game accounts interacting with the current game account is higher than a preset threshold, which refers to a quantified interaction possibility relationship, such as the probability of two accounts colliding or triggering a skill effect within a certain range exceeding a threshold.
[0067] The preset judgment conditions refer to a set of rules used to analyze the status of other game accounts. Based on these rules, it can be determined whether other accounts are likely to interact with the current account, such as whether the location distance, speed direction, etc. are relatively close.
[0068] Rolling back the account status of other game accounts means rolling back the status of other accounts to the frame corresponding to the delay instruction and recalculating the status changes after the frame.
[0069] Exemplarily, the local terminal first determines whether the state change of other game accounts meets the preset judgment conditions based on the predicted frame. For example, in a multiplayer game, the preset judgment conditions may include the distance, direction or relative speed between the two accounts. If the predicted frame shows that a player's movement trajectory enters the skill attack range of the current player, etc., and the possibility of interaction exceeds the preset threshold, it is determined that the two accounts have a first preset relationship. The local terminal will perform a rollback operation on the player's state, roll back its state to the frame corresponding to the delay instruction, and recalculate its state from the frame, and update the logic of subsequent frames.
[0070] For example, in the Snake game, suppose the target frame (90 frames) indicates that the snake head of player B moves to the left, while the predicted frame shows that the movement trajectory of player B between frames 91 and 100 gradually approaches the snake body of player A. If it is determined that the snake head of player B enters the collision range of the snake body of player A at frame 100, and the collision probability is higher than the preset threshold, the local terminal will roll back the state of player B, rewind its state to frame 90, recalculate the state changes from frames 91 to 100, and finally update its display state in the current frame. Through this mechanism, the local terminal can efficiently handle important interactions that may occur, ensuring the accuracy and fairness of the game logic.
[0071] In the above-mentioned rollback method for multiplayer real-time games, first, the frame instruction of the current frame for the current game account is transmitted to the game server in real time, and the frame instruction of the target frame for other game accounts transmitted from the game server is received in real time, so as to ensure data synchronization between the game server and each terminal and improve the real-time performance of instruction transmission; then, in the case where the target frame is earlier than the current frame, the predicted frame between the target frame and the current frame of other game accounts is determined according to the frame instruction of the target frame, and the state changes of other players are inferred through the prediction algorithm, so as to reduce the invalid calculation of the rollback range, ensure that even if the delayed instruction arrives, the picture can still be displayed smoothly, and reduce the impact of the calculation delay on the player's visual experience. ; Finally, when it is determined that other game accounts have a first preset relationship with the current game account according to the preset judgment conditions and prediction frames, the account status of other game accounts is rolled back, wherein the first preset relationship is used to indicate that the possibility of other game accounts interacting with the current game account is higher than the preset threshold. By screening by preset conditions, only the player statuses with a high possibility of interaction with the current player are rolled back, avoiding unnecessary global rollback calculations, thereby significantly reducing the amount of calculations and improving calculation efficiency. Rollback is performed for players with a high possibility of interaction, ensuring that the impact of delayed instructions on the game logic can be corrected in time, while maintaining logical consistency, and improving game fairness and interactive experience. In the above method, by generating prediction frames and screening by preset judgment conditions, only players with a high possibility of interaction are rolled back, avoiding the high calculation overhead of global rollback, ensuring the consistency and fairness of the game logic, and improving the efficiency of rollback calculations and the smoothness of the screen, effectively optimizing the overall game experience of the player.
[0072] In an exemplary embodiment, Figure 3 As shown, the above step S203 of rolling back the account status of other game accounts can also be implemented by the following steps:
[0073] Step S301, when the time interval between the target frame and the current frame is greater than or equal to a preset interval, determining the predicted frame in the middle between the target frame and the current frame as a rollback frame of other game accounts;
[0074] Step S302, when the time interval between the target frame and the current frame is less than a preset interval, determining the target frame as a rollback frame of other game accounts;
[0075] Step S303: Roll back and display the rollback frames of other game accounts.
[0076] Among them, the rollback frame is a temporary display frame used to display the status of other game accounts.
[0077] The preset interval is a predefined threshold that is used to differentiate between long delay and short delay scenarios.
[0078] Rollback display means that the local terminal performs rollback calculation on the status of other game accounts according to the determined rollback frame, and performs a corrected display of the rollback frame.
[0079] For example, when the local terminal receives the target frame, it usually directly rolls back to display the target frame status of other game accounts. However, when the time interval between the target frame and the current frame is large (greater than the preset interval), it may cause the screen to be discontinuous. Therefore, the local terminal will calculate the middle predicted frame from the target frame and display it as the rollback frame to smooth the transition screen. The predicted frame is always calculated based on the instructions of the target frame. No matter where it is in the time interval, it is predicted and calculated based on the operation information of the target frame (such as moving direction, speed, etc.).
[0080] For example, if the target frame is 90, the current frame is 100, and the time interval is 10 frames (greater than the preset interval of 8 frames), the local terminal will select the middle frame 95 as the rollback frame and display it as the rollback frame to avoid the incoherence caused by the picture jumping directly from 90 frames to 100 frames. If the target frame is 98, the current frame is 100, and the time interval is 2 frames (less than the preset interval), the target frame 98 will be directly displayed as the rollback frame.
[0081] In this embodiment, by determining the time interval between the target frame and the current frame, the frame position for rollback display is flexibly selected to ensure a smooth transition when the delay is large, avoiding image inconsistency caused by long-term frame skipping. At the same time, it ensures that all predicted frames are calculated from the operating instructions of the target frame, thereby taking into account both logical consistency and visual fluency.
[0082] In an exemplary embodiment, after the above step S303 rolls back and displays the rollback frame of other game accounts, it also includes: according to a preset step length, starting from the rollback frame, accelerating the display of predicted frames of other game accounts until other game accounts are displayed to the current frame.
[0083] Among them, the preset step size refers to the time interval between each frame update during the accelerated display process, which is usually greater than the normal frame time interval (such as every 1 / 30 second) to increase the status catching up speed; accelerated display means increasing the frame update frequency or displaying multiple frames of status at the same time to make the display of other game accounts quickly catch up to the current frame.
[0084] For example, when the local terminal completes the display of the rollback frame (assuming the rollback frame is 105 frames), it will display the predicted frames in sequence starting from frame 105 according to the preset step size (such as 2 frames), such as frame 107, frame 109, etc. At the same time, the current frame is also advancing, for example, from frame 120 to frame 121, frame 122. The local terminal gradually catches up with the account status of other game accounts to the real-time status of the current frame by continuously generating and displaying predicted frames until the two are synchronized. During the catching-up process, each predicted frame is calculated based on the operation instructions of the target frame to ensure logical consistency and smooth visual transition.
[0085] In this embodiment, by gradually accelerating the display of the predicted frame from the rollback frame, the current frame state that is constantly advancing can be dynamically caught up. Under delay conditions, this method significantly reduces the impact of state lag on the screen, maintains the real-time and smoothness of the game logic and screen display, and improves the user's interactive experience.
[0086] In an exemplary embodiment, after the above step S303 rolls back and displays the rollback frame of other game accounts, it also includes: when receiving a preset target instruction of other game accounts, directly displaying the current frame of other game accounts based on the preset target instruction.
[0087] Among them, preset target instructions refer to the latest operation instructions of other game accounts, which usually correspond to key status changes (such as death, skill triggering) and contain clear timestamps.
[0088] Direct display means that after receiving the preset target instruction, the status of other game accounts is immediately updated to the current frame without the transition of frame-by-frame prediction or accelerated display.
[0089] For example, when the local terminal is accelerating the display from the rollback frame to the current frame (for example, catching up from frame 105 to frame 120 through accelerated frame-by-frame display), if it receives a preset target instruction from another game account (for example, a death status instruction triggered by player B at frame 115), it will immediately stop the current prediction frame and accelerated display process, and directly synchronously display the key status of other game accounts in the current frame (assuming that the current frame is frame 122). In this way, key events (such as death) of other players can be presented to the user immediately without waiting for the completion of the prediction frame or frame-by-frame transition.
[0090] In this embodiment, by receiving preset target instructions and directly displaying the current frame status of other game accounts, the local terminal can quickly synchronize key states, avoiding visual delays or unnatural transitions caused by frame-by-frame prediction. This significantly improves the real-time and accuracy of key events, ensures the consistency of game logic, and optimizes the player's visual experience and operation feedback experience.
[0091] In an exemplary embodiment, after the above step S201 receives in real time the frame instructions of the target frame for other game accounts transmitted from the game server, it also includes: when the target frame is later than the current frame, storing the frame instructions of the target frame; when the current frame advances to the target frame, calculating and determining the account status of the current game account and other game accounts according to the frame instructions of the target frame.
[0092] For example, when the local terminal receives a target frame instruction (for example, the instruction corresponds to 120 frames), and the current frame is 110 frames, and the target frame is later than the current frame, the local terminal will store the 120 frame instruction in the local instruction queue and will not process it immediately. When the current frame gradually advances to 120 frames, the local terminal will extract the target frame instruction from the stored instruction queue, update the status of other game accounts according to these instructions, and calculate the logical state of the current game account to determine whether there is an interaction, such as a collision or skill trigger.
[0093] In this embodiment, by storing the frame instructions of the target frame and processing them when the frame time is reached, the logical inconsistency problem caused by premature processing of future frame instructions is avoided. This can not only ensure the validity of future frame instructions, but also improve the consistency of game logic and real-time performance of the picture through precise time point processing.
[0094] In an exemplary embodiment, the above step S201 receives in real time frame instructions of target frames for other game accounts transmitted from the game server, and also includes: receiving in real time frame instructions and verification parameters of target frames for other game accounts transmitted from the game server.
[0095] Furthermore, in an exemplary embodiment, after rolling back the account status of other game accounts in the above step S203, it also includes: when the calculated verification parameters do not meet the verification parameters of the target frame, re-initiating a game data acquisition request to the game server.
[0096] The calculated verification parameters are verification parameters calculated and determined by other game accounts after rollback.
[0097] Among them, the verification parameter of the target frame is the flag information calculated and transmitted by the game server for the target frame operation instruction, which is used to verify the accuracy of the local terminal's processing of the target frame instruction.
[0098] Exemplarily, after the local terminal receives the frame instruction (e.g., 90 frames) and its verification parameters of the target frame, it will perform a rollback calculation according to the target frame instruction. For example, in the Snake game, the mark parameters (e.g., the specific position of the snake's head) calculated after the rollback will be compared with the verification parameters of the target frame. If the calculation result is consistent with the verification parameters provided by the server, it means that the rollback calculation is correct and no further operation is required; if it is inconsistent, for example, the local calculation shows that the position of the snake's head deviates from the server's verification parameters, it may be due to instruction loss, network anomalies, or local calculation errors. In this case, the local terminal will initiate a game data acquisition request to the server, re-acquire the complete status data of the target frame (including the position and direction of the snake's head, etc.), and perform status correction according to the data provided by the server.
[0099] In this embodiment, by receiving the verification parameters of the target frame and verifying the calculation results, the local terminal can quickly detect and locate problems in the state calculation. When the verification fails, the consistency of the local terminal and the server state is ensured by re-requesting complete data from the server, which effectively improves the accuracy and stability of the game logic, especially in the case of network fluctuations or calculation anomalies, and can be corrected in time to ensure the smooth experience and fairness of the players.
[0100] In an exemplary embodiment, Figure 4 As shown, a rollback method for a multiplayer real-time game is provided, and the method is applied to Figure 1 The game server 104 in FIG. 1 is used as an example to illustrate, including:
[0101] Step S401, receiving frame instructions and verification parameters transmitted by all terminals in their respective current frames, and broadcasting the frame instructions and verification parameters to all terminals in real time.
[0102] Step S402: when it is detected that any terminal has no transmission interaction within a preset time, predictive frame instructions and predictive verification parameters of any terminal are generated, and the predicted frame instructions and predicted verification parameters are broadcasted to all terminals in real time.
[0103] For example, after receiving the frame instructions and verification parameters of all game accounts in their respective current frames, the server broadcasts these data to all other terminals in real time. At the same time, if the server has not received the instruction data of a certain player A within a preset time, it will predict and generate the movement instructions and corresponding verification parameters of player A in the subsequent frames based on the operation trajectory of player A in the latest frame instruction (such as current position, speed and direction), and broadcast these prediction results to all terminals, so that other terminals can temporarily display the predicted status of player A.
[0104] In this embodiment, by receiving and broadcasting frame instructions and verification parameters, the server can ensure the synchronization of the terminal status of normal transmission. At the same time, by predicting the frame instructions and verification parameters of the unresponsive terminal, the server can avoid the problem of screen incoherence caused by network delay or transmission interruption, and ensure the consistency and fluency of the game logic.
[0105] In another exemplary embodiment, the present application provides a rollback method for a multiplayer real-time game, specifically comprising:
[0106] Can be applied to multiplayer snake battle games:
[0107] 1. Each device client and server simultaneously creates a state rollback controller, performs command detection at the same frequency, and synchronizes the current frame command to the server and other users if a command input is detected, and passes flag parameters (such as the user's snake head coordinates) for subsequent verification;
[0108] 2. When receiving synchronization instructions from other users, if the instruction frame is later than the current frame of the local user, the instruction is stored and the state calculation is performed when the same frame is executed; if the instruction frame is earlier than the current frame of the local user, the state is rolled back;
[0109] 3. The solution for state rollback is as follows: when state rollback is needed, for example, if 20 frames of data need to be rolled back, it is necessary to calculate whether each other user can approach the local user within 20 frames (which can be expanded to 40 frames to allow for error tolerance) and may have a special impact on the local user (such as being killed), and the state of other users also needs to be recalculated; if the distance is too far and it is impossible for the user to approach the local user in a short time, even if other users roll back their state, the data will not be affected, so there is no need to recalculate the state of other users. This solution can reduce the amount of calculations generated by rollback.
[0110] 4. A new flag parameter (snake head position) will be generated by rolling back the calculation. If the calculated parameter is inconsistent with the parameter transmitted by the server, it can be considered that the calculation is wrong, or there is a command loss or network abnormality. It is necessary to request the complete data of the current actual state from the server again and reconnect.
[0111] 5. Multiplayer real-time games are prone to network disconnection or fluctuations. Therefore, the server will conduct regular checks. If no user input is detected within a certain period of time, the server will generate instructions for this period of time through data prediction and broadcast the instructions.
[0112] 6. To ensure a smoother user experience, the network fluctuation difference between the two parties will be calculated based on the number of frames of the local user's current frame and the command when receiving other users' commands, and the display frame of the other user will be calculated based on the fluctuation difference. For example, if the local user has executed the command state of 100 frames and received the command of 90 frames from the other user, it can be considered that the network fluctuation is about 10 frames, and the predicted frame state of the other user at about 95 frames can be displayed. First, the data state of the other user's 90 frames can be repaired, and at the same time, by predicting 5 frames of data, the other user's scene display will not lag behind the local user too much.
[0113] 7. The calculation of display frames will be calculated in real time according to network fluctuations. If the current user receives a command of 148 frames from other users when the current frame number reaches 150 frames, then the network speed of other users can catch up, and the network fluctuation gap is reduced to 2 frames, which is close to a negligible gap. At this time, the display can be accelerated to chase the predicted frame of 150 frames. If the synchronization of key instructions (such as death instructions) is received, the frame will be chased to the current frame immediately to display the final state, ensuring that the user can immediately experience the death effect.
[0114] In this embodiment, by calculating the list of users actually affected by the instruction and performing a partial state rollback, unnecessary calculations are reduced and performance is improved; according to network fluctuations, the network fluctuation difference between users is calculated in real time, and the display frame is calculated and displayed according to the fluctuation difference. This makes the user experience smoother, adjusts the user display according to network fluctuations, and reduces frame skipping.
[0115] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0116] Based on the same inventive concept, the embodiment of the present application also provides a rollback device for a multiplayer real-time game for implementing the rollback method for a multiplayer real-time game involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of the rollback device for one or more multiplayer real-time games provided below can refer to the limitations of the rollback method for a multiplayer real-time game above, and will not be repeated here.
[0117] In an exemplary embodiment, Figure 5 As shown, a rollback device for a multi-player real-time game is provided, comprising: a real-time communication module 501, a prediction frame generation module 502 and a state rollback module 503, wherein:
[0118] A real-time communication module 501 is used to transmit a frame instruction for a current frame of a current game account to a game server in real time, and simultaneously receive a frame instruction for a target frame of another game account transmitted from the game server in real time;
[0119] The prediction frame generation module 502 is used to determine the prediction frames between the target frame and the current frame of other game accounts according to the frame instruction of the target frame when the target frame is earlier than the current frame;
[0120] The state rollback module 503 is used to roll back the account state of other game accounts when it is determined that the other game accounts have a first preset relationship with the current game account according to the preset judgment condition and the prediction frame; the first preset relationship is used to indicate that the possibility of interaction between the other game accounts and the current game account is higher than a preset threshold.
[0121] In one of the embodiments, the state rollback module 503 is further used to, when the time interval between the target frame and the current frame is greater than or equal to a preset interval, determine the predicted frame in the middle between the target frame and the current frame as the rollback frame of other game accounts; when the time interval between the target frame and the current frame is less than a preset interval, determine the target frame as the rollback frame of other game accounts; and roll back and display the rollback frames of other game accounts.
[0122] In one embodiment, the state rollback module 503 is further configured to accelerate the display of predicted frames of other game accounts starting from the rollback frame according to a preset step length until other game accounts are displayed to the current frame.
[0123] In one embodiment, the state rollback module 503 is further configured to directly display the current frame of the other game account based on the preset target instruction when receiving the preset target instruction of the other game account.
[0124] In one of the embodiments, the rollback device for the multiplayer real-time game is further used to store the frame instruction of the target frame when the target frame is later than the current frame; when the current frame advances to the target frame, the account status of the current game account and other game accounts is calculated and determined according to the frame instruction of the target frame.
[0125] In one embodiment, the real-time communication module 501 is further configured to receive in real time frame instructions and target frame verification parameters for other game accounts transmitted from the game server.
[0126] In one of the embodiments, the rollback device for the multiplayer real-time game is further used to re-initiate a game data acquisition request to the game server when the calculated verification parameters do not meet the verification parameters of the target frame; the calculated verification parameters are the verification parameters calculated and determined by other game accounts after the rollback.
[0127] Each module in the above-mentioned rollback device for multiplayer real-time games can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0128] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 6As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a rollback method for a multiplayer real-time game is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0129] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0130] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0131] In one embodiment, 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 in the above-mentioned method embodiments are implemented.
[0132] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0133] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0134] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0135] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0136] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A rollback method for a multiplayer real-time game, characterized in that: The method comprises: Transmitting a frame instruction for a current frame of a current game account to a game server in real time, and simultaneously receiving a frame instruction for a target frame of another game account transmitted from the game server in real time; In the case where the target frame is earlier than the current frame, determining the predicted frame of the other game account from the target frame to the current frame according to the frame instruction of the target frame; When it is determined, according to a preset determination condition and the prediction frame, that the other game account has a first preset relationship with the current game account, the account status of the other game account is rolled back; the first preset relationship is used to indicate that a possibility of interaction between the other game account and the current game account is higher than a preset threshold.
2. The method according to claim 1, characterized in that The rolling back the account status of the other game account includes: When the time interval between the target frame and the current frame is greater than or equal to a preset interval, determining a predicted frame in the middle between the target frame and the current frame as a rollback frame of the other game account; When the time interval between the target frame and the current frame is less than the preset interval, determining the target frame as the rollback frame of the other game account; The rollback displays the rollback frames of the other game accounts.
3. The method according to claim 2, characterized in that After rolling back and displaying the rollback frame of the other game account, the method further includes: According to a preset step length, starting from the rollback frame, the predicted frames of the other game accounts are displayed at an accelerated speed until the other game accounts are displayed to the current frame.
4. The method according to claim 2, characterized in that: After rolling back and displaying the rollback frame of the other game account, the method further includes: When the preset target instruction of the other game account is received, the current frame of the other game account based on the preset target instruction is directly displayed.
5. The method according to claim 1, characterized in that After receiving in real time the frame instruction of the target frame for other game accounts transmitted from the game server, the method further includes: When the target frame is later than the current frame, storing a frame instruction of the target frame; When the current frame advances to the target frame, the account status of the current game account and the other game accounts are calculated and determined according to the frame instruction of the target frame.
6. The method according to claim 1, characterized in that The real-time receiving of a frame instruction for a target frame of another game account transmitted from the game server includes: receiving in real time a frame instruction of a target frame for other game accounts and a verification parameter of the target frame transmitted from the game server; After rolling back the account status of the other game accounts, the method further includes: When the calculated verification parameter does not meet the verification parameter of the target frame, a game data acquisition request is re-initiated to the game server; the calculated verification parameter is the verification parameter calculated and determined by the other game account after the rollback.
7. A rollback device for a multiplayer real-time game, characterized in that: The device comprises: A real-time communication module, used to transmit a frame instruction for a current frame of a current game account to a game server in real time, and simultaneously receive a frame instruction for a target frame of another game account transmitted from the game server in real time; A prediction frame generation module, configured to determine, when the target frame is earlier than the current frame, a prediction frame for the other game account between the target frame and the current frame according to a frame instruction of the target frame; The state rollback module is used to roll back the account state of the other game account when it is determined, according to a preset determination condition and the prediction frame, that the other game account has a first preset relationship with the current game account; the first preset relationship is used to indicate that the possibility of the other game account interacting with the current game account is higher than a preset threshold.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.