CN109568959A - A kind of method for supporting a large amount of units pathfinding simultaneously in game - Google Patents

A kind of method for supporting a large amount of units pathfinding simultaneously in game Download PDF

Info

Publication number
CN109568959A
CN109568959A CN201910028931.5A CN201910028931A CN109568959A CN 109568959 A CN109568959 A CN 109568959A CN 201910028931 A CN201910028931 A CN 201910028931A CN 109568959 A CN109568959 A CN 109568959A
Authority
CN
China
Prior art keywords
pathfinding
grid
map
region
large amount
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910028931.5A
Other languages
Chinese (zh)
Inventor
孙伟乐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Individual
Original Assignee
Individual
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Individual filed Critical Individual
Priority to CN201910028931.5A priority Critical patent/CN109568959A/en
Publication of CN109568959A publication Critical patent/CN109568959A/en
Pending legal-status Critical Current

Links

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/55Controlling game characters or game objects based on the game progress
    • A63F13/56Computing the motion of game characters with respect to other game characters, game objects or elements of the game scene, e.g. for simulating the behaviour of a group of virtual soldiers or for path finding

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The present invention relates to map pathfindings, more particularly to a kind of method for supporting a large amount of units pathfinding simultaneously in game, map loading module obtains area information from map datum, and according to the node diagram t between area information formation zone and region, the target point S and pathfinding unit that the crawl of management map module needs to reach, management map module grabs target point S region P from node diagram t, and therefrom grab the grid a where target point S, look for whether that there are the reusable pathfinding area maps that grid is grid a in pathfinding management module, if it exists, then jump to step S9, if it does not exist, then continue in next step, eight grid { fn } around grid a are directed to grid a, and by grid a, { fn } is accordingly to be regarded as F state;Technical solution provided by the invention can effectively overcome the defect that the pathfinding simultaneously of a large amount of units cannot be supported present in the prior art.

Description

A kind of method for supporting a large amount of units pathfinding simultaneously in game
Technical field
The present invention relates to map pathfindings, and in particular to a method of support a large amount of unit pathfindings simultaneously in game.
Background technique
Game pathfinding at present is leading and relevant optimization algorithm with A* algorithm, mainly has fidelity high, a small amount of Fireballing advantage under data.Its disadvantage is exactly that can occupy a large amount of runing times in a large amount of units (hundred or more) pathfinding simultaneously, Such as 500ms, this often means that entire program meeting therefore Caton 0.5s, this can not put up in gaming, even if there is phase The improvement for closing algorithm, can not also overcome this defect.
Therefore game (referring mainly to rts) at present on the market, big multidirectional strategy and tactics direction are developed, and have the spy that soldier is few Point, and cause exactly support the pathfinding simultaneously of a large amount of units the main reason for soldier is few simultaneously.
Summary of the invention
(1) the technical issues of solving
For disadvantages mentioned above present in the prior art, the present invention provides units a large amount of in a kind of support game to seek simultaneously The method on road can effectively overcome the defect that the pathfinding simultaneously of a large amount of units cannot be supported present in the prior art.
(2) technical solution
In order to achieve the above object, the present invention is achieved by the following technical programs:
A kind of method for supporting a large amount of units pathfinding simultaneously in game, comprising the following steps:
S1, map loading module obtain area information from map datum, and according to area information formation zone and region Between node diagram t;
The target point S and pathfinding unit that S2, the crawl of management map module need to reach;
S3, management map module grab target point S region P from node diagram t, and therefrom where crawl target point S Grid a;
S4, look for whether that there are the reusable pathfinding area maps that grid is grid a in pathfinding management module, if depositing Step S9 is then being jumped to, if it does not exist, is then being continued in next step;
Eight grid { f around S5, grid anIt is directed to grid a, and by grid a, { fnIt is accordingly to be regarded as F state;
S6, take be not at F state and with { fnConnected grid { f 'n, successively by grid { f 'nBe directed toward its it is corresponding in Heart grid { fn, if grid { f 'nIn have and occupied by barrier, then be considered as F state;
S7, by the { f ' in S6nIt is considered as { fn, and S6 is repeated, until { f 'nIt is sky;
S8, the grid bearing data generated in S4, S5, S6 is generated into pathfinding area map U;
S9, management map module grab pathfinding unit region { Pn, region { P is obtained from node diagram tnAnd region P Can pass through node { tn};
S10, pathfinding management module are generated using the area information obtained about region { Pn, node { tnPathfinding region Map { Un, pathfinding management module is according to pathfinding area map U, pathfinding area map { UnGenerate pathfinding map R;
S11, pathfinding map R is submitted to pathfinding unit, pathfinding unit can be using the direction of grid where oneself as action Direction, pathfinding work are completed.
Preferably, the node diagram t is incited somebody to action by map loading module using connected component between region and region as cut-off rule There is the region of common connected component to be connect with interregional with straight line.
It preferably, is n*m square by map partitioning when the map loading module obtains area information from map datum Shape grid matrix.
Preferably, eight grid around the grid a are indicated in calculating with vector.
Preferably, the grid a is being in T-shaped state before F state.
Preferably, the F state is the state that the grid on map is occupied by barrier, and the T-shaped state is on map The state that grid is not occupied by barrier.
Preferably, the grid { f 'nIt is directed toward its corresponding center grid { fnRealized by the way of addition of vectors.
Preferably, the pathfinding area map U, pathfinding area map { UnIt is stored in pathfinding management module, convenient for next time Multiplexing.
(3) beneficial effect
Compared with prior art, a kind of method for supporting a large amount of units pathfinding simultaneously in game provided by the present invention has Below the utility model has the advantages that
(1) speed is fast, and similar pathfinding algorithm is often takeed a long time when landform is complex in;
(2) reusability, similar pathfinding algorithm cannot be largely multiplexed in utilization, because starting point, target point are not therewith It is preceding consistent;
(3) time stability, no matter pathfinding Board Lot, entire pathfinding process controls within 10ms substantially, similar to seek Once algorithm Board Lot raising in utilization in road will lead to operation time and skyrocket;
(4) fidelity is high, will not seek out it is certain do not conform to convention as a result, similar pathfinding algorithm in some cases may Largely detour.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described.It should be evident that the accompanying drawings in the following description is only this Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with It obtains other drawings based on these drawings.
Fig. 1 is flow diagram of the present invention;
Fig. 2 is schematic diagram of the embodiment of the present invention;
Fig. 3 is the node diagram t of Fig. 2 of the present invention;
Fig. 4 is the extraction figure of a-quadrant in Fig. 2 of the present invention;
Fig. 5 is the grid chart of Fig. 4 of the present invention;
Fig. 6 is grid { f around grid a in the case of no barriern, grid { f 'nSchematic diagram;
Fig. 7 is to have in the case of barrier grid { f around grid an, grid { f 'nSchematic diagram.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention In attached drawing, technical scheme in the embodiment of the invention is clearly and completely described.Obviously, described embodiment is A part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art Every other embodiment obtained without creative efforts, shall fall within the protection scope of the present invention.
A kind of method for supporting a large amount of units pathfinding simultaneously in game, as shown in Figure 1, comprising the following steps:
S1, map loading module obtain area information from map datum, and according to area information formation zone and region Between node diagram t;
The target point S and pathfinding unit that S2, the crawl of management map module need to reach;
S3, management map module grab target point S region P from node diagram t, and therefrom where crawl target point S Grid a;
S4, look for whether that there are the reusable pathfinding area maps that grid is grid a in pathfinding management module, if depositing Step S9 is then being jumped to, if it does not exist, is then being continued in next step;
Eight grid { f around S5, grid anIt is directed to grid a, and by grid a, { fnIt is accordingly to be regarded as F state;
S6, take be not at F state and with { fnConnected grid { f 'n, successively by grid { f 'nBe directed toward its it is corresponding in Heart grid { fn, if grid { f 'nIn have and occupied by barrier, then be considered as F state;
S7, by the { f ' in S6nIt is considered as { fn, and S6 is repeated, until { f 'nIt is sky;
S8, the grid bearing data generated in S4, S5, S6 is generated into pathfinding area map U;
S9, management map module grab pathfinding unit region { Pn, region { P is obtained from node diagram tnAnd region P Can pass through node { tn};
S10, pathfinding management module are generated using the area information obtained about region { Pn, node { tnPathfinding region Map { Un, pathfinding management module is according to pathfinding area map U, pathfinding area map { UnGenerate pathfinding map R;
S11, pathfinding map R is submitted to pathfinding unit, pathfinding unit can be using the direction of grid where oneself as action Direction, pathfinding work are completed.
Node diagram t, using connected component between region and region as cut-off rule, will there is common connection by map loading module Partial region is connect with interregional with straight line.
It is n*m square lattice matrix by map partitioning when map loading module obtains area information from map datum.
Eight grid around grid a are indicated in calculating with vector.
Grid a is being in T-shaped state before F state.
F state is the state that the grid on map is occupied by barrier, and T-shaped state is the grid on map not by barrier The state occupied.
Grid { f 'nIt is directed toward its corresponding center grid { fnRealized by the way of addition of vectors.
Pathfinding area map U, pathfinding area map { UnIt is stored in pathfinding management module, convenient for multiplexing next time.
As shown in Figures 2 and 3, the shade in map is barrier, using connected component between region and region as segmentation Line will have the region of common connected component to be connect to obtain node diagram t with straight line with interregional.
Herein, by taking the A of region as an example, region A is taken out, the barrier completion of irregular edge, and is drawn as grid chart, such as Shown in Fig. 4, region A is divided into n*m square lattice matrix, as shown in Figure 5.
Eight grid { f in Fig. 6, around grid anIt is directed to grid a, in eight grid { fnOuter ring mark " A " lattice Son is { f 'n, grid { f 'nIt is directed toward its corresponding center grid { fn}.If grid { f 'nIn have and occupied by barrier, then It is considered as F state, as shown in Figure 7.
A kind of method for supporting a large amount of units pathfinding simultaneously in game provided by the present invention has the advantages that
(1) speed is fast, and similar pathfinding algorithm is often takeed a long time when landform is complex in;
(2) reusability, similar pathfinding algorithm cannot be largely multiplexed in utilization, because starting point, target point are not therewith It is preceding consistent;
(3) time stability, no matter pathfinding Board Lot, entire pathfinding process controls within 10ms substantially, similar to seek Once algorithm Board Lot raising in utilization in road will lead to operation time and skyrocket;
(4) fidelity is high, will not seek out it is certain do not conform to convention as a result, similar pathfinding algorithm in some cases may Largely detour.
The above embodiments are merely illustrative of the technical solutions of the present invention, rather than its limitations;Although with reference to the foregoing embodiments Invention is explained in detail, those skilled in the art should understand that: it still can be to aforementioned each implementation Technical solution documented by example is modified or equivalent replacement of some of the technical features;And these modification or Replacement, can't be such that the essence of corresponding technical solution departs from the spirit and scope of the technical scheme of various embodiments of the present invention.

Claims (8)

1. a kind of method for supporting a large amount of units pathfinding simultaneously in game, it is characterised in that: the following steps are included:
S1, map loading module obtain area information from map datum, and according between area information formation zone and region Node diagram t;
The target point S and pathfinding unit that S2, the crawl of management map module need to reach;
S3, management map module grab target point S region P from node diagram t, and therefrom grab the lattice where target point S Sub- a;
S4, look for whether that there are the reusable pathfinding area maps that grid is grid a in pathfinding management module, and if it exists, then Step S9 is jumped to, if it does not exist, is then continued in next step;
Eight grid { f around S5, grid anIt is directed to grid a, and by grid a, { fnIt is accordingly to be regarded as F state;
S6, take be not at F state and with { fnConnected grid { f 'n, successively by grid { f 'nIt is directed toward its corresponding central square Son { fn, if grid { f 'nIn have and occupied by barrier, then be considered as F state;
S7, by the { f ' in S6nIt is considered as { fn, and S6 is repeated, until { f 'nIt is sky;
S8, the grid bearing data generated in S4, S5, S6 is generated into pathfinding area map U;
S9, management map module grab pathfinding unit region { Pn, region { P is obtained from node diagram tnWith region P can Pass through node { tn};
S10, pathfinding management module are generated using the area information obtained about region { Pn, node { tnPathfinding area map {Un, pathfinding management module is according to pathfinding area map U, pathfinding area map { UnGenerate pathfinding map R;
S11, pathfinding map R submits to pathfinding unit, pathfinding unit can using the direction of grid where oneself as route, Pathfinding work is completed.
2. the method according to claim 1 for supporting a large amount of unit pathfindings simultaneously in game, it is characterised in that: the node Scheme t by map loading module using connected component between region and region as cut-off rule, by the region for having common connected component and It is interregional to be connected with straight line.
3. the method according to claim 1 for supporting a large amount of unit pathfindings simultaneously in game, it is characterised in that: the map It is n*m square lattice matrix by map partitioning when loading module obtains area information from map datum.
4. the method according to claim 1 for supporting a large amount of unit pathfindings simultaneously in game, it is characterised in that: the grid Eight grid around a are indicated in calculating with vector.
5. the method according to claim 1 for supporting a large amount of unit pathfindings simultaneously in game, it is characterised in that: the grid A is being in T-shaped state before F state.
6. the method according to claim 5 for supporting a large amount of unit pathfindings simultaneously in game, it is characterised in that: the F shape State is the state that the grid on map is occupied by barrier, and the T-shaped state is what the grid on map was not occupied by barrier State.
7. the method according to claim 1 for supporting a large amount of unit pathfindings simultaneously in game, it is characterised in that: the grid {f’nIt is directed toward its corresponding center grid { fnRealized by the way of addition of vectors.
8. the method according to claim 1 for supporting a large amount of unit pathfindings simultaneously in game, it is characterised in that: the pathfinding Area map U, pathfinding area map { UnIt is stored in pathfinding management module, convenient for multiplexing next time.
CN201910028931.5A 2019-01-12 2019-01-12 A kind of method for supporting a large amount of units pathfinding simultaneously in game Pending CN109568959A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910028931.5A CN109568959A (en) 2019-01-12 2019-01-12 A kind of method for supporting a large amount of units pathfinding simultaneously in game

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910028931.5A CN109568959A (en) 2019-01-12 2019-01-12 A kind of method for supporting a large amount of units pathfinding simultaneously in game

Publications (1)

Publication Number Publication Date
CN109568959A true CN109568959A (en) 2019-04-05

Family

ID=65915016

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910028931.5A Pending CN109568959A (en) 2019-01-12 2019-01-12 A kind of method for supporting a large amount of units pathfinding simultaneously in game

Country Status (1)

Country Link
CN (1) CN109568959A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110812844A (en) * 2019-11-06 2020-02-21 网易(杭州)网络有限公司 Path finding method in game, terminal and readable storage medium
CN110935175A (en) * 2019-12-06 2020-03-31 珠海豹趣科技有限公司 Data processing method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101241507A (en) * 2008-01-17 2008-08-13 腾讯科技(深圳)有限公司 Map road-seeking method and system
KR20130082743A (en) * 2011-12-15 2013-07-22 한국전자통신연구원 Method and apparatus for finding path on on-line game
CN107744663A (en) * 2017-10-19 2018-03-02 广州爱九游信息技术有限公司 The method for searching and device of artificial intelligence AI units

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101241507A (en) * 2008-01-17 2008-08-13 腾讯科技(深圳)有限公司 Map road-seeking method and system
KR20130082743A (en) * 2011-12-15 2013-07-22 한국전자통신연구원 Method and apparatus for finding path on on-line game
CN107744663A (en) * 2017-10-19 2018-03-02 广州爱九游信息技术有限公司 The method for searching and device of artificial intelligence AI units

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
SIDNEY DURANT: "Understanding Goal-Based Vector Field Pathfinding", 《HTTPS://GAMEDEVELOPMENT.TUTSPLUS.COM/TUTORIALS/UNDERSTANDING-GOAL-BASED-VECTOR-FIELD-PATHFINDING--GAMEDEV-9007》 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110812844A (en) * 2019-11-06 2020-02-21 网易(杭州)网络有限公司 Path finding method in game, terminal and readable storage medium
CN110812844B (en) * 2019-11-06 2023-04-07 网易(杭州)网络有限公司 Path finding method in game, terminal and readable storage medium
CN110935175A (en) * 2019-12-06 2020-03-31 珠海豹趣科技有限公司 Data processing method and device

Similar Documents

Publication Publication Date Title
CN104376053B (en) A kind of storage and retrieval method based on magnanimity meteorological data
CN106155454A (en) A kind of interface display method, device and electronic equipment
CN106582023B (en) Game way finding method and device
CN109568959A (en) A kind of method for supporting a large amount of units pathfinding simultaneously in game
CN104239431B (en) Three-dimension GIS model display methods and device
CN108134690B (en) Network service deployment process control method, device and system
CN106416152B (en) A kind of lookup device searches configuration method and lookup method
CN106528622B (en) It is a kind of to vacuate method towards S57 chart data
CN107632937A (en) A kind of method, apparatus tested cluster virtual machine, readable storage medium storing program for executing
CN109190326A (en) Generate the method and device of process flow chart
CN105786525B (en) A kind of process model transplants the method and device of code to threading model
CN108090155A (en) A kind of 2D grids method for searching, device and storage medium
CN108205565A (en) Electronic map element vacuates method, apparatus and terminal
CN107181747B (en) handle analytic system containing top-level node
CN110457212B (en) Test modeling and test case automatic generation method based on complex system
CN110662272A (en) Minimum-number pilot selection method based on swarm unmanned aerial vehicle
CN106650137A (en) Method for accelerating standard cell rationalization in incremental placement
CN102497410A (en) Method for dynamically partitioning computing resources of cloud computing system
CN109855622A (en) Method for searching path and equipment for mobile robot
CN110490798A (en) Point cloud method and system
CN114791985A (en) Domain name matching method and device and prefix tree updating method and device
CN106034266A (en) Optical route generation method and apparatus
CN111325366A (en) Method and device for searching map breakpoint of automatic guided vehicle
US20110170536A1 (en) Network path finding apparatus, method, and program
CN111309438B (en) Method and device for deploying virtualized system based on specific storage equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20190405