Background technology
Mobile as one of the action the most frequently in game, be experience most crucial in game naturally.In gaming, each scenario objects planning its mobile route that needs is regarded as a mobile agent, wherein, moving direction and the translational speed of mobile agent are mainly planned in mobile planning, by regular planning, change moving direction and the speed of mobile agent, the intelligent response of each mobile agent to Environment Obstacles can be simulated.Wherein, in game, Environment Obstacles is divided into two kinds, and a kind of static-obstacle being topography variation and bringing, remains unchanged for a long time in whole game process; Another kind is the obstacle that space that scenario objects is occupied is brought, and scenario objects is generally mobile, and therefore, this kind of obstacle is also commonly called dynamic disorder.
The static-obstacle such as the height change of landform are only considered in general online game, and (climbing capacity, refers to that role can not violate general knowledge, directly climbs up from a very low position the very high position closed on to use climbing capacity; In some cases, role directly falls from a very high position to one that closes on very low position, is not also designed allowed; Both of these case is all considered to encounter obstacle in movement, and namely so mobile trial is invalid.) come abstract and describe terrain obstruction, then generally do not consider for dynamic disorder, the phenomenon that consequently between scenario objects, position is interted mutually is serious, runs counter to the direct feel that player sets up in real world.Although consider that dynamic disorder can bring more real Consumer's Experience in mobile planning, required amount of calculation is larger.
Dynamic disorder is considered in mobile planning, way is that all calculating is by a node control (normally service end) the most intuitively, input the current location information of all mobile agents, anticipated movement impact point, goal pace, current translational speed and current moving direction in node to plan, planning once, then determines the translational speed that all mobile agents are new and moving direction.Regularly plan, each mobile agent uses new translational speed and moving direction to upgrade its position, to avoid the collision with obstacle, and position convergence moving target position gradually.But because planning needs regularly to perform, frequency is very high, and concentrated calculation operations amount of carrying out is excessive, have a strong impact on operation efficiency, and cost consumption is higher.
Summary of the invention
For solving the problem, the object of the present invention is to provide a kind of distributed collisionless to move the method for planning, in conjunction with static-obstacle and dynamic disorder, promoting Consumer's Experience.
The present invention solves the technical scheme that its problem adopts:
Distributed collisionless moves a method for planning, and be included in when moving planning to each mobile agent, the node corresponding by this mobile agent moves planning to this mobile agent, specifically comprises:
Node calculates the anticipated movement direction of this mobile agent according to anticipated movement destination, anticipated movement speed and static-obstacle, wherein, anticipated movement destination obtains from the input of user, and anticipated movement speed is the base attribute of this mobile agent, and static-obstacle is the terrain properties in the middle of game;
Moving disorder is searched in anticipated movement direction according to this mobile agent in the prescribed limit in this anticipated movement direction, moving disorder described herein comprise static terrain obstruction and because of the existence of other mobile agents to the dynamic disorder that current mobile agent causes;
According to anticipated movement direction and the speed of mobile agent, under the constraint of the moving disorder found, calculate the new moving direction of mobile agent and speed;
Moving direction new for this mobile agent calculated and speed sync are sent to node corresponding to other mobile agents, node corresponding to other mobile agents is after receiving the new moving direction of this mobile agent and speed, new mobile planning is carried out to mobile agent corresponding under this node, and the position of corresponding mobile agent under upgrading this node.
Preferably, mobile agent corresponding under described each node all stores the moving disorder information of other mobile agents be associated with this mobile agent, described moving disorder information comprises moving direction and the speed of other mobile agents, described the new moving direction of this mobile agent calculated and speed sync are sent to node corresponding to other mobile agents, node corresponding to other mobile agents is after receiving the new moving direction of this mobile agent and speed, the moving disorder information of corresponding mobile agent under this node of node updates that other mobile agents are corresponding, according to the moving disorder information after renewal, new mobile planning is carried out to mobile agent corresponding under this node simultaneously, and the position of corresponding mobile agent under upgrading this node.
Preferably, described node is participate in each node in the system architecture of whole game interaction, comprises the service end in CS structure and client, or each Peer in P2P structure.
Preferably, described each mobile agent stores its current location with lattice structure, when moving disorder is searched in the described anticipated movement direction according to this mobile agent in the prescribed limit in this anticipated movement direction, determine whether other mobile agents are moving disorder by the prescribed limit of current location whether on this moving direction detecting other mobile agents on this anticipated movement direction fast.
Preferably, the region of described landform is sketched the contours with polygon, and when searching moving disorder according to the anticipated movement direction of this mobile agent in the prescribed limit in this anticipated movement direction, the border outside this polygon shaped area, mobile agent place is then terrain obstruction.
Preferably, described the new moving direction of this mobile agent calculated and speed sync are sent to node corresponding to other mobile agents while, by the status information synchronized transmission of this mobile agent to node corresponding to other mobile agents, described status information at least comprises the positional information of this mobile agent.
Preferably, the described anticipated movement direction according to mobile agent and speed, when calculating the new moving direction of mobile agent and speed under the constraint of the moving disorder found, adjust according to the translational speed of terrain properties to this mobile agent is adaptive.
Preferably, the described anticipated movement direction according to mobile agent and speed, when calculating the new moving direction of mobile agent and speed under the constraint of the moving disorder found, the new moving direction calculated required by the computing capability of the node corresponding to this mobile agent and this mobile agent and the levels of precision of speed, the calculated rate of node and the seek scope of moving disorder corresponding to this mobile agent of dynamic conditioning.
The invention has the beneficial effects as follows:
The present invention adopts a kind of distributed collisionless to move the method for planning, is planned, calculation task is distributed in different nodes by each node to corresponding mobile agent, promotes the efficiency calculated; When mobile agent is planned, both considered that static-obstacle also considered dynamic disorder, improve the game experiencing of player; In the process that mobile agent is planned, can the frequency of Adjustable calculation and the seek scope of moving disorder dynamically, equilibrium assignmen resource.
Detailed description of the invention
With reference to shown in Fig. 1, a kind of distributed collisionless of the present invention moves the method for planning, and be included in when moving planning to each mobile agent, the node corresponding by this mobile agent moves planning to this mobile agent, specifically comprises:
Node calculates the anticipated movement direction of this mobile agent according to anticipated movement destination, anticipated movement speed and static-obstacle, wherein, anticipated movement destination obtains from the input of user, and anticipated movement speed is the base attribute of this mobile agent, and static-obstacle is the terrain properties in the middle of game;
Moving disorder is searched in anticipated movement direction according to this mobile agent in the prescribed limit in this anticipated movement direction, moving disorder described herein comprise static terrain obstruction and because of the existence of other mobile agents to the dynamic disorder that current mobile agent causes;
According to anticipated movement direction and the speed of mobile agent, under the constraint of the moving disorder found, calculate the new moving direction of mobile agent and speed;
Moving direction new for this mobile agent calculated and speed sync are sent to node corresponding to other mobile agents, node corresponding to other mobile agents is after receiving the new moving direction of this mobile agent and speed, new mobile planning is carried out to mobile agent corresponding under this node, and the position of corresponding mobile agent under upgrading this node.
Mobile agent corresponding under described each node all stores the moving disorder information of other mobile agents be associated with this mobile agent, described moving disorder information comprises moving direction and the speed of other mobile agents, described the new moving direction of this mobile agent calculated and speed sync are sent to node corresponding to other mobile agents, node corresponding to other mobile agents is after receiving the new moving direction of this mobile agent and speed, the moving disorder information of corresponding mobile agent under this node of node updates that other mobile agents are corresponding, according to the moving disorder information after renewal, new mobile planning is carried out to mobile agent corresponding under this node simultaneously, and the position of corresponding mobile agent under upgrading this node.
The above method of the present invention when searching moving disorder according to the anticipated movement direction of this mobile agent in the prescribed limit in this anticipated movement direction, both static-obstacle was considered, also dynamic disorder is considered, and adopt distributed computation schema, the computing capability of each node in abundant excavation gaming network, make each node only consume little amount of calculation, namely can be player and bring more real mobile experience.
Above method adopts the strategy of distributed planning moving direction and translational speed, in scene, the moving direction of each mobile agent and translational speed need planning, but be different from the program results that centralized planning determines all mobile agents, distributed planning plans the movement of or a few mobile agent at every turn, by by the mobile programming dispatching of each mobile agent to different nodes, calculating pressure service end born is shared to get off, thus promotes computational efficiency.
Owing to being distributed planning, each node can specify the mobile agent corresponding to it voluntarily, make the complaint message that each mobile agent obtains according to correspondence, independently make corresponding mobile decision-making, be equivalent to the computing capability utilizing numerous node, the computing capability of service end is freed, the present invention is made to have applicability widely, both CS structure had been applicable to, also P2P structure is applicable to, just because of this, node of the present invention comprises each node in the system architecture participating in whole game interaction, comprise the service end in CS structure and client, or each Peer in P2P structure.
Significantly, distributed mobile planning of the present invention is with each mobile agent for research object, each self planning.When planning translational speed and the direction of certain mobile agent, other mobile agents just cause obstacle because occupying position in scene to the movement of current mobile agent, and this also belongs to the dynamic disorder in the present invention.
Conveniently search moving disorder, the mobile agent that all participation obstacles calculate, with its current location of certain structural maintenance, so that when planning moving direction and the speed of certain mobile agent, facilitates inquiry can affect the mobile agent of its program results.In order to save amount of calculation, when mobile planning is done to each mobile agent, only need inquire about the distribution situation of the moving disorder in around certain limit.Each mobile agent of the present invention stores its current location with lattice structure, when moving disorder is searched in the described anticipated movement direction according to this mobile agent in the prescribed limit in this anticipated movement direction, determine whether other mobile agents are moving disorder by the prescribed limit of current location whether on this moving direction detecting other mobile agents on this anticipated movement direction fast.
General static-obstacle (or terrain obstruction) adopts trellis diagram to represent, uses the difference in height of adjacent grid can judge the connectedness of a position to adjacent position.But for the present invention, conveniently search static-obstacle, the region of described landform is sketched the contours with polygon by the present invention, when searching moving disorder according to the anticipated movement direction of this mobile agent in the prescribed limit in this anticipated movement direction, border outside this polygon shaped area, mobile agent place is then terrain obstruction, facilitates searching of terrain obstruction.
Each mobile agent planning terminates, and after changing moving direction, speed and state, all needs the synchronizing information of necessity to other mobile agents.Each mobile agent may be the dynamic disorder that other mobile agents plan when moving, and gives other mobile agents these synchronizing information, submits necessary information during the mobile planning that can be Myself for other mobile agents.Therefore, in above method, described the new moving direction of this mobile agent calculated and speed sync are sent to node corresponding to other mobile agents while, by the status information synchronized transmission of this mobile agent to node corresponding to other mobile agents, described status information at least comprises the positional information of this mobile agent.Described status information is the attribute information of corresponding mobile agent, such as in some cases, wishes the complaint message not calculating some moving disorder.Although this can not occur in real world, in gaming world, design there are such needs.
The present invention, when planning current mobile agent speed, can make the adjustment of adaptive speed according to features of terrain.Generally, speed adjustment occurs in the moment (if speed did not also slow down and will collide this time) that can collide with dynamic disorder or static-obstacle in expection very short time, but geological property situation also can affect program results, such as through a slice marsh than slow through speed from road.Therefore, the present invention is in the described anticipated movement direction according to mobile agent and speed, when calculating the new moving direction of mobile agent and speed under the constraint of the moving disorder found, adjust according to the translational speed of terrain properties to this mobile agent is adaptive.
In order to make the computing capability of node keep in balance, the present invention according to the computing capability of present node and effect needs (referring to the order of accuarcy of program results translational speed and moving direction), the frequency of dynamic conditioning node calculate and the query context of dynamic disorder.Although plan more frequent, query context is wider, effect is better, and required amount of calculation is also larger, therefore, balances and accept or reject just very important according to resource and demand.Distributed planning of the present invention can do real-time adjustment according to present case, in the described anticipated movement direction according to mobile agent and speed, when calculating the new moving direction of mobile agent and speed under the constraint of the moving disorder found, the new moving direction that can calculate required by the computing capability of node corresponding to this mobile agent and this mobile agent and the levels of precision of speed, the calculated rate of node and the seek scope of moving disorder corresponding to this mobile agent of dynamic conditioning.
It should be noted that, the present invention, can the comprehensively velocity attitude of other mobile agents and terrain obstruction information when planning the speed of current mobile agent and direction, draws an optimum program results.The destination of mobile planning arrives impact point as soon as possible according to the speed of expection, therefore, the moving direction of expecting is an important reference mark, on this basis, program results can be subject to the impact of static-obstacle and dynamic disorder, the object of the invention is under the constraints that these are numerous, find an optimal solution.
The method of the invention had both considered static-obstacle and have also contemplated that dynamic disorder, to the more real game experiencing of player; Mobile planning adopts distributed planing method, convenient parallel, wide adaptability, and autgmentability is strong; The present invention can also do the effect demand of mobile planning according to the computing capability condition of each node and each mobile agent, the query context of the frequency that dynamic conditioning calculates and dynamic disorder, improves computational efficiency.
The above, just preferred embodiment of the present invention, the present invention is not limited to above-mentioned embodiment, as long as it reaches technique effect of the present invention with identical means, all should belong to protection scope of the present invention.