Embodiment
The system of the approaches to IM of distributed virtual environment in the management method of distributed virtual environment in a kind of server, a kind of node, a kind of distributed virtual environment and the node in the system are provided in an embodiment of the present invention, the sub-district that distributed virtual environment is divided into fair-sized manages, reduced the load of each node effectively, specific descriptions see below.
The occasion of use distributed virtual environment has a variety of, and as online game, virtual community and so on, this paper will be that example is described with the MMO online game in the online game.
Recreation can be considered as being made of jointly a plurality of pseudo-entities in the virtual environment, each player will participate in the recreation by a node, this node is generally all served as by the normal domestic use computer, it would, of course, also be possible to is that other have computing function, can be connected to the instrument of the Internet, such as special-purpose game machine and so on.The player can set a pseudo-entity by this node and participate in the recreation in recreation, perhaps participate in recreation directly, change pseudo-entity state in the recreation by operational order, each pseudo-entity has attribute and the parameter of oneself, by all elements in the state variable performance recreation.Game element constitutes whole game state, and the user can be mapped as game events by arbitrary behavior of nodal operation game element.Each goes up recreation constantly all because the change that the influence of incident has produced state.
For instance, user participates in a MMO online game by the household PC of oneself, set up a pseudo-entity, this pseudo-entity is presented as a game in recreation, the attribute and the parameter list of this game are present, and it is a women, grade 1, stand in the virtual city, this city is exactly the embodiment of various state variables.The player operates on the stool that this women is sitting in the roadside, promptly recreation has been produced influence, at first its state changes to by standing and is seated, have influence on virtual portrait around its and see that all it sits down, the state of stool is also become by the free time to be taken, and that is to say that other virtual objects are all by this events affecting.In a MMO online game, all there are a large amount of similarly incidents to take place all the time.
Present stage more welcome MMO online game; regular meeting is up to 100,000 or more during simultaneously online number; in recreation based on the P2P structure; each game player or user are positioned on the peer node; these nodes are along with the carrying out of recreation can constantly carry out the renewal of data; the exchange of carrying out data that does not stop, these internodal data traffics be very big just, and the load of node is corresponding also just very heavy.The computer major part that is in the user's use in the recreation all is the normal domestic use computer, and its computing capability is limited, when load is overweight, can shines local response speed slack-off, even cause network to be jammed.
The management method embodiment of distributed virtual environment in the server that the embodiment of the invention provides is divided into less sub-district with distributed virtual environment and manages, and particular content is as follows:
Server is divided into the area sub-district littler than node visual range with distributed virtual environment, the node that is in the described distributed virtual environment is preserved the interior cell information of described node concern scope, and the node that calculates of the participation that makes the sub-district is at events affecting during to the sub-district, calculate the result of events affecting sub-district, with result of calculation send to described events affecting to the node that obtains renewal of sub-district.
When the interstitial content that calculates in the participation of sub-district is one, server is made as the node that the participation of described sub-district is calculated.Also can the upper limit be set simultaneously for the interstitial content that the participation of sub-district is calculated.
When node failure, nodes in communication sends the failure node data of preserving to described server with it, when server receives these failure node data, confirms that this failure node withdraws from from system, the state when preserving described failure node and logging off.
Further, can subscribe a upper limit, make server when receiving that reaching the inefficacy of upper limit number reports, confirm node failure again in order to improve the reliability of the report of losing efficacy.
At this moment, server is when the data of the described failure node that receives the transmission of predetermined number node, confirm that this failure node withdraws from from system, collect the data of the described failure node of all nodes transmissions simultaneously, and described data are compared, be as the criterion with most consistent results, determine the state when described failure node logs off, and preserve.
The approaches to IM embodiment of distributed virtual environment in the node that the embodiment of the invention provides is divided into less sub-district with distributed virtual environment and manages, and particular content is as follows:
The node that is in the distributed virtual environment is preserved the interior cell information of described node concern scope, and this sub-district is the zone that the serviced device of distributed virtual environment marks off, and its area is littler than node visual range;
The node that the participation of the sub-district that events affecting arrives is calculated calculates the result of events affecting sub-district, and with result of calculation send to this events affecting to the node that obtains renewal of sub-district.
The result of calculation that the node that wherein obtains renewal obtains the node issue that this participation calculates comprises: pick out a network connection speed and reach the node that pre-conditioned participation is calculated in the node that the participation of this sub-district is calculated, this node that obtains renewal is connected to the node that this participation is calculated, obtains the result of calculation of the node issue of this participation calculating.
Node is according to self performance and the node that whether calculates as the participation of its sub-district, place of network speed decision.In being the sub-district, obtains node the node of renewal, when the interstitial content that calculates in the participation of sub-district is one, promote to this sub-district participates in the node that calculates or node when the interstitial content of the participation calculating of sub-district is one, request server participates in the calculating of this sub-district.Also can the upper limit be set simultaneously for the interstitial content that the participation of described sub-district is calculated.
When node concern scope need add new sub-district, this node need be connected to the node that the participation of described new sub-district is calculated, and obtained and preserve the information of this new sub-district.
Node concern scope need add new sub-district and comprise following two kinds of situations:
When 1, the visual range of node entered into new sub-district, node need add this new sub-district;
2, the coverage of incident has related to not the new sub-district in the concern scope of the node of firing event, and then node need add this new sub-district.
When node concern scope adds new sub-district, further need judge whether this node needs to participate in the calculating of this sub-district, if need this node then to become the participation computing node of this sub-district, as if not needing this node then to become the more new node that obtains of this sub-district.
When node need withdraw from the sub-district, in this sub-district, there is nodes in communication to send and withdraws from cell notification with this node, notified node is revised the information from this sub-district of preserving on one's body.
When node need log off, node send withdraw from cell notification after, send logging off request to server, server receive log off ask after, the data when preserving this node and withdrawing from.
When node failure, these failure node data that will preserve of nodes in communication send server to it, when server receives the data of described failure node, confirm that described failure node withdraws from from system, the state when preserving described failure node and logging off.
Further, can subscribe a upper limit, make server when receiving that reaching the inefficacy of upper limit number reports, confirm node failure again in order to improve the reliability of the report of losing efficacy.
At this moment, server is when the data of the described failure node that receives the transmission of predetermined number node, confirm that this failure node withdraws from from system, collect the data of the described failure node of all nodes transmissions simultaneously, and described data are compared, be as the criterion with most consistent results, determine the state when described failure node logs off, and preserve.
Further present embodiment gives the method for verification, earlier from the node of sub-district, pick out check-node, during to default time, node in this sub-district is preserved the state information of current area automatically, and with state information or need the cryptographic Hash of verification object to send to this check-node, by check-node state information or described cryptographic Hash are checked, the result identical with majority is as the criterion, and to the inconsistent node feedback check of check results result, the inconsistent node of check results is connected to the node of check results unanimity, obtain the state information of the current area of automatic preservation, cover the state of this inconsistent node.
Picking out check-node from the node of described sub-district, can be to pick out check-node from the node that the participation of described sub-district is calculated.The method of selecting can be that random choose goes out check-node or picks out the higher node of credit rating as check-node.
During to default time, node set up formation preserve described verification constantly the back to receiving check results and carrying out the preceding incident of respective handling;
After covering the state of described inconsistent node, according to the state of the described inconsistent node of preserving in the formation of incident correction.
The default time mentioned above can be the time of the fixed intervals preset.
Be described from server side and node side management method respectively above distributed virtual environment, but in the time of most of in actual use, the behavior of server and the behavior of node are worked in coordination, and the situation in the time of hereinafter will using together the management method of two kinds of distributed virtual environments is described in detail.Hereinafter for convenience of description with the unified management method that is called distributed virtual environment.
The virtual environment of recreation is divided into some littler than visual range usually sub-districts (cell), after the division of cells, the interested scope of each node will be that unit divides with the sub-district, each node is that unit carries out information stores with the sub-district, during the generation incident, with the sub-district is that unit calculates, and also promptly calculates incident which type of result the influence that the sub-district takes place is had.Visual range is a node in concrete gamespace can observed scope, this scope is different according to different game settings, in the most recreation, node all needs to know the relevant information of all game elements in its visual range, the state of other pseudo-entities for example, the variation of game environment.Can be when the division of cells scope among the management method embodiment of this distributed virtual environment with reference to the visual range size of most of nodes in the recreation, microzonation is divided into the zone littler than visual range, the visual range that is to say each node in the recreation all can relate to a plurality of sub-districts, and each node all can be preserved the cell information that common factor is arranged with this node visual range.
The concern scope of node usually is exactly all sub-districts that common factor is arranged with this node visual range, but in some cases, the concern scope of node might exceed all sub-districts that common factor is arranged with this node visual range.
For example, usually, game events of every generation all can influence the state parameter of one or more virtual objects in recreation, and the virtual objects set of influence can be called the events affecting scope.If the events affecting scope of a node initiation has exceeded the current concern scope of this node, had influence on the sub-district that does not have common factor with this node visual range, owing to do not preserve the information of this sub-district on this node, can't be to the node issuing time information of this sub-district, this moment, this node need add this sub-district, this sub-district is also listed in the concern scope, accessed and preserve the information of this sub-district, then the issue of the computing node in all affected sub-districts event information.
Concern range node and sub-district according to node can present three kinds of relations so: the sub-district that node is positioned at, related to by node concern scope but the sub-district, the node that do not comprise this node paid close attention to the sub-district that scope does not relate to.For convenience of description, the sub-district that this paper is positioned at node is called the calculation plot of this node, the non-calculation plot that is related to by the node visual range is called the renewal sub-district of this node, be in the irrelevant sub-district that the outer sub-district of node visual range is called this node, calculation plot, renewal sub-district or the irrelevant sub-district that the sub-district is certain node, can be called is the attention rate of this node to this sub-district, and the calculation plot of a node and renewal sub-district have constituted the concern scope of this node jointly.
Because node is higher to the set degree of concern of the virtual objects in this node visual range usually; especially higher to this node environmental requirement reliability at one's side; therefore node can participate in the calculating of this node calculation plot usually, and the very first time obtains all Data Update in the calculation plot.Because the distance of the renewal sub-district of node and node wants far away than calculation plot, node needn't participate in upgrading the calculating of sub-district usually, can carry out Data Update by the mode of accepting to upgrade sub-district interior nodes information issue.As for irrelevant sub-district, because generally not needing to know this node, node do not pay close attention to extraneous data, so node does not need to preserve the data of irrelevant sub-district usually yet.
It is to be noted herein, the management method embodiment of the distributed virtual environment that the embodiment of the invention provides also provides a kind of execution mode, under some special situations, node can not participate in the calculating of node place calculation plot, for example network delay is big, this node can not be simultaneously and a plurality of node high-speed traffics, or this node computing capability is poor, the node that participates in again or in this node calculation plot calculating has reached certain upper limit, do not need this node to participate in calculating, node can not participate in the calculating of the calculation plot of node in these cases, and play by the cell update information of accepting other node issues in its calculation plot, to improve the performance of entire system.The calculating whether node participates in the calculation plot of node can be determined by system, also can be determined by node self.
In common games system, the behavior of node all is continuous, for example in the Virtual Space, move continuously, or change visual angle, constantly carry out the discovery of new resources, these new resources comprise that all newly enter the game element of node visual range, at this moment must need between the node to carry out a large amount of information exchanges, cause node load too high.And in embodiments of the present invention, new sub-district only appears in node in the visual range of node, when perhaps the events affecting scope of node initiation exceeds the cell range of nodes records, just can need to add new cell information, and preserve this new cell information, needn't when pseudo-entity change position, carry out the resource discovering operation at every turn, significantly reduce internodal amount of information exchange, the corresponding load that also just effectively reduces node.Simultaneously, node need participate in whole calculating of its interesting data group in the prior art, and the interesting data group of node is by the decision of the visual range of node usually, in embodiments of the present invention, node only needs to participate in the calculating of its calculation plot usually, and the sub-district is a zone littler than visual range, so the amount of calculation of node has also obtained very big alleviating, effectively reduces the load of node.
After now illustrating division of cells, the working method of system, the shape of sub-district in virtual environment are generally the geometry of rule, and for example square, hexagon and so on will be that example is described with square in the present embodiment.
As shown in Figure 1, one in the gamespace is divided into 16 sub-districts: sub-district 101, sub-district 102, sub-district 103, sub-district 104, sub-district 105, sub-district 106, sub-district 107, sub-district 108, sub-district 109, sub-district 110, sub-district 11 1, sub-district 112, sub-district 113, sub-district 114, sub-district 115, sub-district 116, be positioned at sub-district 106 on the node 120, the visual range of node 120 represents with circle 130, circle 130 and sub-district 106, sub-district 107, sub-district 110, and sub-district 111 intersect.
As shown in Figure 1, the concern scope of supposing node 120 is exactly a visual range, so for node 120, sub-district 106 is the calculation plot of node, sub-district 107, sub-district 110, and sub-district 111 be the renewal sub-district of node, sub-district 101, sub-district 102, sub-district 103, sub-district 104, sub-district 105, sub-district 108, sub-district 109, sub-district 112, sub-district 113, sub-district 114, sub-district 115, sub-district 116 are the irrelevant sub-district of node.
Usually, game events of every generation all can influence the state parameter of one or more virtual objects in recreation, and the virtual objects set of influence can be called the events affecting scope.Calculating all in the recreation are all initiated by game events, when game events took place, whether node participated in the calculating of this game events, see whether this game events has influence on the calculation plot of this node, if have influence on, this node just can participate in the calculating of this game events.Certainly above mentioned, also provide node not need to participate in the execution mode that calculation plot calculates in the embodiment of the invention, so whether node must participate in the calculating of this incident, also to see the setting of system, system can set in the sub-district all nodes all to be needed to participate in calculating during by events affecting in the sub-district, also can be set in to allow in particular cases that part of nodes does not participate in calculating the sub-district in.
For convenience of description, this paper will be when game events influences the sub-district, the node that needs in this sub-district to participate in calculating is called the computing node of this sub-district, the node that only need obtain this cell update information is called the more new node of this sub-district, need to prove that the more new node of this sub-district also comprises the node that needs to obtain this cell update information in other sub-districts.
Each of sub-district more new node all must be connected to a computing node of this sub-district, to obtain the more new data of sub-district, when having a plurality of computing nodes available, generally with network connection speed as main judgment criteria, select the computing node of network connection speed the best to receive the more new data of sub-district.When this computing node is no longer born calculating when function of sub-district, all nodes that obtain renewal from it need be selected else from the computing node formation and select a computing node as Data Source.
With Fig. 1 is example, if default node 120 is when game events influences sub-district 106, need to participate in calculating, then node 120 is the computing node of sub-district 106, node 120 need obtain its lastest imformation of upgrading sub-district 107 simultaneously, so node 120 can be called the more new node of sub-district 107, if default node 120 does not need to participate in the calculating of sub-district 106, then node 120 also is a more new node for sub-district 106.
Because amount of calculation and information communication amount that computing node is born are far longer than more new node, so when system's permission part of nodes does not participate in calculating, can from the node of sub-district, pick out better performances, network speed usually and serve as computing node faster.The action of selecting is generally finished by node self, server is set some primary conditions, the node that for example in sub-district what computing nodes can be arranged or serve as computing node must possess those conditions, or the like, node will add the calculating of participation and sub-district after judgement self conformance with standard.
In a sub-district computing node and more the identity of new node can exchange, withdrawed from the sub-district as a computing node, need from new node more, pick out one and upgrade to computing node; Perhaps a computing node is owing to network, and it is big that network delay becomes suddenly, and this node applies to become more new node, also allows.
Mention above that each node is that unit carries out information stores with the sub-district in the management method embodiment of the distributed virtual environment that the embodiment of the invention provides.
Owing to the situation of only surplus next computing node in the sub-district in actual motion, may occur, and the confidence level of any domestic consumer node all is limited, under the situation of having only a node to participate in calculating the sub-district, if this computing node mistake in computation, when perhaps deliberating to carry out dirty tricks, will not have other nodes to exercise supervision to it, the more new node of this sub-district also all can be ensued mistake, perhaps cheated, cause system's degree of reliability to reduce.In order to prevent the appearance of these situations, the degree of reliability of raising system, introducing safe node when the embodiment of the invention provides in the sub-district only surplus next computing node exercises supervision, this safe node can be served as by server, certainly, if also there are other more new nodes in the sub-district, also new node more can be promoted and be computing node, the number that promotes can be one, also can be a plurality of.
On the other hand, calculate also simultaneously at the node of the single subdistrict overconcentration of power in the managerial system and there is no need, and can since problem such as network delay to calculating and bring synchronously difficulty, therefore the embodiment of the invention provides the execution mode of the restricted cell computing node number upper limit, can be according to the difference of concrete game environment, as the factors such as probability that number of users, network delay, Network Packet Loss, deception in the sub-district take place, set the upper limit of computing node number in the sub-district.
In the management method embodiment of the distributed virtual environment that the embodiment of the invention provides, each node is also preserved the set of all calculation plots of this node except the identifier of preserving this node, and the set of all renewal sub-districts of this node; In the calculation plot information in the set of calculation plot, write down the identifier of this sub-district, the computing node formation of this sub-district, and the renewal sub-district formation of this sub-district; In the renewal cell information in the formation of upgrading the sub-district, write down the identifier of this sub-district, the computing node formation of this sub-district; All computing node information of this sub-district are preserved in the computing node formation, upgrade all renewal nodal informations that this sub-district is preserved in the sub-district formation; Nodal information in the formation has write down node identifier, address information, has reached the pointer of the virtual objects that points to nodal operation, when this virtual objects is in the concern scope of preservation information node, must on the node of the information of preservation, set up a corresponding virtual object, this object is connected with pointer with its running node information, when this virtual objects not when preserving the concern scope of information node, can not set up the corresponding virtual object, pointed is empty.Each virtual objects on node all has the running node information of a unique correspondence to be saved, and the nodal information of preserving can not have the virtual objects of this intranodal.
In description above, node can need to add new sub-district sometimes, these the time may be new sub-district in the visual range of node, to occur, when perhaps the events affecting scope of node initiation exceeds the cell range of nodes records, the method that the management method embodiment of the distributed virtual environment that following this paper will provide the embodiment of the invention adds new sub-district is described, and this embodiment flow process is seen Fig. 2:
The address of computing node in step 201, the acquisition sub-district, and connect.
When a node need add new sub-district, at first to obtain the address of at least one computing node in this sub-district, and with it and connect.
In the system based on P2P, the mode of Query Information has a variety of, inquires about by distributed hashtable (DHT, Distributed Hash Table) system usually now.So-called DHT system is exactly: the index information of the file that needs are searched---the identifier of node for example, be expressed as (a K, V) right, (K, V) to being called a directory entry, K is called keyword, can be the cryptographic Hash of filename, node identifier or other descriptors, and V is Internet protocol (IP) address of the node of actual storage file or other descriptors of node.All directory entries are formed a big index Hash table, as long as the K value of input destination node just can be found the node address that all store this nodal information from this table.Then, more top big file Hash table is divided into a lot of local fritters, all that the local Hash table of these fritters are distributed in the system according to specific rule participate in making each node be responsible for safeguarding wherein one on nodes.Like this, during another node of querying node, query message is routed to node corresponding and since contain in the Hash table piecemeal of this node maintenance to search (K, V) right, can inquire the nodal information that needs.
In the management method embodiment of the distributed virtual environment that the embodiment of the invention provides, by DHT with network information uniformly dispersing on network node, behind each cell setting identifier, cryptographic Hash according to this identifier, set up the index node of sub-district, generally require node identifier cryptographic Hash and the immediate node of cell identifier cryptographic Hash to serve as this responsibility, as long as this index node is in the network, node that not necessarily will this sub-district is served as, each index node is preserved the information of a computing node on this sub-district, when node is sought cell information, can find the index node of this sub-district according to DHT, obtain the computing node information of preserving on this index node, and then connect with this computing node.
When the computing node of the former preservation of index node is no longer served as the calculation task of this sub-district, select a computing node and index node is contacted directly by the computing node of this sub-district alternative.
Step 202, send concern type to this sub-district.
The node that needs to add new sub-district has been set up the concern type of the computing node transmission of connection to this sub-district in step 201, for example this node need participate in the calculating of this sub-district, and perhaps this node need obtain the state updating information of this sub-district.
Usually our sub-district, default setting node place is the sub-district that participates in calculating, and just needing its sub-district of paying close attention to scope of adding be the sub-district that obtains renewal, and after node added this sub-district, whether system can participate in calculating to node again according to actual conditions was allocated.
Step 203, judge whether this node participates in the sub-district and calculate.
The concern type to this sub-district that sends in the step 202 is judged judge whether this node participates in the sub-district and calculate, if then enter step 204; If not, then enter step 206.
Step 204, receive computing node formation in the sub-district, obtain renewal node queue and sub-district object information.
Enter this step, illustrate that this node need participate in the sub-district and calculate, then need to obtain all information in the sub-district, comprise all object information in the sub-district, participate in the computing node formation and obtain renewal node queue.
Step 205, connect with all computing nodes, send to new node more and participate in calculating notice.
All computing nodes connect in this node and the sub-district, and send the notice that oneself participates in this sub-district calculating to obtaining the node that upgrades in the node queue, require all nodes that obtain cell update self to add in the node queue that participates in calculating the sub-district.
So far flow process finishes.
Computing node formation and sub-district object information in step 206, the reception sub-district.
Enter this step, illustrate that this node only need obtain the lastest imformation of sub-district, the computing node of this node and this sub-district connects, and receives computing node formation and sub-district object information in the sub-district.
Step 207, connect, obtain the lastest imformation of this sub-district with the computing node of sub-district.
This node is picked out a computing node in all computing nodes of this sub-district, fixing state renewal of obtaining this sub-district from this computing node, in formation all participate in the message that this sub-district is landed in the computing node issue then, add obtaining of this sub-district and upgrade node queue, the computing node the sub-district in according to this mark to this node transmission event information or state new data more.
So far flow process finishes.
In addition, can change in the attention rate of node many times to a sub-district, for example because node motion has been left original calculation plot, this calculation plot has become the renewal sub-district, node motion to former renewal sub-district just become calculation plot, perhaps system with one more new node be upgraded to computing node, this sub-district is the renewal sub-district of node originally, has just become calculation plot.Node to the attention rate of a sub-district change be one can be reciprocal process.
The method that the management method embodiment of the distributed virtual environment that following this paper will provide the embodiment of the invention changes the sub-district attention rate is described, and changes into calculation plot that to upgrade the sub-district be example, and flow process is seen shown in Figure 3:
Step 301, notify this sub-district the computing node formation, obtain the node that upgrades in the node queue.
Node sends notice to the computing node formation of this sub-district, the node that obtains in the renewal node queue, and the computing node formation of notifying this node will withdraw from this sub-district adds to obtain and upgrades node queue.
Step 302, revise the attention rate information of this node to the sub-district.
This sub-district of deletion from the calculation plot set that node writes down, and this sub-district joined obtain the renewal set of cells, delete the obtaining of this sub-district of self preserving and upgrade node queue, revise the computing node formation of this sub-district, this node is deleted from the computing node formation.
There is not the sequencing relation between this step and the follow-up step.
Step 303, revise this sub-district the computing node formation, obtain and upgrade node queue.
Notified computing node revise this sub-district of self preserving the computing node formation, obtain and upgrade node queue, this node from computing node formation deletion, is joined to obtain and upgrades node queue.
Notified more new node is revised the computing node formation of this sub-district of self preserving, and this node is deleted from the computing node formation.
Whether step 304, decision node obtain renewal from this node, are then to enter step 305, otherwise flow process finishes.
Step 305, alternative one is obtained and is upgraded the source and connect from the computing node formation of this sub-district.
Flow process finishes.
When upgrading the sub-district lifting for calculation plot with one, flow process is seen shown in Figure 4:
Step 401, obtain obtaining of this sub-district and upgrade node queue.
From obtain the computing node of this sub-district of upgrading the source as this node, obtain obtaining of this sub-district and upgrade node queue.
Step 402, revise the attention rate information of this node to the sub-district.
This node is joined the calculation plot set of writing down on the node, and this sub-district upgraded the set of cells deletion from obtaining, revise this sub-district of preserving on this node the computing node formation, obtain and upgrade node queue, this node is added the computing node formation, withdraw to obtain and upgrade node queue.
There is not the sequencing relation between this step and the follow-up step.
Step 403, the interdependent node to this sub-district send change concern type information.
Node sends notice to the computing node formation of this sub-district, the node that obtains in the renewal node queue, and the computing node formation of notifying this node will add this sub-district is withdrawed to obtain and upgraded node queue.
Step 404, the node that receives this information carry out corresponding modification to the queuing message of self preserving.
Notified computing node revise this sub-district of self preserving the computing node formation, obtain and upgrade node queue, this node is upgraded node queue's deletion from obtaining, join the computing node formation.
Notified more new node is revised the computing node formation of this sub-district of self preserving, and this node is joined the computing node formation.
Flow process finishes.
To have nothing to do the sub-district lifting for upgrading sub-district or calculation plot, and the method for the sub-district that just above-described adding is new no longer is repeated in this description at this.
As for calculation plot or renewal sub-district are become irrelevant sub-district, also can be described as a node has withdrawed from this calculation plot or has upgraded the sub-district, no matter this node is the computing node of this sub-district or new node more, when withdrawing from the sub-district, all the node in the node listing that will self preserve in this sub-district sends notice.If this node is a computing node, then must there be the computing node tabulation of this sub-district and obtains the renewal node listing, then need this moment the node transmission in two tabulations to withdraw from cell notification; If this node is new node more, then only there is the computing node tabulation of this sub-district, just need withdraw from cell notification to all computing nodes transmissions this moment.Node self nodes in communication in these respective cell sends the notice that withdraws from the sub-district, so that make these nodes revise this sub-district internal information, directly delete this cell information of self preserving and get final product and withdraw from node, certainly under the situation that system and node self performance allow, do not delete yet and be fine.
When node need log off, at first to withdraw from the sub-district of all concerns, send the request of logging off to game server at last, the data when game server is preserved this node and withdrawed from.
In actual motion, sometimes also can run into the situation of node sudden failure, for example network breaks suddenly, node crashes and so on suddenly, in order to prevent this class accident, the management method embodiment of the distributed virtual environment that the embodiment of the invention provides provides the processing method when node failure, idiographic flow as shown in Figure 5:
Step 501, transmission failure node data and inefficacy are reported to server.
Node was unexpected when losing efficacy, and was reported to server by nodes in communication with it.If failure node is computing node, then belongs to the computing node of a sub-district with it together and all will under the situation that this node does not respond for a long time, find this node failure from the more new node that this node obtains cell update; If failure node is new node more, then its sub-district computing node of obtaining renewal can not have under situation about responding for a long time at it, learn node failure.Must have part of nodes to preserve the data of this failure node in the node of finding node failure, these nodes are submitted to game server together with the failure node data of preserving in this machine and the report of losing efficacy
Step 502, reception failure node data and the report of losing efficacy.
Game server receives the failure node data and the report of losing efficacy.
Step 503, judging whether to be first inefficacy report to this node, is then to enter step 504; Otherwise enter step 505.
Step 504, set up failure node data statistics formation.
Set up the formation of a statistics, be used to write down data, be called failure node data statistics formation about this failure node.
Step 505, failure node data in this report are inserted failure node data statistics formation.
Server inserts failure node data in this report the failure node data statistics formation of this failure node.
Step 506, server are judged the failure node report about this failure node that receives, and whether reach the default failure node report upper limit, are then to enter step 507; Otherwise return step 501.
Under the situation of having only a node report to lose efficacy, probably be that network failure causes between the node that lost efficacy of report and this failure node, in order to improve the reliability of system, adopted in the processing method when node failure that the embodiment of the invention provides, set a numerical value, when the inefficacy report of predetermined number is only received in restriction, just confirm the method for this node failure.Certainly, directly when receiving that first lost efficacy report, carry out subsequent treatment immediately and also allow.
Step 507, determine and the state when preserving failure node and withdrawing from.
Server is added up according to failure node data in the formation, and the data identical with majority are as the criterion, and determines the state when failure node withdraws from, and preserves then.
Step 508, server send feedback information to the node that sends report.
The feedback information that the node reception server of step 509, transmission report sends.
Flow process finishes.
Because among the management method embodiment of the distributed virtual environment that the embodiment of the invention provides, each node all is that unit preserves data with the sub-district, the data that on each node with the sub-district are unit all may be backed up by a plurality of nodes, be kept at computing node and the Data Update node of contacting directly with it as the computing node data, the Data Update node data is kept on the computing node of contacting directly with it, so when the unexpected inefficacy of node occurring, just can utilize these Backup Datas, data when knowing the failure node timeliness, preserve, promoted the reliability of system.
With Fig. 1 is example, node 120 has been preserved sub-district 106, sub-district 107, sub-district 110, and the information of sub-district 111, when node 120 lost efficacy, with the computing node in the sub-district 106 of node 120 direct communications, and sub-district 107, sub-district 110, for providing the node of Data Update, node 120 can not confirm that node 120 lost efficacy in the sub-district 111 because of node 120 does not respond for a long time, and report to game server, learn the node that node 120 lost efficacy in the sub-district 106, the data of pseudo-entity on the node 120 have been preserved, and send to game server, all state informations when the data that game server sends according to sub-district 106 interior nodes determine that the pseudo-entity on the node 120 withdraws from, and preserve.Like this, node 120 recover normal after, during pseudo-entity before the user accesses once more, the data that can not lose this pseudo-entity just.
When the incident of generation, need issue this incident to interdependent node, being unit then with the sub-district calculates assessment with result of calculation to incident, the method that the management method embodiment of the distributed virtual environment that following this paper will provide the embodiment of the invention issues incident is described, and idiographic flow is seen Fig. 6:
Step 601, the sub-district of calculating events affecting.
When a node causes an incident, calculate the coverage of this incident, according to the overlapping situation of events affecting scope and sub-district, the sub-district of calculating this events affecting, the events affecting scope can exceed a cell range sometimes, promptly influences a plurality of sub-districts simultaneously.
The sub-district that step 602, the incident of judging whether have influence on is then to enter step 603 not in the concern scope of this node; Otherwise enter step 604.
Step 603, use the method for the new sub-district of above-described adding, this sub-district is added the concern scope of this node.
Step 604, the issue of the computing node in all affected sub-districts event information.
Flow process finishes, and being unit with that with the sub-district calculates assessment with result of calculation to incident.
Method by above-mentioned issue incident, as long as each sub-district all can be calculated by a plurality of nodes during the generation incident, just can guarantee that each incident has a plurality of nodes to participate in simultaneously calculating, compare the behavior of the deception that just can realize avoiding the minority node by result of calculation a plurality of nodes.
User instruction in the network at first calculates at each computing node with the form of incident, all obtain node that cell data upgrades and obtain the Information of Development of recreation with the form of directly obtaining state from computing node, and the information of these nodes is consistent with the computing node status data of its data source.As long as can guarantee the calculating unanimity of a plurality of computing nodes, the fraud of computing node or error in data are dropped to minimum, just can guarantee to a certain extent that whole system is that safety is consistent.
In order to ensure the consistency of system, the management method embodiment of distributed virtual environment of the present invention provides the method for node data being carried out verification, and specific practice sees below described, and idiographic flow is referring to Fig. 7:
Step 701, preserve verification constantly data message and send to the sub-district check-node.
In order to ensure the consistency of data in the system, the management method embodiment of distributed virtual environment of the present invention is that the data that unit detects on each node realize by periodicity with the sub-district.
The management method embodiment of distributed virtual environment of the present invention sets up a series of monitoring time point on overall unified clock, as unified verification constantly, the blanking time of these monitoring time points is very short, length normally equates and is fixing, certain system also can get demand according to other these monitoring time points are set, each node will be preserved the state information of current sub-district automatically running to verification during the moment, and a unified check-node in this sub-district sends.
Check-node is that these cell status data are unified the node of verification, this node is owing to need the outer calculation task of commitment, amount of calculation is bigger than other nodes, needs reasonable performance also to need higher confidence level, so served as by the computing node in the sub-district usually.And the selection of check-node, can be by selecting at random or determining based on the mode of credit mechanism election.
When in the node of inside, sub-district, carrying out the selection of check-node, selection scheme is meant in network and rotates the selection check node according to certain rule at random, this scheme can effectively be avoided in the network deception that acts in collusion of a plurality of nodes, but the node of selecting, its performance can not guarantee it is reasonable in all nodes; Based on the mode of credit mechanism election, can in the computing node of sub-district, elect believable node in an a period of time by a kind of effective prestige controlling mechanism, system is relatively stable like this.
The node that participates in the verification of a certain sub-district is the computing node of this sub-district normally, the node that obtains update of district status generally need not participate in verification, as long as the information on the computing node is correct, the more new node that obtains the computing node information releasing so is exactly correct.The node that participates in verification will send the time point t that participates in verification to check-node, participate in the node number N that calculate the sub-district, the also i.e. computing node number of this sub-district, object sum M in this sub-district that this node is preserved, the also i.e. computing node and the number sum of new node more in this sub-district, and the state information of each verification object, the state information of verification object can be the state information cryptographic Hash of this verification object here, to reduce data traffic, reach convenient comparison.
Step 702, set up this verification verification tabulation constantly.
Check-node is set up this verification verification tabulation constantly after receiving the information that each computing node sends, comprise the verification object information that each computing node sends, and the verification object information of check-node preservation itself, is used for follow-up comparison.
Step 703, data message is compared, determine correct status information in the mode that the minority is subordinate to the majority.
Now illustrate the structure of verification tabulation, and the method for comparison, suppose node P1, P2, P3...... PN to check-node sent verification constantly t need the state information of verification, these nodes add that check-node comes to N, the state information cryptographic Hash that each node sends is designated as H1, H2, H3......HM, and wherein M is the object sum in the sub-district.The t that check-node is set up verification tabulation constantly is as shown in table 1.
Table 1, verification tabulation
? |
H1? |
H2? |
H3? |
...... |
HM? |
P1? |
h11? |
h23? |
h31? |
...... |
hM5? |
P2? |
h11? |
h23? |
h31? |
...... |
hM5? |
P3? |
h15? |
h23? |
h31? |
...... |
hM5? |
P4? |
h11? |
h23? |
h31? |
...... |
hM5? |
...... |
...... |
...... |
...... |
...... |
...... |
PN? |
h11? |
h23? |
h31? |
...... |
hM5? |
Comparative result |
h11? |
h23? |
h31? |
...... |
hM5? |
Write down the state information cryptographic Hash of the verification object that each node sends in the table 1, by comparison to these cryptographic Hash, obtaining most consistent results is final result, as H1, P1, P2, P4...... are h11 to the cryptographic Hash that PN sends, and the cryptographic Hash of having only P3 to send is h15, so H1 will be final correct result with h11, P1, P2, P4...... are consistent to PN to the check results of H1 so, and P3 is exactly inconsistent to the check results of H1.
The node of step 704, participation verification in the sub-district sends check results.
Check-node is consistent consistent notice of node transmit status to check results, to check results is the inconsistent notice of inconsistent node transmit status, will comprise an assay in this inconsistent notice and be consistent nodal information, also be a safe node information.
With table 1 is example, just need be to the inconsistent notice of node P3 transmit status, comprise the information of P1, P2, P4...... any node among the PN in this notice, and also will the node transmit status be consistent notifies to other.
Step 705, the node of respectively accepting verification receive check results.
Step 706, judging whether this verification time information is correct, is that then flow process finishes; Otherwise enter step 707.
Step 707, correction node state.
Enter this step and illustrate that this node of accepting verification mistake occurred in the data of verification moment t, need to proofread and correct the state information of this node, this node will be connected to this safe node by the safe node information of carrying in the notice, obtain correct t state information constantly.
At this moment, can directly be used in the state information that state information that safe node obtains covers record current on this node, but the regular hour need be spent owing to carry out verification, though this time is very short, also cause node when getting access to correct t moment state information, t has become the time point in a past constantly, when t, be carved between the current time, the sub-district may be influenced by other incident, at this moment directly be used in the state information that state information that safe node obtains covers record current on this node, may neglect the influence of these kainogenesis incidents.
In order to proofread and correct the information on the node accurately, run to verification constantly at node, in the time of preservation state information, set up a formation and preserve verification moment back to receiving check results and carrying out all preceding incidents of respective handling, after receiving that inconsistent information is obtained correct t moment state information, according to incident correlation circumstance and causality in inconsistent object of state and the formation, node is carried out verification.
Participate in the node of verification, after receiving the inconsistent state notice that check-node sends, with the relevant incident of inconsistent Obj State incident, and retrieve out successively with the incident of dependent event causal correlation, set up anti-event handling successively and send from nearest incident then to interdependent node.
Need to prove, sometimes, because odjective cause, some should participate in the node of verification, fails in time check information to be sent to check-node, at this moment, check-node does not have in time to participate in the node of verification to those, directly send the inconsistent notice of check results, prevent this part of nodes, can carry out next step operation smoothly like this because self network or machine performance influence recreation are pushed ahead.
More than be the description of the management method embodiment working method of distributed virtual environment that the embodiment of the invention is provided, the management method embodiment of the distributed virtual environment that provides of the embodiment of the invention also provides the method for setting cell range in addition:
The scope of above mentioning the sub-district is littler than the viewing area, but too small also is inappropriate, just cause because the sub-district is too small, the mobile meeting of node is frequently moved in each minizone, bring some extra communication datas, for the limiting telecommunication data volume, if the sub-district is square, can require the visual range diameter to be less than or equal to two times the sub-district length of side, be that the length of side of sub-district is not less than half of visual range diameter, make that like this sub-district number in the node visual range keeps smaller or equal to 9, always if the sub-district is a hexagon, can require the diagonal of sub-district to be not less than half of visual range diameter, also follow such rule in the sub-district during for other shapes substantially.
Simultaneously, the computer capacity of node determines which node and this node to constitute communication set, same sub-district is calculated, and the node that participates in calculating same sub-district should not be too much, and this has just determined the sub-district unsuitable excessive.On the other hand, when the sub-district was too small, an incident covered a plurality of sub-districts, participated in the node that this incident calculates and came from the registration of a plurality of sub-districts, but all was in order to calculate same incident, and this can cause the repeated communications between the sub-district.It is an important problem that the size of sub-district defines.Under the certain prerequisite of whole gamespace size, the sub-district is more little, and it is thin more to be referred to as the spatial division granularity.The spatial division granularity is related to the frequent degree of spatial data index.Granularity is meticulous, and node moving in virtual environment may cause the data frequent exchange of by stages; Granularity is thick excessively, and the scope of node control is excessive, and load is excessive.Illustrate, if 100 * 100 Virtual Space, can divide according to every sub-district 15 * 15 or 5 * 5, virtual portrait can be seen in the space 10 * 10 scope, then in 5 * 5 dividing mode, every 5 steps of straightaway of node are just seen a new sub-district, and carrying out with the sub-district is the data discovery of unit.And in 15 * 15 dividing mode, the node number in sub-district has been brought up to 9 times of 5 * 5 dividing mode, and each node produces incident all will send to all nodes in the sub-district, and data traffic increases greatly.Therefore, can require the length of side of sub-district to be slightly larger than or to equal the diameter of average events affecting scope.
In addition, the sub-district had better not overlap, and each cell size is also preferably fixed, because can produce certain additional calculations and communicate by letter at crossover region, and district dynamic changes, and can be not easy to node and carry out searching of resource.
More than be to be example with the MMO online game, the specific descriptions of the management method embodiment of the distributed virtual environment that the embodiment of the invention is provided, as for other other distributed virtual environments, as virtual community, its working method is all with above-described roughly the same.
One of ordinary skill in the art will appreciate that all or part of step that realizes in the foregoing description method is to instruct relevant hardware to finish by program, described program can be stored in a kind of computer-readable recording medium, this program when carrying out and the management method embodiment of above-mentioned distributed virtual environment basic identical.
The above-mentioned storage medium of mentioning can be a read-only memory, disk or CD etc.
Still be example with the MMO online game below, the system embodiment of the distributed virtual environment that the embodiment of the invention is provided specifically describes.
The system embodiment of the distributed virtual environment that the embodiment of the invention provides, usually comprise a plurality of nodes, described node is arranged in the sub-district of described system, the area of these sub-districts is less than the visual range of node, and the structure of the system embodiment of the existing distributed virtual environment that to be example with Fig. 8 provide the embodiment of the invention describes.
Comprise a plurality of sub-districts in the system 800, these sub-districts are sub-district 810, sub-district 820, sub-district 830, sub-district 840, sub-district 850, sub-district 860...... or the like.Comprise some nodes in each sub-district again, comprise node 811, node 812...... or the like in the sub-district 810, comprise node 821, node 822...... or the like in the sub-district 820, comprise node 831, node 832...... or the like in the sub-district 830, comprise node 841, node 842...... or the like in the sub-district 840, comprise node 851, node 852...... or the like in the sub-district 850, comprise node 861, node 862...... or the like in the sub-district 860.The quantity of the quantity of node and sub-district all is for instance among this figure, as long as in fact system has more than a sub-district, the node number in each sub-district without limits.
Wherein, the scope of each sub-district all is less than the visual range of node in the system.
Node is used to preserve all interior cell informations of self concern scope; When game events takes place, if the sub-district that node participates in calculating is related to by the events affecting scope, node need participate in the calculating of this incident, calculate the result of events affecting sub-district, and result of calculation sent to the node that receives this cell update information, also i.e. new node more, more new node is connected to the node that incident is calculated, and receives this result of calculation about the sub-district.
The description basically identical of the management method embodiment of working method that whole system is concrete and the distributed virtual environment that above embodiment of the invention provided no longer is repeated in this description at this.
The internal structure of the embodiment of the node that the embodiment of the invention provides comprises as shown in Figure 9: operation control unit 901, local operation command unit 902, operational order group 903, map form group 904, player status structural group 905, check code unit 906, interface display unit 907, communication unit 908, computing unit 909 and memory cell 910.
Memory cell 910 is used for memory node and pays close attention to the interior cell information of scope, and wherein the sub-district is the zone that the serviced device of distributed virtual environment marks off, and its area is littler than node visual range;
Computing unit 909 is used in sub-district that node participate in to calculate by events affecting then calculating the result of events affecting sub-district, and updated stored unit 910;
Communication unit 908 be used for result of calculation with computing unit 910 send to described events affecting to the node that obtains renewal of sub-district.
Operation control unit 901 is used to receive the keyboard and mouse instruction of user terminal input.
Local operation unit 902 is used for user instruction is encoded, and adds a cover timestamp.
Interface display unit 907 is used for the plot that operational order group 903, map form group 904, player status structural group 905 will present is combined, and shows at display terminal.
Check code unit 906 is used for, the information of the need verification that other nodes that verification communication unit 908 receives send; This moment, communication unit also was used for, to the node feedback check result who sends check information.
Computing unit 909 participates in the calculating of the event information of all nodes calculating, result of calculation is carried out the front end demonstration as required or pass through communication unit 908 other node transmission in network.In our system, computing unit 909 will be responsible for the encapsulation to data of event and state when issue, for each data that send to communication unit 908 adds destination address and timestamp.
Communication unit 908 is responsible for the data qualification and the transmission of transmission bearer in the all-network, and event data sends to computing unit 909, and status data sends to interface display unit 907.
Node all is in the position of equality in the whole game system.User input instruction, system is an event information with instruction transformation, handles being converted into state information by the core calculations process, carries out interface display.Event information and state information send other nodes synchronously by communication unit 908 in addition.The description basically identical of the management method embodiment of working method that the embodiment of the node that the embodiment of the invention provides is concrete and the distributed virtual environment that above embodiment of the invention provided no longer is repeated in this description at this.
More than to the management method of a kind of distributed virtual environment that the embodiment of the invention provided, and a kind of system of distributed virtual environment is described in detail, used specific case herein the principle and the execution mode of the embodiment of the invention are set forth, the explanation of above embodiment just is used to help to understand the method and the core concept thereof of the embodiment of the invention; Simultaneously, for one of ordinary skill in the art, according to the thought of the embodiment of the invention, the part that all can change in specific embodiments and applications, in sum, this description should not be construed as the restriction to the embodiment of the invention.