CN117482519A - Map path-finding method, map path-finding device, electronic equipment and storage medium - Google Patents
Map path-finding method, map path-finding device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN117482519A CN117482519A CN202311532117.XA CN202311532117A CN117482519A CN 117482519 A CN117482519 A CN 117482519A CN 202311532117 A CN202311532117 A CN 202311532117A CN 117482519 A CN117482519 A CN 117482519A
- Authority
- CN
- China
- Prior art keywords
- grid
- player character
- map
- view
- adjacent
- 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
- 238000000034 method Methods 0.000 title claims abstract description 72
- 238000010586 diagram Methods 0.000 claims abstract description 136
- 238000010276 construction Methods 0.000 claims description 34
- 230000000007 visual effect Effects 0.000 claims description 32
- 239000013598 vector Substances 0.000 claims description 23
- 230000004888 barrier function Effects 0.000 claims description 10
- 238000010606 normalization Methods 0.000 claims description 6
- 238000004590 computer program Methods 0.000 claims description 5
- 230000016776 visual perception Effects 0.000 abstract description 6
- 238000004364 calculation method Methods 0.000 description 21
- 238000004422 calculation algorithm Methods 0.000 description 16
- 238000006243 chemical reaction Methods 0.000 description 7
- 238000005516 engineering process Methods 0.000 description 5
- 230000006870 function Effects 0.000 description 4
- 230000008569 process Effects 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 230000003068 static effect Effects 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 230000007423 decrease Effects 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 239000002184 metal Substances 0.000 description 1
- 238000011282 treatment Methods 0.000 description 1
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/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
-
- 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/52—Controlling the output signals based on the game progress involving aspects of the displayed game scene
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Theoretical Computer Science (AREA)
- Human Computer Interaction (AREA)
- Processing Or Creating Images (AREA)
Abstract
The application provides a map path finding method, a map path finding device, electronic equipment and a storage medium, and relates to the technical field of data processing. According to the method, through the acquired position information of the player character in the current frame, a view diagram corresponding to the player character can be constructed, the distance between each view grid in the view diagram and the view grid where the player character is located is calculated, and speed direction information of each view grid relative to the view grid of the player character is generated based on the distance. Therefore, when the object to be tracked is positioned in the view field diagram of the player, the speed direction information of the view field grid relative to the view field grid of the player can be used for tracking and navigating the object to be trained. When the object to be searched is positioned in the view field diagram, the object to be searched is closer to the player character, and the speed direction information generated by the distance information is adopted for searching and navigating, so that the generated speed direction can be more quickly pointed to the position where the player character is positioned, the navigation is smoother, and the visual perception of the player character is more real.
Description
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a map routing method, a map routing device, an electronic device, and a storage medium.
Background
The grid map is a map construction technology commonly used in computer games, and the navigation technology of the large grid map is also a challenge in the field of real-time games, and if the map is too large or the units needing to be searched in the map are too many, the performance of the real-time games can be rapidly reduced.
At present, common real-time path finding algorithms have the modes of path finding data pre-calculation, map layering and the like. The map hierarchical scheme is to divide the map into different levels according to the abstract degree to avoid a great deal of operation.
However, the map layering algorithm only finds a local optimal solution, so that the path of the road finding is not smooth enough; the way to pre-calculate the route is usually needed to use a lot of memory, and if the pre-calculated map is too large, the way is difficult to use directly.
Disclosure of Invention
The invention aims to provide a map route searching method, a map route searching device, electronic equipment and a storage medium, so that the accuracy of local navigation is improved.
In order to achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:
in a first aspect, an embodiment of the present application provides a map routing method, including:
Obtaining position information of a player character in a current frame, wherein the position information comprises: map block coordinates and intra-block grid coordinates;
constructing a view diagram corresponding to the player character in the current frame according to the position information of the player character and the view range of the virtual camera;
determining distance information between each grid and the player character in the view field diagram, and determining speed direction information of each grid relative to the player character according to the distance information between each grid and the player character;
if the current object to be searched in the current frame is located in the view field diagram corresponding to the player character, generating the route searching navigation information of the current object to be searched in the current frame according to the grid information of the current object to be searched in the view field diagram and the speed direction information of each grid relative to the player character.
In a second aspect, an embodiment of the present application further provides a map routing device, including: the device comprises an acquisition module, a construction module, a determination module and a generation module;
the obtaining module is configured to obtain location information of a player character in a current frame, where the location information includes: map block coordinates and intra-block grid coordinates;
The construction module is used for constructing a view diagram corresponding to the player character in the current frame according to the position information of the player character and the view range of the virtual camera;
the determining module is used for determining the distance information between each grid and the player character in the view field diagram and determining the speed direction information of each grid relative to the player character according to the distance information between each grid and the player character;
the generating module is configured to generate, if the object to be currently tracked in the current frame is located in the view field diagram corresponding to the player character, tracking navigation information of the object to be currently tracked in the current frame according to grid information of the object to be tracked in the view field diagram and speed direction information of each grid relative to the player character.
In a third aspect, an embodiment of the present application provides an electronic device, including: the system comprises a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to execute the map routing method as provided in the first aspect.
In a fourth aspect, embodiments of the present application provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs a map routing method as provided in the first aspect.
The beneficial effects of this application are:
the application provides a map path finding method, a map path finding device, electronic equipment and a storage medium, wherein a view map corresponding to a player character can be constructed through acquired position information of the player character in a current frame, distances between each view grid and a view grid where the player character is located in the view map are calculated, and speed direction information of each view grid relative to the view grid of the player character is generated based on the distances. Therefore, when the object to be tracked is positioned in the view field diagram of the player, the speed direction information of the view field grid relative to the view field grid of the player can be used for tracking and navigating the object to be trained. Because the object to be searched is closer to the player character when the object to be searched is positioned in the view field diagram, the speed direction information generated by the distance information is adopted for searching the path and navigating, so that the generated speed direction can be more quickly pointed to the position of the player character, the navigation is smoother, the path searching path is smoother when the object to be searched searches the path according to the path searching navigation information, and the visual perception of the player character is more real.
In addition, for the object to be searched which is not in the view field of the player character, the route searching navigation information of the object to be searched can be searched and obtained according to the route searching topological information corresponding to the game map generated in advance, and when the object to be searched is not in the view field of the player character, the object to be searched is far away from the player, the smoothness requirement on the route searching result is low, the route searching navigation information can be obtained quickly according to the route searching topological information obtained through pre-calculation, the calculation amount of the route searching data is reduced, and the problem of real-time navigation of a large map is solved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered limiting the scope, and that other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic flow chart of a map routing method provided in an embodiment of the present application;
fig. 2 is a schematic diagram of grid coordinates of a map according to an embodiment of the present application;
FIG. 3 is a flowchart illustrating another map routing method according to an embodiment of the present disclosure;
FIG. 4 is a view illustration provided by an embodiment of the present application;
fig. 5 is a flow chart of another map routing method according to an embodiment of the present disclosure;
fig. 6 is a schematic diagram showing a distance between field grids in a field view diagram according to an embodiment of the present application;
fig. 7 is a flow chart of another map routing method according to an embodiment of the present disclosure;
FIG. 8 is a flowchart of another map routing method according to an embodiment of the present disclosure;
fig. 9 is a flow chart of another map routing method according to an embodiment of the present disclosure;
fig. 10 is a schematic view of a field-of-view grid and adjacent grids thereof according to an embodiment of the present disclosure;
fig. 11 is a schematic diagram showing velocity direction information of a field of view grid according to an embodiment of the present disclosure;
FIG. 12 is a flowchart of another map routing method according to an embodiment of the present disclosure;
fig. 13 is a schematic diagram of a map routing device according to an embodiment of the present application;
fig. 14 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it should be understood that the accompanying drawings in the present application are only for the purpose of illustration and description, and are not intended to limit the protection scope of the present application. In addition, it should be understood that the schematic drawings are not drawn to scale. A flowchart, as used in this application, illustrates operations implemented according to some embodiments of the present application. It should be understood that the operations of the flow diagrams may be implemented out of order and that steps without logical context may be performed in reverse order or concurrently. Moreover, one or more other operations may be added to the flow diagrams and one or more operations may be removed from the flow diagrams as directed by those skilled in the art.
In addition, the described embodiments are only some, but not all, of the embodiments of the present application. The components of the embodiments of the present application, which are generally described and illustrated in the figures herein, may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, as provided in the accompanying drawings, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, are intended to be within the scope of the present application.
It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the presence of the features stated hereinafter, but not to exclude the addition of other features.
In recent years, the yield of large maps in computer 2D games is increasing, and large maps are generally represented by grid maps (Tile maps). The grid map is a map construction technology commonly used in computer games, and in order to improve the performance of real-time games, the grid map generally needs to be subjected to block processing to cope with the problem of oversized map. Navigation technology of large grid maps is also a challenge in the field of real-time games, and if the map is too large or the units in the map that need to be searched are too many, the performance of the real-time game can be rapidly reduced.
Common real-time routing algorithms are Depth-First-Search (DFS), breadth-First (BFS, breath First Search), heuristic routing algorithms (e.g., a-Star) and variants thereof. Compared with DFS and BFS, path distance is estimated by a heuristic method, and although the final solution is not necessarily the optimal path, the method has better performance, so that the use of the algorithm in the real-time domain is more common.
The real-time path-finding algorithm has the advantages that the performance can be drastically reduced under the condition of map expansion, and aiming at the problem of slow path-finding calculation of a large map, the solution is to pre-calculate path-finding data, map layering (such as a common HPA (Hierarchical Pathfinding A) algorithm) and the like. The map hierarchical scheme is to divide the map into different levels according to the abstract degree to avoid a great deal of operation.
However, when the map becomes huge, the performance of common path-finding algorithms such as a×and the like starts to decline sharply, and the requirement of real-time calculation cannot be satisfied. Map layering algorithms such as HPA algorithms can only find a locally optimal solution, so that the path of the path finding is not smooth enough. The way to pre-calculate the route is usually needed to use a lot of memory, and if the pre-calculated map is too large, the way is difficult to use directly.
The A (A-Star) algorithm is a direct searching method which is most effective in solving the shortest path in a static road network, and is also an effective algorithm for solving a plurality of searching problems. The closer the distance estimate in the algorithm is to the actual value, the faster the final search speed.
HPA is a hierarchical path-finding algorithm based on A, and the path-finding speed is increased by layering the map.
Based on the map navigation method, map navigation information is generated by pre-calculating and combining map layering in a pre-process; in addition, in the process of running the game in real time, a view diagram corresponding to the player is constructed according to the position information of the player character, so that a distance diagram and a speed diagram of a view lattice in the view diagram and the player character are obtained based on the view diagram, when an object to be searched is positioned in the view diagram corresponding to the player character, navigation is performed according to the generated speed diagram, so that the smoothness of a navigation path is improved when navigation is performed in the view range of the player character, and when the object to be searched is not positioned in the view diagram corresponding to the player character, navigation can be performed according to map navigation information generated in advance, and the performance of real-time navigation of a large number of objects in a large map is improved.
Fig. 1 is a schematic flow chart of a map routing method provided in an embodiment of the present application; the execution subject of the method can be a terminal device, a server, a processor and other computer devices. As shown in fig. 1, the method may include:
s101, acquiring position information of a player character in a current frame, wherein the position information comprises: map tile coordinates and intra-block grid coordinates.
Firstly, describing an application scene of the scheme, the method for searching the path can be applied to a scene of searching the path by a large number of path searching objects in a large map, and player characters can be used as objects to be searched, and the positions of the player characters can be found finally by navigating the large number of path searching objects in the map, wherein the path searching objects can be virtual monsters in the game scene or can be other virtual objects, and the path searching purposes of the path searching objects are all to find the player characters.
Since the player character's position is changing in real time, each frame can be routed in the manner provided by the present scheme.
Optionally, location information of the player character in the current frame may be acquired, where the location information may include: map tile coordinates and intra-block grid coordinates.
Fig. 2 is a schematic diagram of grid coordinates of a map provided in an embodiment of the present application, where a coordinate system of a 2D large map is divided based on map blocks. Specifically, the coordinates of a grid in the map have four dimensions, which may include: block coordinates X, block coordinates Y, intra-block lattice coordinates X, intra-block lattice coordinates Y, in this case the starting points of the coordinates are all the lower left corner.
Fig. 2 (a) shows a schematic of lattice coordinates within a block; fig. 2 (b) shows coordinates of map blocks, and a game map may be divided into a plurality of map blocks, each map block having corresponding coordinates of map blocks, and a plurality of intra-block grids may be included in one map block, each intra-block grid having corresponding coordinates. Therefore, the intra-block grid coordinates and map block coordinates corresponding to the player character can be obtained from the intra-block grid where the player character is located, and the position information of the player character can be expressed by using the map block coordinates and the intra-block grid coordinates.
S102, constructing a view diagram corresponding to the player character in the current frame according to the position information of the player character and the view range of the virtual camera.
The field of view of the virtual camera may be predetermined, and in the case where the field of view of the virtual camera is kept unchanged, the number of map cells visible in the field of view of the player character is kept unchanged regardless of the position of the player character, and only the observed map cells themselves are changed, possibly from the left cell to the right cell. Then, based on the position information of the player character and the visual field range of the virtual camera, a visual field map corresponding to the player character in the current frame can be constructed.
When the visual field range of the virtual camera is changed or the position information of the player character is changed, the visual field diagram corresponding to the player character can be reconstructed.
S103, determining distance information between each grid and the player character in the view field diagram, and determining speed direction information of each grid relative to the player character according to the distance information between each grid and the player character.
In some embodiments, the position information of the player character may be converted into the view diagram to obtain the view lattices in which the player character is located relative to the view diagram, so that distance information from each other lattice in the view diagram to the view lattice in which the player character is located may be determined respectively, and speed and direction information of each lattice relative to the view lattice in which the player character is located may be further calculated according to the distance information. The speed direction information may include directions from other cells to the cell of the field of view in which the player character is located.
And S104, if the current object to be searched in the current frame is positioned in the view field diagram corresponding to the player character, generating the route searching navigation information of the current object to be searched in the current frame according to the grid information of the object to be searched in the view field diagram and the speed direction information of each grid relative to the player character.
In one implementation manner, when the object to be tracked is tracked and navigated, whether the object to be tracked is located in the view field diagram corresponding to the player character can be judged first, if yes, the track-seeking navigation information of the object to be tracked can be generated according to the grid information of the object to be tracked in the view field diagram and the determined speed direction information of each grid relative to the player character in the view field diagram, so that the object to be tracked is navigated according to the track-seeking navigation information, and the player character can be finally found.
It should be noted that, the object to be tracked in each frame may include a plurality of objects, here, taking the current object to be tracked in the current frame as an example, the current object to be tracked may be any object in all objects to be tracked in the current frame, and each object to be tracked is generated as described above if it is located in the view diagram corresponding to the player character.
According to the method and the device, the speed direction information of each grid relative to the grids of the player character in the view field diagram of the player character is calculated in real time, and the speed direction information is determined based on the distance gradient direction, so that the obtained speed direction can point to the direction with the fastest distance decrease, the navigation can be performed according to the speed direction, the fastest navigation can be realized, the navigation path is more accurate, the navigation in the view field range of the player character is smoother, and the path finding path of an object to be found is more true.
In summary, according to the map routing method provided in the present embodiment, through the obtained position information of the player character in the current frame, a view map corresponding to the player character may be constructed, the distance between each view grid and the view grid where the player character is located in the view map may be calculated, and speed direction information of each view grid relative to the view grid of the player character may be generated based on the distance. Therefore, when the object to be tracked is positioned in the view field diagram of the player, the speed direction information of the view field grid relative to the view field grid of the player can be used for tracking and navigating the object to be trained. Because the object to be searched is closer to the player character when the object to be searched is positioned in the view field diagram, the speed direction information generated by the distance information is adopted for searching the path and navigating, so that the generated speed direction can be more quickly pointed to the position of the player character, the navigation is smoother, the path searching path is smoother when the object to be searched searches the path according to the path searching navigation information, and the visual perception of the player character is more real.
FIG. 3 is a flowchart illustrating another map routing method according to an embodiment of the present disclosure; optionally, in step S102, constructing a view map corresponding to the player character in the current frame according to the position information of the player character and the size of the view range of the virtual camera may include:
S301, determining a bounding box of a visual field range according to the visual field range of the virtual camera; the bounding box boundaries are aligned with the map grid.
FIG. 4 is a view illustration provided by an embodiment of the present application; wherein the dashed rectangle 1 of the inner layer characterizes the visual field of the virtual object, and the thick rectangle 2 of the outer layer characterizes the bounding box of the visual field, and it can be seen that the boundary of the bounding box is aligned with the map grid, and the bounding box comprises a plurality of complete map grids.
S302, determining construction parameters of a visual field diagram corresponding to a player character according to a bounding box of the visual field range; the construction parameters include: the number of rows and columns of the view.
Then, based on the determined bounding box of the visual field scope, the construction parameters of the visual field diagram can be obtained, wherein the region formed by the bounding box of the visual field scope is the visual field diagram corresponding to the player character. The bounding box of the visual field range can be seen to be rectangular, and can be seen to be composed of a plurality of rows and columns of map grids, and when the bounding box of the visual field range is determined, the number of rows and the number of columns of the bounding box can be directly determined, so that the number of rows and the number of columns forming the bounding box can be used as construction parameters of the visual field map, and then the number of rows of the bounding box is the number of rows of the visual field map, and the number of columns of the bounding box is the number of columns of the visual field map.
S303, constructing a view diagram corresponding to the player character according to the position information and the construction parameters of the player character.
Because the view map corresponding to the player character is constructed, the view map corresponding to the player character also needs to be constructed by referring to the position information of the player character.
Optionally, in step S303, constructing a view map corresponding to the player character according to the position information and the construction parameters of the player character may include: and constructing a view map of M rows and N columns by taking a map grid in which the player character is positioned as a center according to the rows and the columns of the view map, and taking the view map of M rows and N columns as a view map corresponding to the player character, wherein M is the rows and N is the columns.
Since the player character is always in the center of the view diagram, the position of the player character can be used as the center of the view diagram to construct the view diagram with the size of M rows and N columns, wherein the value of M is the number of rows of the view diagram, and the value of N is the number of columns of the view diagram. And the number of rows and columns are both positive odd numbers.
Thus, in the view constructed in FIG. 4, the X-axis grid of the view has a coordinate range of [0, M-1], and the Y-axis grid has a coordinate range of [0, N-1].
Fig. 5 is a flow chart of another map routing method according to an embodiment of the present disclosure; optionally, in step S103, determining the distance information between each grid in the view map and the player character may include:
S501, determining the coordinates of the player character relative to the target grid of the view diagram according to the size of the view diagram.
Since the player character is always in the center of the view, the coordinates of the player character relative to the view can be calculated according to the following formula with the view size determined: gx=ceil (M/2) +1, gy=ceil (N/2) +1; where GX represents the abscissa of the field of view grid of the player character relative to the field of view map, that is, the abscissa of the target grid described above, and GY represents the ordinate of the field of view grid of the player character relative to the field of view map, that is, the ordinate of the target grid described above. Ceil points upward to round. M is the number of rows and N is the number of columns of the aforementioned view.
S502, using the target grid as the currently traversed grid, sequentially determining adjacent grids of the currently traversed grid in the view field diagram, and determining the distance between the adjacent grids of the currently traversed grid according to the distance between the currently traversed grids.
The field of view grid (i.e., the target grid) of the player character relative field of view map may be considered as the grid for initial traversal, and since the distances from each field of view grid to the player character field of view grid need to be calculated, the distances from the player character field of view grid default to 0, i.e., the distances from the target grid are 0.
Traversing adjacent lattices of the target lattice, wherein adjacent can refer to four positive adjacent, up, down, left and right, not including diagonal adjacent, and increasing the distance of the target lattice by 1 to obtain the distance of the adjacent lattice of the target lattice.
S503, determining a new currently traversed lattice from the adjacent lattices, and determining the distance of the adjacent lattices of the new currently traversed lattice according to the distance of the new currently traversed lattice.
Next, a new lattice is selected from the adjacent lattices of the target lattice as a new lattice to be currently traversed, so that the adjacent lattices of the new lattice to be currently traversed are determined from the remaining lattices, and the distance of the new lattice to be currently traversed is increased by 1, so that the distance of the adjacent lattices of the new lattice to be currently traversed is obtained.
S504, performing iteration until all grids in the view field diagram are traversed, and taking the determined distance of each grid as the distance information of each grid and the player character.
And performing loop iteration according to the mode until all the view lattices in the view graph are traversed, obtaining the distance of each view lattice, and taking the distance as the distance information of the view lattices and the view lattices of the player character.
The above-mentioned manner of determining the distance can be implemented by referring to a breadth-first traversal algorithm, each field of view lattice can be regarded as a node, the adjacent nodes of the node are traversed in turn from the node which is not traversed, and the distance between the adjacent nodes is 1 plus the distance between the nodes, so that all the nodes are traversed in turn.
Fig. 6 is a schematic diagram showing a distance between field grids in a field view diagram according to an embodiment of the present application.
The grids marked with 0 are the visual field grids where the player characters are located, and the numbers marked in the rest grids represent the distance information of the corresponding grids.
Optionally, in step S502, regarding the target lattice as the currently traversed lattice, determining the adjacent lattices of the currently traversed lattice sequentially may include: and if the adjacent lattices of the currently traversed lattice are traversed, deleting the traversed lattice from the adjacent lattices of the currently traversed lattice.
In some embodiments, when determining the neighboring cells of the currently traversed cell, since the same cell may simultaneously serve as the neighboring cells of a different cell, and thus may have been traversed previously, distance information has been assigned, then when it is the neighboring cell of the currently traversed cell, it is not assigned repeatedly, but is deleted from the neighboring cell, and its distance information remains assigned for the first time before.
Referring to fig. 6, since the player character view cell also belongs to its neighboring cell in the view cell marked with 1 directly above the player character view cell, if the distance information is calculated directly as described above, the distance information of the player character view cell will be modified to 2, which is obviously wrong, and the player character view cell will be deleted from its neighboring cells, and only the distance information 2 will be given to the remaining three neighboring cells. All other trellis treatments are similar.
Fig. 7 is a flow chart of another map routing method according to an embodiment of the present disclosure; optionally, in step S502, determining the distance between adjacent lattices of the currently traversed lattice according to the distance between the currently traversed lattices may include:
s701, judging whether the adjacent grids are obstacle grids according to the coordinates of the adjacent grids, the position information of the player characters and the position information of preset obstacles marked in the current game map.
In some embodiments, there may be a grid of obstacles in the field of view, which need to be avoided for navigation when a road is being found.
Alternatively, the coordinates of the view field cell in the view field map may be converted into the map cell coordinates according to the coordinates of the adjacent cells and the position information of the player character, so that whether the view field cell is an obstacle cell or not may be determined according to the coordinates of the map cell obtained after the conversion and the position information of the obstacle in the game map.
Here, the method is not limited to determining whether or not the adjacent cell is an obstacle cell, and any cell in the view field map may be determined in this way.
S702, if the adjacent lattices are not obstacle lattices, determining the distances of the adjacent lattices of the current traversed lattices according to the distances of the lattices of the current traversed lattices.
When judging that the adjacent lattice is not an obstacle lattice, increasing the distance of the currently traversed lattice by 1 according to the previous mode to obtain the distance of the adjacent lattice.
S703, if the adjacent lattice is an obstacle lattice, determining that the distance between the adjacent lattices is a preset distance.
And when the adjacent lattices are obstacle lattices, the distance between the adjacent lattices is set to be a preset distance, so that the obstacle lattices in the view diagram can be marked in a protruding mode. The preset distance may be a null value.
FIG. 8 is a flowchart of another map routing method according to an embodiment of the present disclosure; optionally, in step S701, determining whether the neighboring grid is an obstacle grid according to coordinates of the neighboring grid, position information of the player character, and position information of a preset obstacle marked in the current game map may include:
S801, the coordinates of the adjacent grid are converted into map grid coordinates based on the coordinates of the adjacent grid and the position information of the player character.
The adjacent lattices in this embodiment may refer to any field lattice that needs to perform coordinate conversion, and the position information of the player character refers to world coordinates of the player character, and includes: the block coordinates where the player character is located and the grid coordinates within the block.
S802, if the map grid coordinates corresponding to the adjacent grids are consistent with the map grid coordinates of the preset obstacles marked in the game map, determining the adjacent grids as obstacle grids.
In general, for a designed game map, the positions of the obstacles in the game map are also preset, and then the view grid coordinates may be converted into map grid coordinates, and then it may be determined whether the map grid coordinates corresponding to the view grid are identical to the map grid coordinates where each preset obstacle marked in the map is located, and if they are identical, the view grid may be regarded as an obstacle grid.
Optionally, in step S801, converting the coordinates of the adjacent grid into map grid coordinates according to the coordinates of the adjacent grid and the position information of the player character may include:
If the sum of the in-block grid abscissas of the player character and the abscissas of the adjacent grids is larger than or equal to the width value of the single map block, subtracting the width value from the sum of the in-block grid abscissas of the player character and the abscissas of the adjacent grids to obtain the in-block grid abscissas in the map grid coordinates corresponding to the adjacent grids; and adding 1 to the abscissa of the map block of the player character to obtain the abscissa of the map block in the grid coordinates of the map corresponding to the adjacent grids.
If the sum of the in-block grid abscissas of the player character and the adjacent grid abscissas is smaller than a preset value, obtaining the in-block grid abscissas in the map grid coordinates corresponding to the adjacent grids according to the sum of the in-block grid abscissas of the player character, the abscissas of the adjacent grids and the width values; and subtracting 1 from the abscissa of the map block of the player character to obtain the abscissa of the map block in the grid coordinates of the map corresponding to the adjacent grids.
If the sum of the in-block grid ordinate of the player character and the adjacent grid ordinate is greater than or equal to the length value of the single map block, subtracting the length value from the sum of the in-block grid ordinate of the player character and the adjacent grid ordinate to obtain the in-block grid ordinate in the map grid coordinate corresponding to the adjacent grid; and adding 1 to the ordinate of the map block of the player character to obtain the ordinate of the map block in the grid coordinates of the map corresponding to the adjacent grids.
If the ordinate of the in-block grid of the player character and the ordinate of the adjacent grid are smaller than the preset value, obtaining the ordinate of the in-block grid in the grid coordinates of the map corresponding to the adjacent grid according to the sum of the ordinate of the in-block grid of the player character, the ordinate of the adjacent grid and the length value; and subtracting 1 from the ordinate of the map block of the player character to obtain the ordinate of the map block in the grid coordinates of the map corresponding to the adjacent grids.
The coordinate conversion relation of the field lattice and the map lattice is described as follows by a specific example:
assuming that the coordinates of the field of view grid to be converted are (VX, VY); the player character's block coordinates are (CX, CY); grid coordinates (IX, IY) within the player character's block, width of a single map tile W (unit is grid); the length of a single map tile is H. The coordinates of the map grid obtained after the view grid conversion are: map block coordinates (CVX, CVY); intra-block grid coordinates (IVX, IVY).
Then, when ix+vx > =w, at this time, the map block indicating that the field of view grid currently required to be converted runs to the right is removed, IVX =ix+vx-W; cvx=cx+1.
When ix+vx <0, at this point, the map block indicating that the field of view grid currently needs to be converted to the left is going, IVX =ix+vx+w; cvx=cx-1.
When iy+vy > =h, at this time, a map block indicating that the field of view grid to be currently converted is going to the upper side, iy=iy+vy-H; CVY =cy+1.
When iy+vy <0, at this time, the map block indicating that the field of view grid to be currently converted is going to the lower side, iy=iy+vy+h; CVY =cy-1.
In this way, the view lattice coordinates can be converted to map lattice coordinates according to the conversion formula in the corresponding case. Thereby judging whether the field of view lattice is an obstacle lattice.
Fig. 9 is a flow chart of another map routing method according to an embodiment of the present disclosure; optionally, in step S103, determining speed direction information of each grid relative to the player character according to distance information of each grid from the player character may include:
s901, sequentially traversing each grid in the view field diagram, and determining gradient vectors of the currently traversed grids according to distance information of each adjacent grid of the currently traversed grids.
Alternatively, in performing the velocity direction calculation, it is also necessary to calculate the velocity direction of each cell in the field of view cell with respect to the field of view cell of the player character, that is, the velocity direction information of each cell is directed to the field of view cell of the player character. And thus can be used to navigate the object to be routed to quickly find the player character.
Each cell in the view map may be sequentially traversed, and the velocity direction information of the cell may be calculated from the distance information of each adjacent cell of the currently traversed cell.
First, gradient vectors of the currently traversed lattice may be calculated from distance information of each neighboring lattice of the currently traversed lattice.
In the gradient vector calculation, the gradient vector calculation may be performed by pointing in a set coordinate system. In conjunction with the distance map shown in fig. 6, assuming that the horizontal axis of the coordinate system points to the right and the vertical axis points to the up, then the abscissa of the corresponding gradient vector may be the distance of the left adjacent cell of the field of view cell minus the distance of the right adjacent cell, and the ordinate of the gradient vector may be the distance of the lower adjacent cell of the field of view cell minus the distance of the upper adjacent cell.
Fig. 10 is a schematic diagram of a field-of-view grid and adjacent grids thereof according to the embodiment of the present application, taking a grid with a distance of 3 in the figure as an example, the abscissa of the gradient vector of the grid is: 4-1, ordinate is: 3-2, i.e. the resulting gradient vector is (3, 1).
S902, carrying out normalization processing on the gradient vector to obtain speed direction information of the current traversed grid relative to the player character.
Then, after the normalization processing is performed on the gradient vector, the direction of the velocity direction information of the lattice with the distance of 3 in fig. 10 is obtained as indicated in fig. 10.
The calculation of the velocity direction information can be performed in the above manner for any lattice.
Of course, the calculation of the gradient vector may also be adapted when the direction of the constructed coordinate system changes. For example: when the horizontal axis of the coordinate system points to the left and the vertical axis points to the down, the distance between the left adjacent grids can be subtracted by the distance between the right adjacent grids to obtain the horizontal coordinate of the gradient vector, and the distance between the lower adjacent grids is subtracted by the distance between the upper adjacent grids to obtain the vertical coordinate of the gradient vector, but the obtained gradient vector needs to be multiplied by-1 to enable the speed direction to accord with the direction of the coordinate axis.
Fig. 11 is a schematic diagram showing velocity direction information of a field of view grid according to an embodiment of the present application. The velocity direction of each field of view cell in the figure points to the field of view cell in which the player character is located.
Optionally, the method may further include: and if the barrier grids exist in the adjacent grids of the currently traversed grids, determining the speed direction information of the currently traversed grids relative to the player character according to the directions of the barrier grids relative to the currently traversed grids.
The above calculation of the velocity direction information by the calculation method of the gradient vector is applicable to the case where adjacent lattices of the lattices are all normal lattices, and no obstacle lattice exists.
In this embodiment, a case where an adjacent lattice is an obstacle lattice will be described. When there is an obstacle grid in the adjacent grid of the field of view grid for which the speed direction information needs to be calculated, a direction pointing to the non-obstacle may be generated according to the direction in which the obstacle grid is located.
In case 1, when only one adjacent lattice is an obstacle lattice, if the obstacle lattice is located directly above or directly below the lattice to be calculated, a leftward or rightward velocity direction may be generated as velocity direction information of the lattice to be calculated. If the obstacle cell is located to the left or right of the cell to be calculated, an upward or downward velocity direction may be generated as velocity direction information of the cell to be calculated.
In case 2, when two adjacent lattices are obstacle lattices, a direction leading to any non-obstacle adjacent lattice is generated as speed direction information of lattices to be calculated.
FIG. 12 is a flowchart of another map routing method according to an embodiment of the present disclosure; optionally, in step S104, generating the route-seeking navigation information of the current object to be sought in the current frame according to the grid information of the object to be sought in the view field diagram and the speed direction information of each grid relative to the player character may include:
S1201, according to the grid information of the object to be tracked in the view field diagram, acquiring the speed direction information of the grid of the object to be tracked in the view field diagram relative to the player character.
When the object to be tracked is located in the view field map of the player character, the map grid coordinates of the object to be tracked in the game map can be obtained first, so that the map grid coordinates are converted into the view field map, the view field grid coordinates of the object to be tracked are obtained, and the speed direction information of the view field grid of the object to be tracked relative to the player character can be inquired and obtained based on the speed direction information of each grid relative to the player character obtained through calculation.
S1202, taking the speed direction information of the grid where the object to be searched is positioned in the view diagram relative to the player character as the route searching navigation information of the current object to be searched in the current frame.
Then, the obtained speed direction information of the field of view lattice of the object to be searched relative to the player character can be used as the route searching navigation information of the current object to be searched in the current frame.
In this embodiment, the route-seeking navigation information refers to the navigation direction, and the navigation direction is provided for the object to be routed, and is not limited to the specification of the next route point for the object to be routed. And searching a path along the navigation direction, and finally, smoothly finding the position of the player character.
Optionally, in step S103, after determining the velocity direction information of each grid relative to the player character according to the distance information of each grid from the player character, the method may further include: if the current object to be searched in the current frame is not in the view field diagram corresponding to the player character, determining the route searching navigation information of the current object to be searched in the current frame according to the position information of the object to be searched, the position information of the player character and the route searching topology information corresponding to the current game map generated in advance; the road-finding topology information includes relative speed direction information between any two map lattices in the game map.
In some embodiments, when the object to be tracked is not in the view field of the player character, since the object to be tracked is not in the view field of the player character, the object to be tracked is far away from the player character, so long as the object to be tracked can be navigated, and the player character can be found finally, and whether the tracked path is smooth is not concerned, and then, in this case, the tracked navigation information of the object to be tracked can be directly searched and obtained from the tracked topology information of the game map generated in advance.
Optionally, before the route searching navigation is executed in the scheme, route searching topology information corresponding to the game map is calculated and stored in a mode of pre-calculation and map layering, and the step is executed in advance and is executed once for a specific game map, so that the route searching topology information can be invoked in real time in the subsequent route searching process.
Since there are a huge number of cells (e.g., 8192x8192 cells in a map size) within a 2D large map, if the entire 2D map is directly pre-computed, an unacceptably large data size for the package of game software would result (e.g., pre-computing the path of a 8192x 8192-sized map, requiring 8192x 8192x 8192x N storage, where N represents the data size of a single path). Therefore, in this embodiment, the map may be layered by using the HPA algorithm and then pre-calculated, so that the capacity of pre-calculated data may be reduced to an acceptable size for one game package (assuming that the size of one map block is 128×128, for a map with 8192×8192 grids, the size of the data storage space required after map layering is only 64x64x 64x N+128x 128x 64x64x N). Where 64 refers to the number of map blocks obtained after layering, and 128 refers to the number of map lattices contained in one map block. The calculated navigation data can be used for performing cross-map-block navigation, but the calculated navigation data of the HPA is only locally optimal (i.e. not globally optimal path, which is not smooth and intelligent enough), so the pre-calculated navigation data of the step is only used for object navigation outside the field of view of the player. The specific steps of performing HPA calculation may be understood with reference to the prior art, and will not be described herein.
Alternatively, the route-seeking topology information corresponding to the game map may include relative speed direction information between any two map lattices in the game map. Then, according to the map lattice of the object to be searched and the map lattice of the player character, the speed direction information of the object to be searched relative to the player character can be searched and obtained.
In summary, according to the map routing method provided in the present embodiment, through the obtained position information of the player character in the current frame, a view map corresponding to the player character may be constructed, the distance between each view grid and the view grid where the player character is located in the view map may be calculated, and speed direction information of each view grid relative to the view grid of the player character may be generated based on the distance. Therefore, when the object to be tracked is positioned in the view field diagram of the player, the speed direction information of the view field grid relative to the view field grid of the player can be used for tracking and navigating the object to be trained. Because the object to be searched is closer to the player character when the object to be searched is positioned in the view field diagram, the speed direction information generated by the distance information is adopted for searching the path and navigating, so that the generated speed direction can be more quickly pointed to the position of the player character, the navigation is smoother, the path searching path is smoother when the object to be searched searches the path according to the path searching navigation information, and the visual perception of the player character is more real.
In addition, for the object to be searched which is not in the view field of the player character, the route searching navigation information of the object to be searched can be searched and obtained according to the route searching topological information corresponding to the game map generated in advance, and when the object to be searched is not in the view field of the player character, the object to be searched is far away from the player, the smoothness requirement on the route searching result is low, the route searching navigation information can be obtained quickly according to the route searching topological information obtained through pre-calculation, the calculation amount of the route searching data is reduced, and the problem of real-time navigation of a large map is solved.
The following describes a device, equipment, a storage medium, etc. for executing the map routing method provided in the present application, and specific implementation processes and technical effects of the device, the equipment, the storage medium, etc. refer to the foregoing, and the following is omitted herein.
Fig. 13 is a schematic diagram of a map routing device according to an embodiment of the present application, where functions implemented by the map routing device correspond to steps executed by the above method. The apparatus may be understood as a terminal device, a server, or a processor of a server, or may be understood as a component, which is independent from the server or the processor and is controlled by the server, to implement the functions of the present application, as shown in fig. 13, where the apparatus may include: an acquisition module 130, a construction module 131, a determination module 132, and a generation module 133;
The obtaining module 130 is configured to obtain location information of a player character in a current frame, where the location information includes: map block coordinates and intra-block grid coordinates;
the construction module 131 is configured to construct a view diagram corresponding to the player character in the current frame according to the position information of the player character and the view range of the virtual camera;
a determining module 132, configured to determine distance information between each grid and the player character in the view field map, and determine velocity direction information of each grid relative to the player character according to the distance information between each grid and the player character;
the generating module 133 is configured to generate, if the object to be currently tracked in the current frame is located in the view field diagram corresponding to the player character, tracking navigation information of the object to be currently tracked in the current frame according to grid information of the object to be tracked in the view field diagram and speed direction information of each grid relative to the player character.
Optionally, the construction module 131 is specifically configured to determine a bounding box of the field of view according to the field of view of the virtual camera; the boundary of the bounding box is aligned with the map grid;
determining construction parameters of a visual field diagram corresponding to the player character according to the bounding box of the visual field range; the construction parameters include: the number of rows and columns of the view map;
And constructing a view diagram corresponding to the player character according to the position information and the construction parameters of the player character.
Optionally, the building module 131 is specifically configured to build a view map of M rows and N columns according to the number of rows and the number of columns of the view map with the map grid where the player character is located as a center, and take the view map of M rows and N columns as the view map corresponding to the player character, where M is the number of rows and N is the number of columns.
Optionally, the determining module 132 is specifically configured to determine coordinates of the player character relative to the target grid of the view map according to the size of the view map;
sequentially determining adjacent lattices of the currently traversed lattices in the view field graph by taking the target lattices as the currently traversed lattices, and determining the distances of the adjacent lattices of the currently traversed lattices according to the distances of the currently traversed lattices;
determining a new currently traversed lattice from the adjacent lattices, and determining the distance of the adjacent lattices of the new currently traversed lattice according to the distance of the new currently traversed lattice;
and performing iteration until all the grids in the view field diagram are traversed, and taking the determined distance of each grid as the distance information of each grid and the player character.
Optionally, the determining module 132 is specifically configured to delete the traversed lattice from the neighboring lattices of the currently traversed lattice if the neighboring lattices of the currently traversed lattice have been traversed.
Optionally, the determining module 132 is specifically configured to determine whether the neighboring grid is an obstacle grid according to coordinates of the neighboring grid, position information of the player character, and position information of a preset obstacle marked in the current game map;
if the adjacent lattices are not obstacle lattices, determining the distance between the adjacent lattices of the current traversed lattice according to the distance between the lattices of the current traversed lattice;
if the adjacent lattices are obstacle lattices, determining that the distance of the adjacent lattices is a preset distance.
Optionally, the determining module 132 is specifically configured to convert the coordinates of the adjacent grid into map grid coordinates according to the coordinates of the adjacent grid and the position information of the player character;
and if the map grid coordinates corresponding to the adjacent grids are consistent with the map grid coordinates of the preset obstacle marked in the game map, determining the adjacent grids as obstacle grids.
Optionally, the determining module 132 is specifically configured to subtract the width value from the sum of the in-block grid abscissa of the player character and the abscissa of the adjacent grid if the sum of the in-block grid abscissa of the player character and the abscissa of the adjacent grid is greater than or equal to the width value of the single map block, so as to obtain the in-block grid abscissa in the map grid coordinates corresponding to the adjacent grid; adding 1 to the abscissa of the map block of the player character to obtain the abscissa of the map block in the grid coordinates of the map corresponding to the adjacent grids;
If the sum of the in-block grid abscissas of the player character and the adjacent grid abscissas is smaller than a preset value, obtaining the in-block grid abscissas in the map grid coordinates corresponding to the adjacent grids according to the sum of the in-block grid abscissas of the player character, the abscissas of the adjacent grids and the width values; subtracting 1 from the abscissa of the map block of the player character to obtain the abscissa of the map block in the grid coordinates of the map corresponding to the adjacent grids;
if the sum of the in-block grid ordinate of the player character and the adjacent grid ordinate is greater than or equal to the length value of the single map block, subtracting the length value from the sum of the in-block grid ordinate of the player character and the adjacent grid ordinate to obtain the in-block grid ordinate in the map grid coordinate corresponding to the adjacent grid; adding 1 to the ordinate of the map block of the player character to obtain the ordinate of the map block in the grid coordinates of the map corresponding to the adjacent grids;
if the ordinate of the in-block grid of the player character and the ordinate of the adjacent grid are smaller than the preset value, obtaining the ordinate of the in-block grid in the grid coordinates of the map corresponding to the adjacent grid according to the sum of the ordinate of the in-block grid of the player character, the ordinate of the adjacent grid and the length value; and subtracting 1 from the ordinate of the map block of the player character to obtain the ordinate of the map block in the grid coordinates of the map corresponding to the adjacent grids.
Optionally, the determining module 132 is specifically configured to sequentially traverse each grid in the view field map, and determine a gradient vector of the currently traversed grid according to distance information of each adjacent grid of the currently traversed grid;
and carrying out normalization processing on the gradient vector to obtain the speed direction information of the current traversed grid relative to the player character.
Optionally, the determining module 132 is further configured to determine, if there is an obstacle grid in the adjacent grids of the currently traversed grid, speed direction information of the currently traversed grid relative to the player character according to a direction of the obstacle grid relative to the currently traversed grid.
Optionally, the generating module 133 is specifically configured to obtain, according to grid information of the object to be tracked in the view field diagram, speed direction information of a grid of the object to be tracked in the view field diagram relative to the player character;
and taking the speed direction information of the grid of the object to be searched relative to the player character in the view field diagram as the route searching navigation information of the current object to be searched in the current frame.
Optionally, the determining module 132 is further configured to determine, if the object to be currently tracked in the current frame is not in the view corresponding to the player character, the navigation information of the object to be currently tracked in the current frame according to the position information of the object to be tracked, the position information of the player character, and the pre-generated topology information of the track to be tracked corresponding to the current game map; the road-finding topology information includes relative speed direction information between any two map lattices in the game map.
The above modules may be one or more integrated circuits configured to implement the above methods, for example: one or more application specific integrated circuits (Application Specific Integrated Circuit, abbreviated as ASIC), or one or more microprocessors (digital singnal processor, abbreviated as DSP), or one or more field programmable gate arrays (Field Programmable Gate Array, abbreviated as FPGA), or the like. For another example, when a module above is implemented in the form of a processing element scheduler code, the processing element may be a general-purpose processor, such as a central processing unit (Central Processing Unit, CPU) or other processor that may invoke the program code. For another example, the modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
The modules may be connected or communicate with each other via wired or wireless connections. The wired connection may include a metal cable, optical cable, hybrid cable, or the like, or any combination thereof. The wireless connection may include a connection through a LAN, WAN, bluetooth, zigBee, or NFC, or any combination thereof. Two or more modules may be combined into a single module, and any one module may be divided into two or more units. It will be clearly understood by those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described system and apparatus may refer to corresponding procedures in the method embodiments, which are not described in detail in this application.
Fig. 14 is a schematic structural diagram of an electronic device according to an embodiment of the present application, including: a processor 801, a storage medium 802, and a bus 803, the storage medium 802 storing machine-readable instructions executable by the processor 801, the processor 801 and the storage medium 802 communicating over the bus 803 when the electronic device is running a map routing method as in the embodiments, the processor 801 executing the machine-readable instructions to perform the steps of:
obtaining the position information of the player character in the current frame, wherein the position information comprises: map block coordinates and intra-block grid coordinates;
constructing a view diagram corresponding to the player character in the current frame according to the position information of the player character and the view range of the virtual camera;
determining distance information between each grid and the player character in the view field diagram, and determining speed direction information of each grid relative to the player character according to the distance information between each grid and the player character;
if the current object to be searched in the current frame is positioned in the view field diagram corresponding to the player character, generating the route searching navigation information of the current object to be searched in the current frame according to the grid information of the object to be searched in the view field diagram and the speed direction information of each grid relative to the player character.
In one possible implementation, the processor 801, when executing the construction of the view map corresponding to the player character of the current frame according to the position information of the player character and the view range size of the virtual camera, is specifically configured to: determining a bounding box of the visual field range according to the visual field range of the virtual camera; the boundary of the bounding box is aligned with the map grid;
determining construction parameters of a visual field diagram corresponding to the player character according to the bounding box of the visual field range; the construction parameters include: the number of rows and columns of the view map;
and constructing a view diagram corresponding to the player character according to the position information and the construction parameters of the player character.
In one possible embodiment, the processor 801, when executing the construction of the view map corresponding to the player character according to the position information and the construction parameters of the player character, is specifically configured to: and constructing a view map of M rows and N columns by taking a map grid in which the player character is positioned as a center according to the rows and the columns of the view map, and taking the view map of M rows and N columns as a view map corresponding to the player character, wherein M is the rows and N is the columns.
In one possible embodiment, the processor 801, when executing the determination of the distance information from each grid to the player character within the view, is specifically configured to: determining the coordinates of the player character relative to the target grid of the view diagram according to the size of the view diagram;
Sequentially determining adjacent lattices of the currently traversed lattices in the view field graph by taking the target lattices as the currently traversed lattices, and determining the distances of the adjacent lattices of the currently traversed lattices according to the distances of the currently traversed lattices;
determining a new currently traversed lattice from the adjacent lattices, and determining the distance of the adjacent lattices of the new currently traversed lattice according to the distance of the new currently traversed lattice;
and performing iteration until all the grids in the view field diagram are traversed, and taking the determined distance of each grid as the distance information of each grid and the player character.
In one possible embodiment, the processor 801, when executing the target grid as the currently traversed grid, sequentially determines neighboring grids of the currently traversed grid, is specifically configured to: and if the adjacent lattices of the currently traversed lattice are traversed, deleting the traversed lattice from the adjacent lattices of the currently traversed lattice.
In one possible embodiment, the processor 801, when executing determining the distance of the adjacent lattice of the currently traversed lattice from the distance of the currently traversed lattice, is specifically configured to: judging whether the adjacent grids are obstacle grids or not according to the coordinates of the adjacent grids, the position information of the player characters and the position information of preset obstacles marked in the current game map;
If the adjacent lattices are not obstacle lattices, determining the distance between the adjacent lattices of the current traversed lattice according to the distance between the lattices of the current traversed lattice;
if the adjacent lattices are obstacle lattices, determining that the distance of the adjacent lattices is a preset distance.
In one possible embodiment, the processor 801 is specifically configured to, when executing the determination of whether the neighboring cell is an obstacle cell based on the coordinates of the neighboring cell, the position information of the player character, and the position information of the preset obstacle marked in the current game map: converting the coordinates of the adjacent grids into map grid coordinates according to the coordinates of the adjacent grids and the position information of the player characters;
and if the map grid coordinates corresponding to the adjacent grids are consistent with the map grid coordinates of the preset obstacle marked in the game map, determining the adjacent grids as obstacle grids.
In one possible embodiment, the processor 801, when executing the conversion of the coordinates of the neighboring grid into map grid coordinates according to the coordinates of the neighboring grid and the position information of the player character, is specifically configured to: if the sum of the in-block grid abscissas of the player character and the abscissas of the adjacent grids is larger than or equal to the width value of the single map block, subtracting the width value from the sum of the in-block grid abscissas of the player character and the abscissas of the adjacent grids to obtain the in-block grid abscissas in the map grid coordinates corresponding to the adjacent grids; adding 1 to the abscissa of the map block of the player character to obtain the abscissa of the map block in the grid coordinates of the map corresponding to the adjacent grids;
If the sum of the in-block grid abscissas of the player character and the adjacent grid abscissas is smaller than a preset value, obtaining the in-block grid abscissas in the map grid coordinates corresponding to the adjacent grids according to the sum of the in-block grid abscissas of the player character, the abscissas of the adjacent grids and the width values; subtracting 1 from the abscissa of the map block of the player character to obtain the abscissa of the map block in the grid coordinates of the map corresponding to the adjacent grids;
if the sum of the in-block grid ordinate of the player character and the adjacent grid ordinate is greater than or equal to the length value of the single map block, subtracting the length value from the sum of the in-block grid ordinate of the player character and the adjacent grid ordinate to obtain the in-block grid ordinate in the map grid coordinate corresponding to the adjacent grid; adding 1 to the ordinate of the map block of the player character to obtain the ordinate of the map block in the grid coordinates of the map corresponding to the adjacent grids;
if the ordinate of the in-block grid of the player character and the ordinate of the adjacent grid are smaller than the preset value, obtaining the ordinate of the in-block grid in the grid coordinates of the map corresponding to the adjacent grid according to the sum of the ordinate of the in-block grid of the player character, the ordinate of the adjacent grid and the length value; and subtracting 1 from the ordinate of the map block of the player character to obtain the ordinate of the map block in the grid coordinates of the map corresponding to the adjacent grids.
In one possible embodiment, the processor 801, when executing the determination of the velocity direction information of each grid relative to the player character based on the distance information of each grid from the player character, is specifically configured to: traversing each grid in the view field map in turn, and determining gradient vectors of the currently traversed grids according to the distance information of each adjacent grid of the currently traversed grids;
and carrying out normalization processing on the gradient vector to obtain the speed direction information of the current traversed grid relative to the player character.
In one possible embodiment, the processor 801 is further configured to: and if the barrier grids exist in the adjacent grids of the currently traversed grids, determining the speed direction information of the currently traversed grids relative to the player character according to the directions of the barrier grids relative to the currently traversed grids.
In a possible embodiment, the processor 801 is specifically configured to, when executing the generation of the route-seeking navigation information of the current object to be routed in the current frame according to the grid information where the object to be routed is located in the view field diagram and the speed direction information of each grid relative to the player character: according to the grid information of the object to be searched in the view field diagram, acquiring the speed direction information of the grid of the object to be searched in the view field diagram relative to the player character;
And taking the speed direction information of the grid of the object to be searched relative to the player character in the view field diagram as the route searching navigation information of the current object to be searched in the current frame.
In one possible embodiment, the processor 801, after executing the determination of the velocity direction information of each grid relative to the player character based on the distance information of each grid from the player character, is further configured to: if the current object to be searched in the current frame is not in the view field diagram corresponding to the player character, determining the route searching navigation information of the current object to be searched in the current frame according to the position information of the object to be searched, the position information of the player character and the route searching topology information corresponding to the current game map generated in advance; the road-finding topology information includes relative speed direction information between any two map lattices in the game map.
Through the method, the electronic device can construct the view diagram corresponding to the player character according to the acquired position information of the player character in the current frame, calculate the distance between each view grid and the view grid where the player character is located in the view diagram, and generate speed direction information of each view grid relative to the view grid of the player character based on the distance. Therefore, when the object to be tracked is positioned in the view field diagram of the player, the speed direction information of the view field grid relative to the view field grid of the player can be used for tracking and navigating the object to be trained. Because the object to be searched is closer to the player character when the object to be searched is positioned in the view field diagram, the speed direction information generated by the distance information is adopted for searching the path and navigating, so that the generated speed direction can be more quickly pointed to the position of the player character, the navigation is smoother, the path searching path is smoother when the object to be searched searches the path according to the path searching navigation information, and the visual perception of the player character is more real.
In addition, for the object to be searched which is not in the view field of the player character, the route searching navigation information of the object to be searched can be searched and obtained according to the route searching topological information corresponding to the game map generated in advance, and when the object to be searched is not in the view field of the player character, the object to be searched is far away from the player, the smoothness requirement on the route searching result is low, the route searching navigation information can be obtained quickly according to the route searching topological information obtained through pre-calculation, the calculation amount of the route searching data is reduced, and the problem of real-time navigation of a large map is solved.
In which the storage medium 802 stores program code that, when executed by the processor 801, causes the processor 801 to perform various steps in the map routing method according to various exemplary embodiments of the present application described in the "exemplary method" section of the present specification.
The processor 801 may be a general purpose processor such as a Central Processing Unit (CPU), digital signal processor (Digital Signal Processor, DSP), application specific integrated circuit (Application Specific Integrated Circuit, ASIC), field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, and may implement or perform the methods, steps, and logic blocks disclosed in embodiments of the present application. The general purpose processor may be a microprocessor or any conventional processor or the like. The steps of a method disclosed in connection with the embodiments of the present application may be embodied directly in a hardware processor for execution, or in a combination of hardware and software modules in the processor for execution.
The storage medium 802 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. The Memory may include at least one type of storage medium, which may include, for example, flash Memory, hard disk, multimedia card, card Memory, random access Memory (Random Access Memory, RAM), static random access Memory (Static Random Access Memory, SRAM), programmable Read-Only Memory (Programmable Read Only Memory, PROM), read-Only Memory (ROM), charged erasable programmable Read-Only Memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), magnetic Memory, magnetic disk, optical disk, and the like. The memory is any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to such. The storage medium 802 in the embodiments of the present application may also be a circuit or any other device capable of implementing a storage function, for storing program instructions and/or data.
Optionally, the embodiment of the present application further provides a computer readable storage medium, on which a computer program is stored, the computer program being executed by a processor, the processor performing the steps of:
Obtaining the position information of the player character in the current frame, wherein the position information comprises: map block coordinates and intra-block grid coordinates;
constructing a view diagram corresponding to the player character in the current frame according to the position information of the player character and the view range of the virtual camera;
determining distance information between each grid and the player character in the view field diagram, and determining speed direction information of each grid relative to the player character according to the distance information between each grid and the player character;
if the current object to be searched in the current frame is positioned in the view field diagram corresponding to the player character, generating the route searching navigation information of the current object to be searched in the current frame according to the grid information of the object to be searched in the view field diagram and the speed direction information of each grid relative to the player character.
In one possible implementation, the processor is specifically configured to, when executing the construction of the view map corresponding to the player character of the current frame according to the position information of the player character and the view range size of the virtual camera: determining a bounding box of the visual field range according to the visual field range of the virtual camera; the boundary of the bounding box is aligned with the map grid;
determining construction parameters of a visual field diagram corresponding to the player character according to the bounding box of the visual field range; the construction parameters include: the number of rows and columns of the view map;
And constructing a view diagram corresponding to the player character according to the position information and the construction parameters of the player character.
In one possible embodiment, the processor, when executing the construction of the view map corresponding to the player character according to the position information and the construction parameters of the player character, is specifically configured to: and constructing a view map of M rows and N columns by taking a map grid in which the player character is positioned as a center according to the rows and the columns of the view map, and taking the view map of M rows and N columns as a view map corresponding to the player character, wherein M is the rows and N is the columns.
In one possible embodiment, the processor, when executing the determining of the distance information of each grid from the player character within the view, is specifically configured to: determining the coordinates of the player character relative to the target grid of the view diagram according to the size of the view diagram;
sequentially determining adjacent lattices of the currently traversed lattices in the view field graph by taking the target lattices as the currently traversed lattices, and determining the distances of the adjacent lattices of the currently traversed lattices according to the distances of the currently traversed lattices;
determining a new currently traversed lattice from the adjacent lattices, and determining the distance of the adjacent lattices of the new currently traversed lattice according to the distance of the new currently traversed lattice;
And performing iteration until all the grids in the view field diagram are traversed, and taking the determined distance of each grid as the distance information of each grid and the player character.
In one possible embodiment, the processor, when executing the target grid as the currently traversed grid, sequentially determines adjacent grids of the currently traversed grid, is specifically configured to: and if the adjacent lattices of the currently traversed lattice are traversed, deleting the traversed lattice from the adjacent lattices of the currently traversed lattice.
In one possible embodiment, the processor, when executing determining the distance of the adjacent lattice of the currently traversed lattice according to the distance of the currently traversed lattice, is specifically configured to: judging whether the adjacent grids are obstacle grids or not according to the coordinates of the adjacent grids, the position information of the player characters and the position information of preset obstacles marked in the current game map;
if the adjacent lattices are not obstacle lattices, determining the distance between the adjacent lattices of the current traversed lattice according to the distance between the lattices of the current traversed lattice;
if the adjacent lattices are obstacle lattices, determining that the distance of the adjacent lattices is a preset distance.
In one possible embodiment, the processor is specifically configured to, when executing the determination of whether the neighboring cell is an obstacle cell based on the coordinates of the neighboring cell, the position information of the player character, and the position information of the preset obstacle marked in the current game map: converting the coordinates of the adjacent grids into map grid coordinates according to the coordinates of the adjacent grids and the position information of the player characters;
and if the map grid coordinates corresponding to the adjacent grids are consistent with the map grid coordinates of the preset obstacle marked in the game map, determining the adjacent grids as obstacle grids.
In one possible embodiment, the processor, when executing the conversion of the coordinates of the adjacent grid into map grid coordinates according to the coordinates of the adjacent grid and the position information of the player character, is specifically configured to: if the sum of the in-block grid abscissas of the player character and the abscissas of the adjacent grids is larger than or equal to the width value of the single map block, subtracting the width value from the sum of the in-block grid abscissas of the player character and the abscissas of the adjacent grids to obtain the in-block grid abscissas in the map grid coordinates corresponding to the adjacent grids; adding 1 to the abscissa of the map block of the player character to obtain the abscissa of the map block in the grid coordinates of the map corresponding to the adjacent grids;
If the sum of the in-block grid abscissas of the player character and the adjacent grid abscissas is smaller than a preset value, obtaining the in-block grid abscissas in the map grid coordinates corresponding to the adjacent grids according to the sum of the in-block grid abscissas of the player character, the abscissas of the adjacent grids and the width values; subtracting 1 from the abscissa of the map block of the player character to obtain the abscissa of the map block in the grid coordinates of the map corresponding to the adjacent grids;
if the sum of the in-block grid ordinate of the player character and the adjacent grid ordinate is greater than or equal to the length value of the single map block, subtracting the length value from the sum of the in-block grid ordinate of the player character and the adjacent grid ordinate to obtain the in-block grid ordinate in the map grid coordinate corresponding to the adjacent grid; adding 1 to the ordinate of the map block of the player character to obtain the ordinate of the map block in the grid coordinates of the map corresponding to the adjacent grids;
if the ordinate of the in-block grid of the player character and the ordinate of the adjacent grid are smaller than the preset value, obtaining the ordinate of the in-block grid in the grid coordinates of the map corresponding to the adjacent grid according to the sum of the ordinate of the in-block grid of the player character, the ordinate of the adjacent grid and the length value; and subtracting 1 from the ordinate of the map block of the player character to obtain the ordinate of the map block in the grid coordinates of the map corresponding to the adjacent grids.
In one possible embodiment, the processor, when executing the determining the velocity direction information of each grid relative to the player character based on the distance information of each grid from the player character, is specifically configured to: traversing each grid in the view field map in turn, and determining gradient vectors of the currently traversed grids according to the distance information of each adjacent grid of the currently traversed grids;
and carrying out normalization processing on the gradient vector to obtain the speed direction information of the current traversed grid relative to the player character.
In one possible embodiment, the processor is further configured to: and if the barrier grids exist in the adjacent grids of the currently traversed grids, determining the speed direction information of the currently traversed grids relative to the player character according to the directions of the barrier grids relative to the currently traversed grids.
In one possible implementation, the processor is specifically configured to, when executing the generation of the route-seeking navigation information of the current object to be routed in the current frame according to the grid information of the object to be routed in the view field diagram and the speed direction information of each grid relative to the player character: according to the grid information of the object to be searched in the view field diagram, acquiring the speed direction information of the grid of the object to be searched in the view field diagram relative to the player character;
And taking the speed direction information of the grid of the object to be searched relative to the player character in the view field diagram as the route searching navigation information of the current object to be searched in the current frame.
In one possible embodiment, the processor, after executing the determining of the velocity direction information of each grid relative to the player character based on the distance information of each grid from the player character, is further configured to: if the current object to be searched in the current frame is not in the view field diagram corresponding to the player character, determining the route searching navigation information of the current object to be searched in the current frame according to the position information of the object to be searched, the position information of the player character and the route searching topology information corresponding to the current game map generated in advance; the road-finding topology information includes relative speed direction information between any two map lattices in the game map.
Through the method, the electronic device can construct the view diagram corresponding to the player character according to the acquired position information of the player character in the current frame, calculate the distance between each view grid and the view grid where the player character is located in the view diagram, and generate speed direction information of each view grid relative to the view grid of the player character based on the distance. Therefore, when the object to be tracked is positioned in the view field diagram of the player, the speed direction information of the view field grid relative to the view field grid of the player can be used for tracking and navigating the object to be trained. Because the object to be searched is closer to the player character when the object to be searched is positioned in the view field diagram, the speed direction information generated by the distance information is adopted for searching the path and navigating, so that the generated speed direction can be more quickly pointed to the position of the player character, the navigation is smoother, the path searching path is smoother when the object to be searched searches the path according to the path searching navigation information, and the visual perception of the player character is more real.
In addition, for the object to be searched which is not in the view field of the player character, the route searching navigation information of the object to be searched can be searched and obtained according to the route searching topological information corresponding to the game map generated in advance, and when the object to be searched is not in the view field of the player character, the object to be searched is far away from the player, the smoothness requirement on the route searching result is low, the route searching navigation information can be obtained quickly according to the route searching topological information obtained through pre-calculation, the calculation amount of the route searching data is reduced, and the problem of real-time navigation of a large map is solved.
In the embodiments of the present application, the computer program may also execute other machine readable instructions when executed by a processor to perform the methods as described in other embodiments, and the specific implementation of the method steps and principles are referred to in the description of the embodiments and are not described in detail herein.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in hardware plus software functional units.
The integrated units implemented in the form of software functional units described above may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium, and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (english: processor) to perform part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: u disk, mobile hard disk, read-Only Memory (ROM), random access Memory (Random Access Memory, RAM), magnetic disk or optical disk, etc.
Claims (15)
1. A map routing method, comprising:
obtaining position information of a player character in a current frame, wherein the position information comprises: map block coordinates and intra-block grid coordinates;
constructing a view diagram corresponding to the player character in the current frame according to the position information of the player character and the view range of the virtual camera;
determining distance information between each grid and the player character in the view field diagram, and determining speed direction information of each grid relative to the player character according to the distance information between each grid and the player character;
if the current object to be searched in the current frame is located in the view field diagram corresponding to the player character, generating the route searching navigation information of the current object to be searched in the current frame according to the grid information of the current object to be searched in the view field diagram and the speed direction information of each grid relative to the player character.
2. The method according to claim 1, wherein the constructing a view corresponding to the player character in the current frame according to the position information of the player character and the view size of the virtual camera includes:
determining a bounding box of a visual field range according to the visual field range of the virtual camera; the boundary of the bounding box is aligned with the map grid;
Determining construction parameters of a view map corresponding to the player character according to the bounding box of the view range; the construction parameters include: the number of rows and columns of the view map;
and constructing a view diagram corresponding to the player character according to the position information of the player character and the construction parameters.
3. The method according to claim 2, wherein constructing the view corresponding to the player character according to the position information of the player character and the construction parameter includes:
and constructing M rows and N columns of view maps by taking a map grid in which the player character is positioned as a center according to the rows and the columns of the view maps, and taking the M rows and the N columns of view maps as view maps corresponding to the player character, wherein M is the rows and N is the columns.
4. A method according to any of claims 1-3, wherein said determining distance information from each grid in said view map to said player character comprises:
determining the coordinates of the player character relative to the target grid of the view diagram according to the size of the view diagram;
sequentially determining adjacent lattices of the currently traversed lattices in the view field graph by taking the target lattices as the currently traversed lattices, and determining the distances of the adjacent lattices of the currently traversed lattices according to the distances of the currently traversed lattices;
Determining a new grid traversed currently from the adjacent grids, and determining the distance between the adjacent grids of the new grid traversed currently according to the distance between the new grid traversed currently;
and performing iteration until all grids in the view field diagram are traversed, and taking the determined distance of each grid as the distance information of each grid and the player character.
5. The method of claim 4, wherein the sequentially determining the target grid as the currently traversed grid as adjacent grids of the currently traversed grid comprises:
and if the adjacent lattices of the currently traversed lattice are traversed, deleting the traversed lattice from the adjacent lattices of the currently traversed lattice.
6. The method of claim 4, wherein the determining the distance of the neighboring cells of the currently traversed cell from the distance of the currently traversed cell comprises:
judging whether the adjacent lattices are barrier lattices or not according to the coordinates of the adjacent lattices, the position information of the player characters and the position information of preset barriers marked in the current game map;
If the adjacent lattices are not obstacle lattices, determining the distance between the adjacent lattices of the current traversed lattice according to the distance between the lattices of the current traversed lattice;
and if the adjacent lattices are obstacle lattices, determining that the distance of the adjacent lattices is a preset distance.
7. The method of claim 6, wherein the determining whether the neighboring cell is an obstacle cell according to coordinates of the neighboring cell, position information of the player character, and position information of a preset obstacle marked in a current game map, comprises:
converting the coordinates of the adjacent grids into map grid coordinates according to the coordinates of the adjacent grids and the position information of the player character;
and if the map grid coordinates corresponding to the adjacent grids are consistent with the map grid coordinates of the preset obstacles marked in the game map, determining the adjacent grids as obstacle grids.
8. The method of claim 7, wherein the converting the coordinates of the neighboring cells into map cell coordinates according to the coordinates of the neighboring cells and the position information of the player character comprises:
If the sum of the in-block grid abscissas of the player character and the abscissas of the adjacent grids is larger than or equal to the width value of a single map block, subtracting the width value from the sum of the in-block grid abscissas of the player character and the abscissas of the adjacent grids to obtain the in-block grid abscissas in the map grid coordinates corresponding to the adjacent grids; adding 1 to the abscissa of the map block of the player character to obtain the abscissa of the map block in the grid coordinates of the map corresponding to the adjacent grids;
if the sum of the in-block grid abscissas of the player character and the adjacent grid abscissas is smaller than a preset value, obtaining the in-block grid abscissas in the map grid coordinates corresponding to the adjacent grids according to the in-block grid abscissas of the player character, the adjacent grid abscissas and the sum of the width values; subtracting 1 from the abscissa of the map block of the player character to obtain the abscissa of the map block in the grid coordinates of the map corresponding to the adjacent grids;
if the sum of the in-block grid ordinate of the player character and the ordinate of the adjacent grid is greater than or equal to the length value of a single map block, subtracting the length value from the sum of the in-block grid ordinate of the player character and the ordinate of the adjacent grid to obtain the in-block grid ordinate in the map grid coordinate corresponding to the adjacent grid; adding 1 to the ordinate of the map block of the player character to obtain the ordinate of the map block in the grid coordinates of the map corresponding to the adjacent grids;
If the ordinate of the in-block grid of the player character and the ordinate of the adjacent grid are smaller than the preset value, obtaining the ordinate of the in-block grid in the grid coordinates of the map corresponding to the adjacent grid according to the sum of the ordinate of the in-block grid of the player character, the ordinate of the adjacent grid and the length value; and subtracting 1 from the ordinate of the map block of the player character to obtain the ordinate of the map block in the grid coordinates of the map corresponding to the adjacent grids.
9. The method of claim 1, wherein determining velocity direction information for each grid relative to the player character based on distance information for each grid from the player character comprises:
traversing each grid in the view field map in sequence, and determining gradient vectors of the currently traversed grids according to distance information of adjacent grids of the currently traversed grids;
and carrying out normalization processing on the gradient vector to obtain speed direction information of the currently traversed grid relative to the player character.
10. The method as recited in claim 9, further comprising:
and if the barrier grids exist in the adjacent grids of the currently traversed grids, determining the speed direction information of the currently traversed grids relative to the player character according to the directions of the barrier grids relative to the currently traversed grids.
11. The method according to claim 1, wherein the generating the route-seeking navigation information of the current object to be routed in the current frame according to the grid information of the object to be routed in the view and the speed direction information of each grid relative to the player character includes:
acquiring speed direction information of a grid of the object to be searched in the view diagram relative to the player character according to the grid information of the object to be searched in the view diagram;
and taking the speed direction information of the grid of the object to be searched in the view field diagram relative to the player character as the route searching navigation information of the current object to be searched in the current frame.
12. The method of claim 1, wherein after determining velocity direction information of each grid relative to the player character based on distance information of each grid from the player character, further comprising:
if the current object to be searched in the current frame is not in the view field diagram corresponding to the player character, determining the route searching navigation information of the current object to be searched in the current frame according to the position information of the object to be searched, the position information of the player character and the route searching topology information corresponding to the current game map generated in advance; the route searching topological information comprises relative speed direction information between any two map lattices in the game map.
13. A map routing device, comprising: the device comprises an acquisition module, a construction module, a determination module and a generation module;
the obtaining module is configured to obtain location information of a player character in a current frame, where the location information includes: map block coordinates and intra-block grid coordinates;
the construction module is used for constructing a view diagram corresponding to the player character in the current frame according to the position information of the player character and the view range of the virtual camera;
the determining module is used for determining the distance information between each grid and the player character in the view field diagram and determining the speed direction information of each grid relative to the player character according to the distance information between each grid and the player character;
the generating module is configured to generate, if the object to be currently tracked in the current frame is located in the view field diagram corresponding to the player character, tracking navigation information of the object to be currently tracked in the current frame according to grid information of the object to be tracked in the view field diagram and speed direction information of each grid relative to the player character.
14. An electronic device, comprising: a processor, a storage medium and a bus, the storage medium storing program instructions executable by the processor, the processor and the storage medium communicating over the bus when the electronic device is running, the processor executing the program instructions to perform the map routing method of any one of claims 1 to 12.
15. A computer readable storage medium, characterized in that the storage medium has stored thereon a computer program which, when executed by a processor, performs the map routing method according to any one of claims 1 to 12.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311532117.XA CN117482519A (en) | 2023-11-16 | 2023-11-16 | Map path-finding method, map path-finding device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311532117.XA CN117482519A (en) | 2023-11-16 | 2023-11-16 | Map path-finding method, map path-finding device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117482519A true CN117482519A (en) | 2024-02-02 |
Family
ID=89682658
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311532117.XA Pending CN117482519A (en) | 2023-11-16 | 2023-11-16 | Map path-finding method, map path-finding device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117482519A (en) |
-
2023
- 2023-11-16 CN CN202311532117.XA patent/CN117482519A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108444482B (en) | Unmanned aerial vehicle autonomous road finding and obstacle avoiding method and system | |
US11300964B2 (en) | Method and system for updating occupancy map for a robotic system | |
CN111811514B (en) | Path planning method based on regular hexagon grid jump point search algorithm | |
CN110108284B (en) | Unmanned aerial vehicle three-dimensional flight path rapid planning method considering complex environment constraint | |
CN111504325A (en) | Global path planning method based on weighted A-algorithm for expanding search neighborhood | |
CN110006430B (en) | Optimization method of track planning algorithm | |
CN108444490B (en) | Robot path planning method based on depth fusion of visible view and A-x algorithm | |
CN108775902A (en) | The adjoint robot path planning method and system virtually expanded based on barrier | |
WO2009092327A1 (en) | Map path seeking method and system | |
Harabor et al. | Hierarchical path planning for multi-size agents in heterogeneous environments | |
CN114440916B (en) | Navigation method, device, equipment and storage medium | |
CN103221786B (en) | Endurance distance and/or consumption is calculated with the cost of energy being allocated to area section | |
CN112783169A (en) | Path planning method and device and computer readable storage medium | |
CN115164907B (en) | Forest operation robot path planning method based on A-algorithm of dynamic weight | |
CN110702133A (en) | Path planning method, robot and device with storage function | |
CN116036604B (en) | Data processing method, device, computer and readable storage medium | |
CN112987749A (en) | Hybrid path planning method for intelligent mowing robot | |
CN115167474A (en) | Mobile robot path planning optimization method | |
CN114625162A (en) | Hybrid algorithm-based optimal path planning method, system and medium for unmanned aerial vehicle | |
CN117007067A (en) | River course inspection unmanned aerial vehicle path planning method based on A star algorithm | |
CN114721370A (en) | Robot rapid optimal path planning method based on double heuristic functions | |
CN117482519A (en) | Map path-finding method, map path-finding device, electronic equipment and storage medium | |
CN116772846A (en) | Unmanned aerial vehicle track planning method, unmanned aerial vehicle track planning device, unmanned aerial vehicle track planning equipment and unmanned aerial vehicle track planning medium | |
CN116560360A (en) | Method and system for planning real-time dynamic path of medical care robot facing complex dynamic scene | |
Mekni et al. | Hierarchical path planning for multi-agent systems situated in informed virtual geographic environments |
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 |