Detailed Description
The service scenario described in the embodiment of the present invention is for more clearly illustrating the technical solution of the embodiment of the present invention, and does not form a limitation on the technical solution provided in the embodiment of the present invention, and as a person having ordinary skill in the art knows that along with the evolution of a network architecture and the appearance of a new service scenario, the technical solution provided in the embodiment of the present invention is also applicable to similar technical problems.
The server adaptation method is suitable for determining a scene of a server for starting the target game business for the game client from a plurality of servers for processing the target game business in the game service system when the game client requests the game service system to start the target game business.
In the embodiment of the application, the game client can run on a mobile phone, a notebook computer, a desktop computer and other terminals.
The target game service requested by the game client may be a game service with a high real-time requirement, for example, the target game service may be a game service in which a Player competes with a Player (PVP, Player VS Player); as another example, the target game service may also be a game service in which a Player battles the Environment (PVE, Player VS Environment). Of course, the target game service may also be other game services, and is not limited herein.
Aiming at a target game business, the game service system is provided with at least two servers for processing the target game business, and the at least two servers are respectively arranged in different regions. Wherein different regions refer to different geographical areas. Optionally, in this embodiment of the present application, different regions may refer to geographic areas corresponding to different countries. Of course, the country in which the server is specifically deployed may be set as desired. For example, taking PVP game as an example, three servers for processing PVP game traffic are deployed in the game service system, and the three servers for processing PVP game traffic are deployed in the geographic areas corresponding to country a, country B and country C, respectively.
Meanwhile, after a game starting instruction which is generated by the game client and used for requesting the target game service is acquired, the target server which is used for starting the target game service for the game client can be selected from the at least two servers according to the access time delay of the game client for accessing the at least two servers which are used for processing the target game service, so that the server which is suitable for processing the target game service for the game client is selected from the game service system, the access time delay of the game client in the target game service is reduced, and the condition that game data are not handed over in time is reduced.
For ease of understanding, the game service system according to the embodiment of the present application will be described first.
Referring to fig. 1, which shows a schematic diagram of a composition architecture of a game server system according to an embodiment of the present application, the game server system according to the embodiment may include:
at least twomatching servers 101 for processing the target game service, and the at least twomatching servers 101 are respectively deployed in different regions.
Each matching server is connected to at least oneservice server 102.
The service server to which each matching server is connected actually constitutes aservice processing subsystem 10, and eachservice processing subsystem 10 is indicated by a dashed box in fig. 1.
The matching server is responsible for allocating the task of processing the target game service to the service server, and thus, the matching server is used for allocating the service server for processing the target game service to the game client after receiving a game starting request which is sent by the game client and used for requesting to start the target game service. Accordingly, the service server can process the game data related to the target game service for the game client. In this case, the server for processing the target game service mentioned in the embodiment of the present application may be the matching server. Correspondingly, the delay condition of the data of the game client in the process of running the target game service can be determined by testing the access delay of the game client to the matching server.
Of course, fig. 1 is described by taking an example that each service processing subsystem has a matching server, but in practical applications, the service processing subsystem may include only one service server for processing the target game service, so that the matching server does not need to be deployed in the service processing subsystem to allocate the task of processing the target game service. Or, the service subsystem is actually only deployed with one server, and the server integrates the functions of the matching server and multiple service servers, that is, the internal processing resource of the server can be divided into multiple resource areas, and the server can allocate the target game service requested by the game client to different resource areas for processing according to the needs. In this case, the embodiment of the present application may only include at least two servers distributed in different regions and configured to process the target game service, where the servers may be configured to start the target game service for the game client and process a service process generated by the game client running the target game service.
It is understood that, in the present game service system, the service processing subsystem includes a matching server and a plurality of service servers as a preferable mode, so that the service servers can be added or reduced in the service subsystem according to the required service demand to meet the service processing demand.
In this embodiment, each service processing subsystem may be disposed in a computer room.
It is understood that, in addition to the service processing subsystems deployed in the plurality of regions respectively, the game service system may further include aglobal control system 11 connected to the plurality of service processing subsystems through a network, the global control system is still globally uniform, and the global module may be deployed in a machine room. Servers such as a logic server and a settlement server may be included in theglobal control system 11. If so, the logic server is responsible for verifying the login request sent by the game client so as to verify whether the user name and the password carried by the login request are matched or not; the settlement server is used for acquiring game results generated by different game clients in the process of playing different game services.
In the embodiment of the present application, a plurality of service subsystems may be deployed only in at least two different areas, and other servers such as a logic server and a settlement server need not to be deployed in different areas, so as to reduce resource consumption.
For example, taking the target game service as the PVP game service, in the game service system, only at least two key areas are selected to respectively deploy PVP servers having a large real-time effect on the PVP game service, and of course, when each area includes a plurality of PVP servers, a matching server connected to the plurality of PVP servers needs to be deployed in each area.
Referring to fig. 1, a server adaptation method according to an embodiment of the present application is described, for example, referring to fig. 2, which shows a flowchart of an embodiment of a server adaptation method according to the present application, where the server adaptation method according to the present embodiment may be applied to a game client; the method can also be applied to a designated server of the game service system, such as a speed adapter deployed in a global control system in the game service system; the method can also be applied to communication equipment erected between the game client and the game service system.
The server adaptation method of the present embodiment may include:
and 201, acquiring a game starting instruction generated by the game client.
The game starting instruction is used for indicating the game service system to start the target game business for the game client. For example, when a game player at a game client wishes to start the PVP game service, the game client generates an instruction requesting to start the PVP game service.
In this embodiment, the game service system includes at least two servers configured to process the target game service and deployed in different regions. For example, the server may be a matching server for distributing the target game service, and the game service system may include at least two matching servers deployed in different regions, where each matching server is connected to at least one service server for processing service data of the target game service; for another example, in the case where the service server in the game service system is not connected to the matching server, the server for processing the target game service herein may refer to a service server that processes service data of the target game service.
In any embodiment of the present application, the server mentioned refers to a server for processing the target game service, as not specifically described.
202, determining the access time delay of the game client to access the server.
Wherein, the access time delay of the game client to access the server refers to: the time period between the time that the game client sends the access request to the server and the time that the game client receives the response returned by the server for the access request.
In the embodiment of the present application, it is necessary to determine access delays of the game clients to each server for processing the target game service, so that the at least two servers correspond to data of at least two access delays.
Wherein the access delay of the game client to the server can be determined in a variety of ways. For example, in one possible implementation, the access delay of the game client to the server may be determined by the game client performing an Internet Packet Probe (PING) test, specifically, the game client sends a probe Packet (or a PING command) to the server, and the server returns a response to the game client after receiving the probe Packet, so that the access delay may be determined based on the time interval between sending the probe Packet and receiving the response. Of course, there may be other ways to obtain the access delay of the game client to the server, and is not limited herein.
It should be noted that, when the server adaptation method is applied to a game client, the access time delay obtained by the game client through testing each server can be respectively obtained; when the server adaptation method is applied to a communication device or a server other than the game client, the data of the access delay obtained by the test may be transmitted to the communication device or the server by the game client.
And 203, according to the access time delay, determining a target server meeting a preset condition from at least two servers included in the game service system.
The preset condition may be multiple conditions, for example, the preset condition may be that the access delay is within a specified access delay range, for example, the specified access delay range may be 0-250ms, and if the access delay of the client accessing a certain server is within the specified access delay range, the certain server may be taken as the target server.
Optionally, the preset condition may include: the ordering of the access latency from high to low is within a top-specified range. For example, the target server meeting the preset condition may be a server within the first 5 bits of the smallest access delay, and for example, the target server meeting the preset condition may be a server with the second bit in the order from high to low in the access delay.
It can be understood that, in the embodiment of the present application, in order to facilitate distinguishing from other servers that do not satisfy the preset condition, a server that is determined from the at least two servers and that the game client requests to access to initiate the target game service is referred to as a target server.
It should be noted that, in the embodiment of the present application, one server may be selected from servers that satisfy preset conditions, and the server is used as a target server that the game client requests to start the target game service and needs to access; or all servers meeting the preset conditions can be used as target servers, and the game client terminal finally determines which target server to request to start the target game service.
Further, in order to enable the game client to obtain the game service data from the server in time in the target game service process, in the embodiment of the present application, the ordering of the access delay from high to low in the front designated range may be specifically: the access latency is minimal.
And 204, instructing the game client to request the target server to start the target game service.
After the target server is determined, the game client may be instructed to send a game service request to the target server to request the target server to start the target game service, so that the target game service is started for the game client through the target server, and the target game service is run on the game client.
It should be noted that, when the server adaptation method is applied to a game client, thestep 204 may be to trigger the game client to request the target server to start the target game service; when the server adaptation method is applied to a communication device or a server other than a game client, an access instruction for instructing the game client to request the target server to start the target game service may be sent to the game client.
In the embodiment of the application, the game service system comprises at least two servers for processing the target game service, the at least two servers are respectively located in different regions, and meanwhile, the target servers required to be accessed for processing the target game service are allocated to the game client according to the access time delay of the game client for accessing the at least two servers, so that the condition that game data are not handed over in time is reduced in the process that the game client runs the target game service, and the game experience of a game player for performing the target game service is improved. Meanwhile, the condition that game data are not synchronous among game clients in different regions can be avoided, and the fairness of the game is improved.
Further, considering that the load condition of the server may affect the stability of the target game service, in order to ensure timeliness and stability of data interaction between the game client and the game service system during the process of performing the target game service, in the embodiment of the present application, after the game start instruction generated by the game client is obtained, the load of each server in the game server system for processing the target game service at the current time may also be obtained. Correspondingly, determining the preset condition of the target server may further include: the load is within a preset threshold range. That is, only when the access delay is ranked from high to low, the access delay corresponding to the server is within the pre-specified range, and the load of the server is within the preset threshold range, the server may be determined as the target server for processing the target game service required by the game client.
The preset threshold range can be set as required, and generally, when the load of the server is within the preset threshold range, the performance condition of the server is better. For example, the preset threshold range may be less than a specified percentage.
For example, referring to fig. 3, which shows a flowchart of another embodiment of the server adaptation method of the present application, the server adaptation method of the present embodiment may be applied to a game client; the method can also be applied to a certain server of the game service system, such as a logic server of the game service system; it can also be applied to a communication device installed between a game client and a game service system.
The method of the embodiment may include:
301, obtaining a game starting instruction generated by the game client.
The game starting instruction is used for indicating the game service system to start the target game business for the game client.
In this embodiment, the game service system includes at least two servers configured to process the target game service and deployed in different regions.
This step can be referred to the related description ofstep 201 in fig. 2, and is not described herein again.
302, the load of each server in the game service system at the current time for processing the target game service is obtained.
The load may reflect the performance of the server, for example, the load may be an occupancy rate of resources such as a processor and a memory in the server.
Of course, when the target game service is run in the room mode, when the server receives a request from the game client for the target game service, a room is allocated to the game client, and a specified resource such as hardware and software is actually configured in one room, so that the game service data generated when the subsequent game client runs the target game service is processed based on the resource corresponding to the room.
And 303, determining a server set composed of servers with loads within a preset threshold range.
Wherein, the server set comprises at least one server for processing the target game service.
304, obtaining the access time delay of the game client to each server in the server set.
It is understood that the larger the number of servers requiring access delay testing, the longer the network resources and time duration consumed for testing access delay, and meanwhile, if the load of the server is not within the preset threshold, no matter how long the access delay of the game client accessing the server is, the server is determined as the target server. Therefore, in order to reduce network resources consumed by testing the access delay and reduce the time consumed by testing the access delay, the access delay can be tested only for the servers with the loads within the preset threshold range, so that the access delay required by the game client to access each server in the server set can be obtained.
Of course, it is a preferred embodiment to obtain the access delay only required by the game client to access the server with the load within the preset threshold value. In practical application, the method in the embodiment of fig. 2 may also be adopted to respectively obtain the access delay of the game client for accessing each server, and in this case, the load of each server may be obtained first, and then the access delay of the game client for accessing each server may be obtained; or the load of each server at the current moment can be acquired, and the access time delay of the game client for accessing each server can be acquired.
The target server with the smallest access delay is determined from theserver set 305.
In order to improve the efficiency of matching the target server, as a preferred embodiment, after determining the server set with the load within the preset range, the target server with the access delay meeting the preset condition may be directly selected from the server set.
Of course, after determining the load of each server and the access delay of each server, the server satisfying the preset condition may be determined according to the load and the access delay of each server in the game service system.
It can be understood that, in this embodiment, the determined target server is taken as the server with the smallest access delay as an example for description, but the case where the sequence of the access delays is within the previously specified range is also applicable to this embodiment.
306, instructing the game client to request the target server to start the target game service.
In this embodiment, according to the access delay of the game client accessing the server and the current load condition of the server, the target server to be accessed for starting the target game service is returned to the game client, so that a target server with a better access speed and a proper load can be selected for the game client, and further, the situation that data exchange is not timely performed is reduced when the game client runs the target game service, the situation that a game screen is blocked at the game client or game data between different game clients is not synchronous is reduced, the game experience of the target game service is improved, and the fairness of the game is also improved.
Further, in any of the embodiments of the present application, after determining a target server to be accessed for requesting to start a target game service for a game client each time, a user account used by the game client to currently log in the game service system, an Internet Protocol (IP) address used by the game client to currently connect to a network, and a corresponding relationship between the target servers may be stored in a history access record. In this way, after a game starting instruction generated by the game client is obtained, the user account and the IP address adopted by the game client for currently logging in the game service system can be determined, whether the information of the target server corresponding to the user account adopted by the game client for currently logging in the game service system and the current IP address of the game client exists in the historical access record or not is inquired, and if the information of the target server exists in the historical access record, the game client can be directly instructed to request the target server for starting the target game service; if the target server does not exist, the operation of determining the access time delay of the game client to access each server in the game service system is executed again, and the like, so as to finally determine the target server.
It is understood that the server adaptation system to which the server adaptation method of the embodiment of the present application is applied may include the game service system of the embodiment shown in fig. 1 and at least one game client. For easy understanding, refer to fig. 4, which shows a schematic structural diagram of another embodiment of a server adaptation system to which the server adaptation method of the embodiment of the present application is applied.
As in fig. 4, the server adaptation system may include: agame service system 41, which comprises aglobal control system 410 and at least twobusiness processing subsystems 420 connected with the global control system and deployed in different regions.
Theservice processing subsystem 420 may include a matchingserver 421 and at least oneservice server 422 connected to the matchingserver 421.
The server adaptation system further comprises: at least onegame client 42.
Optionally, aspeed adapter 411 may be further disposed in theglobal control system 410, and thespeed adapter 411 and the matchingserver 421 are connected through the network. The speed adapter can obtain the load of the matching server. For example, the matching server may actively report its own load to the speed adapter, for example, the matching server reports its own load in real time or at regular intervals according to a preset period; or after the speed adapter sends the load acquisition request to the matching server, the matching server sends the current load of the matching server to the speed matcher.
It is understood that, in the embodiment of the present application, the speed adapter may exist as a stand-alone device, or may be built into a server inherent to the global control system, for example, the speed adapter is built into a logical server of the global control system.
Based on fig. 4, referring to fig. 5, which shows a schematic flow chart of another embodiment of the server adaptation method of the present application, the method of the present embodiment may include:
501, a game client sends a game start instruction to a speed adapter in a game service system.
The game starting instruction carries a user account and an IP address used by the game client for logging in the game service system currently. Of course, the game start command may carry an address of the speed adapter, for example, a domain name corresponding to the speed adapter.
The game starting instruction is used for requesting the starting of the target game service. For example, the target game service may be a PVP game service.
502, the speed adapter responds to the game starting instruction, and detects whether a target matching server corresponding to the user account and the IP address of the game client exists in the historical access record.
Wherein, the history access record records: and the game client corresponding to different user accounts and IP addresses before the current moment requests to start the matching server accessed by the target game service.
It can be understood that, in order to ensure that the target matching server corresponding to the user account and the IP address recorded in the historical access record is also a matching server suitable for the game client to access the target game service currently running, the speed adapter may periodically update the historical access record, for example, a historical time at which the historical matching server is allocated to the user account and the IP address before the current time may also be recorded in the historical access record, and if the time length of the historical time from the current time exceeds a specified time length (for example, the specified time length may be two hours), the corresponding relationship between the user account and the IP address and the target matching server is deleted from the historical access record. Therefore, only the matching server accessed by the game client requesting to start the target game service corresponding to different user accounts and IP addresses within a specified time before the current time is recorded in the history access record.
503, if a target matching server corresponding to the user account and the IP address of the game client exists in the history access record, the speed matching server sends an access instruction to the game client, where the access instruction carries an identifier of the target matching server.
Wherein, the access instruction is used for instructing the game client to request the target matching server to start the target game service.
Alternatively, the identifier of the target matching server may be address information of the target matching server, for example, a domain name of the target matching server.
It should be noted that step 502 and step 503 are optional steps, and in practical applications, the operation of the speed adapter acquiring the load of each matching server at the current time may also be directly performed.
504, if there is no history matching server corresponding to the user account and IP address of the game client in the history access record, the speed adapter obtains the load of each matching server at the current time.
It should be noted that the manner of obtaining the load of the matching server may be any manner as mentioned above, for example, the speed adapter indicates the matching server to report the load, or the matching server may report its own load in real time or periodically, so that the speed adapter can query the load of each matching server.
In the embodiment of the application, the matching server is used for distributing the target game service requested by the game client to the service server. Since the matching server is responsible for maintaining the load status of the service server connected to the matching server and allocating the task of processing the target game service to the service server according to the load status, the load of the matching server can be actually understood as the load of at least one service server connected to the matching server.
It is understood that, in the embodiment of the present application, the service subsystem includes the matching server as an example, and the server for processing the target game service may be understood as the matching server for distributing the target game service. In particular, when the service subsystem includes only one service server, or the service server and the matching server are actually one server, the server for processing the target game service may be understood as a service server for starting the target game service and allocating resources required for processing the target game service to the game client.
505, the speed adapter determines a matching server set composed of matching servers with loads smaller than a preset threshold from the at least two matching servers.
The speed adapter sends 506 a delay test indication to the game client, where the delay test indication carries the identification of each matching server in the set of matching servers.
Wherein the identity of the matching server may be used to uniquely identify the matching server. For example, the name of the matching server, the identity of the matching server may be the address of the matching server.
507, the game client end tests the access time delay of the game client end to each matching server in the matching server set according to the identification of each matching server in the matching server set.
If the game client determines the matching server in the matching server set as the matching server which needs to perform the access delay test, the game client sends the test data packet to the matching server according to the identifier of the matching server, and then the game client determines the access delay according to the time length between the time of sending the test data packet and the time of the response data packet returned by the matching server for the test data packet. For example, the game client may determine access latency using a PING test.
Of course, there may be other ways to determine the access latency of the game client to the matching server, and is not limited herein.
It will be appreciated that typically, the game client tests the access latency of the game client to the matching server, and the game client needs to determine the address of the matching server. The method for determining the address of the matching server by the game client can be in various situations, and in one situation, the address of each matching server can be preset in the game client, so that when the game client receives the delay test instruction, the preset address of the matching server can be obtained according to the identification of the matching server in the delay test instruction, and then the matching server is accessed according to the address of the matching server to determine the access delay.
Optionally, in order to reduce the amount of data stored in the game client, the identifier of the matching server carried in the delay test instruction sent by the speed adapter may be an address of the matching server, so that the game client may directly test the access delay required by the game client to access the matching server according to the address of the matching server. The address of the matching server may be a domain name of the matching server.
And 508, the speed adapter receives access delay data sent by the game client, wherein the access delay data comprises the access delay required by the test client to access each matching server in the matching server set.
509, the speed adapter determines a target matching server from the set of matching servers with the minimum access delay and the load less than a preset threshold.
Further, considering that a certain delay exists in the game client test access delay, in order to avoid that the load condition of the matching server changes in the game client test access delay process, in the embodiment of the present application, after the matching server with the minimum access delay is determined from the matching server set, the load of the matching server with the minimum access delay at the current time may also be obtained, and if the load of the matching server with the minimum access delay at the current time is still less than the preset threshold, the matching server is determined as the target matching server; otherwise, the target matching server with the minimum access time delay needs to be reselected from the matching servers with the current loads smaller than the preset threshold in the matching server set.
Naturally, in this embodiment, the selected target matching server is the matching server with the smallest access delay, but in practical application, the target matching servers may be sorted from small to large according to the access delay, and one server may be selected from the matching servers with the access delay at the front designated position and the load smaller than the preset threshold as the matching server.
The speed adapter sends 510 an access indication to the game client, the access indication carrying the identification of the target matching server.
Optionally, the identifier of the target matching server may be address information of the target matching server, such as a domain name of the target matching server.
511, the game client sends a game starting request to the target matching server according to the identifier of the target matching server carried in the received access instruction.
The game access request is used for requesting the target matching server to start the target game service.
Optionally, after the target matching server receives the game access request, the target matching server may determine a target service server from service servers connected to the target matching server, so as to return data required for running the target game service to the game client through the target service server, so that the game client starts the target game service, and at the same time, the target service server may process service data generated in a process of running the target game service by the game client.
512, the speed adapter stores the user account and the corresponding relationship between the IP address and the target matching server of the game client in the history access record.
Wherein the step 512 is an optional step.
It can be understood that, in order to reduce the data amount consumed by the game client for testing the access delay and reduce the testing time consumption, the embodiment of fig. 5 only sends the identifier of the matching server with the load less than the preset threshold value to the game client. However, the method that the speed adapter sends all the identifiers of the matching servers that have the function of processing the target game service to the game client is also applicable to this embodiment, for example, the speed adapter sends all the addresses of the matching servers to the game client, and after the game client tests the access delay of the game client for accessing each matching server in sequence, the speed adapter determines the target matching server with the minimum access delay and the current load smaller than the preset threshold value according to the current load of each matching server and the access delay of each matching server.
It should be noted that, this embodiment is described by taking a case where each matching server in the game service system is connected to at least one service server as an example, when the game service system does not include a matching server but only includes a service server, or when the service server and the matching server are the same server, the target matching server to be determined may be a target service server or a target server including functions of the matching server and the service server, and a specific process thereof is similar to that in fig. 5, and is not described again.
In addition, in the embodiment of the present application, a game service request of one game client is taken as an example to describe the server adaptation method in the embodiment of the present application, but it can be understood that, for a game service request initiated by any game client for requesting the target game service, the server adaptation method in the embodiment of the present application may be used to determine, for the game client, a target matching server to be accessed for starting the game service request this time.
For the convenience of understanding the scheme of the embodiment of fig. 5, the following description is made with reference to an example, and it is considered that the PVP game service requires data interaction between game players of at least two game clients, so that requirements on real-time performance and synchronization of the data interaction are high, and therefore, the example is described in which the target game service requested to be run by the game client is the PVP game service. Correspondingly, the matching server is used for processing a game starting request of the game client terminal for requesting to start the PVP game service, and the service server connected with the matching server is a PVP server. For example, referring to fig. 6, which shows a flowchart of an application scenario of a server adaptation method according to the present application, the server adaptation method of the present embodiment may include:
601, the game client sends PVP game start instructions to the speed adapter in the game service system.
The destination address carried by the PVP game start instruction is the address of the speed adapter, and the PVP game start instruction carries the user account and the IP address used by the game client to currently log in the game service system.
As shown in fig. 7a, which is a schematic diagram of an interface presented by a game client for starting a PVP game, when the game client detects a "light" key in the interface, which is characteristic of starting combat, the game client is triggered to generate a game starting instruction carrying an address of the speed adapter, and send the game starting instruction, so that the speed adapter in the game service system receives the game starting instruction.
The speed adapter queries whether a record of a target matching server corresponding to the user account and the IP address of the game client exists in the history access record 602.
For example, the historical access record may record an address of a matching server to which different user accounts and IP addresses request to start PVP game service within a specified time period before the current time, so that the historical access record may include multiple records, and corresponding relationships between the different user accounts, the IP addresses, and the addresses of the matching servers are recorded in the different records, respectively.
603, when the speed adapter inquires the record of the target matching server corresponding to the user account and the IP address, sending an access instruction to the game client, where the access instruction carries the address of the target matching server.
The time delay test instruction is used for instructing the game client to test the access time delay of the game client to access the server.
604, when the speed adapter does not inquire the record of the target matching server corresponding to the user account and the IP address, the speed adapter obtains the load of each matching server at the current time.
The specific way of obtaining the load of the matching server can refer to the related description of the foregoing embodiments, and is not described herein again.
In PVP game services, the load of a matching server can be determined by the total number of game rooms that can be provided by the service server to which the matching server is connected and the number of game rooms currently available.
605, the speed adapter determines a matching server set composed of matching servers with a load less than a preset threshold.
606, the speed adapter sends a delay test indication to the game client, the delay test indication carrying the address of each matching server in the set of matching servers.
607, the game client responds to the delay test instruction and sends test data packets to the matching servers in turn according to the address of each matching server in the matching server set.
The matching server returns a response packet to the game client for the test packet 608.
609, the game client determines the access delay required by the game client to access the matching server according to the sending time of the test data packet sent to the matching server and the receiving time of the response data packet returned by the matching server.
It is to be understood that only one matching server is shown in fig. 6, and the matching server in the matching server set is taken as an example in fig. 6, which shows the testing process of the access delay of the game client and the matching server, but the testing process of the access delay of steps 607 to 609 is applicable to the testing of the access delay of the game client to any one matching server in the matching server set.
610, the game client sends access delay data to the speed adapter, the access delay data comprising: the access delay required by the game client to access each matching server in the set of matching servers.
611, the speed adapter determines the target matching server with the minimum access delay from the set of matching servers.
The speed adapter sends 612 an access indication to the game client, the access indication carrying the address of the target matching server.
Optionally, after the step 612, the speed adapter may further store the user account and the corresponding relationship between the IP address and the target matching server of the game client in the history access record.
613, the game client sends a PVP game start request to the target matching server according to the address of the target matching server.
The target matching server determines from the PVP servers to which the target matching server is connected, a target PVP room in which there is a free position and the free position is the least, 614, in response to the PVP game request.
It will be appreciated that the matching server shown in figure 6 is used as the target matching server for ease of describing the interaction between the game client and the target matching server.
Of course, step 614 is only one way to determine the target PVP server running the target game service and the target PVP room from the target PVP server, but the other ways to determine the target PVP server and the target PVP room that the game client needs to enter are equally applicable to the present embodiment.
615, the target matching server sends the address of the target PVP server to which the target room belongs and the identification of the target room to the game client.
At 616, the game client sends a room entry request to the target PVP server, the room entry request carrying the identification of the PVP room.
After the target matching server allocates the target PVP server and the target PVP room to the game client, the target matching server completes processing of the PVP game start request, and the subsequent target matching server may interact with the target PVP server to implement running of the PVP game.
As shown in fig. 7b, which shows a schematic diagram of a game client showing that a target matching server allocates a target PVP server and a target PVP room for the game client, as can be seen from fig. 7b, after the target matching server allocates the target PVP server and the target PVP room for the game client, the game client may establish a connection with the target PVP server, and wait for the number of players in the target PVP room to satisfy a preset number, the game client may enter the target PVP room to run the PVP game service, so that the game player of the game client and other game players in the target PVP room can play a PVP game. For example, see fig. 7c, which shows an interface schematic after the game client enters the target PVP room.
By the method of the embodiment, the target server which needs to be accessed for starting the target game service can be returned for the game client according to the access delay of the game client to access the server and the current load condition of the server, so that the target server with better access speed and proper load can be selected for the game client, the difference of the access delay and the stability of the game players playing the PVP game based on the same matching server and the service server is smaller, the synchronism of game data among the game players in the same PVP room can be improved, the fairness of the game is improved, and the game experience is improved.
Referring to fig. 8, which shows a flowchart of another embodiment of a server adaptation method according to the present application, the method of the present embodiment may include:
801, the game client intercepts the generated game starting instruction.
The game starting instruction is used for requesting the game service system to start the target game service. For example, the target game service may be a PVP game service.
For example, when detecting that there is a trigger request for triggering the starting of the target game service in the game client, the game client generates a game starting instruction. For example, when the user clicks an icon in the game client for triggering the starting of the target game service, the game client generates a game starting instruction.
The game client determines the user account and IP address currently used to log in the game service system 802.
803, the game client detects whether a target matching server corresponding to the user account and the IP address of the game client exists in the history access record.
Wherein, the history access record records: and the game client corresponding to different user accounts and IP addresses before the current moment requests to start the matching server accessed by the target game service.
Optionally, the historical access record records a matching server to which the game client corresponding to different user accounts and IP addresses requests to start the target game service within a specified time before the current time.
And 804, if a target matching server corresponding to the user account and the IP address exists in the historical access record, the game client sends a game starting request to the target matching server.
The game start request is used for requesting the target matching server to start a target game service.
The game starting request may carry an identifier of a target matching server, such as an address of the target matching server, and certainly, the game starting request may also carry one or more of a user account, an IP address, and the like corresponding to the game client.
It should be noted that steps 802 to 804 are optional steps, and in practical applications, the game client may also directly perform an operation of acquiring the load of each matching server at the current time.
If there is no history matching server corresponding to the user account and the IP address in the history access record, 805, the game client requests the speed adapter for the loads of the at least two matching servers in the game service system.
The speed adapter sends 806 the load of each matching server at the current time to the game client.
The manner in which the speed adapter determines the load of the matching server can be referred to in the related description of the foregoing embodiments, and is not described herein again.
In this embodiment, the load of the matching server may actually be understood as the load of at least one service server connected to the matching server, such as the total load of all service servers connected to the matching server.
It should be noted that steps 805 and 806 are only one preferred way to obtain the load of the matching server, and in practical applications, the game client may directly request the matching server to feed back the current load of the matching server. For example, the game client may preset addresses of all matching servers in the game service system, and according to the address of each matching server, the game client may send a request to the matching server to request the matching server to feed back the current load. Of course, there may be other ways for the game client to determine the load of each matching server, and the present invention is not limited thereto.
807, the game client determines a matching server set composed of matching servers with loads smaller than a preset threshold from the at least two matching servers.
It is understood that step 807 is a preferred embodiment, and after the load of all the matching servers is determined by the speed adaptor, only the information of the matching server set composed of the matching servers with the load less than the preset threshold is sent to the game client.
The game client determines the access delay required for the game client to access each matching server in the set of matching servers 808.
The manner in which the game client determines the access delay required by the game client to access the matching server can be referred to in the related description of the foregoing embodiments, and is not described herein again.
It will be appreciated that the game client tests the access delay of the game client and the matching server, and the game client needs to determine the identity of the matching server, such as the address of the matching server, which may be the domain name of the matching server. The mode of determining the address of the matching server by the game client can have various conditions, and in one condition, the address of each matching server can be preset in the game client; in another case, the speed server may carry the address of the matching server when sending the load of the matching server to the game client.
And 809, the game client determines a target matching server with the minimum access delay and the load less than a preset threshold from the set of matching servers.
Further, considering that a certain delay exists in the game client test access delay, in order to avoid that the load condition of the matching server changes in the game client test access delay process, in the embodiment of the present application, after the matching server with the minimum access delay is determined from the matching server set, the load of the matching server with the minimum access delay at the current time may also be obtained, and if the load of the matching server with the minimum access delay at the current time is still less than the preset threshold, the matching server is determined as the target matching server; otherwise, the target matching server with the minimum access time delay needs to be reselected from the matching servers with the current loads smaller than the preset threshold in the matching server set.
Naturally, in this embodiment, the selected target matching server is taken as the matching server with the smallest access delay for example, but in practical application, the target matching servers may also be selected in other manners according to the access delay, for example, the target matching servers may also be sorted from small to large according to the access delay, and one matching server is selected as the target matching server from the matching servers with the access delay at the front designated position and the load smaller than the preset threshold.
The game client sends a game start request to the target matching server 810.
The game access request is used for requesting the target matching server to start the target game service.
Optionally, after the target matching server receives the game access request, the target matching server may determine a target service server from service servers connected to the target matching server, so as to return data required for running the target game service to the game client through the target service server, so that the game client starts the target game service, and at the same time, the target service server may process service data generated in a process of running the target game service by the game client.
811, the game client stores the user account and the correspondence between the IP address and the target matching server in the history access record.
It can be understood that, in order to reduce the data amount consumed by the game client for testing the access delay and reduce the testing time consumption, the embodiment of fig. 8 only determines the access delay of the matching server with the load less than the preset threshold. However, the method that the game client determines the loads of all the matching servers and then selects the target server with the smallest access delay (or at the front designated position according to the sequence of the access delays from large to small) from all the matching servers and the load smaller than the preset load is also applicable to the embodiment.
It should be noted that, this embodiment is described by taking a case where each matching server in the game service system is connected to at least one service server as an example, when the game service system does not include a matching server but only includes a service server, or when the service server and the matching server are the same server, the target matching server to be determined may be a target service server or a target server including functions of the matching server and the service server, and a specific process thereof is similar to that in fig. 8, and is not described again.
The embodiment of the application takes a one-time game service request of one game client as an example, and introduces the server adaptation method of the embodiment of the application. However, it can be understood that, for a game service request initiated by any game client for requesting the target game service, the server adaptation method of the embodiment of the present application may be adopted to allocate, to the game client, a target matching server that needs to be accessed to start the game service request this time.
Referring to fig. 9, which shows a schematic structural diagram of an embodiment of a server adaptation device according to the present application, the device of the present embodiment may be applied to a server of a game service system or a game client; or in a communication device between the game service system and the game client, the apparatus of this embodiment may include:
aninstruction obtaining unit 901, configured to obtain a game starting instruction generated by a game client, where the game starting instruction is used to instruct a game service system to start a target game service for the game client, and the game service system includes at least two servers that are used for processing the target game service and are deployed in different regions;
a timedelay determining unit 902, configured to determine an access time delay for the game client to access the server;
aserver determining unit 903, configured to determine, according to the access delay, a target server that meets a preset condition from the at least two servers;
astart instruction unit 904, configured to instruct the game client to request the target server to start the target game service.
Optionally, the preset conditions include: the ordering of the access latency from high to low is within a top-specified range.
Optionally, the apparatus of this embodiment may further include:
aload obtaining unit 905, configured to obtain a load of each server at the current time after the instruction obtaining unit obtains the game start instruction;
the preset condition in the server determination unit further includes: the load is within a preset threshold range.
Optionally, the apparatus of this embodiment further includes:
the set determining unit is used for determining a server set with the load within a preset threshold range before the time delay determining unit determines the access time delay of the game client to access the server, and the server set comprises at least one server;
the delay determining unit is specifically configured to determine an access delay of the game client for accessing each server in the server set.
Optionally, the server determining unit includes:
and the server determining subunit is used for determining the target servers with the access delays within the previously specified range from high to low from the server set.
Optionally, the apparatus may further include:
the login information determining unit is used for determining a user account adopted by the game client to currently log in the game service system and a current IP address of the game client after the instruction obtaining unit obtains the game starting instruction;
a record detection unit, configured to detect whether information of a target server corresponding to the user account and the IP address exists in a history access record, where: the game client corresponding to different user accounts and IP addresses before the current moment requests to start the information of the server accessed by the target game service;
the starting triggering unit is used for indicating the game client to request for starting the target game service from the target server corresponding to the user account and the IP address if the target server corresponding to the user account and the IP address exists;
the time delay determining unit is specifically configured to execute the determining of the access time delay of the game client accessing the server if a target server corresponding to the user account and the IP address does not exist.
Optionally, in an implementation manner, the instruction obtaining unit may include:
the instruction receiving subunit is used for receiving a game starting instruction sent by the game client;
the delay determining unit includes:
the time delay request unit is used for sending a time delay test instruction to the game client, wherein the time delay test instruction is used for instructing the game client to test the access time delay of the game client for accessing the server;
and the time delay acquisition unit is used for acquiring the access time delay aiming at the server tested by the game client.
Further, the starting indication unit includes:
and the indication sending subunit is configured to send an access indication to the game client, where the access indication is used to indicate that the test client requests the target server to start the target game service.
Optionally, in another implementation manner, the instruction obtaining unit may include:
the instruction intercepting unit is used for intercepting a game starting instruction generated by triggering the game client;
the starting indication unit comprises:
and the starting request triggering unit is used for triggering the game client to send a game starting request to the target server, wherein the game starting request is used for requesting to start the target game service.
The embodiment of the invention also provides a server, which can comprise the other server adapting device.
Fig. 10 is a block diagram showing a hardware configuration of a server, and referring to fig. 10, theserver 1000 may include: aprocessor 1001, acommunication interface 1002, amemory 1003, and acommunication bus 1004;
wherein, theprocessor 1001, thecommunication interface 1002 and thememory 1003 complete the communication with each other through thecommunication bus 1004;
optionally, thecommunication interface 1002 may be an interface of a communication module, such as an interface of a GSM module;
aprocessor 1001 for executing programs;
amemory 1003 for storing a program;
the program may include program code including computer operating instructions.
Theprocessor 1001 may be a central processing unit CPU or an application Specific Integrated circuit asic or one or more Integrated circuits configured to implement embodiments of the present invention.
Thememory 1003 may include a high-speed RAM memory, and may further include a non-volatile memory (non-volatile memory), such as at least one disk memory.
Among them, the procedure can be specifically used for:
obtaining a game starting instruction generated by a game client, wherein the game starting instruction is used for indicating a game service system to start a target game service for the game client, and the game service system comprises at least two servers which are used for processing the target game service and are deployed in different regions;
determining an access delay of the game client to access the server;
determining a target server meeting a preset condition from the at least two servers according to the access time delay;
and instructing the game client to request the target server to start the target game service.
In addition, the embodiment of the present application further provides a terminal, and a composition structure of the terminal may be similar to that of the server, and is not described herein again.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.