Web game framework and apply the method for this framework
Technical field
The invention belongs to communication technical field, be specifically related to a kind of web game framework and apply the method for this framework.
Background technology
Existing web game framework is: according to the online number of game products, the business indicators such as some card income, offer the game server of many platform independent for same game products, and every game server is stored respectively player attributes data and player's operating data.But, along with the minimizing of online number and operating income, more game server only can additionally increase operation cost and allow remaining player be dispersed in each game server and experience the enjoyment less than more interactions, therefore in this case, close clothes and just become a kind of inevitable means that extend the product life cycle and improve running income.
But, close while taking based on above-mentioned web game framework, for example: when game server A and game server B are merged into a new game server C, all player attributes data of the upper storage of game server A and player's operating data need to be imported to game server C, simultaneously, all player attributes data of upper game server B storage and player's operating data need to be imported to game server C, therefore, have to close and take complicated operation, deficiency that cost is high; And, in the process of clothes, easily cause loss of data closing.In addition, because each game server stored respectively player attributes data and player's operating data, therefore, also there is the defect that game server load is heavy, the whole network architecture is difficult to expansion.
Summary of the invention
The defect existing for prior art, the invention provides a kind of web game framework and applies the method for this framework, has advantages of that resource utilization is high, software and hardware cost is low, closes and take simple to operate and be difficult for obliterated data.
The technical solution used in the present invention is as follows:
The invention provides a kind of web game framework, comprise user resources storage server, user resources swap server, central control server and more than two game server; The first input/output interface of described central control server is connected with game server described in each respectively; The second input/output interface of described central control server is connected with described user resources storage server by described user resources swap server.
Preferably, described central control server is connected by cable network or wireless network with game server described in each.
Preferably, described wireless network is GPRS wireless network, WCDMA wireless network or cdma wireless network.
Preferably, also comprise more than one game client; Described in each, game client is connected with described central control server respectively.
The present invention also provides a kind of method of applying above-mentioned web game framework, comprises the following steps:
S1, in the time that described central control server receives the access request of described game client transmission, judges that whether the user ID of carrying in described access request has been stored in described user resources swap server, if judged result is no, carries out S2-S3; If judged result is yes, carry out S4-S6;
S2, described central control server sends the request message that obtains of player registers information to described game client;
S3, when described central control server receives after the message of the player registers information that described game client returns, specify game server to the user assignment that described user ID is corresponding, allow user corresponding to described user ID to play at described appointment game server; Meanwhile, described user ID is stored in described user resources swap server with the mapping relations of corresponding player information; Meanwhile, described player information is stored in described user resources storage server;
S4, described central control server is searched described user resources swap server according to described user ID, obtains the memory location of described player information in described user resources storage server according to the mapping relations of the described user ID of storing in described user resources swap server and described player information;
S5, described user resources storage server is searched in the described memory location that described central control server obtains according to S4, obtains the described player information corresponding with described user ID;
S6, the described player information that described central control server finds based on S5 is to user assignment game resource corresponding to described user ID, and user corresponding to described user ID play according to described game resource.
Preferably, described player information comprises player attributes information and player's operation information.
Preferably, described player's operation information comprises the game server ID that fights player in game operation and/or updating operation and/or described player play.
Preferably, in S3, described central control server specifies game server to be specially to user assignment corresponding to described user ID:
Described central control server obtains described in each game server optimum in game server based on load balancing principle, then the game server of described optimum is distributed to user corresponding to described user ID.
Preferably, after S6, also comprise:
S7, in the time that described central control server need to close clothes operation to game server described in each, described central control server merges the above game server, obtains new game server.
Preferably, in S7, described central control server merges the above game server and is specially:
Described central control server merges described in each each the lightest described game server of load in game server.
Beneficial effect of the present invention is as follows:
The invention provides a kind of web game framework and apply the method for this framework, have the following advantages:
(1) realized maximum using, the software and hardware cost of resource low;
(2) close and take simple to operately, do not need to merge player attributes data and player's operating data, realize and close the seamless of clothes and accept; And close and in the process of clothes, also there is the obliterated data of being difficult for.
(3) reduce the load of game server, be conducive to the expansion of online game framework.
Accompanying drawing explanation
Fig. 1 is the structural representation of web game framework provided by the invention;
Fig. 2 is method and the schematic flow sheet of applying web page game structure provided by the invention.
Embodiment
Below in conjunction with accompanying drawing, the present invention is described in detail:
As shown in Figure 1, the invention provides a kind of web game framework, comprise user resources storage server, user resources swap server, central control server and more than two game server; The first input/output interface of described central control server is connected with game server described in each respectively; The second input/output interface of described central control server is connected with described user resources storage server by described user resources swap server.Wherein, central control server is connected by cable network or wireless network with game server described in each; Wireless network includes but not limited to GPRS wireless network, WCDMA wireless network or cdma wireless network.Also comprise more than one game client; Described in each, game client is connected with described central control server respectively.
As shown in Figure 2, apply the method for above-mentioned web game framework, comprise the following steps:
S1, in the time that described central control server receives the access request of described game client transmission, judges that whether the user ID of carrying in described access request has been stored in described user resources swap server, if judged result is no, carries out S2-S3; If judged result is yes, carry out S4-S6;
S2, described central control server sends the request message that obtains of player registers information to described game client;
S3, when described central control server receives after the message of the player registers information that described game client returns, specify game server to the user assignment that described user ID is corresponding, allow user corresponding to described user ID to play at described appointment game server; Meanwhile, described user ID is stored in described user resources swap server with the mapping relations of corresponding player information; Meanwhile, described player information is stored in described user resources storage server; Wherein, player information comprises player attributes information and player's operation information; Player's operation information comprises the game server ID that fights player in game operation and/or updating operation and/or described player play.
In addition, central control server specifies game server to be specially to user assignment corresponding to described user ID: described central control server obtains described in each optimum game server in game server based on load balancing principle, then the game server of described optimum is distributed to user corresponding to described user ID.
S4, described central control server is searched described user resources swap server according to described user ID, obtains the memory location of described player information in described user resources storage server according to the mapping relations of the described user ID of storing in described user resources swap server and described player information;
S5, described user resources storage server is searched in the described memory location that described central control server obtains according to S4, obtains the described player information corresponding with described user ID;
S6, the described player information that described central control server finds based on S5 is to user assignment game resource corresponding to described user ID, and user corresponding to described user ID play according to described game resource.
After S6, also comprise:
S7, in the time that central control server need to close clothes operation to each game server, described central control server merges the above game server, obtains new game server.As a kind of optimal way, central control server merges described in each each the lightest described game server of load in game server.
The invention provides a kind of web game framework and apply the method for this framework, have the following advantages:
(1) realized maximum using, the software and hardware cost of resource low;
(2) close and take simple to operately, do not need to merge player attributes data and player's operating data, realize and close the seamless of clothes and accept; And close and in the process of clothes, also there is the obliterated data of being difficult for.
(3) reduce the load of game server, be conducive to the expansion of online game framework.
The above is only the preferred embodiment of the present invention; it should be pointed out that for those skilled in the art, under the premise without departing from the principles of the invention; can also make some improvements and modifications, these improvements and modifications also should be looked protection scope of the present invention.