A game server-based processing method and related apparatus
By employing a barrier mechanism in the game server and executing synchronized code sets in the order of dependencies, the efficiency and reliability issues caused by complex dependencies between game systems are resolved, enabling efficient and accurate determination of the external service status.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2022-03-17
- Publication Date
- 2026-07-07
AI Technical Summary
The dependencies between multiple game systems located in different processes within a game server are complex. Existing technologies require the development of additional timer-based fetching logic, which consumes a lot of manpower and effort and makes it difficult to accurately determine the state of entering external service, thus reducing work efficiency and reliability.
The system employs a barrier mechanism, which loads N barriers, with each barrier executing a set of synchronous code. The system then moves to the next barrier in the order determined by the dependencies, until all systems have left the Nth barrier, thus determining that they are ready to provide services to the outside world.
It saves manpower and effort in developing additional timer retrieval logic, accurately synchronizes data sequentially through barriers, precisely determines the state of entering external service, and improves the working efficiency and reliability of the game server.
Smart Images

Figure CN116785685B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing, and in particular to a processing method and related apparatus based on a game server. Background Technology
[0002] As the gaming industry continues to develop, game content and other features are becoming increasingly diverse to ensure player retention. This proliferation of content leads to a greater number of game systems on game servers. To ensure high availability, disaster recovery, and high load capacity, multiple processes are typically used to manage these multiple game systems.
[0003] In related technologies, when there are dependencies between multiple game systems located in different processes, additional timer retrieval logic needs to be developed for each dependency. An active polling retrieval method is used to resolve the dependencies and complete the loading of each game system, enabling the game server to enter the external service state.
[0004] However, as the number of game systems on the game server increases, the dependencies between multiple systems in different processes on the game server become more complex. The above method needs to consider more complex dependencies, and the additional development of timer retrieval logic requires a lot of manpower and effort. The retrieval frequency in the active polling retrieval method is difficult to determine, which makes it impossible to accurately determine the state of entering external service, thereby reducing the efficiency and reliability of the game server in providing external services. Summary of the Invention
[0005] To address the aforementioned technical issues, this application provides a processing method and related apparatus based on a game server. This eliminates the need for developing additional timer retrieval logic for dependencies, saving manpower and effort. Furthermore, it accurately determines the state of entering external service, thereby improving the efficiency and reliability of the game server in providing external services.
[0006] The embodiments of this application disclose the following technical solutions:
[0007] On the one hand, this application provides a processing method based on a game server, the method comprising:
[0008] Load N fences, each fence is used to execute a set of synchronized code, the order of the N fences corresponds to the execution order of the N sets of synchronized code, the N sets of synchronized code and the execution order are determined according to the dependency relationship between multiple game systems in different processes in the game server, where N is a positive integer;
[0009] When the process starts, the multiple game systems are controlled to enter the i-th fence in the order specified, i = 1, 2, ..., N;
[0010] Execute the set of synchronization code corresponding to the i-th fence within the i-th fence;
[0011] If it is detected that all of the multiple game systems have left the i-th fence, control the multiple game systems to enter the (i+1)-th fence, until it is detected that all of the multiple game systems have left the N-th fence, and then determine to enter the external service state.
[0012] On the other hand, this application provides a processing device based on a game server, the device comprising: a loading unit, a control unit, an execution unit, and a determination unit;
[0013] The loading unit is used to load N fences, each fence is used to execute a set of synchronized code, and the order of the N fences corresponds to the execution order of the N sets of synchronized code. The N sets of synchronized code and the execution order are determined according to the dependency relationship between multiple game systems located in different processes in the game server, where N is a positive integer.
[0014] The control unit is used to control the multiple game systems to enter the i-th fence in the order of arrangement when the process starts, i = 1, 2, ..., N;
[0015] The execution unit is used to execute the set of synchronization code corresponding to the i-th fence within the i-th fence;
[0016] The determining unit is configured to control the multiple game systems to enter the (i+1)th fence if it is detected that all of the multiple game systems have left the i-th fence, until it is detected that all of the multiple game systems have left the N-th fence, and then determine that the system has entered the external service state.
[0017] On the other hand, this application provides a processing computer device for a game server, the computer device including a processor and a memory:
[0018] The memory is used to store program code and transmit the program code to the processor;
[0019] The processor is used to execute the game server-based processing method described above according to the instructions in the program code.
[0020] On the other hand, embodiments of this application provide a computer-readable storage medium for storing a computer program for executing the game server-based processing method described above.
[0021] On the other hand, embodiments of this application provide a computer program product, which includes a computer program or instructions; when the computer program or instructions are executed by a processor, the game server-based processing method described above is performed.
[0022] As can be seen from the above technical solution, firstly, N barriers are loaded, each barrier is used to execute a set of synchronized code, and the order of the N barriers corresponds to the execution order of the N sets of synchronized code. The N sets of synchronized code and their execution order are determined by the dependencies between multiple game systems located in different processes in the game server, where N is a positive integer. Secondly, by starting a process, multiple game systems are controlled to enter the i-th barrier in the order they are arranged, i = 1, 2, ..., N. Then, the synchronized code set corresponding to the i-th barrier is executed within the i-th barrier. Finally, if it is detected that multiple game systems have left the i-th barrier, the multiple game systems are controlled to enter the (i+1)-th barrier, until it is detected that multiple game systems have left the N-th barrier, at which point the system is determined to enter the external service state. As can be seen, by autonomously implementing data synchronization corresponding to the set of synchronized code with defined dependencies through barriers, the data in the previous barrier is automatically synchronized after the data in the previous barrier is completed, and the next barrier is automatically entered. This not only eliminates the need to develop additional timer fetching logic for dependencies, saving manpower and effort, but also accurately achieves different data synchronizations in sequence through different barriers, so as to accurately determine the state of entering external service, thereby improving the efficiency and reliability of the game server in providing external services. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 This is a schematic diagram illustrating the process of a game server entering an external service state in a related technology.
[0025] Figure 2 A schematic diagram illustrating an application scenario of a processing method based on a game server provided in this application embodiment;
[0026] Figure 3 A flowchart illustrating a processing method based on a game server provided in this application embodiment;
[0027] Figure 4 A schematic diagram illustrating the loading of N fences on a game server, provided as an embodiment of this application;
[0028] Figure 5A schematic diagram illustrating multiple game systems entering the i-th fence, provided as an embodiment of this application;
[0029] Figure 6 A schematic diagram illustrating a game system leaving the i-th fence, provided as an embodiment of this application;
[0030] Figure 7 A schematic diagram illustrating how multiple game systems leave the i-th fence, as provided in an embodiment of this application;
[0031] Figure 8 A schematic diagram illustrating multiple game systems entering the (i+1)th fence, provided as an embodiment of this application;
[0032] Figure 9 A schematic diagram of a processing device based on a game server provided in an embodiment of this application;
[0033] Figure 10 This application provides a schematic diagram of the structure of a server according to an embodiment of the present application.
[0034] Figure 11 This is a schematic diagram of the structure of a terminal device provided in an embodiment of this application.
[0035] Specific implementation method
[0036] The embodiments of this application will now be described with reference to the accompanying drawings.
[0037] In related technologies, when there are dependencies between multiple game systems located in different processes, additional timer retrieval logic needs to be developed for each dependency. An active polling retrieval method is used to resolve the dependencies between multiple game systems located in different processes, complete the loading of each game system, and enable the game server to enter the external service state.
[0038] For example, when there is a data dependency between game system A and game system B located in different processes on a game server, specifically, data a1 in game system A depends on data b1 in game system B, and data b2 in game system B depends on data a1 in game system A. See also... Figure 1The diagram illustrates a process for a game server to enter an external service state in a related technology. Game system A adds a timer 1, which periodically sends a data retrieval request (b1) to game system B. If data b1 is loaded in game system B, game system A retrieves data b1 and stops timer 1, then constructs data a1 based on data b1. Furthermore, game system B adds a timer 2, which periodically sends a data retrieval request (a1) to game system A. If data a1 is constructed in game system A, game system B retrieves data a1 and stops timer 2, then constructs data b2 based on data a1. After data b2 is constructed, the game server enters the external service state.
[0039] However, as the number of game systems on the game server increases, the dependencies between multiple systems located in different processes become more complex. The above method needs to consider more complex dependencies, and the additional development of timer retrieval logic requires a lot of manpower and effort. The retrieval frequency in the active polling retrieval method is difficult to determine, which makes it impossible to accurately determine the state of entering external service, thereby reducing the efficiency and reliability of the game server in providing external services.
[0040] In view of this, this application proposes a processing method and related apparatus based on a game server. The method autonomously realizes data synchronization corresponding to the set of synchronization codes with determined dependencies through barriers. After the data synchronization in the previous barrier is completed, it automatically enters the next barrier. This not only eliminates the need to develop additional timer retrieval logic for dependencies, saving manpower and effort, but also accurately realizes different data synchronizations in sequence through different barriers, so as to accurately determine the state of entering external service, thereby improving the efficiency and reliability of the game server in providing external services.
[0041] The processing method based on a game server provided in this application can be applied to game servers with data processing capabilities. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services, but is not limited to these.
[0042] The processing method based on a game server provided in this application embodiment can store data such as synchronization code sets and barriers on a blockchain.
[0043] To facilitate understanding of the technical solution of this application, the processing method based on a game server provided in the embodiments of this application will be introduced below in conjunction with actual application scenarios.
[0044] See Figure 2 , Figure 2 This is a schematic diagram illustrating an application scenario of a game server-based processing method provided in an embodiment of this application. Figure 1 The application scenario shown includes a terminal device 201 and a game server 202, wherein a game client is installed on the terminal device 201.
[0045] In response to the launch of the game client on terminal device 201, game server 202 loads N fences, each fence is used to execute a set of synchronized code, and the order of the N fences corresponds to the execution order of the N sets of synchronized code. The N sets of synchronized code and the execution order are determined according to the dependency relationship between multiple game systems located in different processes in the game server, where N is a positive integer.
[0046] The terminal device 201 can be a smartphone, computer, tablet computer, laptop computer, desktop computer, smart speaker, smartwatch, smart voice interaction device, smart home appliance, vehicle terminal or aircraft, etc. The terminal device 201 and the server 202 can be directly or indirectly connected through wired or wireless communication, which is not limited in this application.
[0047] When the game server 202 starts its process, it controls multiple game systems to enter the i-th fence in a pre-arranged order, where i = 1, 2, ..., N.
[0048] Game server 202 executes the set of synchronization code corresponding to the i-th fence within the i-th fence.
[0049] If the game server 202 detects that multiple game systems have left the i-th fence, it controls the multiple game systems to enter the (i+1)-th fence, until it detects that multiple game systems have left the N-th fence, and then determines that it has entered the external service state to provide external services to the game client on the terminal device 201.
[0050] As can be seen, game server 202 autonomously achieves data synchronization corresponding to the set of synchronization codes with defined dependencies through barriers. After the data synchronization in the previous barrier is completed, it automatically enters the next barrier. This not only eliminates the need to develop additional timer retrieval logic for dependencies, saving manpower and effort, but also accurately achieves different data synchronizations in sequence through different barriers, so as to accurately determine whether game server 202 enters the external service state, thereby improving the efficiency and reliability of game server 202 in providing external services.
[0051] Next, taking a terminal device as the processing game server device, the processing method based on the game server provided in this application embodiment will be described in detail.
[0052] See Figure 2 This figure is a flowchart of a game server-based processing method provided in an embodiment of this application. Figure 2 As shown, this game server-based processing method is executed by the terminal device and includes the following steps:
[0053] S301: Load N fences, each fence is used to execute a set of synchronized code. The order of the N fences corresponds to the execution order of the N sets of synchronized code. The N sets of synchronized code and the execution order are determined based on the dependencies between multiple game systems in different processes in the game server. N is a positive integer.
[0054] As the number of game systems on a game server increases, the dependencies between multiple systems in different processes become more complex. In order for the game server to enter the external service state, related technologies require the development of additional timer-based fetching logic for each dependency, which consumes a lot of manpower and resources. Using an active polling fetching method to resolve the above dependencies makes it difficult to determine the fetching frequency, which makes it impossible to accurately determine the external service state, thereby reducing the efficiency and reliability of the game server in providing external services.
[0055] Therefore, in this embodiment, considering the dependencies between multiple game systems located in different processes, the code required to load multiple game systems can be divided into different sets of synchronization code representing data synchronization. A barrier is a synchronization auxiliary class that allows a group of threads to wait for each other until a common point is reached before continuing execution. Thus, data synchronization corresponding to the synchronization code sets determined by the aforementioned dependencies can be achieved autonomously through barriers. That is, based on the aforementioned dependencies, N sets of synchronization code and their execution order can be determined. A barrier is set to execute one set of synchronization code, requiring N barriers to be set. The order of the N barriers corresponds to the execution order of the N sets of synchronization code. Based on this, the game server first needs to load N barriers, where N is a positive integer.
[0056] Specifically, before executing S301, for example, based on the dependencies between multiple game systems located in different processes, the execution order of N sets of synchronized code can be determined; and the N sets of synchronized code are then deployed sequentially within N fences according to the execution order. This method establishes the N fences, providing a fence mechanism for executing S301. Therefore, this application provides a possible implementation, whereby the method may further include, for example, the following S1-S2 before executing S301:
[0057] S1: Determine the N sets of synchronous code and their execution order based on dependencies.
[0058] Specifically, in the implementation of S1, firstly, based on the dependencies between multiple game systems located in different processes, the code required to load multiple game systems is divided, and the code that implements the same data synchronization is assigned to the same synchronization code set, resulting in N synchronization code sets; then, based on the logical order represented by the dependencies, the execution priority of the N synchronization code sets is determined, resulting in the execution order of the N synchronization code sets. Therefore, this application provides a possible implementation, and S1 may include, for example, the following S11-S12:
[0059] S11: Based on dependencies, divide the code required to load multiple game systems into N sets of synchronous code.
[0060] S12: Determine the execution order based on the logical order of the dependency relationships.
[0061] S2: Deploy N sets of synchronous code sequentially within N fences according to their execution order.
[0062] As an example, such as Figure 4 The diagram illustrates the loading of N fences by a game server. The game server deploys a coordination process for global control of all processes, including process A, process B, and process C. Process A includes game system 1, game system 2, and game system 3; process B includes game system 4, game system 5, and game system 6; and process C includes game system 7, game system 8, and game system 9. For example, game system 1 could be a reward system, game system 2 could be a guild system, and game system 3 could be an experience system, etc. The game server loads three fences—fence 1, fence 2, and fence 3—by executing S301.
[0063] S302: When the process starts, control multiple game systems to enter the i-th fence in a sorted order, where the sorted order corresponds to the execution order, i = 1, 2, ..., N.
[0064] In this embodiment of the application, after the game server executes S301 to load N fences, the process can start. At this time, multiple game systems located in different processes need to enter the i-th fence according to the arrangement order of the N fences, i = 1, 2, ..., N.
[0065] In this process, multiple game systems can be controlled to enter the i-th fence. For example, a coordinating process can broadcast a message to each process to enter the i-th fence. After receiving the message, each process controls multiple game systems to enter the i-th fence.
[0066] As an example, such as Figure 5The diagram illustrates how multiple game systems enter the i-th fence. Based on the example above, the three fences are arranged in the order of fence 1, fence 2, and fence 3. When the game server starts the process, it first controls game system 1, game system 2, game system 3, ... and game system 9 to enter the first fence, i.e., fence 1.
[0067] S303: Execute the set of synchronization code corresponding to the i-th fence within the i-th fence.
[0068] In this embodiment of the application, after the game server executes S302 to control multiple game systems to enter the i-th fence, as can be seen from the foregoing description, N fences are used to execute N sets of synchronization code in sequence. Therefore, the set of synchronization code corresponding to the i-th fence needs to be executed within the i-th fence.
[0069] As an example, based on the above example, the set of synchronization code corresponding to fence 1 is executed within fence 1; that is, game system 1, game system 2, game system 3, ... and game system 9 prepare the necessary data for self-sufficiency within fence 1, which mainly refers to game system 1, game system 2, game system 3, ... and game system 9 loading the necessary data from the database within fence 1.
[0070] During the execution of S303, any one of the multiple game systems can leave the i-th fence after completing its corresponding operation. That is, based on the above description, any one of game systems 1, 2, 3, ..., and 9 can leave fence 1 after loading the required data from the database. Of course, if any one of the game systems 1, 2, 3, ..., and 9 does not need to prepare its own data, it can leave fence 1 after entering it. For example, ... Figure 6 The diagram illustrates a game system leaving the i-th fence; where game system 1 leaves fence 1 after loading the required data from the database.
[0071] S304: If multiple game systems are detected to have left the i-th fence, control the multiple game systems to enter the (i+1)-th fence, until multiple game systems are detected to have left the N-th fence, then determine to enter the external service state.
[0072] In this embodiment, after the game server executes S303 to execute the synchronization code set corresponding to the i-th fence, it is also necessary to detect whether multiple game systems have all left the i-th fence. If so, it means that the data synchronization corresponding to the synchronization code set deployed in the i-th fence can be completed. At this time, multiple game systems located in different processes need to enter the (i+1)-th fence according to the arrangement order of the N fences.
[0073] One method to control multiple game systems to enter the (i+1)th fence is to broadcast a message to each process about entering the (i+1)th fence through a coordinating process. After receiving the message, each process controls multiple game systems to enter the (i+1)th fence.
[0074] As an example, such as Figure 7 The diagram shows multiple game systems leaving the i-th fence. Based on the example above, game system 1, game system 2, game system 3, ... and game system 9 have all completed loading the required data from the database, and game system 1, game system 2, game system 3, ... and game system 9 have all left fence 1.
[0075] Based on the above explanation, such as Figure 8 The diagram shows multiple game systems entering the (i+1)th fence. It is detected that game system 1, game system 2, game system 3, ... and game system 9 have all left fence 1. The system then controls game system 1, game system 2, game system 3, ... and game system 9 to enter the second fence, i.e., fence 2.
[0076] Based on this, after multiple game systems enter the (i+1)th fence, refer to the subsequent steps of the aforementioned multiple game systems entering the ith fence, and repeat in this way, that is, execute the set of synchronization code corresponding to the (i+1)th fence within the (i+1)th fence.
[0077] For example, based on the above example, if data c1 in game system 3 included in process A depends on data f1 in game system 6 included in process B, then both game system 3 and game system 6 are within fence 2 and can freely perform data synchronization corresponding to the set of synchronization codes determined by this dependency relationship until data synchronization is completed.
[0078] Based on the loop, if it is detected that multiple game systems have left the (N-1)th fence, control the multiple game systems to enter the Nth fence, and execute the synchronization code set corresponding to the Nth fence within the Nth fence. If it is detected that multiple game systems have left the Nth fence, it means that the data synchronization corresponding to the N synchronization code sets has been completed in the execution order, and it can be determined that the external service state has been entered.
[0079] In this implementation, since any one of the multiple game systems can leave the i-th fence after completing its corresponding operation during the execution of S303, when multiple game systems are detected to have left the i-th fence, the game server first obtains information about any one of the multiple game systems leaving the i-th fence each time, and then counts whether the system state of each game system is in the i-th fence state or not. Then, when the counted system states of all the game systems are in the i-th fence state, it can be determined that multiple game systems have left the i-th fence. Therefore, this application provides a possible implementation for detecting that multiple game systems have left the i-th fence, which may include, for example, the following S3-S4:
[0080] S3: Each time any game system leaves the i-th fence, the system state of the multiple game systems is counted. The system state includes the state of leaving the i-th fence or the state of being in the i-th fence.
[0081] Specifically, obtaining information that any one of the multiple game systems has left the i-th fence can be achieved by having the process containing that game system report to the coordinating process.
[0082] S4: If the system states of multiple game systems are both in the state of leaving the i-th fence, it is determined that multiple game systems have left the i-th fence.
[0083] Furthermore, if any one of the multiple game systems is in the i-th fence state, it means that not all game systems have left the i-th fence. That is, the data synchronization corresponding to the set of synchronized code executed within the i-th fence has not yet been completed. Therefore, according to the characteristic of a fence that allows a group of threads to wait for each other until a common point is reached before continuing execution, the game system leaving the i-th fence state still needs to wait for the game system in the i-th fence state. Therefore, this application provides a possible implementation method. After S3, the method may also include, for example, S5: if any one of the multiple game systems is in the i-th fence state, control the game system leaving the i-th fence state to wait for the game system in the i-th fence state.
[0084] Furthermore, in this embodiment, after the game server executes S304 to enter the external service state, the game server can be opened to game players, thus providing external services to the game client. Therefore, this application provides a possible implementation method where, after S304, the method may further include, for example, S6: providing external services to the game client.
[0085] The game server-based processing method provided in the above embodiment first loads N barriers, each barrier being used to execute a set of synchronized code. The order of the N barriers corresponds to the execution order of the N synchronized code sets. The N synchronized code sets and their execution order are determined by the dependencies between multiple game systems located in different processes within the game server, where N is a positive integer. Second, by starting a process, multiple game systems are controlled to enter the i-th barrier in the order they are arranged, where i = 1, 2, ..., N. Then, the synchronized code set corresponding to the i-th barrier is executed within the i-th barrier. Finally, if it is detected that multiple game systems have all left the i-th barrier, the multiple game systems are controlled to enter the (i+1)-th barrier, until it is detected that multiple game systems have all left the N-th barrier, at which point the system is determined to enter the external service state. As can be seen, by autonomously implementing data synchronization corresponding to the set of synchronized code with defined dependencies through barriers, the data in the previous barrier is automatically synchronized after the data in the previous barrier is completed, and the next barrier is automatically entered. This not only eliminates the need to develop additional timer fetching logic for dependencies, saving manpower and effort, but also accurately achieves different data synchronizations in sequence through different barriers, so as to accurately determine the state of entering external service, thereby improving the efficiency and reliability of the game server in providing external services.
[0086] In addition to the game server-based processing method provided in the above embodiments, this application also provides a game server-based processing device.
[0087] See Figure 9 , Figure 9 This is a schematic diagram of a processing device based on a game server, provided as an embodiment of this application. Figure 9 As shown, the game server-based processing device 900 includes a loading unit, a control unit, an execution unit, and a determination unit;
[0088] Loading unit 901 is used to load N fences, each fence is used to execute a set of synchronized code, and the order of the N fences corresponds to the execution order of the N sets of synchronized code. The N sets of synchronized code and the execution order are determined according to the dependency relationship between multiple game systems located in different processes in the game server, where N is a positive integer.
[0089] Control unit 902 is used to control multiple game systems to enter the i-th fence in an ordered manner when the process starts, i = 1, 2, ..., N;
[0090] Execution unit 903 is used to execute the set of synchronization code corresponding to the i-th fence within the i-th fence;
[0091] The determining unit 904 is used to control multiple game systems to enter the (i+1)th fence if it is detected that multiple game systems have left the i-th fence, until it is detected that multiple game systems have left the N-th fence, and then determine to enter the external service state.
[0092] As one possible implementation, unit 904 is also used for:
[0093] Based on dependencies, determine the N sets of synchronized code and their execution order;
[0094] The device also includes: a deployment unit;
[0095] A deployment unit is used to deploy N sets of synchronous code sequentially within N fences according to their execution order.
[0096] As one possible implementation, unit 904 is specifically used for:
[0097] Based on dependencies, the code required to load multiple game systems is divided into N sets of synchronous code;
[0098] The execution order is determined based on the logical order represented by the dependencies.
[0099] As one possible implementation, unit 904 is specifically used for:
[0100] Each time any game system leaves the i-th fence from multiple game systems, the system states of the multiple game systems are counted. The system states include the state of leaving the i-th fence or the state of being in the i-th fence.
[0101] If multiple game systems are in the state of leaving the i-th fence, it is determined that multiple game systems have left the i-th fence.
[0102] As one possible implementation, after statistically analyzing the system states of multiple game systems, the control unit 902 is also used for:
[0103] If any one of the multiple game systems is in the i-th fence state, the game system that controls leaving the i-th fence state waits for the game system that is in the i-th fence state.
[0104] As one possible implementation, upon determining the state of entering external service, the device further includes: a providing unit:
[0105] The providing unit is used to provide external services to the game client.
[0106] The game server-based processing device provided in the above embodiment first loads N barriers, each barrier being used to execute a set of synchronization code. The order of the N barriers corresponds to the execution order of the N sets of synchronization code. The N sets of synchronization code and their execution order are determined by the dependencies between multiple game systems located in different processes within the game server, where N is a positive integer. Second, by starting a process, multiple game systems are controlled to enter the i-th barrier in the order they are arranged, where i = 1, 2, ..., N. Then, the synchronization code set corresponding to the i-th barrier is executed within the i-th barrier. Finally, if it is detected that multiple game systems have all left the i-th barrier, the multiple game systems are controlled to enter the (i+1)-th barrier, until it is detected that multiple game systems have all left the N-th barrier, at which point it is determined that the system has entered the external service state. As can be seen, by autonomously implementing data synchronization corresponding to the set of synchronized code with defined dependencies through barriers, the data in the previous barrier is automatically synchronized after the data in the previous barrier is completed, and the next barrier is automatically entered. This not only eliminates the need to develop additional timer fetching logic for dependencies, saving manpower and effort, but also accurately achieves different data synchronizations in sequence through different barriers, so as to accurately determine the state of entering external service, thereby improving the efficiency and reliability of the game server in providing external services.
[0107] This application also provides a device for processing game servers. The computer device provided in this application will be described below from the perspective of hardware physicalization.
[0108] See Figure 10 , Figure 10 This is a schematic diagram of a server structure provided in an embodiment of this application. The server 1000 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 1022 (e.g., one or more processors) and memory 1032, and one or more storage media 1030 (e.g., one or more mass storage devices) for storing application programs 1042 or data 1044. The memory 1032 and storage media 1030 can be temporary or persistent storage. The program stored in the storage media 1030 may include one or more modules (not shown in the diagram), each module may include a series of instruction operations on the server. Furthermore, the CPU 1022 may be configured to communicate with the storage media 1030 and execute the series of instruction operations in the storage media 1030 on the server 1000.
[0109] Server 1000 may also include one or more power supplies 1026, one or more wired or wireless network interfaces 1050, one or more input / output interfaces 1058, and / or one or more operating systems 1041, such as Windows Server.NM Mac OS X NM Unix NM Linux NM FreeBSD NM etc.
[0110] The steps performed by the server in the above embodiments can be based on this Figure 10 The server structure shown.
[0111] For example, CPU 1022 is used to perform the following steps:
[0112] Load N fences, each fence is used to execute a set of synchronized code. The order of the N fences corresponds to the execution order of the N sets of synchronized code. The N sets of synchronized code and the execution order are determined based on the dependencies between multiple game systems in different processes in the game server. N is a positive integer.
[0113] When the process starts, it controls multiple game systems to enter the i-th fence in a pre-arranged order, where i = 1, 2, ..., N;
[0114] Execute the set of synchronization code corresponding to the i-th fence within the i-th fence;
[0115] If multiple game systems are detected to have left the i-th fence, control the multiple game systems to enter the (i+1)-th fence, until multiple game systems are detected to have left the N-th fence, then determine to enter the external service state.
[0116] In addition to the game server-based processing method described above, this application also provides a terminal device that is applied to the above-described game server-based processing method.
[0117] See Figure 11 , Figure 11 This is a schematic diagram of a terminal device provided in an embodiment of this application. For ease of explanation, only the parts related to the embodiment of this application are shown; for specific technical details not disclosed, please refer to the method section of the embodiment of this application. The terminal device can be any terminal device including mobile phones, tablets, etc.; taking a mobile phone as an example:
[0118] Figure 11 This diagram illustrates a partial structure of a mobile phone related to the terminal device provided in the embodiments of this application. (Reference) Figure 11The mobile phone includes components such as a radio frequency (RF) circuit 1110, a memory 1120, an input unit 1130, a display unit 1140, a sensor 1150, an audio circuit 1160, a Wi-Fi module 1170, a processor 1180, and a power supply 1190. Those skilled in the art will understand that... Figure 11 The mobile phone structure shown does not constitute a limitation on the mobile phone and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0119] The following is combined Figure 11 A detailed introduction to each component of a mobile phone:
[0120] RF circuit 1110 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink information from the base station and processes it with processor 1180; additionally, it transmits uplink data to the base station. Typically, RF circuit 1110 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier (LNA), a duplexer, etc. Furthermore, RF circuit 1110 can also communicate wirelessly with networks and other devices. The aforementioned wireless communication can use any communication standard or protocol, including but not limited to Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LNE), email, and Short Messaging Service (SMS).
[0121] The memory 1120 can be used to store software programs and modules. The processor 1180 runs the software programs and modules stored in the memory 1120 to realize various functions and data processing of the mobile phone. The memory 1120 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory 1120 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0122] The input unit 1130 can be used to receive input numerical or character information, and to generate key signal inputs related to user settings and function control of the mobile phone. Specifically, the input unit 1130 may include a touch panel 1131 and other input devices 1132. The touch panel 1131, also known as a touch screen, can collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel 1131), and drive the corresponding connection devices according to a pre-set program. Optionally, the touch panel 1131 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, sends it to the processor 1180, and can receive and execute commands sent by the processor 1180. In addition, the touch panel 1131 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 1131, the input unit 1130 may also include other input devices 1132. Specifically, other input devices 1132 may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.
[0123] Display unit 1140 can be used to display information input by the user or information provided to the user, as well as various menus of the mobile phone. Display unit 1140 may include display panel 1141, optionally configured as a Liquid Crystal Display (LCD), Organic Light-Emitting Diode (OLED), or similar display panel 1141. Further, touch panel 1131 may cover display panel 1141. When touch panel 1131 detects a touch operation on or near it, it transmits the information to processor 1180 to determine the type of touch event. Subsequently, processor 1180 provides corresponding visual output on display panel 1141 based on the type of touch event. Although in Figure 11 In this embodiment, the touch panel 1131 and the display panel 1141 are two separate components to realize the input and output functions of the mobile phone. However, in some embodiments, the touch panel 1131 and the display panel 1141 can be integrated to realize the input and output functions of the mobile phone.
[0124] The mobile phone may also include at least one sensor 1150, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor. The ambient light sensor can adjust the brightness of the display panel 1141 according to the ambient light level, and the proximity sensor can turn off the display panel 1141 and / or the backlight when the phone is moved to the ear. As a type of motion sensor, an accelerometer sensor can detect the magnitude of acceleration in various directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity and can be used for applications that recognize the phone's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition-related functions (such as pedometer, taps), etc. Other sensors that may be configured in the mobile phone, such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be described in detail here.
[0125] Audio circuit 1160, speaker 1161, and microphone 1162 provide an audio interface between the user and the mobile phone. Audio circuit 1160 converts received audio data into electrical signals and transmits them to speaker 1161, where speaker 1161 converts them into sound signals for output. On the other hand, microphone 1162 converts collected sound signals into electrical signals, which are received by audio circuit 1160, converted into audio data, and then processed by processor 1180 before being transmitted via RF circuit 1110 to, for example, another mobile phone, or the audio data can be output to memory 1120 for further processing.
[0126] WiFi is a short-range wireless transmission technology. Through the WiFi module 1170, mobile phones can help users send and receive emails, browse web pages, and access streaming media, providing users with wireless broadband internet access. Although Figure 11 WiFi module 1170 is shown, but it is understood that it is not an essential component of a mobile phone and can be omitted as needed without changing the essence of the invention.
[0127] The processor 1180 is the control center of the mobile phone, connecting various parts of the phone through various interfaces and lines. It performs various functions and processes data by running or executing software programs and / or modules stored in the memory 1120 and calling data stored in the memory 1120, thereby controlling the phone as a whole. Optionally, the processor 1180 may include one or more processing units; preferably, the processor 1180 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 1180.
[0128] The mobile phone also includes a power supply 1190 (such as a battery) that supplies power to various components. Preferably, the power supply can be logically connected to the processor 1180 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system.
[0129] Although not shown, mobile phones may also include a camera, Bluetooth module, etc., which will not be described in detail here.
[0130] In this embodiment of the application, the memory 1120 included in the mobile phone can store program code and transmit the program code to the processor.
[0131] The processor 1180 included in the mobile phone can execute the steps required by the terminal device according to the instructions in the program code.
[0132] This application also provides a computer-readable storage medium for storing a computer program for executing the game server-based processing method provided in the above embodiments.
[0133] This application also provides a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor for processing a game server device reads the computer instructions from the computer-readable storage medium, executes the computer instructions, and causes the game server processing device to perform the game server-based processing method provided in various optional implementations of the above aspects.
[0134] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium can be at least one of the following media: read-only memory (ROM), RAM, magnetic disk, or optical disk, etc., and other media capable of storing program code.
[0135] It should be noted that the various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for the device and system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiments. The device and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of the solution in this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0136] The above description is merely one specific implementation of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A processing method based on a game server, characterized in that, The method, executed by the game server, includes: N barriers are loaded, each barrier is used to execute a set of synchronized code, and the order of the N barriers corresponds to the execution order of the N sets of synchronized code. The N sets of synchronized code and the execution order are determined based on the dependencies between multiple game systems in different processes in the game server, where N is a positive integer. The barrier is a synchronization helper class that allows a group of threads to wait for each other until they reach a common point before continuing execution. When the process starts, the multiple game systems are controlled to enter the i-th fence in the order specified, i=1, 2, ..., N; Execute the set of synchronization code corresponding to the i-th fence within the i-th fence; If it is detected that all of the multiple game systems have left the i-th fence, control the multiple game systems to enter the (i+1)-th fence, until it is detected that all of the multiple game systems have left the N-th fence, and determine that the external service state has been entered; Before loading the N fences, the method further includes: Based on the dependencies, the code required to load the multiple game systems is divided into the N sets of synchronized code; The execution order is determined based on the logical order represented by the dependencies; The N sets of synchronized code are deployed sequentially within the N fences according to the execution order.
2. The method according to claim 1, characterized in that, The detection that all of the multiple game systems have left the i-th fence includes: Each time any game system in multiple game systems leaves the i-th fence, the system states of the multiple game systems are counted, including the state of leaving the i-th fence or the state of being in the i-th fence. If the system states of all the multiple game systems are in the state of leaving the i-th fence, it is determined that all the multiple game systems have left the i-th fence.
3. The method according to claim 2, characterized in that, After statistically analyzing the system states of the multiple game systems, the method further includes: If any one of the multiple game systems is in the i-th fence state, the game system that controls the departure from the i-th fence state waits for the game system that is in the i-th fence state.
4. The method according to any one of claims 1-3, characterized in that, After determining that the system has entered the external service state, the method further includes: Provide external services to game clients.
5. A processing device based on a game server, characterized in that, Deployed on a game server, the device includes: a loading unit, a control unit, an execution unit, and a determining unit; The loading unit is used to load N fences, each fence being used to execute a set of synchronized code. The order of the N fences corresponds to the execution order of the N sets of synchronized code. The N sets of synchronized code and the execution order are determined based on the dependencies between multiple game systems located in different processes in the game server, where N is a positive integer. The fence is a synchronization auxiliary class that allows a group of threads to wait for each other until they reach a common point before continuing execution. The control unit is used to control the multiple game systems to enter the i-th fence in the order of arrangement when the process starts, i=1,2,...,N; The execution unit is used to execute the set of synchronization code corresponding to the i-th fence within the i-th fence; The determining unit is configured to control the multiple game systems to enter the (i+1)th fence if it is detected that all of the multiple game systems have left the i-th fence, until it is detected that all of the multiple game systems have left the N-th fence, and then determine to enter the external service state. Before the loading unit loads N fences, the device further includes a deployment unit; The determining unit is further configured to: Based on the dependencies, the code required to load the multiple game systems is divided into the N sets of synchronized code; The execution order is determined based on the logical order represented by the dependencies; The deployment unit is used to deploy the N sets of synchronized code sequentially within the N fences according to the execution order.
6. A computer device, characterized in that, The computer device includes a processor and memory: The memory is used to store program code and transmit the program code to the processor; The processor is used to execute the game server-based processing method according to any one of the claims 1-4 according to the instructions in the program code.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store a computer program for performing the game server-based processing method according to any one of claims 1-4.
8. A computer program product, characterized in that, The computer program product includes a computer program or instructions; when the computer program or instructions are executed by a processor, the processing method based on a game server as described in any one of claims 1-4 is performed.