Network synchronization flow control method in game

By introducing the intermediate layer of network protocol in game development for data interception, subcontracting and compression processing, the network blockage caused by the excessive data size is solved, the game fluency and development efficiency are improved, and abnormal detection is simplified.

CN118890399APending Publication Date: 2024-11-01XIAMEN TRUE FUN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411059134.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-02
Publication Date
2024-11-01

AI Technical Summary

Technical Problem

During the game development process, network synchronization traffic increases due to the excessively long data size, causing network blockage and client lag. The existing technology audit and compression solutions have problems such as low efficiency and difficulty in troubleshooting.

Method used

The network protocol intermediate layer scheme is adopted to intercept and subcontract network protocol information to convert and compress data formats, including splitting, subcontracting and compression of protocol headers and contents, and further compressing is used to ensure data transmission efficiency and convenience. Troubleshoot abnormalities.

Benefits of technology

It realizes rapid project application construction, saves network traffic, reduces message blockage, improves game fluency and development and maintenance convenience, and simplifies network protocol interface abnormality checking.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118890399A_ABST
    Figure CN118890399A_ABST
Patent Text Reader

Abstract

The invention discloses a network synchronization flow control method in a game, which comprises the following steps of: S1, adjusting a network protocol information unified interface process of a client and a server, and adding a protocol processing intermediate layer in each network protocol synchronization; s2, when the client side receives data needing to be uploaded to the server side, a data sending protocol interface is started, current network protocol information is packaged and submitted to a protocol processing middle layer to be subjected to information content adjustment in a unified mode; s3, the existing network protocol information is split and subjected to subpackage processing; s4, the protocol processing intermediate layer performs corresponding data format conversion on the subpackaged protocol content information and compresses the subpackaged protocol content information; and S5, integrating and restoring the received network protocol information compressed data packet by the server. According to the method and the device, the problems of network congestion and client jamming caused by increase of network synchronization flow data due to overlong size of applied data when the network synchronization interface data is processed are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of network communication, and in particular relates to a method for controlling network synchronization flow in a game. Background Art

[0002] When gamers play online games, they need to exchange high-frequency client data with the server. However, there are differences in the technical levels of development members. When processing network synchronization interface data, it is easy for the requested data size to be too long, resulting in an increase in network synchronization traffic data, causing network congestion and client lag.

[0003] To solve the above problems, the existing technology mainly adopts the following two solutions: Solution 1: Establish code review members to review the quality of codes submitted by development members, ensure that the development codes in the game development process meet the specifications, and shield the network synchronization logic problems caused by different levels of members to the greatest extent. This solution is limited by the volume of game development content. The time spent by review members will increase with the increase in the development volume, and the accuracy of the review is greatly affected by the level of the review members, which makes it easy for review omissions to occur. Solution 2: Use a compression plug-in of a third-party plug-in (such as 7-zip, RaRd, etc.) to compress data content and minimize the amount of network synchronization data. Since this solution uses third-party compression, it is impossible to know the specific location of the problematic network synchronization interface, which makes it difficult to troubleshoot abnormal problems.

[0004] The Chinese patent with publication number CN1964351A discloses a method for reducing the network traffic of a game server by compressing data packets, including: the game server uses the LZW compression algorithm to compress and decompress data by dictionary reconstruction; the LZW compression algorithm means that for each client that establishes a network link with the game server, a compression module corresponding to the game server is set, the compression module compresses the data sent between the client and the game server through the network link before sending it, and the data received between the client and the game server through the network link is decompressed by the compression module. After the invention uses the LZW compression algorithm to compress data, the content of the data packet becomes unreadable or difficult to analyze directly, which may also cause difficulties in debugging and locating network synchronization problems. Summary of the invention

[0005] The present invention provides a method for controlling network synchronization flow in a game, aiming to solve the problem that when processing network synchronization interface data, the network synchronization flow data increases due to the excessive size of the requested data, causing network congestion and client freezes.

[0006] In order to solve the above technical problems, the present invention provides a method for controlling network synchronization flow in a game, comprising the following steps:

[0007] S1: Adjust the unified interface process of the network protocol information between the client and the server, and add a protocol processing middle layer in each network protocol synchronization.

[0008] S2: When the client receives data that needs to be uploaded to the server, it starts the data transmission protocol interface. The interface automatically intercepts and captures the current transmission information, packages the current network protocol information and sends it to the protocol processing middle layer for unified adjustment of the information content.

[0009] S3: After receiving the corresponding network protocol information, the protocol processing middle layer splits the existing network protocol information into protocol header information and protocol content information, and performs packet processing on the split network protocol information.

[0010] S4: The protocol processing middle layer adjusts the packetized protocol content information from a recurring data structure to a simple data storage, performs corresponding data format conversion according to the parameter type of the current network protocol information, and further performs compression processing.

[0011] S5: The server integrates and restores the received network protocol information compression data packets in the information receiving queue, and resolves them into the original network protocol information according to the network protocol type.

[0012] Preferably, the protocol header information in step S2 includes the source location and source interface name of the current network protocol information; the protocol content information includes the protocol content length, the number of protocol information packets, and the specific content stored in the protocol information.

[0013] Preferably, the protocol content length is the overall length of the current network protocol information, which is used to determine whether to perform protocol subpackaging processing; the number of protocol information subpackaging is used to indicate the specific number of cuts of the current protocol file information; and the specific content of the protocol information storage is used to indicate the network protocol information data content that currently needs to be transmitted.

[0014] Preferably, the packet processing for the split network protocol information in step S3 is specifically as follows:

[0015] First, the network protocol types of different interfaces are divided, and the length of the current protocol content information is checked in the client's protocol processing middle layer. When the protocol content information exceeds the set length, data cutting is performed and the current cutting granularity is recorded; the network protocol types of the interface include CMD protocol, RPC protocol, and TARGETRPRC protocol.

[0016] Preferably, the step S4 is specifically:

[0017] S41: After the protocol processing intermediate layer receives the corresponding protocol content information, the parameter data type according to the protocol content information is adjusted to the corresponding data interval type and precision processing is performed, including:

[0018] According to the actual value length of the parameter data in the protocol content information, the parameter data type is dynamically adjusted to the maximum value type parameter data that can accommodate the value length.

[0019] The complex parameter data including quaternions or vectors in the protocol content information is compressed and adjusted into simple parameter data including unsigned integers or signed integers.

[0020] S42: After the corresponding data format conversion is performed, further compression processing is performed according to the data length of the converted protocol content information, and ZSTD is started to perform compression after the data length of the protocol content information exceeds a preset data length.

[0021] Preferably, step S5 is specifically as follows: the server receives a compressed data packet of the current network protocol information, determines whether there is a corresponding number of subpackets, and if there is a corresponding number of subpackets, waits until all the subpacket data are received, and then re-arranges them according to the subpacket order to form a new network protocol information packet, and parses them into the original network protocol information according to the network protocol type.

[0022] Preferably, the method further comprises: performing information statistics of the corresponding interface source, the number of interface network transmissions, and the network transmission frequency for the network protocol information transmitted via the network protocol.

[0023] On the other hand, the present invention provides a network synchronization flow control system in a game, including a client and a server, wherein the client and the server are used to execute the network synchronization flow control method in a game as described in any embodiment of the present invention.

[0024] On the other hand, the present invention also provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for controlling network synchronization traffic in a game as described in any embodiment of the present invention is implemented.

[0025] On the other hand, the present invention further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the method for controlling network synchronization flow in a game as described in any embodiment of the present invention is implemented.

[0026] Compared with the prior art, the present invention has the following technical effects:

[0027] 1. The present invention adopts a solution of establishing a network protocol middle layer, so that it can quickly build project applications for different development projects without the need for additional development processing for specific projects. In addition, the detailed information data on the network protocol in the statistical content is recorded accordingly in the background, making it more convenient to troubleshoot network protocol interface anomalies.

[0028] 2. The method of the present invention also includes corresponding network protocol information compression, which can greatly save the traffic consumption of network information synchronization. At the same time, there is a corresponding packetization mechanism, which greatly reduces the message congestion problem caused by protocol network synchronization. In terms of developing network protocols, it improves the convenience of maintenance for development members while reducing the transmission cost of the server. In terms of player experience, it can reduce the delay caused by network synchronization and improve the fluency of the game. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 It is an overall flow chart of the network synchronization flow control method in the game described in the present invention. DETAILED DESCRIPTION

[0030] In order to make the objectives, technical solutions and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in combination with specific embodiments of the present application and with reference to the accompanying drawings.

[0031] Embodiment 1

[0032] This embodiment provides a method for controlling network synchronization flow in a game, comprising the following steps:

[0033] S1: Adjust the unified interface process of the network protocol information between the client and the server, and add a protocol processing middle layer in each network protocol synchronization.

[0034] S2: When the client receives data that needs to be uploaded to the server, it starts the data transmission protocol interface. The interface automatically intercepts and captures the current transmission information, packages the current network protocol information and sends it to the protocol processing middle layer for unified adjustment of the information content.

[0035] As a preferred implementation of this embodiment, the protocol header information in step S2 includes the source location and source interface name of the current network protocol information; the protocol content information includes the protocol content length, the number of protocol information packets, and the specific content stored in the protocol information.

[0036] As a preferred implementation mode of this embodiment, the protocol content length is the overall length of the current network protocol information, which is used to determine whether to perform protocol subpackaging processing; the number of protocol information subpackaging is used to indicate the specific number of cuts of the current protocol file information; the specific content of the protocol information storage is used to indicate the network protocol information data content that currently needs to be transmitted.

[0037] S3: After receiving the corresponding network protocol information, the protocol processing middle layer splits the existing network protocol information into protocol header information and protocol content information, and performs packet processing on the split network protocol information.

[0038] As a preferred implementation of this embodiment, the packet processing for the split network protocol information in step S3 is specifically as follows:

[0039] First, the network protocol types of different interfaces are divided. The length of the current protocol content information is first checked in the client's protocol processing middle layer. When the protocol content information exceeds the set length, data cutting is performed and the current cutting granularity is recorded. For example, the length of a single network protocol information is 1000, and the set length is 200. The number of data packets after cutting is 5, each with a length of 200. The format of the network protocol information finally sent is {protocol header information, number of subpackets, protocol content information i}, i∈[1,N], N is the number of data packets cut; the network protocol types of the interface include CMD protocol, RPC protocol, and TARGETRPRC protocol. Among them, the CMD protocol usually indicates that the client communicates messages to the server in the network protocol; the RPC protocol indicates that the server sends network messages to all connected clients; the TARGETRPRC protocol indicates that the server sends network messages to the specified client.

[0040] S4: The protocol processing middle layer adjusts the packetized protocol content information from a recurring data structure to a simple data storage, performs corresponding data format conversion according to the parameter type of the current network protocol information, and further performs compression processing.

[0041] As a preferred implementation of this embodiment, step S4 is specifically as follows:

[0042] S41: After the protocol processing intermediate layer receives the corresponding protocol content information, the parameter data type according to the protocol content information is adjusted to the corresponding data interval type and precision processing is performed, including:

[0043] According to the actual value length of the parameter data in the protocol content information, the parameter data type is dynamically adjusted to the maximum value type parameter data that can accommodate the value length. For example, if the data type of the parameter data is long data type, but the actual value length does not exceed the value that can be accommodated by 32int, it can be dynamically adjusted to the maximum value type that can actually be accommodated, such as 64int, 32int, uInt, short byte data type, according to the actual value length of the current parameter data.

[0044] The composite parameter data including quaternions or vectors in the protocol content information is compressed and adjusted to simple parameter data including unsigned integers or signed integers. Specifically, for example, the parameter data quaternion (float, float, float, float) of the composite quaternion is compressed accordingly and its type can be adjusted to uint storage, so that each parameter data can save 12 bytes of memory space. Further, the adjustment of the quaternion can be:

[0045] 1. Use unit radius limit: Because the quaternion (x, y, z, w) represents the rotation on the unit sphere, it is assumed that the value of the quaternion is normalized (unit length), that is:

[0046] x 2 +y 2 +z 2 +w 2 =1

[0047] This means that w can be derived from x, y, z, and only x, y, z can be stored and packed into a uint through bit compression.

[0048] 2. Quantize the quaternion components to integers: Map the value range of x, y, and z from [-1, 1] to an integer range. Assuming that 10 bits are used to store each component, the integer range of each component is [0, 1023].

[0049]

[0050] In the formula, q int is the converted data; component is the x, y or z component of the quaternion; the 511.5 in the above formula is because 10 bits are used to represent each component, and the range is [0,1023], so the maximum value is 511.5.

[0051] 3. Use 2 bits to store the sign bit: Since there are only three components, 2 bits can be used to store the index of the largest absolute value component in the original quaternion to determine whether it needs to be handled as a negative value.

[0052] 4. Merge into a uint: The format of the merged uint is: 2 bits: used to store the index of the maximum absolute value component; 10 bits: store x; 10 bits: store y; 10 bits: store z; a total of 32 bits, that is, one unit.

[0053] For the parameter data vector (float, float, float) of the composite vector, long length is stored according to the corresponding parameter value, so each parameter data can save 4 bytes of memory space.

[0054] S42: After the corresponding data format conversion is performed, further compression processing is performed according to the data length of the converted protocol content information, and ZSTD is started for compression after the data length of the protocol content information exceeds the preset data length. Among them, ZSTD compression is an algorithm with high compression rate, high decompression and compression speed among the commonly used compression algorithms, which can greatly improve the data compression speed and data compression capacity.

[0055] S5: The server integrates and restores the received network protocol information compression data packets in the information receiving queue, and resolves them into the original network protocol information according to the network protocol type.

[0056] As a preferred implementation scheme of this embodiment, step S5 is specifically as follows: the server receives a compressed data packet of the current network protocol information, determines whether there is a corresponding number of subpackets, and if there is a corresponding number of subpackets, waits until all the subpacket data are received, and then re-arranges them according to the subpacket order to form a new network protocol information packet, and parses them into the original network protocol information according to the network protocol type, and when detailed data is needed, adjusts the data format converted from the network protocol information to normal data.

[0057] As a preferred implementation of this embodiment, the method further includes: performing information statistics of the corresponding interface source, the number of interface network transmissions, and the network transmission frequency for the network protocol information transmitted via the network protocol.

[0058] Embodiment 2

[0059] Accordingly, this embodiment provides a network synchronization flow control system in a game, including a client and a server, and the client and the server are used to execute the network synchronization flow control method in a game as described in any embodiment of the present invention.

[0060] Embodiment 3

[0061] This embodiment provides an electronic device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method for controlling network synchronization traffic in a game as described in any embodiment of the present invention when executing the computer program.

[0062] Embodiment 4

[0063] This embodiment provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for controlling network synchronization flow in a game as described in any embodiment of the present invention is implemented.

[0064] In the embodiments of the present application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent the existence of A alone, the existence of A and B at the same time, and the existence of B alone. Among them, A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c can be represented by: a, b, c, a and b, a and c, b and c, or a and b and c, where a, b, c can be single or multiple.

[0065] Those of ordinary skill in the art will appreciate that the various units and algorithm steps described in the embodiments disclosed herein can be implemented in a combination of electronic hardware, computer software, and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0066] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0067] In several embodiments provided in the present application, if any function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory; hereinafter referred to as: ROM), random access memory (Random Access Memory; hereinafter referred to as: RAM), disk or optical disk, and other media that can store program codes.

[0068] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A method for controlling network synchronization flow in a game, characterized in that: The following steps are involved: S1: Adjust the unified interface process of the network protocol information between the client and the server, and add a protocol processing middle layer in each network protocol synchronization; S2: When the client receives data that needs to be uploaded to the server, it starts the data transmission protocol interface, which automatically intercepts and captures the current transmission information, packages the current network protocol information and sends it to the protocol processing middle layer for unified adjustment of the information content; S3: After receiving the corresponding network protocol information, the protocol processing middle layer splits the existing network protocol information into protocol header information and protocol content information, and performs packet processing on the split network protocol information; S4: The protocol processing middle layer adjusts the packetized protocol content information from a recurring data structure to a simple data storage, performs corresponding data format conversion according to the parameter type of the current network protocol information, and further performs compression processing; S5: The server integrates and restores the received network protocol information compression data packets in the information receiving queue, and resolves them into the original network protocol information according to the network protocol type.

2. The method for controlling network synchronization flow in a game according to claim 1, characterized in that: The protocol header information in step S2 includes the source location and source interface name of the current network protocol information; the protocol content information includes the protocol content length, the number of protocol information packets, and the specific content stored in the protocol information.

3. The method for controlling network synchronization flow in a game according to claim 2, characterized in that: The protocol content length is the overall length of the current network protocol information, which is used to determine whether to perform protocol subpackaging processing; the number of protocol information subpackaging is used to indicate the specific number of cuts of the current protocol file information; the specific content of the protocol information storage is used to indicate the data content of the network protocol information that currently needs to be transmitted.

4. A method for controlling network synchronization flow in a game according to claim 1, characterized in that: The specific steps of performing the packet sub-processing on the split network protocol information in step S3 are as follows: First, divide the network protocol types of different interfaces into different types. In the client's protocol processing middle layer, the length of the current protocol content information is checked. When the protocol content information exceeds the set length, data is cut and the current cutting granularity is recorded. The network protocol types of the interface include CMD protocol, RPC protocol, and TARGETRPRC protocol.

5. A method for controlling network synchronization flow in a game according to claim 1, characterized in that: The step S4 is specifically as follows: S41: After the protocol processing intermediate layer receives the corresponding protocol content information, the parameter data type according to the protocol content information is adjusted to the corresponding data interval type and precision processing is performed, including: According to the actual value length of the parameter data in the protocol content information, the parameter data type is dynamically adjusted to the maximum value type parameter data that can accommodate the value length; The composite parameter data including quaternions or vectors in the protocol content information is compressed and adjusted into simple parameter data including unsigned integers or signed integers; S42: After the corresponding data format conversion is performed, further compression processing is performed according to the data length of the converted protocol content information, and ZSTD is started to perform compression after the data length of the protocol content information exceeds a preset data length.

6. The method for controlling network synchronization flow in a game according to claim 1, characterized in that: Step S5 is specifically as follows: the server receives the compressed data packet of the current network protocol information, determines whether there is a corresponding number of sub-packets, and if so, waits until all the sub-packet data are received, and then re-arranges them according to the sub-packet order to form a new network protocol information packet, and resolves them into the original network protocol information according to the network protocol type.

7. The method for controlling network synchronization flow in a game according to claim 1, characterized in that: The method further comprises: performing information statistics of corresponding interface sources, interface network transmission quantity, and network transmission frequency on the network protocol information transmitted via the network protocol.

8. A network synchronization flow control system in a game, characterized in that: It comprises a client and a server, and the client and the server are used to execute the network synchronization flow control method in the game as described in any one of claims 1 to 7.

9. An electronic device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the network synchronization flow control method in the game as described in any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for controlling network synchronization flow in a game according to any one of claims 1 to 7 is implemented.