CN104784932A - Path finding method for game role - Google Patents
Path finding method for game role Download PDFInfo
- Publication number
- CN104784932A CN104784932A CN201510170909.6A CN201510170909A CN104784932A CN 104784932 A CN104784932 A CN 104784932A CN 201510170909 A CN201510170909 A CN 201510170909A CN 104784932 A CN104784932 A CN 104784932A
- Authority
- CN
- China
- Prior art keywords
- point
- path
- direct path
- pathfinding
- searching
- 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
Links
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention provides a path fining method for a game role. The path fining method comprises the following steps: S1, receiving a path fining command, wherein the path fining command comprises an initial point and a target point; S2, according to the path finding command, searching for a first direct path from the initial point to the target point in a current map, meanwhile, searching for a second direct path from the target point to the initial point, and dividing the current map into gridding path finding points, wherein the initial point and the target point belong to the path finding points; S3, stopping the search when an overlapping path finding point appears between the first direct path and the second direct path; S4, judging whether a barrier point exists in the path finding point between the first direct path and the second direct path; S5, if yes, optimizing the first direct path and the second direct path to remove the barrier point; S6, connecting the first direct path and the second direct path to serve as the shortest path finding path. By means of the method, the searching time for path finding can be shortened.
Description
Technical field
The present invention relates to technical field of network information, particularly relate to a kind of method for searching of game role.
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 problem that the present invention mainly solves is to provide a kind of method for searching of game role, 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: the method for searching providing a kind of game role, and described method for searching comprises: S1, and receive pathfinding instruction, pathfinding instruction comprises starting point and impact point; S2, searches for first direct path from starting point to impact point according to pathfinding instruction in current map, and search for the second direct path from impact point to starting point, current map is divided into the pathfinding point of gridding, and starting point and impact point belong to pathfinding point simultaneously; S3, stops search when overlapping pathfinding point appears in the first direct path and the second direct path; S4, judges in the first direct path and the second direct path, whether pathfinding point exists obstacle object point; S5, if so, is optimized the first direct path and the second direct path, to remove obstacle object point; S6, is connected the first direct path as the shortest pathfinding path with the second direct path.
Preferably, before step S1, method for searching 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.
The invention has the beneficial effects as follows: the situation being different from prior art, the method for searching of game role of the present invention is by searching for direct path to the other side from starting point and impact point simultaneously, and 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 embodiment of game role of the present invention.
Detailed description of the invention
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 embodiment of game role of the present invention.The method for searching 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 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: search for the first direct path from starting point to impact point according to pathfinding instruction in current map, search for the second direct path from impact point to starting point, current map is divided into the pathfinding point of gridding, and starting point and impact point belong to pathfinding point simultaneously.
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 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.
S3: 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.
S4: judge in the first direct path and the second direct path, whether pathfinding point exists obstacle object point.
Wherein, obstacle object point can for having the pathfinding point of special marking, by inquiring about in the first direct path and the second direct path whether comprise the judgement that special marking realizes obstacle object point.
S5: if be optimized the first direct path and the second direct path, to remove obstacle object point.
Wherein, the mode of optimization can be the new pathfinding point of non-obstacle object point as the first direct path and the new pathfinding point of the second direct path of selecting obstacle object point to adjoin.
S6: the first direct path is connected as the shortest pathfinding path with the second direct path.
Wherein, after the shortest pathfinding path is determined, game role will start mobile according to the shortest pathfinding path, until arrive impact point.
By the way, the method for searching of game role of the present invention carries out bidirectional research in starting point and impact point simultaneously, and the pathfinding point traveled through in search procedure significantly reduces, thus can reduce the search time of pathfinding, and by being optimized two direct paths, realize optimum path.
The foregoing is only embodiments of the invention; not thereby the scope of the claims of the present invention is limited; every utilize description 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. a method for searching for game role, is characterized in that, described method for searching comprises:
S1, receive pathfinding instruction, described pathfinding instruction comprises starting point and impact point;
S2, in current map, the first direct path is searched for from described starting point to described impact point according to described pathfinding instruction, search for the second direct path from described impact point to described starting point simultaneously, described current map is divided into the pathfinding point of gridding, and described starting point and described impact point belong to described pathfinding point;
S3, stops search when the pathfinding point overlapped appears in described first direct path and described second direct path;
S4, judges in described first direct path and described second direct path, whether pathfinding point exists obstacle object point;
S5, if so, is optimized described first direct path and described second direct path, to remove obstacle object point;
S6, is connected described first direct path as the shortest pathfinding path with described second direct path.
2. method for searching according to claim 1, is characterized in that, before described step S1, described method for searching 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.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510170909.6A CN104784932A (en) | 2015-04-13 | 2015-04-13 | Path finding method for game role |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510170909.6A CN104784932A (en) | 2015-04-13 | 2015-04-13 | Path finding method for game role |
Publications (1)
Publication Number | Publication Date |
---|---|
CN104784932A true CN104784932A (en) | 2015-07-22 |
Family
ID=53550402
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510170909.6A Pending CN104784932A (en) | 2015-04-13 | 2015-04-13 | Path finding method for game role |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104784932A (en) |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106075906A (en) * | 2016-06-03 | 2016-11-09 | 腾讯科技(深圳)有限公司 | The method for searching of a kind of simulated object, the building method of scene and the device of correspondence |
CN106582023A (en) * | 2016-12-01 | 2017-04-26 | 北京像素软件科技股份有限公司 | Game path-searching method and apparatus |
CN106790224A (en) * | 2017-01-13 | 2017-05-31 | 腾讯科技(深圳)有限公司 | The method and server of a kind of control simulated object pathfinding |
CN107198883A (en) * | 2017-05-26 | 2017-09-26 | 网易(杭州)网络有限公司 | Method for searching and device for game object in virtual game |
CN108079580A (en) * | 2017-12-20 | 2018-05-29 | 苏州蜗牛数字科技股份有限公司 | A kind of method for searching and terminal |
CN108939547A (en) * | 2018-07-04 | 2018-12-07 | 苏州玩友时代科技股份有限公司 | A kind of optimal path acquisition methods, device, equipment and storage medium |
CN109126134A (en) * | 2018-09-29 | 2019-01-04 | 北京金山安全软件有限公司 | Game role moving method and device and electronic equipment |
CN113101663A (en) * | 2021-04-20 | 2021-07-13 | 网易(杭州)网络有限公司 | Game way-finding control method, device, processing equipment and storage medium |
WO2022001511A1 (en) * | 2020-07-03 | 2022-01-06 | 上海莉莉丝科技股份有限公司 | Path finding method and device for game object, and computer-readable storage medium |
CN114130013A (en) * | 2021-12-07 | 2022-03-04 | 腾讯科技(深圳)有限公司 | Game automation method and related device |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20130082743A (en) * | 2011-12-15 | 2013-07-22 | 한국전자통신연구원 | Method and apparatus for finding path on on-line game |
CN103893969A (en) * | 2014-04-15 | 2014-07-02 | 广州博冠信息科技有限公司 | Way-finding method and device in game |
CN104156459A (en) * | 2014-08-20 | 2014-11-19 | 焦点科技股份有限公司 | Efficient path-finding method and system based on the same cost grids |
CN104199878A (en) * | 2014-08-21 | 2014-12-10 | 西安闻泰电子科技有限公司 | Game engine shortest path search method and game engine system |
-
2015
- 2015-04-13 CN CN201510170909.6A patent/CN104784932A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20130082743A (en) * | 2011-12-15 | 2013-07-22 | 한국전자통신연구원 | Method and apparatus for finding path on on-line game |
CN103893969A (en) * | 2014-04-15 | 2014-07-02 | 广州博冠信息科技有限公司 | Way-finding method and device in game |
CN104156459A (en) * | 2014-08-20 | 2014-11-19 | 焦点科技股份有限公司 | Efficient path-finding method and system based on the same cost grids |
CN104199878A (en) * | 2014-08-21 | 2014-12-10 | 西安闻泰电子科技有限公司 | Game engine shortest path search method and game engine system |
Cited By (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106075906B (en) * | 2016-06-03 | 2019-07-05 | 腾讯科技(深圳)有限公司 | The building method and corresponding device of a kind of method for searching of simulated object, scene |
CN106075906A (en) * | 2016-06-03 | 2016-11-09 | 腾讯科技(深圳)有限公司 | The method for searching of a kind of simulated object, the building method of scene and the device of correspondence |
CN106582023A (en) * | 2016-12-01 | 2017-04-26 | 北京像素软件科技股份有限公司 | Game path-searching method and apparatus |
CN106582023B (en) * | 2016-12-01 | 2020-06-02 | 北京像素软件科技股份有限公司 | Game way finding method and device |
CN106790224A (en) * | 2017-01-13 | 2017-05-31 | 腾讯科技(深圳)有限公司 | The method and server of a kind of control simulated object pathfinding |
CN106790224B (en) * | 2017-01-13 | 2018-09-07 | 腾讯科技(深圳)有限公司 | A kind of method and server of control simulated object pathfinding |
CN107198883A (en) * | 2017-05-26 | 2017-09-26 | 网易(杭州)网络有限公司 | Method for searching and device for game object in virtual game |
CN107198883B (en) * | 2017-05-26 | 2020-12-08 | 网易(杭州)网络有限公司 | Path finding method and device for game object in virtual game |
CN108079580A (en) * | 2017-12-20 | 2018-05-29 | 苏州蜗牛数字科技股份有限公司 | A kind of method for searching and terminal |
CN108939547B (en) * | 2018-07-04 | 2019-06-21 | 苏州玩友时代科技股份有限公司 | A kind of optimal path acquisition methods, device, equipment and storage medium |
CN108939547A (en) * | 2018-07-04 | 2018-12-07 | 苏州玩友时代科技股份有限公司 | A kind of optimal path acquisition methods, device, equipment and storage medium |
CN109126134A (en) * | 2018-09-29 | 2019-01-04 | 北京金山安全软件有限公司 | Game role moving method and device and electronic equipment |
WO2022001511A1 (en) * | 2020-07-03 | 2022-01-06 | 上海莉莉丝科技股份有限公司 | Path finding method and device for game object, and computer-readable storage medium |
CN113101663A (en) * | 2021-04-20 | 2021-07-13 | 网易(杭州)网络有限公司 | Game way-finding control method, device, processing equipment and storage medium |
CN113101663B (en) * | 2021-04-20 | 2024-02-23 | 网易(杭州)网络有限公司 | Method, device, processing equipment and storage medium for controlling path finding of game |
CN114130013A (en) * | 2021-12-07 | 2022-03-04 | 腾讯科技(深圳)有限公司 | Game automation method and related device |
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 | |
CN104548598B (en) | A kind of method of pathfinding in virtual reality scenario | |
CN105589461A (en) | Parking system path planning method on the basis of improved ant colony algorithm | |
CN103017757B (en) | Engineering machinery entry path planning method and path planning device | |
CN106716872B (en) | Aircraft, control method and device thereof and electronic equipment | |
CN103592926B (en) | The intelligent control system combined with AGV based on mechanical three-dimensional parking place and method | |
CN106371445A (en) | Unmanned vehicle planning control method based on topology map | |
CN104914866A (en) | Tour inspection robot global path planning method based on topological point classification and system | |
CN106774425A (en) | A kind of method and system of unmanned plane during flying navigation | |
CN111309004A (en) | Mobile robot path planning method based on improved jumping point search algorithm | |
CN104156459A (en) | Efficient path-finding method and system based on the same cost grids | |
CN104759098A (en) | Game way-finding method | |
CN114675649A (en) | Indoor mobile robot path planning method fusing improved A and DWA algorithm | |
CN110220528A (en) | A kind of two-way dynamic path planning method of automatic Pilot unmanned vehicle based on A star algorithm | |
CN105320134A (en) | Path planning method for robot to independently build indoor map | |
CN104740876A (en) | Pointing method for game role moving direction | |
CN104784933A (en) | Method for determining shortest path for game role | |
CN102927990B (en) | Locomotive is by the method for Geographic Information System determination urban road optimal path of automobile | |
CN102915008A (en) | Intelligent scheduling system of unmanned conveyers in workshop | |
CN103344248A (en) | Optimal path calculation method for vehicle navigation system | |
CN110275528A (en) | For the method for optimizing route of RRT algorithm improvement | |
CN104751001A (en) | Shortest path searching method for game |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
EXSB | Decision made by sipo to initiate 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: 20150722 |