Embodiment
Below in the mode of a specific embodiment, the present invention program is elaborated.
Shown in Figure 1, be the structural representation of distribution plug-in type game services applicator platform embodiment of the present invention.
As shown in Figure 1, in this example, distribution plug-in type game services applicator platform of the present invention includes: connection server cluster, logon server, central server cluster, lobby server cluster, logical server cluster, wherein, this connection server cluster includes at least one connection server, the central server cluster includes at least one central server, the lobby server cluster includes at least one lobby server, and the logical server cluster includes at least one logical server.It should be noted that, for illustrating easy purpose, be to describe with a central server in diagram, and this diagram can only not have a central server in order to the distribution plug-in type game services applicator platform that the present invention program is described.
Wherein, each connection server in above-mentioned connection server cluster, for realizing the data interaction of client and this distribution plug-in type game services applicator platform, be embodied in the user data that receives the encapsulation that client sends over, and send to certain central server to be routed to corresponding logon server, lobby server or logical server this user data, and the data that central server is sended over send to corresponding client, the transmission of realization to user's data;
Above-mentioned game server, for completing user's authentication check and logging in, and, after verification is passed through, send route instruction to central server;
Central server in above-mentioned central server cluster, for realizing the data route between connection server and logon server, lobby server and logical server;
Lobby server in above-mentioned lobby server cluster, for carrying out room, hall logical process, room, the hall logical process here can comprise that establishment hall, deletion hall, user enter the processing such as hall;
Logical server in above-mentioned logical server cluster, being used for game logic processes, the game logic is here processed the logic function in the game process such as comprise chat, video, family, form a team, and adopts plug-in part technology to realize these logic functions during this logical server.
Game services applicator platform of the present invention, to adopt distributed game server structure, carry out respectively different functions by dissimilar server respectively, each connection server in the connection server cluster is realized the data interaction of client and this game services applicator platform, realize the authentication check to user's access by game server, central server is realized the data route, carry out room, hall logical process by lobby server, complete the logical process in game process by logical server, and be all types of Servers installed clusters, connection server cluster for example, the logical server cluster, lobby server cluster etc., thereby make each server in cluster can realize sharing task, in addition, because logical server is all to adopt plug-in unit to realize, thereby can be by disposing different game services plug-in units, the Maintenance free server can be realized the bearing capacity of game server is carried out to dynamic capacity-expanding, and supported game content is expanded and dynamically updated.
As shown in Figure 1, the present invention program's distribution plug-in type game services applicator platform, also include the data server cluster, this data server cluster includes at least one data server, for game data is carried out to the persistence processing, game data after above-mentioned logical server game logic is processed, be kept in data server.
In addition, as shown in Figure 1, according to actual needs, distribution plug-in type game services applicator platform of the present invention, can also include the server of the other types such as log server, accounting server, to expand the application of game content.Picture servers shown in Fig. 1, Resource Server, web server etc. are servers general in prior art, not within the scope of distribution plug-in type game services applicator platform of the present invention.
Consider that general needs a game server just can meet the concurrent demand logged in of the thousands of people of support, so the invention described above is to only have a game server to describe.As required, if need to support the concurrent demand logged in of more people simultaneously, also can be provided with a plurality of game servers, not repeat them here.
According to the distribution plug-in type game services applicator platform in Fig. 1, below just to being elaborated according to one of this game services applicator platform concrete course of work.
As shown in Figure 2, be according to the user of distribution plug-in type game services applicator platform of the present invention login and the schematic flow sheet while entering hall.
When the user need to be played, the user uses client to send connection request by gateway to the connection server in the connection server cluster, is connected to this connection server (be the purpose of follow-up illustrative ease, be referred to as selected connection server).Should selected connection server be the connection server of load pressure minimum in current connection server cluster, specifically can be selected at gateway.Definite mode of the load pressure of each connection server can be determined that in conjunction with information such as cpu load, the user's that connects number, thread state, internal memory service conditions concrete definite mode does not repeat them here.
Should select subsequently a central server (being referred to as selected center's server) by selected connection server, this selected center can be an optional central server, under preferable case, this selected center's server is the central server of a present load pressure minimum selecting according to the load pressure situation of each central server in current central server cluster, and selected connection server is routed to logon server by user's user data by this selected center's server.
Logon server receives the user data of being come by the central server route, this user data is carried out to authentication check, if authentication check is passed through, to this selected center's server, send the route transfer instruction, simultaneously, can also pass through to this selected center's server return authentication verification, allow the message of login;
After selected center's server receives the route transfer instruction, load pressure situation according to current each lobby server in the lobby server cluster, select the lobby server (being referred to as selected lobby server) of a present load pressure minimum, and set up and should select connection server, route between this selected center's server and this selected lobby server, be equivalent to set up this user and should select the mapping route between lobby server, subsequently, all carrying out at lobby server alternately between mutual and user and the user in user and hall, mutual data were by selecting connection server, selected center's server forwards.
As shown in Figure 2, after client obtains the result, be after the user of client logins successfully, client sends relevant game request to selected connection server, request of for example forming a team etc., after selected connection server receives, this game request is routed to selected lobby server by selected center's server.Selected lobby server needs to send to the information of client after processing, be also to be transferred to client via this selected center's server, selected connection server.
Each lobby server in the lobby server cluster, can regularly upgrade the state information of oneself to each central server, the state information here can comprise the information such as cpu load information, memory usage information, thread state information.Each central server can be observed with observer's state the loading condition of each lobby server, central server, when receiving the route transfer instruction and carry out route migration work, selects the lobby server of a present load pressure minimum to carry out the route transfer according to the state information of each lobby server.Wherein, determining of the load pressure size of each lobby server, can determine according to the state information of lobby server.Wherein a kind of concrete definite mode can be, by setting the computing formula of corresponding load pressure size, give corresponding weighted value on the impact of load pressure for each information in conjunction with each information in formula, according to actual conditions, can give different weighted values for dissimilar information, the setting means of concrete computing formula,, definite mode and the account form of weighted value do not repeat them here.
The user successfully accesses selected lobby server, can realize room, hall logical process by selected lobby server, and room, the hall logical process here can comprise that establishment hall, deletion hall, user enter the processing such as hall.In game process after starting to enter game, can complete relevant game logic, integration statistics and other game logics relevant to game by specific logical server and process.
As shown in Figure 3, be according to distribution plug-in type game services applicator platform of the present invention schematic flow sheet while starting to play.In initial game logic, the game request msg that client sends routes to selected lobby server by selected connection server, selected center's server, should select the logical type of lobby server according to this game request msg, select the logical server (being referred to as selected logical server) of a present load minimum from each logical server that the type logical services is provided, and by this selected lobby server, this game request msg is routed to this selected logical server.The transfer of data of the follow-up game operation for this same type is directly carried out between client, selected connection server, selected center's server, selected logical server, no longer via selected lobby server, forwards.
As mentioned above, when selecting selected logical server, each logical server from the type logical services is provided, selected, this be because, can on each logical server, realize various logic function, effectively to share the load pressure of each logical server.In acceptable situation, it can be the game logic operation that only is provided with respectively a type on a logical server.Due to the diversity of game logic action type, this setting means will certainly cause rolling up of logical server number, therefore, can be to give a plurality of dissimilar game logic operations on same logical server.Certainly, according to actual needs, can be also that various types of game logic operations are given to each logical server in the logical server cluster, concrete implementation does not repeat them here.
In the processing procedure of logical server, relevant game data can be stored in data server.As shown in Figure 4, it is the schematic flow sheet according to collaborative work between distribution plug-in type game services applicator platform logical server of the present invention and data server, in this schematic diagram, omitted the communication process between client, connection server, central server and logical server.
As shown in Figure 4, the request that obtains player's data of take is example, after logical server receives the request that obtains player's data, send a data service request that obtains player's data to data server, after sending this data service request, logical server is without the result of waiting for this request, can be directly to the next one request processed.Thereby by the asynchronous operation mode, make data flow and computing move fully independently, utilize the most efficiently CPU and bandwidth, strengthen disposal ability.
After data server receives this data service request, check in the data buffer zone of inquiring about oneself whether these data have been arranged, the process of this inspection inquiry can adopt the memcache technology to realize.If had these data in data buffer zone, direct these data in the calling logic server, and these data are returned to logical server, to complete follow-up logical process.If there are not these data in data buffer zone, data server is inquired about these data from database, after inquiry obtains, these data is inserted into to the buffering area of data server, and calls this data, returns to logical server, to complete follow-up logical process.
Wherein, the data service request that data server mainly adopts the mode of Data Connection Pool to come the processing logic server to send over, thus a plurality of threading operations can be provided, realize the concurrent processing to each data service request.Simultaneously, data server can also adopt the mode of asynchronous call, when the IO operation of carrying out from the data base querying data, can also continue to process other data service request simultaneously.In addition, in the situation capacious of data server, for example 1,000,000 grades, can also carry out segment processing to these data.
In addition, the lobby server cluster of the invention described above and logical server cluster, can dynamically increase or reduce lobby server or logical server according to the actual loading situation, to carry out dynamic capacity-expanding.
When needs add a lobby server, each central server can be monitored the process of each new lobby server at any time.When new lobby server need to add, central server listens to the information that this new lobby server need to add, for this new lobby server distributes a hall ID who not yet is used, subsequently, this new lobby server starts with this hall ID, the information such as game services that be accompanied with serve port, service IP during startup, provide.After this new lobby server starts, to each central server in the central server cluster, each logical server in the logical server cluster, send process log-on message (being referred to as the first process log-on message).After each central server receives this first process log-on message, judge the legitimacy of this new lobby server, if legal, using this new lobby server process as available lobby server process, use to provide in the subsequent game process.
When needs increase a new logic server, start the process of this new logic server, during this new logic startup of server, can be accompanied with simultaneously the logical services that this new logic server provides protocol number, serve port, service IP, whether need the information such as Data Migration.After this new logic startup of server, each lobby server in the lobby server cluster sends process log-on message (being referred to as the second process log-on message).After each lobby server in the lobby server cluster receives this second process log-on message, judge the legitimacy of this new logic server, if legal, the available logical protocol of new logic server is associated with this logical server.
Wherein, when starting this new logic server, incidental information can also comprise the information that whether needs Data Migration.If need Data Migration, judging this new logic server legitimacy, by the available logical protocol of this new logic server with after this logical server is associated, if receive user's request, by this user's migration of subscriber data portion in this new logic server.
Correspondingly, according to actual needs, also can be deleted lobby server, logical server.
When needs are deleted a lobby server, this lobby server that will delete sends regularly closing information to each central server.After each central server receives this timing closing information, this lobby server is designated to regularly closed condition, no longer for this lobby server, accepts logining of new user.Subsequently, this lobby server sends the Data Migration announcement information to central server, central server completes the migration work of the data with existing of this lobby server according to this Data Migration announcement information, the user data of this lobby server is transferred to other available lobby servers and is taken over.When being transferred to available lobby server and being taken over, load pressure that can be current according to other each lobby server, the lobby server that is transferred to present load pressure minimum is taken over, or share to front several lobby servers of present load pressure minimum and taken over, concrete implementation does not repeat them here.
When needs are deleted a logical server, this logical server that will delete sends regularly closing information to each lobby server in the lobby server cluster, after each lobby server receives this timing closing information, this logical server is designated to regularly closed condition, and the data that no longer user sent send to this logical server to process.
Wherein, each lobby server in the invention described above scheme, the logic function of each logical server, for example chat, video, family, the logic function such as form a team, all adopt plug-in part technology to realize, support dynamically plug, thereby without server is recompilated, close and restart, just can dynamically update, increase and close relevant logic function module, the function renewal of chat module for example, close the function of forming a team, increase safe handling module etc., neither needs redeploy and restart server, can realize the dynamic capacity-expanding of server bearing capacity and the startup of server of plug-in type.
In addition, each server in the present invention program, when realizing, some basic modules of its bottom, for example some communication interfaces of bottom etc., can adopt program language to realize, some logic functions on upper strata, communication process etc., with script, realize, process with script, thereby the logic of processing by script and communication process drive/transfer the work of underlying basis module.Because logic and communication process are to realize with script, and script is normally explained operation and decomplier, script is all used simple, easy to learn, easy-to-use characteristics usually, thereby logical gate that can the real time modifying server, and can be so that the distribute exploitation of plug-in type game services applicator platform of the present invention be realized and safeguards.
Because game services applicator platform of the present invention is to adopt distributed structure/architecture, the mode that above-mentioned employing script is realized to logic function, communication process etc. combines with each logic function module that adopts plug-in unit to realize, not only realized the Dynamic expansion of server scale, also realized the expansion to available logic function, can dynamically increase, delete and manage server in real time.
Distribution plug-in type game services applicator platform according to the invention described above, the present invention also provides a kind of collaboration working method of the plug-in type game services applicator platform that distributes, as shown in Figure 5, be the schematic flow sheet of the collaboration working method embodiment of distribution plug-in type game services applicator platform of the present invention, it comprises step:
Step S101: the selected connection server in the connection server cluster receives user's connection request that client sends, and this user's connection request is routed to game server by the selected center's server in the central server cluster, enters step S102;
Step S102: described game server receives described user data, completes authentication check and landfall process to the user, and, after authentication check is passed through, to described selected center server, sends the route transfer request, enters step S103;
Step S103: described selected center server receives this route transfer request, select a lobby server in the lobby server cluster, and set up this selected connection server, this selected center's server and should select the route between lobby server according to this route transfer request, enter step S104;
Step S104: described selected connection server receives room, the hall logic request that client sends, and this room, hall logic request is routed to described lobby server by described selected center server, described lobby server is carried out room, hall logical process according to this room, hall logic request, enters step S105;
Step S105: described selected connection server receives the game logic request that client sends, and this game logic request is routed to described selected lobby server by described selected center server, described selected lobby server is selected a selected logical server from described logical server cluster, and described selected logical server adopts plug-in part technology to complete game logic according to this game logic request and processes.
The specific implementation of other of the collaboration working method of distribution plug-in type game services applicator platform of the present invention is identical with the course of work of above-mentioned distribution plug-in type game services applicator platform, does not repeat them here.
Above-described embodiment of the present invention, do not form limiting the scope of the present invention.Any modification of doing within the spirit and principles in the present invention, be equal to and replace and improvement etc., within all should being included in claim protection range of the present invention.