Method, device, electronic device and readable storage medium for prompting pathfinding information
By dividing areas on the game's large map and determining the set of reference points, the shortest path is quickly filtered out, which solves the problem of low long-distance pathfinding efficiency in the game and improves human-computer interaction efficiency.
Patent Information
- Application Number
- CN202211122438.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-15
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2042-09-15
AI Technical Summary
In the game, when the distance between the current position and the target position is too long, the prior art requires a large amount of calculation data, resulting in low efficiency in showing distance and time to the player and low human-computer interaction efficiency.
By dividing the map area on the game's large map, determining the reference point set of the current location of the virtual character and the end point of the wayfinding point, quickly filtering out the shortest path and calculating the wayfinding time, reducing the amount of data calculation.
It improves the efficiency of showing distance and time to players and improves human-computer interaction efficiency.
Smart Images

Figure CN115382209B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of games, and in particular to a method, device, electronic device and readable storage medium for prompting pathfinding information. Background Art
[0002] During the game process, the player needs to control the virtual character to move in the game scene. In order to better plan the movement process of the virtual character, the player needs to know the distance and time from the current position to the target position. Therefore, an automatic pathfinding algorithm in the game is generated, that is, after determining the current position where the virtual character is located and the target position to be reached, path planning is performed. After the complete path is planned, the distance and time are calculated according to the planned path. In this case, if the distance between the current position and the target position is too long, when planning the complete pathfinding path, the data to be calculated and the planning problems to be considered are relatively many, resulting in a low efficiency of displaying the distance and time from the current position to the target position to the player, and further resulting in a too long waiting time for the player and a low human-computer interaction efficiency. Therefore, how to quickly and efficiently display the distance and time from the current position to the target position to the player has become an urgent problem to be solved. Summary of the Invention
[0003] In view of this, the purpose of the present application is to provide a method, device, electronic device and readable storage medium for prompting pathfinding information. By using a first set of reference points at the current position of the virtual character and a second set of reference points at the pathfinding end position, multiple overall pathfinding distances from the current position to the pathfinding end position are determined, and the shortest path among the multiple overall pathfinding distances is quickly selected, and then the character pathfinding time is quickly calculated, which can reduce the amount of data calculation, improve the efficiency of displaying the distance and time from the current position to the target position to the player, and help improve the human-computer interaction efficiency.
[0004] In a first aspect, an embodiment of the present application provides a method for prompting pathfinding information. A graphical user interface is provided through a terminal device. At least part of the game scene and a game map showing the entire game scene are displayed in the graphical user interface. The game scene includes a target virtual character controlled by the terminal device; the game map includes multiple pre-divided map areas, and each map area includes at least one pathfinding reference point. The pathfinding reference point is a pixel point in the game map and is used to calculate the lengths of different estimated paths. The method for prompting pathfinding information includes:
[0005] Responding to a touch operation on the game map to determine the pathfinding end position;
[0006] Detect whether a preset pathfinding processing condition is satisfied between the current position of the target virtual character and the pathfinding end position; if satisfied, determine a first set of pathfinding reference points in adjacent regions of the map region where the current position is located, and a second set of pathfinding reference points in adjacent regions of the map region where the pathfinding end position is located;
[0007] From the pre-stored set of position point distances and the set of reference point distances, determine a first distance between each first pathfinding reference point in the first set of pathfinding reference points and the current position, a second distance between each second pathfinding reference point in the second set of pathfinding reference points and the pathfinding end position, and a third distance between each first pathfinding reference point and each second pathfinding reference point, and determine a plurality of pathfinding distances;
[0008] Determine the pathfinding distance with the shortest distance among the plurality of pathfinding distances as the target distance, and determine the character pathfinding time according to the target distance;
[0009] Display the target distance and the character pathfinding time at a preset position on the game map.
[0010] In a second aspect, an embodiment of the present application further provides a pathfinding information prompting device, which provides a graphical user interface through a terminal device. At least part of the game scene and a game map showing the entire game scene are displayed in the graphical user interface. The game scene includes a target virtual character controlled by the terminal device; the game map includes a plurality of pre-divided map regions, and each map region includes at least one pathfinding reference point. The pathfinding reference point is a pixel point in the game map and is used to calculate the lengths of different estimated paths. The pathfinding information prompting device includes:
[0011] A position determination module, configured to determine a pathfinding end position in response to a touch operation on the game map;
[0012] A reference point set determination module, configured to detect whether a preset pathfinding processing condition is satisfied between the current position of the target virtual character and the pathfinding end position; if satisfied, determine a first set of pathfinding reference points in adjacent regions of the map region where the current position is located, and a second set of pathfinding reference points in adjacent regions of the map region where the pathfinding end position is located;
[0013] The pathfinding distance determination module is used to determine, from the pre-stored set of position point distances and the set of reference point distances, the first distance between each first pathfinding reference point in the first set of pathfinding reference points and the current position, the second distance between each second pathfinding reference point in the second set of pathfinding reference points and the pathfinding end position, and the third distance between each first pathfinding reference point and each second pathfinding reference point, and determine a plurality of pathfinding distances;
[0014] The pathfinding time determination module is used to determine the shortest pathfinding distance among the plurality of pathfinding distances as the target distance, and determine the character pathfinding time according to the target distance;
[0015] The information display module is used to display the target distance and the character pathfinding time at a preset position on the game map.
[0016] In a third aspect, an embodiment of the present application further provides an electronic device, including: a processor, a storage medium, and a bus. The storage medium stores machine-readable instructions executable by the processor. When the electronic device runs, the processor communicates with the storage medium through the bus. The processor executes the machine-readable instructions to perform the steps of the pathfinding information prompting method according to any one of the first aspects.
[0017] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium. A computer program is stored on the computer-readable storage medium. When the computer program is run by a processor, it performs the steps of the pathfinding information prompting method according to any one of the first aspects.
[0018] The pathfinding information prompting method, device, electronic device, and readable storage medium provided by the embodiments of the present application determine the pathfinding end position in response to a touch operation on the game large map; after determining that the preset pathfinding processing condition is satisfied between the current position of the target virtual character and the pathfinding end position, determine the first pathfinding reference point set corresponding to the current position and the second pathfinding reference point set corresponding to the pathfinding end position; determine, from the pre-stored position point distance set and the reference point distance set, the first distance between each first pathfinding reference point in the first pathfinding reference point set and the current position, the second distance between each second pathfinding reference point in the second pathfinding reference point set and the pathfinding end position, and the third distance between each first pathfinding reference point and each second pathfinding reference point, and determine multiple pathfinding distances; determine the shortest pathfinding distance among the multiple pathfinding distances as the target distance, and calculate the character pathfinding time according to the target distance; display the target distance and the character pathfinding time at a preset position on the game large map. In the embodiments of the present application, through the first reference point set at the current position of the virtual character and the second reference point set at the pathfinding end position, multiple overall pathfinding distances from the current position to the pathfinding end position are determined, and the shortest path among the multiple overall pathfinding distances is quickly screened out, and then the character pathfinding time is quickly calculated, which can reduce the amount of data calculation and improve the efficiency of displaying the distance and time from the current position to the target position to the player, and is helpful to improve the human-computer interaction efficiency.
[0019] To make the above objects, features, and advantages of the present application more obvious and understandable, the following specific embodiments are given in detail in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] To more clearly illustrate the technical solutions of the embodiments of the present application, the accompanying drawings required for the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present application and should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.
[0021] Figure 1 It is a flowchart of a pathfinding information prompting method provided by an embodiment of the present application;
[0022] <H Figure 2 It is a schematic diagram of the divided area of the game large map provided by an embodiment of the present application;
[0023] Figure 3 It is a schematic diagram of the adjacent areas of the target area provided by an embodiment of the present application;
[0024] Figure 4One of the schematic structural diagrams of a pathfinding information prompting device provided by an embodiment of the present application;
[0025] Figure 5 Another schematic structural diagram of a pathfinding information prompting device provided by an embodiment of the present application;
[0026] Figure 6 Schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0027] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in 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. Apparently, the described embodiments are only some of the embodiments of the present application, rather than all the embodiments. Components of the embodiments of the present application usually described and illustrated in the accompanying drawings here can be arranged and designed in various different configurations. Therefore, the detailed description of the embodiments of the present application provided in the accompanying drawings here is not intended to limit the scope of the claimed present application, but merely represents selected embodiments of the present application. Based on the embodiments of the present application, every other embodiment obtained by those skilled in the art without creative efforts shall fall within the protection scope of the present application.
[0028] First, an applicable application scenario of the present application will be introduced. The present application can be applied to the game technology field.
[0029] During the game process, the player needs to control the virtual character to move in the game scene. To better plan the movement process of the virtual character, the player needs to know the distance and time from the current position to the target position. Therefore, an automatic pathfinding algorithm in the game is generated, that is, after determining the current position where the virtual character is located and the target position to be reached, path planning is performed. After the complete path is planned, the distance and time are calculated according to the planned path. In this case, if the distance between the current position and the target position is too long, when planning the complete pathfinding path, there are more data to be calculated and more planning problems to be considered, resulting in a lower efficiency of showing the distance and time from the current position to the target position to the player, and further resulting in a too long waiting time for the player and a low man-machine interaction efficiency. Therefore, how to quickly and efficiently show the distance and time from the current position to the target position to the player has become an urgent problem to be solved.
[0030] Based on this, the embodiments of the present application provide a pathfinding information prompting method to improve the efficiency of showing the distance and time from the current position to the target position to the player and the man-machine interaction efficiency.
[0031] To facilitate understanding of this embodiment, the pathfinding information prompting method, device, electronic device, and readable storage medium provided in this embodiment are described in detail. This embodiment can be applied to the gaming field, for example, in games that transmit frames per second (FPS) or massively multiplayer online (MMO) games. It should be noted that this embodiment is not limited to the above-mentioned types of games, nor is it limited to the gaming field.
[0032] The pathfinding information prompting method in the embodiment of the present application can be run on a terminal device or a server. Among them, the terminal device can be a local terminal device (such as a local touch terminal). When the pathfinding information prompting method runs on a server, it can be a cloud game.
[0033] In an optional implementation, cloud gaming refers to a gaming method based on cloud computing. In the cloud gaming operation mode, the operating entity of the game program and the entity presenting the game screen are separated. The storage and operation of the information generation method are completed on the cloud gaming server. The cloud gaming client is used for receiving and sending data and presenting the game screen. For example, the cloud gaming client can be a display device with data transmission function close to the user side, such as a mobile terminal, TV, computer, PDA, etc.; but the terminal device for information generation is the cloud gaming server in the cloud. When playing the game, the user operates the cloud gaming client to send operation instructions to the cloud gaming server. The cloud gaming server runs the game according to the operation instructions, encodes and compresses the game screen and other data, and returns it to the cloud gaming client through the network. Finally, the cloud gaming client decodes and outputs the game screen.
[0034] In another optional embodiment, the terminal device may be a local terminal device. The local terminal device stores a game program and is used to present the game screen. The local terminal device is used to interact with the user through a graphical user interface, that is, conventionally downloading and installing the game program through an electronic device and running it. The local terminal device may provide the graphical user interface to the user in a variety of ways, for example, it may be rendered and displayed on the display screen of the local terminal device, or provided to the user through holographic projection. For example, the local terminal device may include a display screen and a processor, the display screen is used to present the graphical user interface, the graphical user interface includes the game screen, and the processor is used to run the game, generate the graphical user interface, and control the display of the graphical user interface on the display screen.
[0035] The pathfinding information prompting method provided by the embodiments of the present application can run on the aforementioned local terminal device or on the aforementioned cloud game client. The following takes the pathfinding information prompting method running on the local terminal device (hereinafter referred to as the terminal device) as an example for description.
[0036] Please refer to Figure 1 , Figure 1 which is a flowchart of a pathfinding information prompting method provided by the embodiments of the present application. As Figure 1 shown in
[0037] S101. In response to a touch operation on the game map, determine the pathfinding end position.
[0038] S102. Detect whether a preset pathfinding processing condition is satisfied between the current position of the target virtual character and the pathfinding end position; if satisfied, determine a first set of pathfinding reference points in adjacent regions of the map region where the current position is located, and a second set of pathfinding reference points in adjacent regions of the map region where the pathfinding end position is located.
[0039] S103. Determine, from the pre-stored position point distance set and the reference point distance set, a first distance between each first pathfinding reference point in the first set of pathfinding reference points and the current position, a second distance between each second pathfinding reference point in the second set of pathfinding reference points and the pathfinding end position, and a third distance between each first pathfinding reference point and each second pathfinding reference point, and determine a plurality of pathfinding distances.
[0040] S104. Determine the pathfinding distance with the shortest distance among the plurality of pathfinding distances as the target distance, and determine the character pathfinding time according to the target distance.
[0041] S105. Display the target distance and the character pathfinding time at a preset position on the game map.
[0042] The pathfinding information prompting method provided by the embodiments of the present application determines multiple overall pathfinding distances from the current position to the pathfinding end position through the first set of reference points at the current position of the virtual character and the second set of reference points at the pathfinding end position, quickly screens out the shortest path among the multiple overall pathfinding distances, and then quickly calculates the character pathfinding time, which can reduce the amount of data calculation, improve the efficiency of displaying the distance and time from the current position to the target position to the player, and help improve the human-computer interaction efficiency.
[0043] The following describes each step of the embodiments of the present application by way of example:
[0044] S101. In response to a touch operation on the game's large map, determine the end position of pathfinding.
[0045] In the embodiments of the present application, for different types of games, it may be necessary for the target virtual character to move in the game scene. At this time, the virtual character needs to find the corresponding path in the game scene so as to move to the destination without obstruction. When determining the movement path, the player can complete it through the map provided in the game.
[0046] In a possible implementation manner, after the player opens the game's large map, the player can determine the destination of pathfinding in the game's large map. After receiving the touch operation of the player on the game's large map, according to the operation position of the player's touch operation, the end position of the player's current pathfinding can be determined.
[0047] Specifically, the game includes a mini-map showing the current game scene and a large map showing the entire game scene. In the embodiments of the present application, the focus is on the pathfinding solution for a relatively long distance. Therefore, in the embodiments of the present application, the operation involved is related to the large map showing the entire game scene.
[0048] In a possible implementation manner, please refer to Figure 2 , Figure 2 which is a schematic diagram of the divided areas of the game's large map provided by the embodiments of the present application. As shown in Figure 2 , in order to better determine the pathfinding path and position, before pathfinding, it is necessary to divide the game's large map, and divide multiple map areas in the game's large map to determine the pathfinding reference points and pathfinding positions according to different map areas.
[0049] Specifically, when dividing the map areas in the game's large map, it can be divided according to the plots included in the game's large map (referring to different game scenes included in the map). One plot can correspond to one map area, or it can be further divided according to the size of different plots and the path calculation requirements to subdivide different plots and obtain more map areas. For the pathfinding calculation scheme, the more map areas there are, the finer the division of the game's large map, and the closer the obtained pathfinding scheme is to the actual path, that is, the calculation of the pathfinding path is more accurate.
[0050] It should be noted that for the convenience of calculating the pathfinding path, the different subdivided map areas should have the same shape and size. As shown in Figure 2 , different map areas can be divided into squares, and at the same time, different map areas are numbered.
[0051] In a possible implementation, each map area in the game's large map includes at least one pathfinding reference point, which is a pixel point in the game's large map and is used to calculate the lengths of different estimated paths. For different pathfinding reference points, they are determined after dividing the map area. Specifically, the multiple pathfinding reference points in the game's large map are determined through the following steps:
[0052] a1: Determine the connected regions in each map area of the game's large map; the connected regions are the regions where each pixel in each map area is interconnected with each other.
[0053] a2: For each connected region, determine the central position of the connected region. Taking the central position of the connected region as the center, determine a preset number of pathfinding reference points in the connected region.
[0054] a3: Aggregate the pathfinding reference points of each connected region in each map area to determine the multiple pathfinding reference points in the game's large map.
[0055] In the embodiments of the present application, in different map areas, due to different game scene settings, different areas may be connected (two areas can reach each other) or may not be connected (two areas cannot reach each other). Specifically, for each map area, the region where each pixel in the map area is interconnected with each other is determined as the connected region in the map area.
[0056] In a possible implementation, taking a map area as an example, when setting the pathfinding reference points in the map area, it can be based on the connected region as the reference setting unit. Specifically, at least one pathfinding reference point is selected for each connected region in a map area; if there is no connected region in the map area, no pathfinding reference point will be set in this map area (even if set, since there is no connected region in the map area and other map areas cannot enter and then exit this map area unobstructed, therefore, in the actual pathfinding process, the pathfinding path will not be set at this map area, so it is meaningless to set pathfinding reference points in this map area).
[0057] Furthermore, for a certain connected region, when setting at least one pathfinding reference point included in the connected region, different pathfinding reference points need to be evenly distributed in the connected region as much as possible. Therefore, when setting the pathfinding reference points, first determine the central position of the connected region, and at the same time, according to the coordinates of the central position, adjust the coordinates of different pathfinding reference points so that the mean coordinate of the coordinates of all pathfinding reference points in the connected region (that is, the coordinate point composed of the horizontal and vertical coordinates obtained by averaging all coordinates) is as close as possible to the coordinate of the center point of the connected region.
[0058] After determining at least one pathfinding reference point for each connected component in different map regions, the pathfinding reference points are aggregated to obtain multiple pathfinding reference points distributed in the entire game map. For the convenience of storage and subsequent pathfinding calculations involving the pathfinding reference points, the pathfinding reference points can be numbered and then stored. The numbering rules can be to number them sequentially from a corner of the game map, or to set the numbers according to storage requirements, or to number them according to the map regions where different pathfinding reference points are located.
[0059] S102. Detect whether the preset pathfinding processing condition is satisfied between the current position of the target virtual character and the pathfinding end position; if satisfied, determine the first set of pathfinding reference points in the adjacent regions of the map region where the current position is located, and the second set of pathfinding reference points in the adjacent regions of the map region where the pathfinding end position is located.
[0060] In the embodiment of the present application, after determining the pathfinding end position that the player wants to reach according to the touch operation of the player on the game map, the current position of the target virtual character controlled by the player can be obtained again according to the data in the system (the position on the two-dimensional game map can be represented by two-dimensional coordinates). After determining the current position and the pathfinding end position of the target virtual character, it is necessary to determine whether the preset pathfinding processing condition is satisfied between the current position of the target virtual character and the pathfinding end position. Only when the preset pathfinding processing condition is satisfied between the two, can the pathfinding path be efficiently estimated according to the pathfinding scheme provided in the embodiment of the present application.
[0061] Specifically, the following steps are used to determine that the preset pathfinding processing condition is satisfied between the current position of the target virtual character and the pathfinding end position:
[0062] b1: Detect whether the current position and the pathfinding end position are in the same map region.
[0063] b2: If the current position and the pathfinding end position are not in the same map region, determine that the preset pathfinding processing condition is satisfied between the current position of the target virtual character and the pathfinding end position.
[0064] In the embodiment of the present application, it is aimed at the situation where the distance between the current position of the target virtual character and the pathfinding end position is relatively far. In the game's large map, the distance between the current position and the pathfinding end position can be represented by whether the current position and the pathfinding end position are in the same map area. If the current position and the pathfinding end position are not in the same map area, it is very likely that the player has crossed different scenes during this pathfinding (such as arriving at a city from an island, etc.). Then, the current position of the target virtual character and the pathfinding end position meet the preset pathfinding processing conditions, and the player's current pathfinding is long-distance pathfinding. At this time, in order to improve the pathfinding efficiency, the pathfinding technical solution in the present application can be considered.
[0065] In a possible implementation manner, if the map areas in the game's large map are divided in a relatively detailed manner, and the area covered by each map area in the game's large map is relatively small, different map areas may still be in the same game scene. In this case, after determining that the current position and the pathfinding end position are not in the same map area, it is also necessary to set the number of map areas between the current position and the pathfinding end position. Only when it is determined that the current position and the pathfinding end position are not in the same map area and the number of map areas between the current position and the pathfinding end position is greater than the preset area number threshold, it is determined that the current position of the target virtual character and the pathfinding end position meet the preset pathfinding processing conditions.
[0066] In another possible implementation manner, if it is determined that the current position of the target virtual character and the pathfinding end position do not meet the preset pathfinding processing conditions (the current position and the pathfinding end position are in the same map area, or the current position and the pathfinding end position are not in the same map area, but the number of map areas between the current position and the pathfinding end position is not greater than the preset area number threshold), at this time, for the player's pathfinding requirement, according to the existing pathfinding algorithm, first determine the actual pathfinding path from the current position of the target virtual character to the pathfinding end position, and then calculate pathfinding information such as the path length and pathfinding time of the planned actual pathfinding path.
[0067] For example, the pathfinding algorithm can include the Floyd algorithm, Dijkstra algorithm, A* algorithm, etc.
[0068] In the embodiment of the present application, after determining the current position and the pathfinding end position of the player's current pathfinding, it is necessary to determine the first set of pathfinding reference points in the adjacent areas of the map area where the current position is located and the second set of pathfinding reference points in the adjacent areas of the map area where the pathfinding end position is located respectively according to the current position and the pathfinding end position, so as to perform pathfinding calculations based on the first set of pathfinding reference points and the second set of pathfinding reference points.
[0069] Specifically, the first set of pathfinding reference points is determined through the following steps:
[0070] c1: Determine the target area to which the current position belongs in the game's large map, and centered on the target area, determine multiple adjacent areas connected to the target area in different preset directions.
[0071] c2: Determine the pathfinding reference points included in the target area and the sets of pathfinding reference points included in each adjacent area as the first set of pathfinding reference points.
[0072] In the embodiment of the present application, after determining the current position, after determining the target area where the current position is located on the game's large map, in order to ensure that the walking paths in all directions can be estimated, therefore, different pathfinding reference points need to be determined in the adjacent areas in different preset directions of the target area. Then, determine the multiple reference points in the multiple adjacent areas connected in different preset directions and the target area where the current position is located as the first set of reference points.
[0073] Specifically, please refer to Figure 3 , Figure 3 which is a schematic diagram of the adjacent areas of the target area provided by the embodiment of the present application. As shown in Figure 3 , taking the target area where the current position is located as the center, the eight areas connected to the top, bottom, left, right, upper left, upper right, lower left, and lower right of the target area are all determined as the adjacent neighborhoods (the shaded parts in the figure) where the first set of reference points needs to be determined.
[0074] It should be noted that when determining the reference points in the neighborhood, if there are no pathfinding reference points in the adjacent areas adjacent to the target area, then, when determining the first set of pathfinding reference points, this adjacent area will no longer be considered; in addition, if the target area where the current position is located is at the edge of the game's large map, then, for this target area, there are no eight adjacent areas. At this time, only calculate the pathfinding reference points in the areas adjacent to the target area. That is, for different target areas, the number of adjacent areas is not necessarily eight.
[0075] In a possible implementation manner, the determination method of the second set of reference points corresponding to the pathfinding end position of this pathfinding is the same as that of the first set of reference points. Taking the target area where the pathfinding end position is located as the center, determine the pathfinding reference points in the multiple adjacent areas adjacent to this target area, and then determine the second set of reference points. The specific determination process is the same as that of determining the first set of reference points and will not be elaborated here.
[0076] S103. Determine, from the pre-stored set of position point distances and the set of reference point distances, the first distance between each first pathfinding reference point in the first set of pathfinding reference points and the current position, the second distance between each second pathfinding reference point in the second set of pathfinding reference points and the pathfinding end position, and the third distance between each first pathfinding reference point and each second pathfinding reference point, to determine a plurality of pathfinding distances.
[0077] In an embodiment of the present application, after determining the first set of reference points corresponding to the current position where the target virtual character is located and the second set of reference points corresponding to the pathfinding end position, for each first reference point, the first distance between this first reference point and the current position needs to be obtained. For each second reference point, the second distance between this second reference point and the current position needs to be obtained. Then, the third distance between each first pathfinding reference point and each second pathfinding reference point is obtained. Based on the first distance, the second distance, and the third distance, the pathfinding distances under multiple pathfinding schemes are determined.
[0078] In a possible implementation manner, the set of position point distances and the set of reference point distances store a plurality of pre-calculated distances between different reference points and ordinary points, as well as the distances between different reference points. When calculating the pathfinding distances, the corresponding distances are directly obtained from the set of position point distances and the set of reference point distances. The determination processes of the set of position point distances and the set of reference point distances will be described separately below.
[0079] In a first aspect, the set of position point distances is determined through the following steps:
[0080] d1. For any position in the game map, calculate the position distance from this position to each pathfinding reference point in the game map, save at least one position distance whose position distance is less than the first preset distance threshold, and generate the set of position point distances.
[0081] d2. Combine the sub-sets of position point distances of all positions in the game map to obtain the set of position point distances.
[0082] In an embodiment of the present application, for any position in the game map (which can be any pixel point or any game task position), calculate the position distance from this position to each pathfinding reference point in the game map, save at least one position distance whose position distance is less than the first preset distance threshold, then obtain the sub-set of position point distances of this position, and then combine the sub-sets of position point distances of all positions to obtain the set of position point distances.
[0083] It should be noted that the distance calculated from any position in the large game map to a certain pathfinding reference point is the shortest distance.
[0084] In another possible implementation, the calculated position distances can be sorted in ascending order, and then the N position distances ranked among the top N are saved to generate a set of sub-position point distances for this position.
[0085] In a possible implementation, for the convenience of storing and subsequently searching for different position distance information, when storing the position distance, the length corresponding to the position distance and the position point can be stored together. That is, the position point distance set includes multiple pieces of position distance information, and each piece of position distance information includes position coordinate information, the corresponding position distance information, and the corresponding pathfinding reference point identification information.
[0086] For example, for any position G on the entire large game map, the pathfinding paths from point F to several nearby reference points can be obtained, denoted as PG1, PG2,.... Sort the path lengths and retain the first n shortest paths (if less than n, retain all). The size of n (n >= 1) is determined according to requirements. The larger n is, the more storage space is required, but the estimated distance is closer to the actual distance. This data is stored in the form of (coordinates of position G, reference point number, path length).
[0087] In a possible implementation, the position distance set can be used to save an image with the same size as the large game map, and the coordinates of each pixel in the image correspond to the coordinates of position G in the game map. It should be noted that since the common image format has only 4 channels, each image can save 2 sets of (reference point number, path length) data.
[0088] Furthermore, when saving the position distance information of different positions, to reduce the data storage space, the position distance information of all positions within a preset range can be set to the same one. By using the position distance information within a preset range to represent the position distance information of all positions within the preset range, the number of stored data can be greatly reduced.
[0089] Specifically, before the step of "for any position in the large game map, calculate the position distance from this position to each pathfinding reference point in the large game map", the prompting method further includes:
[0090] f1: For any position in the large game map, detect whether there is a position point for which the position distance information has been calculated within the preset area range of the map area where this position is located.
[0091] f2: For any position in the game's large map, if there is a position point with position distance information within the preset range of the map area where this position is located, determine the position distance information of the position point for which the position distance information calculation is completed as the position distance information of this position.
[0092] In the embodiments of the present application, for any position in the game's large map, detect whether there is a position point for which the position distance information calculation is completed within the preset range of the map area where this position is located. If so, determine the position distance information of the position point for which the position distance information calculation is completed as the position distance information of this position.
[0093] Specifically, multiple position points (such as 25 pixel points) within the preset range of a certain position can share the distance calculation result (position distance information) of this position point. Taking this position point as H, use point H as the calculation result of the n-layer domain. The value of n is determined according to requirements. Assume there are m pixel points in the n-layer domain. Then the calculation amount and storage space of this step can be reduced by m times. In this way, while improving the calculation efficiency, the memory storage space can also be saved.
[0094] In the second aspect, determine the set of reference point distances through the following steps:
[0095] g1: For any pathfinding reference point in the game's large map, calculate the reference point distance between this pathfinding reference point and each other pathfinding reference point in the game's large map except this pathfinding reference point, save at least one reference point distance of the position distance whose reference point distance is less than the second preset distance threshold, and generate a sub-reference point distance set of the pathfinding reference point;
[0096] g2: Combine the sub-reference point distance sets of all pathfinding reference points in the game's large map to obtain the set of reference point distances.
[0097] In the embodiments of the present application, for any pathfinding reference point in the game's large map, calculate the reference point distance between this pathfinding reference point and each other pathfinding reference point in the game's large map except this pathfinding reference point, save at least one reference point distance of the position distance whose reference point distance is less than the second preset distance threshold, then obtain the sub-reference point distance set of this position, and then combine the sub-reference point distance sets of all pathfinding reference points to obtain the set of reference point distances.
[0098] Similarly, in another possible implementation manner, the calculated reference point distances can also be sorted in ascending order, and then the first N reference point distances in the sorted order are saved to generate the sub-reference point distance set of this pathfinding reference point.
[0099] Similarly, for the convenience of storing and subsequent searching for distance information of different reference points, when storing the distance of the reference points, the paths between different reference points, the path lengths, and the reference point identifiers can be stored simultaneously. That is, the set of position point distances includes multiple pieces of reference point distance information, and each piece of reference point distance information includes the first reference point identifier information, the corresponding reference point distance information, and the second reference point identifier information.
[0100] For example, for any pathfinding reference point C on the entire game map, calculate the distance from the pathfinding reference point C to the pathfinding reference point D, and obtain the path as P and the path length as L. Then the storage method can be (the reference point number of point C, the reference point number of point D, the path length L CD ).
[0101] It should be noted that different pathfinding algorithms are selected according to the calculation requirements to try to find the shortest pathfinding paths between reference points pairwise. However, the pathfinding algorithm used here should be consistent with the commonly used pathfinding algorithms in the game to avoid a large error between the estimated result and the actual pathfinding.
[0102] After determining the set of position point distances and the set of reference point distances, in the process of determining the specific pathfinding path, the first distance, the second distance, and the third distance need to be determined from the set of position point distances and the set of reference point distances respectively. Taking the determination of the first distance as an example below, the determination process of the first distance is described. The determination methods of the second distance and the third distance are the same as that of the first distance and will not be elaborated in the embodiments of the present application.
[0103] Specifically, the step "for each first reference point, determine the first distance between the first pathfinding reference point and the current position through the following steps" includes:
[0104] h1: For each first reference point, based on the target coordinate information of the current position, determine at least one piece of candidate position information with the same position coordinate information as the target coordinate information from the set of position point distances;
[0105] h2: For each first reference point, determine the target position information with the same pathfinding reference point identifier information as the corresponding pathfinding reference point from the at least one piece of candidate position information;
[0106] h3: For each first reference point, determine the distance information included in the piece of target position information as the first distance between the first pathfinding reference point and the current position.
[0107] In an embodiment of the present application, for each reference point, according to the target coordinate information of the current position, first determine at least one piece of candidate position information whose position coordinate information is consistent with the target coordinate information from the set of position point distances; then for each piece of candidate position information, determine the target position information whose corresponding pathfinding reference point identification information is consistent with this pathfinding reference point, and then determine the distance information included in the determined target position information as the first distance between this first pathfinding reference point and the current position.
[0108] Among them, the determination methods of the second distance and the third distance are the same as that of the first distance, and will not be elaborated in the embodiments of the present application.
[0109] Furthermore, after determining multiple first distances, multiple second distances, and multiple third distances, respectively arrange and combine each first distance, each second distance, and each third distance to obtain multiple groups of different distance combinations of (first distance, second distance, third distance), and respectively add the first distance, second distance, and third distance in each distance combination to obtain multiple pathfinding distances.
[0110] S104: Determine the pathfinding distance with the shortest distance among the multiple pathfinding distances as the target distance, and determine the character pathfinding time according to the target distance.
[0111] In an embodiment of the present application, after determining multiple pathfinding distances, determine the pathfinding distance with the shortest distance from the multiple pathfinding distances, and determine this pathfinding distance as the target distance. At the same time, calculate the character pathfinding time according to the determined target distance.
[0112] Specifically, the step "determine the character pathfinding time according to the target distance" includes:
[0113] i1: Determine the actual pathfinding distance based on the target distance and a preset distance adjustment coefficient.
[0114] i2: Determine the character pathfinding time based on the actual pathfinding distance and the moving speed of the target virtual character.
[0115] In an embodiment of the present application, the estimated target distance is generally longer than the actual pathfinding distance in the game scene. Therefore, it is necessary to set a distance adjustment coefficient to determine the actual pathfinding distance. After determining the actual pathfinding distance, determine the character pathfinding time according to the actual pathfinding distance and the moving speed of the target virtual character.
[0116] In a possible implementation manner, the distance adjustment coefficient can be set to any value within the range of 0.9 to 0.98 according to the error adjustment experience.
[0117] In another possible implementation, after determining multiple pathfinding distances, the pathfinding distances can also be filtered in combination with the road conditions (whether the road is easy to pass and the presence of enemy virtual characters on this road) on the pathfinding paths corresponding to different pathfinding distances, so as to filter out the road that best meets the player's pathfinding needs.
[0118] Specifically, different weight coefficients can be set, and different dimensions of the road conditions and the pathfinding distances are weighted and calculated to calculate the road scores of each pathfinding path. The target path is filtered according to the road scores, and then the character pathfinding time is calculated according to the distance of the target path.
[0119] S105. Display the target distance and the character pathfinding time at a preset position on the game map.
[0120] In the embodiment of the present application, after determining the target distance and the character pathfinding time of the estimated target pathfinding path, the target distance and the pathfinding time need to be displayed at a preset position on the game map to prompt the player of the distance from the current position to the pathfinding end position.
[0121] In a possible implementation, the preset position on the game map can be the operation position of the player's touch operation on the game map, that is, the pathfinding end position; it can also be a preset position on the game map, which can be set according to needs and is not specifically limited in the embodiment of the present application.
[0122] Next, specific examples will be used to elaborate on the process of prompting pathfinding information in the embodiment of the present application. Specifically:
[0123] Step 1: When receiving the player's touch operation on the game map, determine the player's current position coordinate point J and the target coordinate point K.
[0124] Step 2: Query the position point distance set to obtain the pathfinding lengths P of point J to several nearby reference points J1 , P J2 , P J3 ...P Jn , and obtain the pathfinding lengths P of point K to several nearby reference points K1 , P K2 , P K3 ...P Kn ;
[0125] Step 3: Assume that P J1 corresponds to point J and reference point R, and point P K1 corresponds to point K and reference point T. Query the 'reference point distance set' to obtain the path length P between reference points R and T RTThen the estimated path length from point J to point K is S JK = P J1 + P K1 + P RT ;
[0126] Step 4: Arbitrarily select one from the Ps at the starting point Jn and the Ps at the target point Kn respectively, and perform Step 3 pairwise. Then the distance from any starting point to any target point can be obtained, denoted as S n . Select the shortest path from the n estimated paths S, which is the estimated path length. If the character pathfinding time for the pathfinding path needs to be displayed on the map, then the character pathfinding time = estimated path length / character walking speed; where, in order to eliminate the error between the estimated path length and the actual path length, the estimated path length can be multiplied by the distance adjustment coefficient first, and then the character pathfinding time can be calculated
[0127] The pathfinding information prompting method provided by the embodiment of the present application responds to a touch operation on the game map to determine the pathfinding end position; after determining that the preset pathfinding processing condition is satisfied between the current position of the target virtual character and the pathfinding end position, determine the first pathfinding reference point set corresponding to the current position and the second pathfinding reference point set corresponding to the pathfinding end position; determine the first distance between each first pathfinding reference point in the first pathfinding reference point set and the current position, the second distance between each second pathfinding reference point in the second pathfinding reference point set and the pathfinding end position, and the third distance between each first pathfinding reference point and each second pathfinding reference point from the pre-stored position point distance set and the reference point distance set, and determine multiple pathfinding distances; determine the shortest pathfinding distance among the multiple pathfinding distances as the target distance, and calculate the character pathfinding time according to the target distance; display the target distance and the character pathfinding time at a preset position on the game map. In the embodiment of the present application, through the first reference point set at the current position of the virtual character and the second reference point set at the pathfinding end position, multiple overall pathfinding distances from the current position to the pathfinding end position are determined, and the shortest path among the multiple overall pathfinding distances is quickly screened out, and then the character pathfinding time is quickly calculated, which can reduce the data calculation amount and improve the efficiency of displaying the distance and time from the current position to the target position to the player, and help improve the human-computer interaction efficiency
[0128] Based on the same inventive concept, the embodiment of the present application also provides a pathfinding information prompting device corresponding to the pathfinding information prompting method. Since the principle of solving problems by the device in the embodiment of the present application is similar to the above pathfinding information prompting method in the embodiment of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be elaborated
[0129] Please refer toFigures 4 to 5 , Figure 4 is one of the schematic structural diagrams of a pathfinding information prompting device provided by an embodiment of the present application, Figure 5 and is the second of the schematic structural diagrams of a pathfinding information prompting device provided by an embodiment of the present application. As Figure 4 shown in, the prompting device 400 includes:
[0130] A position determination module 410, configured to determine a pathfinding end position in response to a touch operation on the game map;
[0131] A reference point set determination module 420, configured to detect whether a preset pathfinding processing condition is satisfied between the current position of the target virtual character and the pathfinding end position; if satisfied, determine a first set of pathfinding reference points in adjacent regions of the map region where the current position is located, and a second set of pathfinding reference points in adjacent regions of the map region where the pathfinding end position is located;
[0132] A pathfinding distance determination module 430, configured to determine, from a pre-stored position point distance set and a reference point distance set, a first distance between each first pathfinding reference point in the first set of pathfinding reference points and the current position, a second distance between each second pathfinding reference point in the second set of pathfinding reference points and the pathfinding end position, and a third distance between each first pathfinding reference point and each second pathfinding reference point, and determine a plurality of pathfinding distances;
[0133] A pathfinding time determination module 440, configured to determine the pathfinding distance with the shortest distance among the plurality of pathfinding distances as the target distance, and determine the character pathfinding time according to the target distance;
[0134] An information display module 450, configured to display the target distance and the character pathfinding time at a preset position on the game map.
[0135] In a possible implementation manner, as Figure 5 shown, the prompting device 400 further includes a pathfinding reference point determination module 460, and the pathfinding reference point determination module 460 is configured to determine a plurality of pathfinding reference points in the game map through the following steps:
[0136] Determine the connected regions in each map region of the game map; the connected region is a region where each pixel in each map region is interconnected;
[0137] For each connected region, determine the central position of the connected region, and determine a preset number of pathfinding reference points in the connected region with the central position of the connected region as the center;
[0138] Collect the pathfinding reference points of each connected region in each map area, and determine multiple pathfinding reference points in the game's large map.
[0139] In a possible implementation manner, as Figure 5 shown, the prompting device 400 further includes a position point distance set determination module 470, and the position point distance set determination module 470 is used to determine the position point distance set through the following steps:
[0140] For any position in the game's large map, calculate the position distance from this position to each pathfinding reference point in the game's large map, save at least one position distance of the position distances whose position distances are less than the first preset distance threshold, and generate a sub-position point distance set of this position;
[0141] Collect the sub-position point distance sets of all positions in the game's large map to obtain the position point distance set;
[0142] Among them, the position point distance set includes multiple position distance information, and each position distance information includes position coordinate information, corresponding position distance information, and corresponding pathfinding reference point identification information.
[0143] In a possible implementation manner, as Figure 5 shown, the prompting device 400 further includes a position detection module 480, and the position detection module 480 is used for:
[0144] For any position in the game's large map, detect whether there is a position point whose position distance information has been calculated within the preset area range of the map area where this position is located;
[0145] For any position in the game's large map, if there is a position point with position distance information within the preset area range of the map area where this position is located, determine the position distance information of the position point whose position distance information has been calculated as the position distance information of this position.
[0146] In a possible implementation manner, as Figure 5 shown, the prompting device 400 further includes a reference point distance set determination module 490, and the reference point distance set determination module 490 is used to determine the reference point distance set through the following steps:
[0147] For any pathfinding reference point in the game's large map, calculate the reference point distance between this pathfinding reference point and each other pathfinding reference point in the game's large map except this pathfinding reference point, save at least one reference point distance of the reference point distances whose reference point distances are less than the second preset distance threshold, and generate a sub-reference point distance set of the pathfinding reference point;
[0148] Collect the sub-reference point distance set containing all pathfinding reference points in the game's large map to obtain the reference point distance set;
[0149] Among them, the position point distance set includes multiple reference point distance information. Each piece of reference point distance information includes first reference point identification information, corresponding reference point distance information, and second reference point identification information.
[0150] In a possible implementation manner, the reference point set determination module 420 is configured to determine that the current position of the target virtual character and the pathfinding end position satisfy a preset pathfinding processing condition through the following steps:
[0151] Detect whether the current position and the pathfinding end position are in the same map area;
[0152] If the current position and the pathfinding end position are not in the same map area, it is determined that the current position of the target virtual character and the pathfinding end position satisfy a preset pathfinding processing condition.
[0153] In a possible implementation manner, the reference point set determination module 420 is configured to determine the first pathfinding reference point set through the following steps:
[0154] Determine the target area where the current position is located in the game's large map, and centering on the target area, determine multiple adjacent areas connected to the target area in different preset directions;
[0155] Determine the pathfinding reference points included in the target area and the set of pathfinding reference points included in each adjacent area as the first pathfinding reference point set.
[0156] In a possible implementation manner, for each first reference point, the pathfinding distance determination module 430 is configured to determine the first distance between the first pathfinding reference point and the current position through the following steps:
[0157] For each first reference point, based on the target coordinate information of the current position, determine at least one piece of candidate position information in the position point distance set whose position coordinate information is consistent with the target coordinate information;
[0158] For each first reference point, determine the target position information in the at least one piece of candidate position information whose corresponding pathfinding reference point identification information is consistent with the pathfinding reference point;
[0159] For each first reference point, determine the distance information included in the piece of target position information as the first distance between the first pathfinding reference point and the current position.
[0160] In a possible implementation manner, when the pathfinding time determination module 440 is used to determine the character pathfinding time according to the target distance, the pathfinding time determination module 440 is configured to:
[0161] Determine the actual pathfinding distance based on the target distance and a preset distance adjustment coefficient;
[0162] Determine the character pathfinding time based on the actual pathfinding distance and the moving speed of the target virtual character.
[0163] The pathfinding information prompting device provided by the embodiments of the present application responds to a touch operation on the game map to determine the pathfinding end position; after determining that the preset pathfinding processing condition is satisfied between the current position of the target virtual character and the pathfinding end position, determine the first set of pathfinding reference points corresponding to the current position and the second set of pathfinding reference points corresponding to the pathfinding end position; determine, from the pre-stored position point distance set and the reference point distance set, the first distance between each first pathfinding reference point in the first set of pathfinding reference points and the current position, the second distance between each second pathfinding reference point in the second set of pathfinding reference points and the pathfinding end position, and the third distance between each first pathfinding reference point and each second pathfinding reference point, and determine a plurality of pathfinding distances; determine the shortest pathfinding distance among the plurality of pathfinding distances as the target distance, and calculate the character pathfinding time according to the target distance; display the target distance and the character pathfinding time at a preset position on the game map. In the embodiments of the present application, through the first set of reference points at the current position of the virtual character and the second set of reference points at the pathfinding end position, multiple overall pathfinding distances from the current position to the pathfinding end position are determined, and the shortest path among the multiple overall pathfinding distances is quickly screened out, and then the character pathfinding time is quickly calculated, which can reduce the amount of data calculation and improve the efficiency of displaying the distance and time from the current position to the target position to the player, and help improve the human-computer interaction efficiency.
[0164] Please refer to Figure 6 , Figure 6 which is a schematic structural diagram of an electronic device provided by the embodiments of the present application. As Figure 6 shown in
[0165] The memory 620 stores machine-readable instructions executable by the processor 610. When the electronic device 600 runs, the processor 610 communicates with the memory 620 through the bus 630, so that the processor 610 executes the following instructions when running:
[0166] Respond to a touch operation on the game map to determine the pathfinding end position;
[0167] Detect whether a preset pathfinding processing condition is satisfied between the current position of the target virtual character and the pathfinding end position; if satisfied, determine a first set of pathfinding reference points in adjacent regions of the map region where the current position is located, and a second set of pathfinding reference points in adjacent regions of the map region where the pathfinding end position is located;
[0168] From the pre-stored position point distance set and reference point distance set, determine a first distance between each first pathfinding reference point in the first set of pathfinding reference points and the current position, a second distance between each second pathfinding reference point in the second set of pathfinding reference points and the pathfinding end position, and a third distance between each first pathfinding reference point and each second pathfinding reference point, and determine a plurality of pathfinding distances;
[0169] Determine the pathfinding distance with the shortest distance among the plurality of pathfinding distances as the target distance, and determine the character pathfinding time according to the target distance;
[0170] Display the target distance and the character pathfinding time at a preset position on the game map.
[0171] In a possible implementation manner, in the instructions executed by the processor 610, the following steps are used to determine that a preset pathfinding processing condition is satisfied between the current position of the target virtual character and the pathfinding end position:
[0172] Detect whether the current position and the pathfinding end position are located in the same map region;
[0173] If the current position and the pathfinding end position are not located in the same map region, determine that a preset pathfinding processing condition is satisfied between the current position of the target virtual character and the pathfinding end position.
[0174] In a possible implementation manner, in the instructions executed by the processor 610, the following steps are used to determine a plurality of pathfinding reference points in the game map:
[0175] Determine the connected domains in each map region of the game map; the connected domain is a region where each pixel in each map region is interconnected;
[0176] For each connected domain, determine the central position of the connected domain, and take the central position of the connected domain as the center, and determine a preset number of pathfinding reference points in the connected domain;
[0177] Collect the pathfinding reference points of each connected domain in each map region, and determine a plurality of pathfinding reference points in the game map.
[0178] In a possible implementation, among the instructions executed by the processor 610, the first pathfinding reference point set is determined through the following steps:
[0179] Determine the target area to which the current position belongs in the game's large map, and with the target area as the center, determine a plurality of adjacent areas connected to the target area in different preset directions;
[0180] Determine the pathfinding reference points included in the target area and the pathfinding reference point sets included in each adjacent area as the first pathfinding reference point set.
[0181] In a possible implementation, among the instructions executed by the processor 610, the position point distance set is determined through the following steps:
[0182] For any position in the game's large map, calculate the position distance from this position to each pathfinding reference point in the game's large map, save at least one position distance whose position distance is less than the first preset distance threshold, and generate a sub-position point distance set for this position;
[0183] Aggregate the sub-position point distance sets of all positions included in the game's large map to obtain the position point distance set;
[0184] Among them, the position point distance set includes multiple pieces of position distance information, and each piece of position distance information includes position coordinate information, the corresponding position distance information, and the corresponding pathfinding reference point identification information.
[0185] In a possible implementation, the instructions executed by the processor 610 further include:
[0186] For any position in the game's large map, detect whether there is a position point for which the position distance information has been calculated within the preset area range of the map area where this position is located;
[0187] For any position in the game's large map, if there is a position point with position distance information within the preset area range of the map area where this position is located, determine the position distance information of the position point for which the position distance information has been calculated as the position distance information of this position.
[0188] In a possible implementation, among the instructions executed by the processor 610, the reference point distance set is determined through the following steps:
[0189] For any pathfinding reference point in the game's large map, calculate the reference point distances between this pathfinding reference point and all other pathfinding reference points in the game's large map except this pathfinding reference point, save at least one reference point distance of the position distances where the reference point distance is less than the second preset distance threshold, and generate a sub-reference point distance set of the pathfinding reference point;
[0190] Aggregate the sub-reference point distance sets in the game's large map that contain all pathfinding reference points to obtain the reference point distance set;
[0191] Among them, the position point distance set includes multiple reference point distance information. Each piece of reference point distance information includes first reference point identification information, corresponding reference point distance information, and second reference point identification information.
[0192] In a possible implementation, in the instructions executed by the processor 610, for each first reference point, determine the first distance between this first pathfinding reference point and the current position through the following steps:
[0193] For each first reference point, based on the target coordinate information of the current position, determine at least one piece of candidate position information in the position point distance set whose position coordinate information is consistent with the target coordinate information;
[0194] For each first reference point, determine the target position information whose corresponding pathfinding reference point identification information is consistent with this pathfinding reference point from the at least one piece of candidate position information;
[0195] For each first reference point, determine the distance information included in this piece of target position information as the first distance between this first pathfinding reference point and the current position.
[0196] In a possible implementation, in the instructions executed by the processor 610, the determining the character pathfinding time according to the target distance includes:
[0197] Based on the target distance and a preset distance adjustment coefficient, determine the actual pathfinding distance;
[0198] Based on the actual pathfinding distance and the movement speed of the target virtual character, determine the character pathfinding time.
[0199] In the above - mentioned manner, according to the first set of reference points at the current position of the virtual character and the second set of reference points at the path - finding end position, the shortest path among multiple path - finding distances from the current position to the path - finding end position is quickly screened out. Furthermore, the character path - finding time is quickly calculated. While reducing the amount of data calculation and improving the efficiency of showing the distance and time from the current position to the target position to the player, the shortest path among multiple paths can also be screened out, improving the rationality of path - finding and contributing to improving the human - computer interaction efficiency. At the same time, when saving the position - distance information of different positions, the position - distance information of all positions within a preset range is set to be the same. By using the position - distance information within a preset range to represent the position - distance information of all positions within the preset range, the number of stored data can be greatly reduced, saving storage space.
[0200] The embodiment of the present application also provides a computer - readable storage medium, on which a computer program is stored, so that when the computer program is run by a processor, the following instructions are executed:
[0201] In response to a touch operation on the game map, determine the path - finding end position;
[0202] Detect whether the current position of the target virtual character and the path - finding end position satisfy a preset path - finding processing condition; if satisfied, determine the first set of path - finding reference points in the adjacent regions of the map area where the current position is located, and the second set of path - finding reference points in the adjacent regions of the map area where the path - finding end position is located;
[0203] From the pre - stored set of position - point distances and the set of reference - point distances, determine the first distance between each first path - finding reference point in the first set of path - finding reference points and the current position, the second distance between each second path - finding reference point in the second set of path - finding reference points and the path - finding end position, and the third distance between each first path - finding reference point and each second path - finding reference point, and determine multiple path - finding distances;
[0204] Determine the path - finding distance with the shortest distance among the multiple path - finding distances as the target distance, and determine the character path - finding time according to the target distance;
[0205] Display the target distance and the character path - finding time at a preset position on the game map.
[0206] In a possible implementation manner, in the instructions executed by the computer - readable storage medium, the following steps are used to determine that the current position of the target virtual character and the path - finding end position satisfy the preset path - finding processing condition:
[0207] Detect whether the current position and the pathfinding end position are in the same map area;
[0208] If the current position and the pathfinding end position are not in the same map area, determine that the preset pathfinding processing conditions are met between the current position of the target virtual character and the pathfinding end position.
[0209] In a possible implementation, in the instructions executed by the computer-readable storage medium, the following steps are used to determine multiple pathfinding reference points in the game's large map:
[0210] Determine the connected regions in each map area of the game's large map; the connected region is the region where each pixel in each map area is interconnected;
[0211] For each connected region, determine the central position of the connected region, and centered on the central position of the connected region, determine a preset number of pathfinding reference points in the connected region;
[0212] Collect the pathfinding reference points of each connected region in each map area to determine multiple pathfinding reference points in the game's large map.
[0213] In a possible implementation, in the instructions executed by the computer-readable storage medium, the following steps are used to determine the first set of pathfinding reference points:
[0214] Determine the target area to which the current position belongs in the game's large map, and centered on the target area, determine multiple adjacent areas connected to the target area in different preset directions;
[0215] Combine the pathfinding reference points included in the target area and the set of pathfinding reference points included in each adjacent area to determine the first set of pathfinding reference points.
[0216] In a possible implementation, in the instructions executed by the computer-readable storage medium, the following steps are used to determine the set of position distances:
[0217] For any position in the game's large map, calculate the position distance from this position to each pathfinding reference point in the game's large map, save at least one position distance whose position distance is less than the first preset distance threshold, and generate a sub-set of position distances for this position;
[0218] Combine the sub-sets of position distances of all positions included in the game's large map to obtain the set of position distances;
[0219] Among them, the position point distance set includes multiple pieces of position distance information, and each piece of position distance information includes position coordinate information, corresponding position distance information, and corresponding pathfinding reference point identification information.
[0220] In a possible implementation manner, the instructions executed by the computer-readable storage medium further include:
[0221] For any position in the game large map, detect whether there is a position point at which the position distance information calculation is completed within the preset area range of the map area where the position is located;
[0222] For any position in the game large map, if there is a position point with position distance information within the preset area range of the map area where the position is located, determine the position distance information of the position point at which the position distance information calculation is completed as the position distance information of this position.
[0223] In a possible implementation manner, in the instructions executed by the computer-readable storage medium, the reference point distance set is determined through the following steps:
[0224] For any pathfinding reference point in the game large map, calculate the reference point distance between this pathfinding reference point and each other pathfinding reference point except this pathfinding reference point in the game large map, save at least one reference point distance of the position distance whose reference point distance is less than the second preset distance threshold, and generate a sub-reference point distance set of the pathfinding reference point;
[0225] Combine the sub-reference point distance sets of all pathfinding reference points in the game large map to obtain the reference point distance set;
[0226] Among them, the position point distance set includes multiple pieces of reference point distance information, and each piece of reference point distance information includes first reference point identification information, corresponding reference point distance information, and second reference point identification information.
[0227] In a possible implementation manner, in the instructions executed by the computer-readable storage medium, for each first reference point, the following steps are used to determine the first distance between this first pathfinding reference point and the current position:
[0228] For each first reference point, based on the target coordinate information of the current position, determine at least one piece of candidate position information in the position point distance set whose position coordinate information is the same as the target coordinate information;
[0229] For each first reference point, determine the target position information whose corresponding pathfinding reference point identification information is the same as this pathfinding reference point from the at least one piece of candidate position information;
[0230] For each first reference point, the distance information included in the target position information is determined as the first distance between the first pathfinding reference point and the current position.
[0231] In a possible implementation manner, among the instructions executed by the computer-readable storage medium, the determining the character pathfinding time according to the target distance includes:
[0232] Based on the target distance and a preset distance adjustment coefficient, determine the actual pathfinding distance;
[0233] Based on the actual pathfinding distance and the moving speed of the target virtual character, determine the character pathfinding time.
[0234] Through the above method, according to the set of first reference points at the current position of the virtual character and the set of second reference points at the pathfinding end position, the shortest path among multiple pathfinding distances from the current position to the pathfinding end position can be quickly screened out. Furthermore, the character pathfinding time can be quickly calculated, which can reduce the amount of data calculation, improve the efficiency of showing the distance and time from the current position to the target position to the player, and at the same time screen out the shortest path among multiple paths, improving the rationality of pathfinding and helping to improve the human-computer interaction efficiency. Also, when saving the position distance information of different positions, by setting the position distance information of all positions within a preset range to be the same, and representing the position distance information of all positions within the preset range with the position distance information within a preset range, the number of stored data can be greatly reduced, saving storage space.
[0235] Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.
[0236] In several embodiments provided in the present application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. The device embodiments described above are only illustrative. For example, the division of the units is only a logical function division, and there can be other division methods in actual implementation. Also, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other can be through some communication interfaces. The indirect coupling or communication connection of the devices or units can be in an electrical, mechanical, or other forms.
[0237] The unit described as a separation component may or may not be physically separated. The component displayed as a unit may or may not be a physical unit, that is, it may be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0238] In addition, in each embodiment of the present application, each functional unit may be integrated in a processing unit, may exist physically alone for each unit, or two or more units may be integrated in one unit.
[0239] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or a part of this technical solution can be embodied in the form of a software product. This computer software product 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.) to execute all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks, or optical discs that can store program codes.
[0240] Finally, it should be noted that: the above-described embodiments are only specific implementation manners of the present application, used to illustrate the technical solutions of the present application, rather than limiting it. The protection scope of the present application is not limited thereto. Although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: any person skilled in the art within the technical scope disclosed by the present application can still modify the technical solutions recorded in the foregoing embodiments or can easily think of changes, or perform equivalent replacements on some of the technical features; and these modifications, changes, or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be covered by the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A method for prompting pathfinding information, characterized in that, Provide a graphical user interface through a terminal device. At least part of a game scene and a game map showing all game scenes are displayed in the graphical user interface. The game scene includes a target virtual character controlled by the terminal device. The game map includes a plurality of pre-divided map areas, and each map area includes at least one pathfinding reference point. The pathfinding reference point is a pixel point in the game map and is used to calculate the lengths of different estimated paths. The method for prompting pathfinding information includes: In response to a touch operation on the game map, determine the pathfinding end position; Detect whether a preset pathfinding processing condition is satisfied between the current position of the target virtual character and the pathfinding end position. If satisfied, determine a first set of pathfinding reference points in adjacent areas of the map area where the current position is located, and a second set of pathfinding reference points in adjacent areas of the map area where the pathfinding end position is located; Determine, from a pre-stored set of position point distances and a set of reference point distances, a first distance between each first pathfinding reference point in the first set of pathfinding reference points and the current position, a second distance between each second pathfinding reference point in the second set of pathfinding reference points and the pathfinding end position, and a third distance between each first pathfinding reference point and each second pathfinding reference point, and determine a plurality of pathfinding distances; Determine the pathfinding distance with the shortest distance among the plurality of pathfinding distances as the target distance, and determine the character pathfinding time according to the target distance; Display the target distance and the character pathfinding time at a preset position on the game map; Determine the first set of pathfinding reference points through the following steps: Determine the target area to which the current position belongs in the game map, and take the target area as the center to determine a plurality of adjacent areas connected to the target area in different preset directions; Determine the pathfinding reference points included in the target area and the set of pathfinding reference points included in each adjacent area as the first set of pathfinding reference points; For each first pathfinding reference point, determine the first distance between the first pathfinding reference point and the current position through the following steps: For each first pathfinding reference point, based on the target coordinate information of the current position, determine at least one piece of candidate position information with the same position coordinate information as the target coordinate information from the set of position point distances; For each first pathfinding reference point, determine the target position information with the same pathfinding reference point identification information as the corresponding pathfinding reference point from the at least one piece of candidate position information; For each first pathfinding reference point, determine the distance information included in the piece of target position information as the first distance between the first pathfinding reference point and the current position.
2. The prompting method according to claim 1, wherein Determine that the preset pathfinding processing condition is satisfied between the current position of the target virtual character and the pathfinding end position through the following steps: Detect whether the current position and the pathfinding end position are in the same map area; If the current position and the pathfinding end position are not in the same map area, determine that the preset pathfinding processing conditions are met between the current position of the target virtual character and the pathfinding end position.
3. The prompting method according to claim 1, wherein Determine multiple pathfinding reference points in the game's large map through the following steps: Determine the connected regions in each map area of the game's large map; the connected region is the region where each pixel in each map area is connected to each other; For each connected region, determine the central position of the connected region, and with the central position of the connected region as the center, determine a preset number of pathfinding reference points in the connected region; Collect the pathfinding reference points of each connected region in each map area to determine multiple pathfinding reference points in the game's large map.
4. The prompting method according to claim 1, characterized in that, Determine the position point distance set through the following steps: For any position in the game's large map, calculate the position distance from this position to each pathfinding reference point in the game's large map, save at least one position distance whose position distance is less than the first preset distance threshold, and generate a sub-position point distance set for this position; Collect the sub-position point distance sets including all positions in the game's large map to obtain the position point distance set; Among them, the position point distance set includes multiple pieces of position distance information, and each piece of position distance information includes position coordinate information, the corresponding position distance information, and the corresponding pathfinding reference point identification information.
5. The prompting method according to claim 4, characterized in that, Before calculating the position distance from any position in the game's large map to each pathfinding reference point in the game's large map, the prompting method further includes: For any position in the game's large map, detect whether there is a position point whose position distance information has been calculated within the preset area range of the map area where this position is located; For any position in the game's large map, if there is a position point whose position distance information has been calculated within the preset area range of the map area where this position is located, determine the position distance information of the position point whose position distance information has been calculated as the position distance information of this position.
6. The prompting method according to claim 1, wherein Determine the reference point distance set through the following steps: For any pathfinding reference point in the game's large map, calculate the reference point distance between this pathfinding reference point and each other pathfinding reference point in the game's large map except this pathfinding reference point, save at least one reference point distance whose reference point distance is less than the second preset distance threshold, and generate a sub-reference point distance set for the pathfinding reference point; Collect the sub-reference point distance sets including all pathfinding reference points in the game's large map to obtain the reference point distance set; Among them, the position point distance set includes multiple pieces of reference point distance information, and each piece of reference point distance information includes the first reference point identification information, the corresponding reference point distance information, and the second reference point identification information.
7. The prompting method according to claim 1, wherein The determining of the character pathfinding time according to the target distance includes: Based on the target distance and the preset distance adjustment coefficient, determine the actual pathfinding distance; Based on the actual pathfinding distance and the moving speed of the target virtual character, determine the character pathfinding time.
8. A prompting device for wayfinding information, characterized in that, A graphical user interface is provided through a terminal device. At least part of a game scene and a game map showing all game scenes are displayed in the graphical user interface. The game scene includes a target virtual character controlled by the terminal device. The game map includes a plurality of pre-divided map areas, and each map area includes at least one pathfinding reference point. The pathfinding reference point is a pixel point in the game map and is used to calculate the lengths of different estimated paths. The pathfinding information prompting device includes: A position determination module for determining a pathfinding end position in response to a touch operation on the game map; A reference point set determination module for detecting whether a preset pathfinding processing condition is satisfied between the current position of the target virtual character and the pathfinding end position. If satisfied, determining a first set of pathfinding reference points in adjacent areas of the map area where the current position is located, and a second set of pathfinding reference points in adjacent areas of the map area where the pathfinding end position is located; A pathfinding distance determination module for determining, from a pre-stored position point distance set and a reference point distance set, a first distance between each first pathfinding reference point in the first set of pathfinding reference points and the current position, a second distance between each second pathfinding reference point in the second set of pathfinding reference points and the pathfinding end position, and a third distance between each first pathfinding reference point and each second pathfinding reference point, and determining a plurality of pathfinding distances; A pathfinding time determination module for determining the shortest pathfinding distance among the plurality of pathfinding distances as the target distance, and determining a character pathfinding time based on the target distance; An information display module for displaying the target distance and the character pathfinding time at a preset position on the game map; The reference point set determination module is used to determine the first set of pathfinding reference points through the following steps: Determining a target area to which the current position belongs in the game map, and taking the target area as the center, determining a plurality of adjacent areas connected to the target area in different preset directions; Determining the pathfinding reference points included in the target area and the set of pathfinding reference points included in each adjacent area as the first set of pathfinding reference points; For each first pathfinding reference point, the pathfinding distance determination module is used to determine the first distance between this first pathfinding reference point and the current position through the following steps: For each first pathfinding reference point, based on the target coordinate information of the current position, determining at least one candidate position information whose position coordinate information is consistent with the target coordinate information from the position point distance set; For each first pathfinding reference point, determining, from the at least one candidate position information, target position information whose corresponding pathfinding reference point identification information is consistent with this pathfinding reference point; For each first pathfinding reference point, determining the distance information included in this piece of target position information as the first distance between this first pathfinding reference point and the current position.
9. An electronic device, characterized in that, Including: A processor, a storage medium, and a bus, wherein the storage medium stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of the pathfinding information prompting method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is run by the processor, it performs the steps of the pathfinding information prompting method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Way-finding method in game, terminal and readable storage medium
CN110812844A
Way-finding method and device, electronic equipment and readable storage medium
CN114053713A