CN110420461B - Game hierarchical navigation method based on height map - Google Patents
Game hierarchical navigation method based on height map Download PDFInfo
- Publication number
- CN110420461B CN110420461B CN201910676024.1A CN201910676024A CN110420461B CN 110420461 B CN110420461 B CN 110420461B CN 201910676024 A CN201910676024 A CN 201910676024A CN 110420461 B CN110420461 B CN 110420461B
- Authority
- CN
- China
- Prior art keywords
- block
- path
- height
- blocks
- point
- 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.)
- Active
Links
Images
Classifications
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F13/00—Video games, i.e. games using an electronically generated display having two or more dimensions
- A63F13/50—Controlling the output signals based on the game progress
- A63F13/53—Controlling the output signals based on the game progress involving additional visual information provided to the game scene, e.g. by overlay to simulate a head-up display [HUD] or displaying a laser sight in a shooting game
- A63F13/537—Controlling the output signals based on the game progress involving additional visual information provided to the game scene, e.g. by overlay to simulate a head-up display [HUD] or displaying a laser sight in a shooting game using indicators, e.g. showing the condition of a game character on screen
- A63F13/5372—Controlling the output signals based on the game progress involving additional visual information provided to the game scene, e.g. by overlay to simulate a head-up display [HUD] or displaying a laser sight in a shooting game using indicators, e.g. showing the condition of a game character on screen for tagging characters, objects or locations in the game scene, e.g. displaying a circle under the character controlled by the player
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F13/00—Video games, i.e. games using an electronically generated display having two or more dimensions
- A63F13/55—Controlling game characters or game objects based on the game progress
- A63F13/56—Computing 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)
- Physics & Mathematics (AREA)
- Optics & Photonics (AREA)
- Processing Or Creating Images (AREA)
- Instructional Devices (AREA)
Abstract
The invention provides a game hierarchical navigation method based on a height map, which comprises the following steps: the method comprises the steps that a game scene is disassembled into a plurality of connected blocks, each block is provided with an independent height map, and three channels of the height maps RGB respectively record different height information according to application scenes of different areas; when navigation is carried out, firstly, determining the blocks where the starting point and the end point are located, and finding out the connecting block with the shortest two blocks; then each block obtains a segmented path; and finally, splicing all the sectional paths to obtain a final navigation path.
Description
Technical Field
The invention relates to the technical field of computer communication, in particular to a game hierarchical navigation method based on a height map.
Background
Navigation and path finding are a technique frequently used in games, and the navigation and path finding method has the main function of calculating a shortest path capable of walking according to the form of a game scene, so that the performance of game roles is more intelligent. In 3D games, navigation grids are typically employed to mark where walks can take place. But for application scenarios with high performance requirements, height map based or so-called grid based navigation is certainly a better choice. The method samples height information of each position of a scene at equal distances and stores the height information in a picture in a pixel mode. The conventional height map navigation method records a scene with one picture, and only one piece of information is recorded in one picture. For complex application scenes, such as dynamically spliced scenes, or scene areas with different walkable meanings for different roles, the conventional height map cannot meet the requirements.
The prior art discloses a method for loading terrain elevation map data, which is disclosed as follows: 201610751098.3, publication date is: 2017.02.01, the present invention relates to a method for loading topographic height map data, which comprises: dividing a terrain area in a scene into a plurality of terrain grids in advance, and generating and storing height map data of each preset level of detail (LOD) precision grade for each terrain grid, wherein the number of vertexes corresponding to the height map data of high LOD precision grade is larger than that corresponding to the height map data of low LOD precision grade; for each terrain grid in the current scene to be rendered, determining the LOD precision level corresponding to the terrain grid according to the principle that the LOD precision level of the far terrain grid is lower than that of the near terrain grid, and loading height map data of the corresponding LOD precision level to a memory. By adopting the invention, the memory overhead can be greatly reduced. The technical problems solved by the patent and the technical scheme adopted by the patent are different from the patent.
Disclosure of Invention
In order to overcome the problems, the invention aims to provide a game hierarchical navigation method based on a height map, which widens the adaptive scene of height map navigation and meets the application requirements of complex game scenes.
The invention is realized by adopting the following scheme: a game hierarchical navigation method based on a height map is provided, which comprises the following steps: the method comprises the steps that a game scene is disassembled into a plurality of connected blocks, each block is provided with an independent height map, and three channels of the height maps RGB respectively record different height information according to application scenes of different areas; when navigation is carried out, firstly, determining the blocks where the starting point and the end point are located, and finding out the connecting block with the shortest two blocks; then each block obtains a segmented path; and finally, splicing all the segmented paths to obtain a final navigation path.
Further, the method further specifically comprises the following steps: step S1, a game scene is disassembled into a plurality of connected blocks, each block is provided with an independent height map, and three channels of the height maps RGB respectively record different height information according to application scenes of different areas;
step S2, acquiring blocks where the starting point and the end point are located when navigating and searching the route, namely, finding the blocks where the starting point and the end point belong according to the size information of the points and the block positions;
step S3: obtaining the shortest connection path of the blocks, namely finding a shortest communication path between the starting block and the end block according to the connection relation of the blocks;
step S4: calculating the shortest path in each block, namely acquiring the shortest target route for each block on the block path, and acquiring the shortest path from the starting point to the connecting point of the block N and the block N-1 by the block N; the block N-1 acquires the shortest path from the connection point of the block N and the block N-1 to the connection point of the block N-1 and the block N-2; the block N-2 acquires the shortest path from the connection point of the block N-1 and the block N-2 to the end point, wherein N > is an integer of 3;
step S5: and merging the segmented paths, namely splicing the paths obtained by each block, and removing repeated path points to obtain a final path.
Further, the step S4 is further specifically: each block acquires a path according to the block height map, namely, the generation mode of the height map of each block defines each channel of the RGB three channels according to the application scenes of different games; one pixel of the height map represents one cell, the shortest path in the block is converted into the shortest path query between two pixel coordinates, an A-x algorithm is adopted, and the algorithm idea is that the walkable points around the query are continuously diffused from a starting point to an end point until the end point is reached; the height map pixel can only express two conditions of height information and no height information, and the A-star algorithm only needs to acquire whether the point has the height information or not when inquiring whether the point can walk or not; the mobile terminal can walk with the height information, and can not walk to continuously inquire the surrounding walkable points without the height information, so that the walkable path in the block is the shortest path in each block.
Further, the method defines three channels of RGB per channel, and the height image pixel is represented by a binary mask, i.e. the pixel point will express 8 different cases, RGB: 111,110,101,100,011,010,001,000, respectively; where 1 indicates that the channel has height information and 0 indicates that the channel does not have height information.
Furthermore, the method also comprises a query function, namely the query function is triggered when the A-algorithm queries whether the pixel can walk, and the query function can accelerate the A-algorithm to diffuse and query the walkable points around until the end point is reached.
The invention has the beneficial effects that: the invention is different from the traditional navigation technology based on the height map, and provides an improved hierarchical navigation method which can split different blocks of a scene and use different height maps to realize block navigation; meanwhile, data expression information of the height map is expanded, each channel can have different information meanings, different query modes can be defined to query the height map data, the adaptive scene of height map navigation is widened, and the application requirements of complex cases are met.
Drawings
FIG. 1 is a schematic flow diagram of the process of the present invention.
Fig. 2 is a schematic flow chart according to a first embodiment of the present invention.
FIG. 3 is a diagram of a game scenario in which embodiments of the present invention are applied.
Fig. 4 is a schematic diagram of the shortest path spliced structure in each tile of the game scene in fig. 3.
Detailed Description
The invention is further described below with reference to the accompanying drawings.
Referring to fig. 1, the game hierarchical navigation method based on a height map of the present invention includes: a game scene is divided into a plurality of connected blocks, each block is provided with an independent height map, and three channels of the height maps RGB respectively record different height information according to application scenes of different areas; when navigation is carried out, firstly, determining the blocks where the starting point and the end point are located, and finding out the connecting block with the shortest two blocks; then each block obtains a segmented path; and finally, splicing all the segmented paths to obtain a final navigation path.
The method further comprises the following steps: step S1, a game scene is disassembled into a plurality of connected blocks, each block is provided with an independent height map, and three channels of the height maps RGB respectively record different height information according to application scenes of different areas;
step S2, acquiring blocks where the starting point and the end point are located when navigating and searching the route, namely, finding the blocks where the starting point and the end point belong according to the size information of the points and the block positions;
step S3: obtaining the shortest connection path of the blocks, namely finding a shortest communication path between the starting block and the end block according to the connection relation of the blocks;
step S4: calculating the shortest path in each block, namely acquiring the shortest target route for each block on the block path, and acquiring the shortest path from the starting point to the connecting point of the block N and the block N-1 by the block N; the block N-1 acquires the shortest path from the connection point of the block N and the block N-1 to the connection point of the block N-1 and the block N-2; the block N-2 acquires the shortest path from the connection point of the block N-1 and the block N-2 to the end point, wherein N > is an integer of 3; the step S4 further includes: each block acquires a path according to the block height map, namely, the generation mode of the height map of each block defines each channel of the RGB three channels according to the application scenes of different games; one pixel of the height map represents one cell, the shortest path in the block is converted into the shortest path query between two pixel coordinates, an A-x algorithm is adopted, and the algorithm idea is that the walkable points around the query are continuously diffused from a starting point to an end point until the end point is reached; the height map pixel can only express two conditions of height information and no height information, and the A-star algorithm only needs to acquire whether the point has the height information or not when inquiring whether the point can walk or not; the mobile terminal can walk with the height information, and can not walk to continuously inquire the surrounding walkable points without the height information, so that the walkable path in the block is the shortest path in each block.
Step S5: and merging the segmented paths, namely splicing the paths obtained by each block, and removing repeated path points to obtain a final path.
The invention is further illustrated below in connection with a specific embodiment:
referring to fig. 2 to 4, a hierarchical navigation method according to an embodiment of the present invention includes:
s1: acquiring blocks of a starting point and an end point:
and finding out the block to which the point belongs according to the point and the block position size information.
S2: calculating the shortest connection path of the blocks:
according to the connection relationship of the blocks, a shortest communication path can be found between the starting block and the ending block. In the case of FIG. 2, referring to FIG. 3, the block A with the starting point (sphere in block A is the starting point), the block C with the ending point (sphere in block C is the ending point), and the shortest connecting path of the blocks are block A- > block B- > block C
S3: each block computes the shortest path within the block:
the shortest target route is calculated for each block on the block path. In the case of fig. 2, referring to fig. 3, block a calculates the shortest path from the starting point to the connection point (black dot) of block a and block B; the block B calculates the shortest path from the connection point of the block A and the block B to the connection point (black dot) of the block B and the block C; the block C calculates the shortest path from the connection point of the block B and the block C to the end point;
each block computes a path based on the block height map and a defined query function. The generation mode of the height map can be reasonably utilized for each channel according to application scenes of different games. As shown in fig. 4, in the present example, the R channel of the three channels of the height map RGB is used to record the height information of the walkable area (walked floor), the G channel is used to record the height information of the obstacle (fence), and the B channel is left empty.
One pixel of the height map represents one cell, the shortest path in the block can be converted into the shortest path query between two pixel coordinates, an A-x algorithm is adopted, and the algorithm idea is that walkable points around the query are continuously diffused from a starting point to an end point until the end point is reached.
Height pixels can only express both height and no height. The algorithm A only needs to acquire whether the point has height information when inquiring whether the point can walk or not.
After introducing multiple channels in the present invention, each pixel point will be able to express 8 different cases. This patent is represented by a binary mask.
In order to more flexibly deal with different application scenes, a query function is introduced.
(pixel mask) > return (whether pixel mask satisfies condition)
The query function is triggered when the a-x algorithm queries whether the pixel can walk, different height maps can be customized according to different application cases, and in the example of fig. 3, the patent wants to search for points belonging to the floor but not to the fence, that is, the points are found for which the R channel has height information and the G channel does not have height information. The query function is defined as: (pixel mask) > return (pixel mask, r ═ 1& & pixel mask, g ═ 0);
s4: merging the segmented paths: the paths calculated by each block are spliced, and repeated path points are removed to obtain a final path, as shown in fig. 4.
The above description is only a preferred embodiment of the present invention, and all equivalent changes and modifications made in accordance with the claims of the present invention should be covered by the present invention.
Claims (4)
1. A game hierarchical navigation method based on a height map is characterized in that: the method comprises the following steps: the method comprises the steps that a game scene is disassembled into a plurality of connected blocks, each block is provided with an independent height map, and three channels of the height maps RGB respectively record different height information according to application scenes of different areas; when navigating and searching the way, firstly determining the blocks where the starting point and the end point are positioned, and finding out the shortest connecting block of the two blocks; then each block obtains a segmented path; finally, all the segmented paths are spliced to obtain a final navigation path;
the method further comprises the following steps: step S1, a game scene is disassembled into a plurality of connected blocks, each block is provided with an independent height map, and three channels of the height maps RGB respectively record different height information according to application scenes of different areas;
step S2, acquiring blocks where the starting point and the end point are located when navigating and searching the route, namely, finding the blocks where the starting point and the end point belong according to the size information of the points and the block positions;
step S3: obtaining the shortest connection path of the blocks, namely finding a shortest communication path between the starting block and the end block according to the connection relation of the blocks;
step S4: calculating the shortest path in each block;
step S5: merging the segmented paths, namely splicing the paths obtained by each block, and removing repeated path points to obtain a final path;
the step S4 further includes: each block acquires a path according to the block height map, namely, the generation mode of the height map of each block defines each channel of the RGB three channels according to the application scenes of different games; one pixel of the height map represents one cell, the shortest path in the block is converted into the shortest path query between two pixel coordinates, an A-x algorithm is adopted, and the algorithm idea is that the walkable points around the query are continuously diffused from a starting point to an end point until the end point is reached; the height map pixel can only express two conditions of height information and no height information, and the A-star algorithm only needs to acquire whether the point has the height information or not when inquiring whether the point can walk or not; the mobile terminal can walk with the height information, and can not walk to continuously inquire the surrounding walkable points without the height information, so that the walkable path in the block is the shortest path in each block.
2. The method of claim 1, wherein the method comprises: the step S4 specifically includes: respectively acquiring a shortest target route for each block on a block path, and acquiring a shortest path from a starting point to a connection point of the block N and the block N-1 by the block N; the block N-1 acquires the shortest path from the connection point of the block N and the block N-1 to the connection point of the block N-1 and the block N-2; the block N-2 obtains the shortest path from the connection point of the block N-1 and the block N-2 to the end point, N > = an integer of 3.
3. The method of claim 1, wherein the method comprises: the method defines three channels of RGB per channel, and the height image pixels are represented by a binary mask, i.e. the pixel points will express 8 different cases, RGB: 111,110,101,100,011,010,001,000, respectively; where 1 indicates that the channel has height information and 0 indicates that the channel does not have height information.
4. The method of claim 1, wherein the method comprises: the method further comprises a query function, wherein the query function is triggered when the A-algorithm queries whether the pixel can walk or not, and the query function can accelerate the A-algorithm to diffuse and query the walkable points around until the end point is reached.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910676024.1A CN110420461B (en) | 2019-07-25 | 2019-07-25 | Game hierarchical navigation method based on height map |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910676024.1A CN110420461B (en) | 2019-07-25 | 2019-07-25 | Game hierarchical navigation method based on height map |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110420461A CN110420461A (en) | 2019-11-08 |
CN110420461B true CN110420461B (en) | 2022-05-10 |
Family
ID=68412405
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910676024.1A Active CN110420461B (en) | 2019-07-25 | 2019-07-25 | Game hierarchical navigation method based on height map |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110420461B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111135565B (en) * | 2019-12-02 | 2023-04-25 | 网易(杭州)网络有限公司 | Terrain splicing method and device in game scene, processor and electronic device |
CN112382135B (en) * | 2020-04-26 | 2021-07-09 | 北京三快在线科技有限公司 | Method and device for determining flight path, storage medium and electronic equipment |
CN111870954B (en) * | 2020-07-24 | 2024-02-13 | 上海米哈游天命科技有限公司 | Altitude map generation method, device, equipment and storage medium |
CN112076478B (en) * | 2020-09-25 | 2024-06-21 | 网易(杭州)网络有限公司 | Game path generation method and device |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP2315075A1 (en) * | 2009-10-22 | 2011-04-27 | Samsung Electronics Co., Ltd. | Method for Navigation in Panoramic Image, Machine-Readable Storage and Portable Device |
JP2011136128A (en) * | 2010-01-04 | 2011-07-14 | Konami Digital Entertainment Co Ltd | Match game system, and game progress control method there |
CN104548597A (en) * | 2014-12-26 | 2015-04-29 | 北京像素软件科技股份有限公司 | Navigation grid automatic-generation method and navigation grid automatic-generation device |
CN108079580A (en) * | 2017-12-20 | 2018-05-29 | 苏州蜗牛数字科技股份有限公司 | A kind of method for searching and terminal |
-
2019
- 2019-07-25 CN CN201910676024.1A patent/CN110420461B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP2315075A1 (en) * | 2009-10-22 | 2011-04-27 | Samsung Electronics Co., Ltd. | Method for Navigation in Panoramic Image, Machine-Readable Storage and Portable Device |
JP2011136128A (en) * | 2010-01-04 | 2011-07-14 | Konami Digital Entertainment Co Ltd | Match game system, and game progress control method there |
CN104548597A (en) * | 2014-12-26 | 2015-04-29 | 北京像素软件科技股份有限公司 | Navigation grid automatic-generation method and navigation grid automatic-generation device |
CN108079580A (en) * | 2017-12-20 | 2018-05-29 | 苏州蜗牛数字科技股份有限公司 | A kind of method for searching and terminal |
Non-Patent Citations (2)
Title |
---|
地形——高度图;冷崖;《https://blog.csdn.net/qq_33248019/article/details/89058316》;20190517;全文 * |
游戏的寻路导航 1:导航网格;MobiusChen;《https://www.jianshu.com/p/490a9128b248》;20180315;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN110420461A (en) | 2019-11-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110420461B (en) | Game hierarchical navigation method based on height map | |
CN111405284B (en) | Point cloud density-based attribute prediction method and device | |
CN106582023B (en) | Game way finding method and device | |
CN101241507B (en) | Map road-seeking method and system | |
CN110887499B (en) | Method and terminal for processing road data and interest point data in map | |
CN112115534A (en) | Method for converting three-dimensional house model into two-dimensional vector plane with height attribute | |
CN109815419B (en) | Interest point indexing method, device, medium and electronic equipment based on geographic position | |
CN107677269A (en) | A kind of low signal areas intelligent navigation method based on topological map | |
CN109472416B (en) | Indoor path planning method and device based on automatic road network data extraction, and client | |
JP2020500319A (en) | Map making device using machine learning and image processing | |
CN108595608B (en) | Road network communication scene oriented neighboring object index query method | |
CN112381078B (en) | Elevated-based road identification method, elevated-based road identification device, computer equipment and storage medium | |
CN112132951B (en) | Construction method of grid semantic map based on vision | |
CN111652977A (en) | Intelligent roaming method for three-dimensional scene of transformer substation | |
CN108446357A (en) | A kind of mass data spatial dimension querying method based on two-dimentional geographical location | |
CN113096181B (en) | Method and device for determining equipment pose, storage medium and electronic device | |
CN115267724A (en) | Position re-identification method of mobile robot based on pose estimation of laser radar | |
CN112525208B (en) | Method, device and equipment for quickly constructing urban road map | |
CN111964682B (en) | Fast path planning method and device adapting to unknown dynamic space and storage medium | |
CN113074735B (en) | Processing method of map data structure | |
CN114509085A (en) | Quick path searching method combining grid and topological map | |
CN114780758A (en) | Construction method of image control point library based on stereo mapping satellite image | |
CN117128974B (en) | Navigation route searching method and device | |
CN117237560B (en) | Data processing method and related device | |
CN110889042B (en) | Resource recommendation method and device, computer equipment and storage medium |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |