CN104751001A - Shortest path searching method for game - Google Patents

Shortest path searching method for game Download PDF

Info

Publication number
CN104751001A
CN104751001A CN201510171002.1A CN201510171002A CN104751001A CN 104751001 A CN104751001 A CN 104751001A CN 201510171002 A CN201510171002 A CN 201510171002A CN 104751001 A CN104751001 A CN 104751001A
Authority
CN
China
Prior art keywords
point
direct path
path
pathfinding
game
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
CN201510171002.1A
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.)
Sichuan You Jia Network Technology In Sky Co Ltd
Original Assignee
Sichuan You Jia Network Technology In Sky Co Ltd
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 Sichuan You Jia Network Technology In Sky Co Ltd filed Critical Sichuan You Jia Network Technology In Sky Co Ltd
Priority to CN201510171002.1A priority Critical patent/CN104751001A/en
Publication of CN104751001A publication Critical patent/CN104751001A/en
Pending legal-status Critical Current

Links

Abstract

The invention discloses a shortest path searching method for a game. The shortest path searching method for the game includes that receiving a path finding command, and judging whether there are two skipping points with skipping relationship between an initial point and a target point in a current map according to the path finding command; if so, searching a first direct path in the current map from the initial point to the first skipping point closest to the initial point, and meanwhile, searching a second direct path from the target point to the second skipping point closest to the target point; using the first direct path and second direct path as the shortest path finding path; otherwise, searching the first direct path from the initial point to the target point in the current map, and searching the second direct path from the target point to the initial point; when the first direct path and second direct path have an overlapped path finding point, stopping searching; connecting the first direct path with the second direct path to serve as the shortest path finding path. The shortest path searching method for the game is capable of reducing the path finding time.

Description

Method for searching shortest route in game
Technical field
The present invention relates to technical field of network information, particularly relate to the method for searching shortest route in a kind of game.
Background technology
When game user is played games, need direct game role to perform various action, comprise movement, fight etc.And movement is the elemental motion of game.In order to make game user spended time and energy go to find the target in game, automatic pathfinding is arisen at the historic moment, the target location that automatic pathfinding can make game role be automatically moved to game user to specify.
Traditional automatic seeking path method is all map is divided into latticed pathfinding point, after game user selected target point, searches for the shortest reachable path from starting point to impact point.This mode can find shortest path very soon when impact point is shorter apart from starting point, but when impact point distance starting point is larger, then require a great deal of time removal search, thus add the search time of pathfinding.
Summary of the invention
The technical matters that the present invention mainly solves is to provide the method for searching shortest route in a kind of game, can reduce the search time of pathfinding.
For solving the problems of the technologies described above, the technical scheme that the present invention adopts is: provide the method for searching shortest route in a kind of game, described method for searching shortest route comprises: S1, and receive pathfinding instruction, described pathfinding instruction comprises starting point and impact point; S2, in current map, determine between described starting point and described impact point, whether to there is the jump-point that two have redirect relation each other according to described pathfinding instruction, described current map is divided into the pathfinding point of gridding, and described starting point, described impact point and described jump-point belong to described pathfinding point; S3, if there are described two jump-point, in described current map, search for the first direct path from described starting point to the first jump-point nearest with described starting point, search for the second direct path from described impact point to the second jump-point nearest with described impact point simultaneously; S4, using described first direct path and described second direct path as the shortest pathfinding path; S5, if there is no described two jump-point, search for the first direct path from described starting point to described impact point in current map, search for the second direct path from described impact point to described starting point simultaneously; S6, stops search when the pathfinding point overlapped appears in described first direct path and described second direct path; S7, is connected described first direct path as the shortest pathfinding path with described second direct path.
Preferably, before described step S1, described method for searching shortest route also comprises: when game user generates pathfinding instruction during selected described impact point on described current map, and described starting point is the current residing pathfinding point of game role that described game user is handled.
The invention has the beneficial effects as follows: the situation being different from prior art, method for searching shortest route in game of the present invention is after determining that between starting point and impact point, existence two has the jump-point of redirect relation each other, search for direct path to nearest jump-point from starting point and impact point simultaneously, after there is not above-mentioned jump-point, search for direct path to the other side from starting point and impact point simultaneously, search data amount significantly reduces, thus can reduce the search time of pathfinding.
Accompanying drawing explanation
Fig. 1 is the schematic diagram of the method for searching shortest route embodiment during the present invention plays.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, be clearly and completely described the technical scheme in the embodiment of the present invention, obviously, described embodiment is only a part of embodiment of the present invention, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
See Fig. 1, it is the schematic diagram of the method for searching shortest route embodiment during the present invention plays.The method for searching shortest route of the embodiment of the present invention comprises the following steps:
S1: receive pathfinding instruction, pathfinding instruction comprises starting point and impact point.
Wherein, pathfinding instruction is triggered by game user.Specifically, in the present embodiment, before step S1, method for searching shortest route also comprises: when game user generates pathfinding instruction during selected target point on current map, and starting point is the current residing pathfinding point of game role that game user is handled.
S2: determine whether there is the jump-point that two have redirect relation each other between starting point and impact point according to pathfinding instruction in current map, current map is divided into the pathfinding point of gridding, and starting point, impact point and jump-point belong to pathfinding point.
Wherein, map partitioning is the pathfinding point of gridding, and a pathfinding point is a grid, and all map scenes comprise ground, forest etc. and are filled in pathfinding point.
The jump-point each other with redirect relation can make game role without the need to the map between two jump-point moves, but moment redirect is moved.Transmission gate in jump-point such as scene of game.
S3: if there are two jump-point, search for the first direct path from starting point to the first jump-point nearest with starting point in current map, searches for the second direct path from impact point to the second jump-point nearest with impact point simultaneously.
Wherein, the mode of search direct path can be realized by A star algorithm, and A star algorithm belongs to the common practise of those of ordinary skill in the art, repeats no more herein.In search first direct path and the second direct path process, the pathfinding point traveled through is the half or following of the pathfinding point traveled through from starting point to impact point unidirectional search, thus significantly can reduce the data volume of search.
S4: using the first direct path and the second direct path as the shortest pathfinding path.
Wherein, after the shortest pathfinding path is determined, game role will start mobile according to the shortest pathfinding path, until arrive impact point.
S5: if there is no two jump-point, searches for the first direct path from starting point to impact point in current map, searches for the second direct path from impact point to starting point simultaneously.
Wherein, the mode of search direct path can be realized by A star algorithm, and A star algorithm belongs to the common practise of those of ordinary skill in the art, repeats no more herein.In search first direct path and the second direct path process, the pathfinding point traveled through is the half or following of the pathfinding point traveled through from starting point to impact point unidirectional search, thus significantly can reduce the data volume of search.
S6: stop search when the pathfinding point overlapped appears in the first direct path and the second direct path.
Wherein, the first direct path and the second direct path occur that the pathfinding point overlapped shows that the first direct path and the second direct path are connected mutually, thus the path that formation one is complete.If there is the pathfinding point overlapped, then stop search, avoid repeat search.
S7: the first direct path is connected as the shortest pathfinding path with the second direct path.
By the way, method for searching shortest route in the game of the embodiment of the present invention carries out bidirectional research in starting point and impact point to nearest jump-point between the two simultaneously, if jump-point does not exist, then carry out bidirectional research in starting point and impact point simultaneously, the pathfinding point traveled through in search procedure significantly reduces, thus can reduce the search time of pathfinding.
The foregoing is only embodiments of the invention; not thereby the scope of the claims of the present invention is limited; every utilize instructions of the present invention and accompanying drawing content to do equivalent structure or equivalent flow process conversion; or be directly or indirectly used in other relevant technical fields, be all in like manner included in scope of patent protection of the present invention.

Claims (2)

1. the method for searching shortest route in game, it is characterized in that, described method for searching shortest route comprises:
S1, receive pathfinding instruction, described pathfinding instruction comprises starting point and impact point;
S2, in current map, determine between described starting point and described impact point, whether to there is the jump-point that two have redirect relation each other according to described pathfinding instruction, described current map is divided into the pathfinding point of gridding, and described starting point, described impact point and described jump-point belong to described pathfinding point;
S3, if there are described two jump-point, in described current map, search for the first direct path from described starting point to the first jump-point nearest with described starting point, search for the second direct path from described impact point to the second jump-point nearest with described impact point simultaneously;
S4, using described first direct path and described second direct path as the shortest pathfinding path;
S5, if there is no described two jump-point, search for the first direct path from described starting point to described impact point in current map, search for the second direct path from described impact point to described starting point simultaneously;
S6, stops search when the pathfinding point overlapped appears in described first direct path and described second direct path;
S7, is connected described first direct path as the shortest pathfinding path with described second direct path.
2. the method for searching shortest route in game according to claim 1, is characterized in that, before described step S1, described method for searching shortest route also comprises:
When game user generates pathfinding instruction during selected described impact point on described current map, described starting point is the current residing pathfinding point of game role that described game user is handled.
CN201510171002.1A 2015-04-13 2015-04-13 Shortest path searching method for game Pending CN104751001A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510171002.1A CN104751001A (en) 2015-04-13 2015-04-13 Shortest path searching method for game

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510171002.1A CN104751001A (en) 2015-04-13 2015-04-13 Shortest path searching method for game

Publications (1)

Publication Number Publication Date
CN104751001A true CN104751001A (en) 2015-07-01

Family

ID=53590676

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510171002.1A Pending CN104751001A (en) 2015-04-13 2015-04-13 Shortest path searching method for game

Country Status (1)

Country Link
CN (1) CN104751001A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106295164A (en) * 2016-08-05 2017-01-04 中国兵器科学研究院 A kind of paths planning method and electronic equipment
WO2021068665A1 (en) * 2019-10-08 2021-04-15 上海莉莉丝科技股份有限公司 Way-finding method, apparatus and device, and recording medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060047416A1 (en) * 2004-08-25 2006-03-02 Microsoft Corporation Efficiently finding shortest paths using landmarks for computing lower-bound distance estimates
CN102645228A (en) * 2012-04-12 2012-08-22 清华大学 Trafficability route-finding algorithm of vehicle navigation system
CN103893969A (en) * 2014-04-15 2014-07-02 广州博冠信息科技有限公司 Way-finding method and device in game
CN104199878A (en) * 2014-08-21 2014-12-10 西安闻泰电子科技有限公司 Game engine shortest path search method and game engine system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060047416A1 (en) * 2004-08-25 2006-03-02 Microsoft Corporation Efficiently finding shortest paths using landmarks for computing lower-bound distance estimates
CN102645228A (en) * 2012-04-12 2012-08-22 清华大学 Trafficability route-finding algorithm of vehicle navigation system
CN103893969A (en) * 2014-04-15 2014-07-02 广州博冠信息科技有限公司 Way-finding method and device in game
CN104199878A (en) * 2014-08-21 2014-12-10 西安闻泰电子科技有限公司 Game engine shortest path search method and game engine system

Non-Patent Citations (7)

* Cited by examiner, † Cited by third party
Title
FU L等: "Heuristic shortest path algorithms for transportation applications", 《COMPUTERS&OPERATIONS RESEARCH》 *
刘钰等: "基于改进A*算法的机器人路径规划方法研究", 《计算机技术与发展》 *
晋国卿: "游戏开发中智能寻径方法的应用研究", 《中国优秀硕士学位论文全文数据库信息科技辑》 *
杨泳: "路径诱导系统中双向启发式A*算法研究", 《计算机工程与应用》 *
武雪玲等: "基于分层分块数据组织的双向A*算法", 《测绘信息与工程》 *
沈健: "FPS游戏寻路算法的研究与实现", 《中国优秀硕士学位论文全文数据库信息科技辑》 *
邱磊: "基于A*算法的游戏地图寻路实现及性能比较", 《陕西科技大学学报》 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106295164A (en) * 2016-08-05 2017-01-04 中国兵器科学研究院 A kind of paths planning method and electronic equipment
CN106295164B (en) * 2016-08-05 2018-12-04 中国兵器科学研究院 A kind of paths planning method and electronic equipment
WO2021068665A1 (en) * 2019-10-08 2021-04-15 上海莉莉丝科技股份有限公司 Way-finding method, apparatus and device, and recording medium

Similar Documents

Publication Publication Date Title
CN104784932A (en) Path finding method for game role
CN104759097A (en) Automatic way-finding method in game
CN104784934A (en) Method for moving game role
CN104740875A (en) Guiding method for game role move
CN108827278B (en) Air navigation aid and equipment
CN106716872B (en) Aircraft, control method and device thereof and electronic equipment
KR102069981B1 (en) Navigation reference point determination and navigation method and apparatus, and storage medium
CN104156459B (en) A kind of method and system of the efficient pathfinding based on identical expense grid
CN103714234B (en) Method and equipment for determining moving paths of objects in games
CN105589461A (en) Parking system path planning method on the basis of improved ant colony algorithm
CN104914866A (en) Tour inspection robot global path planning method based on topological point classification and system
CN105279207B (en) A kind of user's recommended method, device and system
CN104199878A (en) Game engine shortest path search method and game engine system
CN102693362B (en) A kind of game role skip philosophy and device adapting with landform
CN107943053A (en) A kind of paths planning method of mobile robot
CN110755848B (en) Path finding method in game, terminal and readable storage medium
MX343548B (en) Methods and apparatuses for building tag library and searching for user.
CN104759098A (en) Game way-finding method
CN110220528A (en) A kind of two-way dynamic path planning method of automatic Pilot unmanned vehicle based on A star algorithm
CN106408124A (en) Moving path hybrid forecasting method oriented to data sparse environment
CN104751001A (en) Shortest path searching method for game
CN106574842A (en) Navigation system
CN105071814B (en) The online GPS track data compression algorithm calculated based on offset
CN103344248A (en) Optimal path calculation method for vehicle navigation system
CN104815437A (en) Automatic path-finding method applied to games

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into 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: 20150701