Pathfinding method, device, equipment and medium based on game scene
By storing transmission point information in the game map in the scene area, and directly obtaining transmission point information in the target scene area, the problem of low transmission point search efficiency is solved, efficient transmission point search is achieved, and game performance is improved.
Patent Information
- Application Number
- CN202210204450.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-15
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2040-12-15
AI Technical Summary
In the game map, the low efficiency of teleport point search results in a reduced game performance, especially when the number of teleport points increases, the search complexity increases sharply.
By storing transmission point information in the transmission information table in the scene area, the transmission point information corresponding to the target scene area is directly obtained, avoiding traversing all transmission points and achieving fast search.
It greatly improves the search efficiency of teleportation points, reduces the consumption of computing resources, avoids the increase in search complexity caused by the increase in the number of teleportation points, and ensures the stability of game performance.
Smart Images

Figure CN114642882B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image technology, and in particular to a path-finding method, device, equipment and medium based on a game scene. Background Art
[0002] Currently, a plurality of fixed teleportation points are set in the game map to facilitate the game character to move to a specific location (ie, the target location) in the map through the teleportation points.
[0003] When searching for teleport points, the A* pathfinding algorithm is usually used to traverse the teleport points and calculate the path and corresponding path length between each teleport point and the target location. Thus, the teleport point with the shortest path is used as the target teleport point to be used during the movement. Since the position of the game character changes in real time, the teleport point needs to be searched again every time it moves, which can easily lead to reduced game performance.
[0004] In summary, how to search for the transmission point closest to the target location has become a technical problem that needs to be solved urgently. Summary of the invention
[0005] The embodiments of the present invention provide a path-finding method and device, equipment, and medium based on a game scene, which are used to simplify the search method of a transmission point and improve the efficiency of the transmission point search.
[0006] In a first aspect, an embodiment of the present invention provides a pathfinding method based on a game scene, wherein an application is loaded with a scene map and a transmission information table, wherein the scene map includes multiple scene areas, and the transmission point information corresponding to each of the multiple scene areas is stored in the transmission information table in units of scene areas; the method comprises:
[0007] In response to a pathfinding instruction issued to the application, a target position is obtained from the pathfinding instruction, and a target scene area where the target position is located is determined;
[0008] Obtain the teleportation point information corresponding to the target scene area from the teleportation information table;
[0009] Based on the transmission point information corresponding to the target scene area, execute the action logic corresponding to the pathfinding instruction.
[0010] In a possible embodiment, the transmission point information corresponding to any scene area in the transmission information table includes the nearest transmission point closest to the current scene area, and the distance between the nearest transmission point and the current scene area.
[0011] Based on the teleportation point information corresponding to the target scene area, the action logic corresponding to the pathfinding instruction is executed, including: determining the displacement object corresponding to the pathfinding instruction; based on the nearest teleportation point and the distance between the nearest teleportation point and the target scene area, moving the displacement object from the current position to the nearest teleportation point.
[0012] In a possible embodiment, the multiple scene areas are multiple grids, and the multiple grids include transmission point grids where the multiple transmission points are located.
[0013] The method further includes: storing the transmission point information corresponding to each transmission point grid into a transmission information table; traversing multiple grids layer by layer around each transmission point grid to determine the connectivity relationship between each grid in the multiple grids and the transmission point grid; acquiring the transmission point information corresponding to each grid based on the connectivity relationship, and storing the transmission point information corresponding to each grid into the transmission information table.
[0014] In a possible embodiment, the plurality of grids further include a plurality of first-layer grids adjacent to each transmission point grid. Traversing the plurality of grids layer by layer around each transmission point grid to determine the connectivity relationship between each grid in the plurality of grids and the transmission point grid includes:
[0015] Add each transmission point grid to the search queue; obtain any transmission point grid j from the search queue, traverse multiple first-layer grids adjacent to the transmission point grid j to determine the connectivity relationship between the transmission point grid j and the multiple adjacent first-layer grids; if it is determined that the transmission point grid j is connected to the first-layer grid k, add the first-layer grid k to the search queue, wherein the first-layer grid k is any one of the multiple first grids adjacent to the transmission point grid j; with the first-layer grid in the search queue as the center, traverse the next-layer grid surrounding the first-layer grid to determine the connectivity relationship between the next-layer grid and each transmission point grid.
[0016] In a possible embodiment, traversing a plurality of first-layer grids adjacent to the transmission point grid j to determine a connectivity relationship between the transmission point grid j and the plurality of adjacent first-layer grids includes:
[0017] Take the position information of the first-layer grid m currently traversed as the first position information; determine whether there is first routing information corresponding to the first position information; if it is determined that the first routing information exists, obtain the first routing information and the second routing information corresponding to the second position information, the second position information being the position information of the transmission point grid j; based on the first routing information and the second routing information, determine whether the transmission point grid j is connected to the first-layer grid m.
[0018] In a possible embodiment, the first path finding information is first polygon mesh information including first position information, and the second path finding information is second polygon mesh information including second position information.
[0019] Based on the first routing information and the second routing information, determine whether the transmission point grid j is connected to the first layer grid m, including: determining whether there is obstruction between the first polygonal grid information and the second polygonal grid information; if it is determined that there is no obstruction between the first polygonal grid information and the second polygonal grid information, determine that the transmission point grid j is connected to the first layer grid m.
[0020] In a possible embodiment, the situation of determining that the first polygon mesh information and the second polygon mesh information are not blocked includes one of the following: there are common edges between the first polygon mesh information and the second polygon mesh information; the first polygon mesh information and the second polygon mesh information are the same common edge polygons.
[0021] In a possible embodiment, the transmission point grid j is any one of a plurality of transmission point grids, and the first layer grid k is any one of a plurality of first grids adjacent to the transmission point grid j.
[0022] The method comprises: obtaining transmission point information corresponding to each grid based on the connectivity relationship, and storing the transmission point information corresponding to each grid in a transmission information table, including: if the transmission point grid j is connected to the adjacent first-layer grid k, obtaining the distance between the first-layer grid k and the transmission point grid j as the first distance; and storing the first distance and the transmission point grid j as the transmission point information of the first-layer grid k in the transmission information table.
[0023] In a possible embodiment, the path-finding method further includes: if the transmission point information of the first layer grid k is stored in the transmission information table, determining whether the first distance is less than the second distance in the transmission point information of the first layer grid k; if the first distance is less than the second distance, storing the first distance and the transmission point grid j in the transmission information table to update the transmission information table.
[0024] In a second aspect, an embodiment of the present invention provides a pathfinding device based on a game scene, the pathfinding device is applied to an application loaded with a scene map and a transmission information table, the scene map includes multiple scene areas, and the transmission point information corresponding to each of the multiple scene areas is stored in the transmission information table in units of scene areas; the pathfinding device includes:
[0025] A grid acquisition module, for responding to a pathfinding instruction issued to an application, acquiring a target position from the pathfinding instruction, and determining a target scene area where the target position is located;
[0026] An information acquisition module, used to acquire the transmission point information corresponding to the target scene area from the transmission information table;
[0027] The logic execution module is used to execute the action logic corresponding to the path-finding instruction based on the transmission point information corresponding to the target scene area.
[0028] An embodiment of the present invention further provides a system, including a processor and a memory, wherein the memory stores at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to implement the game scene-based pathfinding method described above.
[0029] An embodiment of the present invention provides a computer-readable medium on which at least one instruction, at least one program, code set or instruction set is stored, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the game scene-based pathfinding method described above.
[0030] In an embodiment of the present invention, the application is loaded with a scene map and a transmission information table. The scene map includes multiple scene areas. The transmission point information corresponding to each of the multiple scene areas is stored in the transmission information table in units of scene areas, so that it is convenient to search for transmission points in the transmission information table in units of scene areas. On this basis, in response to the path-finding instruction issued to the application, the target position is obtained from the path-finding instruction. Since the target position is usually not located at the transmission point, it is necessary to determine the target scene area where the target position is located. Then, the transmission point information corresponding to the target scene area is directly obtained from the transmission information table storing the transmission point information corresponding to each of the multiple scene areas. The transmission point search can be realized without the need for path-finding data or the use of a path-finding algorithm to traverse each transmission point, thereby avoiding a large amount of calculations generated in each path-finding process, and greatly improving the transmission point search efficiency. Finally, based on the directly obtained transmission point information corresponding to the target scene area, the action logic corresponding to the path-finding instruction is executed, and the path-finding process based on the transmission point information is realized. Furthermore, since the teleportation point information can be directly searched from the teleportation information table through the target scene area, it can effectively avoid the problem of a sharp increase in the complexity of the teleportation point search due to the increase in the number of teleportation points, making the number of teleportation point configurations in the game scene map unlimited and the teleportation point configuration more flexible. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0032] Figure 1 A flowchart of a path-finding method based on a game scene provided by an embodiment of the present invention;
[0033] Figure 2A schematic diagram of the principle of a path-finding process provided by an embodiment of the present invention;
[0034] Figure 3 A schematic diagram of another principle of a pathfinding process provided by an embodiment of the present invention;
[0035] Figure 4 A schematic diagram of the principle of another path-finding process provided by an embodiment of the present invention;
[0036] Figure 5 A schematic diagram of the structure of a path-finding device based on a game scene provided by an embodiment of the present invention;
[0037] Figure 6 For Figure 5 A schematic diagram of the structure of an electronic device corresponding to a path-finding device based on a game scene provided in the illustrated embodiment. DETAILED DESCRIPTION
[0038] Now the content of the present invention will be discussed with reference to several exemplary embodiments. It should be understood that these embodiments are discussed only to enable those skilled in the art to better understand and thus implement the content of the present invention, rather than implying any limitation on the scope of the present invention.
[0039] As used herein, the term "including" and variations thereof are to be interpreted as open-ended terms meaning "including but not limited to." The term "based on" is to be interpreted as "based, at least in part, on." The terms "one embodiment" and "an embodiment" are to be interpreted as "at least one embodiment." The term "another embodiment" is to be interpreted as "at least one other embodiment."
[0040] In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.
[0041] The pathfinding scheme provided in the embodiment of the present invention can be executed by an electronic device, which can be a terminal device such as a smart phone, a tablet computer, a PC, a laptop computer, etc. In an optional embodiment, an application for executing the pathfinding scheme can be installed on the electronic device. Alternatively, in another optional embodiment, the pathfinding scheme can also be executed by the server device and the terminal device in cooperation.
[0042] The pathfinding solution provided by the embodiment of the present invention is applicable to various teleportation point search scenarios, such as: a switching scenario of switching to another location in the game map after receiving a task, a scenario of autonomous movement in a big world game, and a prop transmission scenario.
[0043] The following uses a game scenario as an example to illustrate the technical problem that the technical solution provided by the embodiment of the present invention actually solves:
[0044] Currently, multiple fixed teleportation points are set in the game map, so that the game character can move to a specific location (i.e., the target location) in the map through the teleportation points. In fact, since the teleportation points often do not coincide with the target location, the game character can also move to the vicinity of the target location through the teleportation points.
[0045] When searching for teleportation points, the A* pathfinding algorithm is usually used to traverse the teleportation points, and the pathfinding path and the corresponding path length between each teleportation point and the target position are calculated, so that the teleportation point with the shortest pathfinding path is used as the target teleportation point to be used during the movement. Since the position of the game character changes in real time, the teleportation point needs to be searched again for each movement. In simple terms, each movement requires the use of a pathfinding algorithm to traverse the teleportation points to calculate the pathfinding path length between each teleportation point and the target position in real time, so as to select the target teleportation point with the shortest pathfinding path. Obviously, this teleportation point search method requires a lot of computing resources, which can easily lead to a decrease in the efficiency of the teleportation point search and a decrease in game performance. In summary, how to search for the teleportation point closest to the target position has become a technical problem that needs to be solved urgently.
[0046] On the other hand, as the game map is updated and the gameplay is expanded, the number of teleportation points continues to increase, resulting in a sharp increase in the complexity of teleportation point searches and a sharp increase in the computing resources consumed by teleportation point searches, further leading to a decline in game performance. Therefore, there is still a problem of a sharp increase in the complexity of teleportation point searches due to the increase in the number of teleportation points.
[0047] In view of the above technical problems, a solution is provided in some embodiments of the present invention. The technical solutions provided by the embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0048] The execution process of the path-finding method based on the game scene is described below in conjunction with the following embodiments. Figure 1 Flow chart of a path finding method based on a game scene provided by an embodiment of the present invention. Figure 1 As shown, the path-finding method based on the game scene includes the following steps:
[0049] 101. In response to a pathfinding instruction issued to an application program, a target position is obtained from the pathfinding instruction, and a target scene area where the target position is located is determined;
[0050] 102. Obtaining the transmission point information corresponding to the target scene area from the transmission information table;
[0051] 103. Based on the transmission point information corresponding to the target scene area, execute the action logic corresponding to the path-finding instruction.
[0052] The path finding method in the embodiment of the present invention is applied to an application program, which can be set in a terminal device. The application program is loaded with a scene map and a transmission information table.
[0053] In order to store each transmission point information in the transmission information table, it is also necessary to clarify the scope of each transmission point information in the scene map. Therefore, multiple scene areas covering the scene map can also be set. The scene area can be used as the minimum storage unit for constructing the transmission information table, so that the transmission point information corresponding to multiple scene areas is stored in the transmission information table in units of scene areas. Optionally, multiple scene areas correspond to multiple position coordinate ranges in the scene map one by one.
[0054] Optionally, in order to facilitate the description of the position coordinate range corresponding to the scene area, multiple scene areas can be implemented as multiple grids. Therefore, the multiple grids here are set to facilitate the description of the scope of the teleportation point information in the scene map in the transmission information table. Taking the game scene as a three-dimensional scene as an example, the scene map can be implemented as a three-dimensional scene map containing collision information. Multiple grids are, for example, multiple two-dimensional grids covering each scene area in the scene map. On this basis, the transmission point information corresponding to each of the multiple grids is stored in the transmission information table with the grid as the minimum storage unit, so that the corresponding transmission point information can be queried in the transmission information table based on the grid coordinates.
[0055] Taking the game map as an example, the shapes of multiple grids can be set to squares of the same size. Alternatively, the shapes of multiple grids can also be set to irregular polygons according to the specific terrain of the scene map. Regardless of the form used, multiple grids must cover any position that can be moved to in the game map to ensure the accuracy of the teleportation point information.
[0056] In 101, in response to a pathfinding instruction issued to an application, a target position is obtained from the pathfinding instruction, and a target scene area where the target position is located is determined.
[0057] In some embodiments, the pathfinding instruction may be triggered by a game player. For example, in some scenarios, when a game player needs to move a moving object (such as a game character or an item) corresponding to a pathfinding instruction to a target location during the game, the pathfinding instruction may be issued through a control button provided in the game interface. The pathfinding instruction may be implemented as a movement instruction, an attack instruction, an item transfer instruction, etc., which is not limited in this embodiment.
[0058] In other embodiments, the pathfinding instruction may be automatically triggered by the game system according to a detected event. The event that automatically triggers the pathfinding instruction may be a timing event, a counting event, or other monitoring event, which is not limited in this embodiment. If it is a timing event, the game system may trigger the pathfinding instruction according to the timing task. For example, in a game scene, after a game character enters the current scene for a specified period of time, the system may automatically trigger a move instruction to move the game character from the current scene to another scene. If it is a counting event, the game system may trigger the pathfinding instruction according to a counting task. For example, in a game scene, when a game character collects a certain item and reaches a quantity threshold, the system may automatically trigger a jump instruction to move the game character to the target scene. They will not be listed one by one.
[0059] After the pathfinding instruction is detected, the target position can be parsed from the pathfinding instruction. The target position is, for example, the coordinate information of the target position. Then, the target scene area where the target position is located can be determined, and the coordinate information of the target position can be converted into an identifier of the target scene area. Taking the target scene area as a target grid as an example, the identifier of the target grid is, for example, a grid identifier, a grid index, and a grid coordinate.
[0060] For example, suppose the application is a game client, and the pathfinding instruction is a movement instruction to Castle P. Based on this, the target location can be parsed from the pathfinding instruction to be Castle P, and the location coordinates of Castle P can be obtained. Since Castle P is not a teleportation point, in order to search for the teleportation point closest to Castle P, the grid where Castle P is located is used as the target grid, and the location coordinates of Castle P are converted into the grid coordinates of the grid where Castle P is located.
[0061] Then, after determining the target scene area where the target position is located, in 102, the transmission point information corresponding to the target scene area is obtained from the transmission information table. The transmission information table stores the transmission point information corresponding to each of the multiple scene areas. Specifically, the transmission point information corresponding to each scene area in the transmission information table includes, but is not limited to: the nearest transmission point closest to the current scene area (e.g., the identifier of the nearest transmission point), and the distance between the nearest transmission point and the current scene area.
[0062] Assume that the application is a game client, and assume that the pathfinding instruction is a movement instruction to the castle P. Based on this, after determining the grid where the castle P is located as the target scene area, the teleportation point information corresponding to the scene area where the castle P is located is obtained from the teleportation information table through the scene area coordinates of the scene area where the castle P is located, such as the identifier of the teleportation point closest to the scene area where the castle P is located.
[0063] In practical applications, in order to facilitate the construction of the transmission information table, it is assumed that M*N grids covering the scene map are obtained based on the scene map, where the length and width of the grid are unit lengths, M is the length of the scene map, and N is the width of the scene map. Based on this, with the grid as the minimum calculation unit, the transmission point information corresponding to each of the M*N grids covering the scene map is stored in the transmission information table in the form of structure data. The structure data is, for example, struct structure data.
[0064] Taking the struct structure data as an example, the teleportation point information corresponding to each of the M*N grids can be stored in the following structure: struct DStruct{int dis; int ID}, where struct is the structure tag, DStruct is the structure name, dis is the distance between the nearest teleportation point and the current scene area, ID is the identifier of the nearest teleportation point closest to the current scene area, and int is the data type, i.e., integer. Based on this, the transmission information table Dmap includes the data blocks corresponding to each of the M*N grids, i.e., DStruct[M,N]Dmap, where [M,N] is the grid coordinate.
[0065] Finally, after acquiring the transmission point information corresponding to the target scene area, in 103, the action logic corresponding to the path-finding instruction is executed based on the transmission point information corresponding to the target scene area.
[0066] The action logic may be implemented as position movement logic, transmission logic, etc., which is not limited in this embodiment.
[0067] It is assumed that the transmission point information corresponding to each scene area in the transmission information table includes: the identifier of the nearest transmission point closest to the current scene area, and the distance between the nearest transmission point and the current scene area.
[0068] Based on this, in 103, based on the transmission point information corresponding to the target scene area, an optional implementation method of executing the action logic corresponding to the pathfinding instruction is:
[0069] Determine the displacement object corresponding to the pathfinding instruction; and move the displacement object from the current position to the nearest transmission point based on the nearest transmission point and the distance between the nearest transmission point and the target scene area, so that the displacement object moves to the target position through the nearest transmission point.
[0070] For example, let us continue to assume that the application is a game client, and the pathfinding instruction is a movement instruction to the castle P. Let us assume that the castle P is not located at the teleportation point. Let us assume that the teleportation point information corresponding to the scene area where the castle P is located (i.e., the target scene area) includes: the nearest teleportation point identifier closest to the scene area where the castle P is located, and the distance between the nearest teleportation point and the scene area where the castle P is located.
[0071] Based on this, first determine the displacement object corresponding to the movement instruction, assuming that the displacement object corresponding to the movement instruction is the game character controlled by the player. Then, according to the identifier of the nearest transmission point and the distance between the nearest transmission point and the scene area where the castle p is located, move the game character controlled by the player from the current position to the nearest transmission point corresponding to the identifier, so that the game character is displaced to the transmission point closest to the castle p. Thus, the player can control the game character to move from the nearest transmission point to the castle p, completing the position movement logic corresponding to the movement instruction.
[0072] Among them, moving the displacement object from the current position to the nearest transmission point can be understood as switching the scene where the displacement object is located from the scene where the current position is located to another scene where the nearest transmission point is located. The two scenes, for example, include scenery with different plot settings, scene tones of different styles, and different NPCs, so that the user can perceive the displacement object moving from the current position to the nearest transmission point from the visual effects of the two scenes.
[0073] In the above steps 101 to 103, the teleportation point information corresponding to the target scene area is directly obtained from the transmission information table that stores the transmission point information corresponding to multiple scene areas. The teleportation point search can be achieved without the need for pathfinding data or the use of a pathfinding algorithm to traverse each teleportation point, thereby avoiding a large amount of calculation generated during each pathfinding process and greatly improving the efficiency of the teleportation point search.
[0074] On the other hand, in response to the current problem of a sharp increase in the complexity of teleportation point searches due to an increase in the number of teleportation points, in an embodiment of the present invention, teleportation point information corresponding to a target scene area is directly obtained from a teleportation information table that stores teleportation point information corresponding to a plurality of scene areas, without the need for pathfinding data or a pathfinding algorithm to traverse each teleportation point, and the teleportation point search can be directly implemented through the teleportation information table. Therefore, the problem of a sharp increase in the complexity of teleportation point searches during each pathfinding process due to an increase in the number of teleportation points can be avoided, the computing resources consumed by the teleportation point search can be greatly reduced, and the teleportation point search efficiency can be improved. Not only is the number of teleportation point configurations in the game scene map not limited, the teleportation point configuration is more flexible, and it also helps to further ensure game performance.
[0075] In the above and below embodiments of the present invention, optionally, a transmission information table corresponding to the scene map can be pre-established. Optionally, the transmission information table can be periodically maintained by the application program carried by the terminal device, or it can be maintained by the server device and updated to the application program carried by the terminal device. For example, assuming that the terminal device is a mobile phone, assuming that the application program is a game client installed in the mobile phone, the transmission information table is stored in the game client in the form of a file. In fact, the structure data in the transmission information table can be directly accessed through a preset code interface.
[0076] Specifically, assuming that the server device is a game server, the transmission information table can be updated and maintained by the game server based on the update information of the game map, and the maintained transmission information table is transmitted to the game client side. For example, as the game map is updated and the game play is expanded, a transmission point and corresponding transmission point information are added to the transmission information table.
[0077] In fact, in some types of games, game players can customize teleportation points. In this case, the game client can transmit the customized teleportation point information to the game server, and the game server will update it in real time to the transmission information table and distribute it to each game client in the same game map.
[0078] In some embodiments, it is assumed that the scene map includes multiple scene areas. It is assumed that the multiple scene areas are multiple grids. Similar to the above description, the multiple grids are actually set to facilitate the description of the scope of the transmission point information in the scene map in the transmission information table. It is assumed that the multiple grids include: the transmission point grids where the multiple transmission points are located. Based on this, Figure 2 Shown with Figure 1 A corresponding generation process of a transmission information table. Figure 2 As shown, the transmission information table can be generated by the following steps:
[0079] 201. Store the transmission point information corresponding to each transmission point grid into the transmission information table;
[0080] 202. Traverse multiple grids layer by layer around each transmission point grid to determine the connectivity relationship between each grid in the multiple grids and the transmission point grid;
[0081] 203. Acquire the transmission point information corresponding to each grid based on the connectivity relationship, and store the transmission point information corresponding to each grid into a transmission information table.
[0082] It is assumed that the transmission point information corresponding to each grid in the transmission information table includes: an identifier of the nearest transmission point closest to the current grid, and a distance between the nearest transmission point and the current grid.
[0083] Based on the above assumption, in 201, for each transmission point grid, the identifier of the transmission point grid itself is used as the identifier of the nearest transmission point in the transmission information table, and the distance between the nearest transmission point and the current grid is set to 0.
[0084] Furthermore, in 202, multiple grids are traversed layer by layer around each transmission point grid to determine the connectivity relationship between each grid in the multiple grids and the transmission point grid.
[0085] Assume that the multiple grids divided into the scene map include multiple transmission point grids and multiple first-layer grids adjacent to each transmission point grid. Assume that the transmission point grid j is any one of the multiple transmission point grids. Based on the above assumption, the following takes the transmission point grid j and the first-layer grids adjacent to the transmission point grid j as an example to illustrate how to traverse multiple grids layer by layer around each transmission point grid in 202 to determine the connectivity relationship between each grid in the multiple grids and the transmission point grid.
[0086] Specifically, the transmission point grid j can be taken as the center, and the first layer grids surrounding the transmission point grid j are first traversed to determine the connectivity relationship between each first layer grid surrounding the transmission point grid j and the transmission point grid j. For example, the position relationship between the transmission point grid j and the first layer grids surrounding the transmission point grid j and distributed in 8 directions is as follows: Figure 3 shown.
[0087] Then, with the first layer of meshes connected to the transmission point mesh j as the center, the second layer of meshes surrounding these first layer meshes are traversed to determine the connectivity relationship between the second layer of meshes surrounding these first layer meshes and the transmission point mesh j. Further, with the second layer of meshes connected to the transmission point mesh j as the center, the third layer of meshes surrounding these second layer meshes are traversed to determine the connectivity relationship between the third layer of meshes surrounding these second layer meshes and the transmission point mesh j. This is done by analogy until the next layer of meshes detected is at the edge of the scene map, at which time it can be determined that the traversal operation of multiple meshes has been completed.
[0088] Here, taking the teleportation point grid j and the first layer grids surrounding the teleportation point grid j as an example, the teleportation point grid j is connected to a first layer grid, which means that the two have a connected relationship. In simple terms, the teleportation point grid j can move to the first layer grid. For example, in a game, a game character can walk from the teleportation point grid j to a first layer grid connected to it.
[0089] It is further assumed that the first layer grid k is any one of the multiple first grids adjacent to the transmission point grid j. Based on this, for the transmission point grid j and the first layer grid k adjacent to the transmission point grid j, step 202 can be implemented as follows:
[0090] Add each transmission point grid to the search queue; obtain any transmission point grid j from the search queue, traverse multiple first-layer grids adjacent to the transmission point grid j, so as to determine the connectivity relationship between the transmission point grid j and the multiple adjacent first-layer grids; if it is determined that the transmission point grid j is connected to the first-layer grid k, then add the first-layer grid k to the search queue; with the first-layer grid in the search queue as the center, traverse the next-layer grid surrounding the first-layer grid to determine the connectivity relationship between the next-layer grid and each transmission point grid.
[0091] Specifically, if a grid is added to the search queue, the search queue will store the index identifier corresponding to the grid. In 202, each transmission point grid is added to the search queue, and the transmission point grids are obtained from the search queue one by one based on the index identifier.
[0092] Taking the case where the currently acquired transmission point grid is transmission point grid j as an example, firstly, multiple first-layer grids adjacent to the transmission point grid j are traversed to determine the connectivity relationship between the transmission point grid j and the multiple adjacent first-layer grids. Optionally, assuming that the transmission point grid j is a two-dimensional grid, in this case, the multiple first-layer grids adjacent to the transmission point grid j can be: first-layer grids distributed in 8 directions with the transmission point grid j as the center.
[0093] Take the first layer grid k among the multiple first layer grids adjacent to the transmission point grid j as an example. If it is determined that the transmission point grid j is connected to the first layer grid k, it means that the first layer grid k is connected to the transmission point grid j, and the two have a connected relationship. In this case, the first layer grid k can be added to the search queue as the basis for traversing the next layer grid. In other words, the next layer grid surrounding the first layer grid will be traversed with the first layer grid in the search queue as the center to determine the connected relationship between the next layer grid and each transmission point grid. Of course, if the first layer grid k is at the edge of the scene, the traversal operation on the next layer grid will be stopped.
[0094] It can be seen from the above steps that by determining the connectivity relationship between the transmission point grid and multiple adjacent first-layer grids, the first-layer grids that have a connectivity relationship with the transmission point grid can be added to the search queue, and the first-layer grids that do not have a connectivity relationship can be removed. Then, based on the first-layer grids that have a connectivity relationship, the next-layer grids surrounding the first-layer grids are traversed to determine the connectivity relationship between the next-layer grids and each transmission point grid. In this way, the connectivity relationship between each grid in the scene map can be detected as a whole with the transmission point grid as the center.
[0095] In practical applications, for example, it is further assumed that the first-layer grid m is any one of the multiple first grids adjacent to the transmission point grid j. Based on this, in 202, an optional implementation method of traversing multiple first-layer grids adjacent to the transmission point grid j to determine the connectivity relationship between the transmission point grid j and the multiple adjacent first-layer grids is specifically:
[0096] Take the position information of the first-layer grid m currently traversed as the first position information; determine whether there is first routing information corresponding to the first position information; if it is determined that the first routing information exists, obtain the first routing information and the second routing information corresponding to the second position information, the second position information being the position information of the transmission point grid j; based on the first routing information and the second routing information, determine whether the transmission point grid j is connected to the first-layer grid m.
[0097] In the above steps, whether the first layer grid m is connected to the transmission point grid j can be simply determined by determining whether the first path finding information exists. That is, if the first path finding information does not exist, in this case, it can be directly determined that the first layer grid m is not connected to the transmission point grid j, and other first layer grids can be traversed. If the first path finding information exists, in this case, it can be preliminarily determined that the first layer grid m and the transmission point grid j may be connected, and the first path finding information and the second path finding information can be used to further determine whether the transmission point grid j and the first layer grid m are connected. Through the above multiple ways of determining the connection relationship, the efficiency of determining the connection relationship can be improved, and the efficiency of generating the transmission information can be further improved.
[0098] Optionally, before taking the position information of the first layer of grid m currently traversed as the first position information, the position information of each of the multiple grids in the scene map can also be obtained through the physical ray (Physic.Raycast) interface. The position information in the embodiment of the present invention includes height information. For example, through the Physic.Raycast interface, in the grid to be marked, rays are emitted downward from a set height to obtain the height information of the grid based on the ray reflection situation, and the height information of the grid is stored in a position information table (such as Hmap). The set height is greater than the height of the highest point in the map. The position information table Hmap constructed by the structure data is, for example, float[M, N]Hmap, where float is the structure data type, [M, N] is the grid coordinate, and Hmap is the structure name.
[0099] Specifically, the first pathfinding information can be implemented as first polygonal mesh information containing first position information, and the second pathfinding information can be implemented as second polygonal mesh information containing second position information. Here, "first" and "second" are only used for distinction. In fact, both of the above two position information can be obtained through the pathfinding information sampling (NavMesh.SamplePosition) interface. Specifically, the NavMesh.Sample Position interface is mainly used to obtain pathfinding information around a certain position. The parameters that need to be input to this interface include the position coordinates of the position and the range that needs to be sampled. Through this interface, you can query whether there is corresponding polygonal mesh (NavMesh, also called pathfinding mesh or navigation mesh) information in the input sampling range.
[0100] Based on this, based on the first routing information and the second routing information, it is determined whether the transmission point grid j and the first layer grid m are connected, which can be implemented as: determining whether there is blocking between the first polygonal grid information and the second polygonal grid information; if it is determined that there is no blocking between the first polygonal grid information and the second polygonal grid information, it is determined that the transmission point grid j and the first layer grid m are connected.
[0101] Here, "blocking" can be understood as the path finding being unconnected. Therefore, in some embodiments, it is assumed that the first polygon mesh information and the second polygon mesh information are obtained through the NavMesh.Sample Position interface. It is assumed that the first polygon mesh information and the second polygon mesh information belong to the same NavMesh set.
[0102] Based on the above assumptions, the first polygon mesh information and the second polygon mesh information are input to the NavMesh.Raycast interface, and the blocking judgment result based on the Nav Mesh set feedback is obtained through the NavMesh.Raycast interface. Further, based on the blocking judgment result, it is determined whether the transmission point mesh j is connected to the first layer mesh m. For example, a blocking judgment result of False means that there is no "path finding blockage" between the first polygon mesh information and the second polygon mesh information, that is, the transmission point mesh j is connected to the first layer mesh m. A blocking judgment result of True means that there is a "path finding blockage" between the first polygon mesh information and the second polygon mesh information, that is, the transmission point mesh j is not connected to the first layer mesh m.
[0103] Of course, the path-finding connection situation can also be used to determine whether the first polygon mesh information and the second polygon mesh information are blocked. If one of the following situations occurs, it is determined that the first polygon mesh information and the second polygon mesh information are path-finding connected (i.e., not blocked): there is a common edge between the first polygon mesh information and the second polygon mesh information, and the first polygon mesh information and the second polygon mesh information are the same common edge polygons.
[0104] Specifically, if there are common edges between the first polygon mesh information and the second polygon mesh information, it means that the two polygon meshes are directly connected. In this case, it can be judged that the two polygon meshes are connected; if the first polygon mesh information and the second polygon mesh information are the same common edge polygons, it means that the two polygon meshes are indirectly connected. In this case, it can also be judged that the two polygon meshes are connected.
[0105] Finally, in 203, based on the connectivity relationship, the transmission point information corresponding to each grid is obtained, and the transmission point information corresponding to each grid is stored in the transmission information table, which can be implemented as follows:
[0106] If the transmission point grid j is connected to the adjacent first-layer grid k, the distance between the first-layer grid k and the transmission point grid j is obtained as the first distance; and the first distance and the transmission point grid j are used as the transmission point information of the first-layer grid k and stored in the transmission information table.
[0107] If it is detected that the transmission point information of the first layer grid k is stored in the transmission information table, it is determined whether the first distance is less than the second distance in the transmission point information of the first layer grid k. If it is determined that the first distance is less than the second distance, it means that the first distance is the shortest path between the first layer grid k and the transmission point grid, and therefore, the first distance and the transmission point grid j need to be stored in the transmission information table to update the transmission information table.
[0108] In an example, the distance between the first layer grid k and the transmission point grid j can be determined in the following manner: specifically, the positional relationship between the first layer grid k and the transmission point grid j is determined, wherein the positional relationship between the first layer grid k and the transmission point grid j includes horizontal connectivity, vertical connectivity, and oblique connectivity. Then, a grid distance matching the positional relationship is obtained, and the grid distance is used as the distance between the first layer grid k and the transmission point grid j.
[0109] In another example, assume that the first layer grid k is connected to the transmission point grid j. Assume that the second layer grid t is adjacent to the first layer grid k, but not adjacent to the transmission point grid j. Assume that the second layer grid t is connected to the transmission point grid j. The positional relationship between the first layer grid k, the second layer grid t, and the transmission point grid j is as follows: Figure 4 shown.
[0110] Based on the above assumptions, the distance between the first layer grid k and the transmission point grid j can be determined in the following manner, specifically: determining the positional relationship between the first layer grid k and the second layer grid t, wherein the positional relationship between the first layer grid k and the second layer grid t includes horizontal connectivity, vertical connectivity, and diagonal connectivity.
[0111] Furthermore, assuming that the second-layer grid t is located horizontally (or vertically) to the first-layer grid k, the matched grid distance is 1; assuming that the second-layer grid t is located obliquely to the first-layer grid k, the matched grid distance is 1.4.
[0112] exist Figure 4 In the example, the second layer grid t is located obliquely to the first layer grid k, and the grid distance that matches the positional relationship is obtained as 1.4, and the sum of the grid distance and the distance from the first layer grid k to the transmission point grid j stored in the transmission information table is used as the distance between the first layer grid k and the transmission point grid j.
[0113] Through the above steps, the transmission information table can be established and maintained, thereby ensuring the reliability of the transmission information table. If the game developer or player needs to add or delete a transmission point, the transmission information table can also be maintained and updated by modifying the search queue in the above steps, providing a basis for a more flexible transmission point management method.
[0114] Figure 1 During the execution of the pathfinding method based on the game scene shown, the scene map loaded by the application is divided into multiple grids, so as to facilitate the search of the transmission point in units of grids. On this basis, in response to the pathfinding instruction issued to the application, the target position is obtained from the pathfinding instruction. Since the target position is usually not located at the transmission point, it is also necessary to determine the target scene area where the target position is located. Furthermore, the transmission point information corresponding to the target scene area is directly obtained from the transmission information table storing the transmission point information corresponding to each of the multiple grids. The transmission point search can be realized without the need for pathfinding data or the use of a pathfinding algorithm to traverse each transmission point, thereby avoiding a large amount of calculations generated during each pathfinding process, and greatly improving the efficiency of the transmission point search. Finally, based on the directly obtained transmission point information corresponding to the target scene area, the action logic corresponding to the pathfinding instruction is executed, and the pathfinding process based on the transmission point information is realized.
[0115] Furthermore, since the teleportation point information can be directly searched from the teleportation information table through the target scene area, the change in the number of teleportation points has little effect on the complexity of the teleportation point search, thereby effectively avoiding the problem of a sharp increase in the complexity of the teleportation point search caused by an increase in the number of teleportation points, making the number of teleportation point configurations in the game scene map unrestricted and the teleportation point configuration more flexible.
[0116] The path-finding device of one or more embodiments of the present invention will be described in detail below. Those skilled in the art will appreciate that these path-finding devices can be configured using commercially available hardware components through the steps taught in this solution.
[0117] Figure 5 Schematic diagram of a path-finding device based on a game scene provided by an embodiment of the present invention. The path-finding device is applied to a server, such as Figure 5 As shown, the path-finding device is applied to an application loaded with a scene map and a transmission information table, the scene map includes multiple scene areas, and the transmission point information corresponding to the multiple scene areas is stored in the transmission information table in units of scene areas; the path-finding device includes: a grid acquisition module 11, an information acquisition module 12, and a logic execution module 13.
[0118] A grid acquisition module 11 is used to respond to a path-finding instruction issued to the application program, obtain a target position from the path-finding instruction, and determine a target scene area where the target position is located;
[0119] An information acquisition module 12 is used to acquire the transmission point information corresponding to the target scene area from the transmission information table;
[0120] The logic execution module 13 is used to execute the action logic corresponding to the path-finding instruction based on the transmission point information corresponding to the target scene area.
[0121] Optionally, the transmission point information corresponding to any grid in the transmission information table includes the nearest transmission point closest to the current scene area, and the distance between the nearest transmission point and the current scene area.
[0122] When the logic execution module 13 executes the action logic corresponding to the pathfinding instruction based on the transmission point information corresponding to the target scene area, it is specifically used to:
[0123] Determine a displacement object corresponding to the pathfinding instruction; and move the displacement object from a current position to a nearest teleportation point based on the nearest teleportation point and the distance between the nearest teleportation point and the target scene area.
[0124] Optionally, the multiple scene areas are multiple grids, and the multiple grids include transmission point grids where the multiple transmission points are located.
[0125] The pathfinding device also includes a generation module, which is used to store the teleportation point information corresponding to each teleportation point grid into a teleportation information table; traverse multiple grids layer by layer around each teleportation point grid to determine the connectivity relationship between each grid in the multiple grids and the teleportation point grid; obtain the teleportation point information corresponding to each grid based on the connectivity relationship, and store the teleportation point information corresponding to each grid into the teleportation information table.
[0126] Optionally, the multiple grids further include multiple first-layer grids adjacent to each transmission point grid.
[0127] The generation module traverses multiple grids layer by layer around each transmission point grid to determine the connectivity relationship between each grid in the multiple grids and the transmission point grid, specifically for:
[0128] Add each transmission point grid to the search queue; obtain any transmission point grid j from the search queue, traverse multiple first-layer grids adjacent to the transmission point grid j to determine the connectivity relationship between the transmission point grid j and the multiple adjacent first-layer grids; if it is determined that the transmission point grid j is connected to the first-layer grid k, add the first-layer grid k to the search queue, wherein the first-layer grid k is any one of the multiple first grids adjacent to the transmission point grid j; with the first-layer grid in the search queue as the center, traverse the next-layer grid surrounding the first-layer grid to determine the connectivity relationship between the next-layer grid and each transmission point grid.
[0129] Optionally, when the generation module traverses a plurality of first-layer grids adjacent to the transmission point grid j to determine the connectivity relationship between the transmission point grid j and the plurality of adjacent first-layer grids, it is specifically configured to:
[0130] Take the position information of the first-layer grid m currently traversed as the first position information; determine whether there is first routing information corresponding to the first position information; if it is determined that the first routing information exists, obtain the first routing information and the second routing information corresponding to the second position information, the second position information being the position information of the transmission point grid j; based on the first routing information and the second routing information, determine whether the transmission point grid j is connected to the first-layer grid m.
[0131] Optionally, the first routing information is first polygonal mesh information including first position information, and the second routing information is second polygonal mesh information including second position information.
[0132] When the generation module determines whether the transmission point grid j is connected to the first layer grid m based on the first path finding information and the second path finding information, it is specifically used to:
[0133] It is determined whether the first polygonal mesh information and the second polygonal mesh information are blocked; if it is determined that the first polygonal mesh information and the second polygonal mesh information are not blocked, it is determined that the transmission point mesh j is connected to the first layer mesh m.
[0134] Optionally, the situation of determining that there is no obstruction between the first polygon mesh information and the second polygon mesh information includes one of the following: there are common edges between the first polygon mesh information and the second polygon mesh information; the first polygon mesh information and the second polygon mesh information are the same common edge polygons.
[0135] Optionally, the transmission point grid j is any one of a plurality of transmission point grids, and the first layer grid k is any one of a plurality of first grids adjacent to the transmission point grid j.
[0136] When the generation module obtains the transmission point information corresponding to each grid based on the connectivity relationship and stores the transmission point information corresponding to each grid into the transmission information table, it is specifically used for:
[0137] If the transmission point grid j is connected to the adjacent first-layer grid k, the distance between the first-layer grid k and the transmission point grid j is obtained as the first distance; and the first distance and the transmission point grid j are used as the transmission point information of the first-layer grid k and stored in the transmission information table.
[0138] Optionally, the generation module is also used to: if the transmission point information of the first layer grid k is stored in the transmission information table, determine whether the first distance is less than the second distance in the transmission point information of the first layer grid k; if the first distance is less than the second distance, store the first distance and the transmission point grid j in the transmission information table to update the transmission information table.
[0139] Figure 5 The path-finding device based on the game scene shown can execute the methods provided in the aforementioned embodiments. For the parts not described in detail in this embodiment, please refer to the relevant description of the aforementioned embodiments, which will not be repeated here.
[0140] In one possible design, the above Figure 5 The structure of the path-finding device shown can be implemented as an electronic device.
[0141] like Figure 6 As shown, the electronic device may include: a processor 21 and a memory 22. The memory 22 stores executable code, and when the executable code is executed by the processor 21, the processor 21 can at least implement the path-finding method based on the game scene provided in the above embodiment. The structure of the electronic device may also include a communication interface 23 for communicating with other devices or communication networks.
[0142] The device embodiments described above are merely illustrative, wherein the modules described as separate components may or may not be physically separated. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. Those of ordinary skill in the art may understand and implement the present invention without creative effort.
[0143] As needed, the systems, methods and devices of the embodiments of the present invention can be implemented as pure software (such as a software program written in Java), as pure hardware (such as a dedicated ASIC chip or FPGA chip), or as a system that combines software and hardware (such as a firmware system that stores fixed code or a system with a general-purpose memory and processor).
[0144] Another aspect of the present invention is a computer-readable medium having computer-readable instructions stored thereon, which, when executed, can implement the game scene-based path-finding method of various embodiments of the present invention.
[0145] While various embodiments of the present invention have been described above, the above description is exemplary, non-exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The scope of the subject matter for which protection is sought is limited only by the appended claims.
Claims
1. A path-finding method based on a game scene, characterized in that: The application is loaded with a scene map and a transmission information table, wherein the scene map includes a plurality of scene areas, the scene area is used as the minimum storage unit for constructing the transmission information table, and the transmission point information corresponding to each of the plurality of scene areas is stored in the transmission information table in units of scene areas, and the transmission point setting method corresponding to the transmission point information includes a game player custom setting; The path finding method comprises: In response to a pathfinding instruction issued to the application, obtaining a target position from the pathfinding instruction, and determining a target scene area where the target position is located; The transmission point information corresponding to the target scene area is obtained from the transmission information table, wherein the transmission point information corresponding to each of the multiple scene areas is stored in the transmission information table in the form of structured data, the multiple scene areas are multiple grids, and the multiple grids include the transmission point grids where the multiple transmission points are located and multiple first-layer grids adjacent to each transmission point network; the transmission point information is obtained through the connectivity relationship between each grid in the multiple grids and the transmission point grid; the connectivity relationship is determined based on the position information of multiple first-layer grids adjacent to the transmission point grid, if it is determined that the first-layer grid k is connected to the transmission point grid, then the next-layer grid surrounding the first-layer grid k is traversed to determine the connectivity relationship between the next-layer grid and the transmission point grid; the position information of the first-layer grid includes the height information of the first-layer grid obtained by emitting rays downward from a set height; Based on the transmission point information corresponding to the target scene area, execute the action logic corresponding to the pathfinding instruction.
2. The method according to claim 1, characterized in that The transmission point information corresponding to the target scene area in the transmission information table includes the nearest transmission point closest to the target scene area, and the distance between the nearest transmission point and the target scene area; The executing the action logic corresponding to the pathfinding instruction based on the transmission point information corresponding to the target scene area includes: Determining a displacement object corresponding to the pathfinding instruction; Based on the nearest transmission point and the distance between the nearest transmission point and the target scene area, the displacement object is moved from the current position to the nearest transmission point.
3. The method according to claim 1, characterized in that The method further comprises: Storing the transmission point information corresponding to each transmission point grid into the transmission information table; Traversing the plurality of grids layer by layer around each transmission point grid to determine a connectivity relationship between each grid in the plurality of grids and the transmission point grid; The transmission point information corresponding to each grid is acquired based on the connectivity relationship, and the transmission point information corresponding to each grid is stored in the transmission information table.
4. The method according to claim 3, characterized in that: The traversing the plurality of grids layer by layer around each transmission point grid to determine the connectivity relationship between each grid in the plurality of grids and the transmission point grid includes: Add each teleportation point grid to the search queue; Obtain any transmission point grid j from the search queue, and traverse a plurality of first-layer grids adjacent to the transmission point grid j to determine a connectivity relationship between the transmission point grid j and the plurality of adjacent first-layer grids; If it is determined that the transmission point grid j is connected to the first layer grid k, the first layer grid k is added to the search queue, wherein the first layer grid k is any one of a plurality of first grids adjacent to the transmission point grid j; Taking the first layer of grids in the search queue as the center, the next layer of grids surrounding the first layer of grids are traversed to determine the connectivity relationship between the next layer of grids and each transmission point grid.
5. The method according to claim 4, characterized in that The traversing a plurality of first-layer grids adjacent to the transmission point grid j to determine a connectivity relationship between the transmission point grid j and the plurality of adjacent first-layer grids includes: The position information of the first layer grid m currently traversed is used as the first position information; Determining whether there is first routing information corresponding to the first location information; If it is determined that the first path finding information exists, obtaining the first path finding information and second path finding information corresponding to the second position information, where the second position information is the position information of the transmission point grid j; Based on the first routing information and the second routing information, it is determined whether the transmission point grid j is connected to the first layer grid m.
6. The method according to claim 5, characterized in that The first pathfinding information is first polygonal mesh information including the first position information, and the second pathfinding information is second polygonal mesh information including the second position information; The determining, based on the first path finding information and the second path finding information, whether the transmission point grid j is connected to the first layer grid m includes: Determine whether the first polygon mesh information and the second polygon mesh information are blocked; If it is determined that the first polygon mesh information and the second polygon mesh information are not blocked, it is determined that the transmission point mesh j is connected to the first layer mesh m.
7. The method according to claim 6, characterized in that The situation of determining that the first polygon mesh information and the second polygon mesh information are not blocked includes one of the following: There is a common edge between the first polygonal mesh information and the second polygonal mesh information; The first polygon mesh information and the second polygon mesh information are the same common edge polygons.
8. The method according to claim 3, characterized in that The transmission point grid j is any one of a plurality of transmission point grids, and the first layer grid k is any one of a plurality of first grids adjacent to the transmission point grid j; The acquiring the transmission point information corresponding to each grid based on the connectivity relationship, and storing the transmission point information corresponding to each grid in the transmission information table, includes: If the transmission point grid j is connected to the adjacent first-layer grid k, obtaining the distance between the first-layer grid k and the transmission point grid j as the first distance; and The first distance and the transmission point grid j are used as the transmission point information of the first layer grid k and stored in the transmission information table.
9. The method according to claim 8, characterized in that Also includes: If the transmission point information of the first layer grid k is stored in the transmission information table, determining whether the first distance is less than the second distance in the transmission point information of the first layer grid k; If the first distance is smaller than the second distance, the first distance and the transmission point grid j are stored in the transmission information table to update the transmission information table.
10. A path-finding device based on a game scene, characterized in that: The device is applied to an application loaded with a scene map and a transmission information table, wherein the scene map includes a plurality of scene areas, the scene area is used as the minimum storage unit for constructing the transmission information table, and the transmission point information corresponding to each of the plurality of scene areas is stored in the transmission information table in units of scene areas, and the transmission point setting method corresponding to the transmission point information includes a game player's custom setting; the device includes: A grid acquisition module, for responding to a pathfinding instruction issued to the application, acquiring a target position from the pathfinding instruction, and determining a target scene area where the target position is located; an information acquisition module, configured to acquire the transmission point information corresponding to the target scene area from a transmission information table, wherein the transmission point information corresponding to each of the plurality of scene areas is stored in the transmission information table in the form of structured data, the plurality of scene areas being a plurality of grids, the plurality of grids comprising the transmission point grids where each of the plurality of transmission points is located and a plurality of first-layer grids adjacent to each transmission point network; the transmission point information is acquired through a connectivity relationship between each grid in the plurality of grids and the transmission point grid; the connectivity relationship is determined based on the position information of the plurality of first-layer grids adjacent to the transmission point grid, if it is determined that the first-layer grid k is connected to the transmission point grid, then the next-layer grids surrounding the first-layer grid k are traversed to determine the connectivity relationship between the next-layer grid and the transmission point grid; the position information of the first-layer grid comprises the height information of the first-layer grid acquired by emitting rays downward from a set height; A logic execution module is used to execute the action logic corresponding to the path-finding instruction based on the transmission point information corresponding to the target scene area.
11. An electronic device, characterized in that: include: A memory and a processor; wherein the memory stores executable code, and when the executable code is executed by the processor, the processor executes the path-finding method based on the game scene as described in any one of claims 1 to 9.
12. A computer-readable medium having stored thereon at least one instruction, at least one program, code set or instruction set, wherein the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement a game scene-based pathfinding method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Method and device for path finding of non-player character, storage medium and computer device
CN112044074A