Server-side path-finding method, device and equipment for sand table game and medium

By marking and correlating the door and pathfinding routes in the sandbox game, and cutting the path when the door state changes, the pressure problem of real-time path detection on server performance is solved, and more efficient route correction and game carrying capacity are achieved.

CN119868932APending Publication Date: 2025-04-25GUANGZHOU THUNDER INTERACTIVE NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510159587.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-13
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

In existing sandbox games, real-time path detection puts great pressure on server performance, and it is impossible to sense changes in the location of the unreached area in advance, resulting in limited game carrying capacity.

Method used

By setting marks and relating to the route search, the route is immediately corrected when the door state changes from passable to non-passable without real-time path detection. The specific method includes setting a first mark for the gate when the map data is generated, setting a second mark when generating a route search route and associating the gate mark, performing path cutting when the gate state changes, and determining the intersection point as the path correction target point using the line segment intersection method.

Benefits of technology

It realizes the perception and correction of routes in advance when the gate state changes, reduces the pressure of path detection and calculation, and improves the server carrying capacity of the game.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119868932A_ABST
    Figure CN119868932A_ABST
Patent Text Reader

Abstract

The invention discloses a server-side way-finding method, device and equipment for a sand table game and a medium, and relates to the technical field of way-finding of sand table games. The method comprises the steps that when map data is generated, a first mark is set for a door; when the way-finding route of each moving target is generated, a second mark is set for the way-finding route, and meanwhile, a first mark of a door passed by the way-finding route is obtained, so that the first mark of each passed door is associated with the second mark of the way-finding route of the corresponding moving target; and when the state of the door is changed from the passable state to the impassable state, obtaining corresponding way-finding routes, then carrying out intersection judgment on the original path of each way-finding route and the area of the door with the changed state, and taking the intersection point as a target point of path cutting. According to the method, the door and the path-finding path are marked and associated, and the path is obtained and corrected through the association relationship when the state of the door is changed, so that the pressure of path detection calculation is greatly relieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of sandbox game pathfinding, and in particular to a server-side pathfinding method, device, equipment and medium for sandbox games. Background Art

[0002] In the popular sandbox games on the market today, large maps with long-distance automatic pathfinding have become a standard feature of the game. As the richness of the game content increases, the map is also getting bigger and bigger. In large sandbox games, there are usually thousands or even tens of thousands of players playing on the same map. These players' map movement operations are almost all the time, and after the player goes offline, they still need to simulate a "real person" moving on the map. Moreover, with the continuous update of gameplay and graphics, the elements on the sandbox map are also increasing, evolving from the original "large plane" to "mountains, rivers, cities and tribes." This means there are several major premises: ① multiple players, ② computing is also required offline, ③ large maps, and ④ dynamic terrain interaction.

[0003] In the currently popular sandbox strategy games, a common practice is to divide the large map into small maps or small areas, and adjust the map opening according to the progress of the game and the occupation of the camps composed of different players in the game. This change in map status is real-time, and even in some real-time interactive scenes, the change in the walkable state of the map area needs to be reflected immediately. For example, the player sets a target location and automatically finds a way to the point. There is a door between the player's area and the target area. At this time, an event occurred in the game that caused the door to be inaccessible to the player. It is necessary to immediately correct and generate a new route on the player's interface. The newly corrected target location is near the door, and the route needs to be updated in real time to the surrounding players so that players can take new interactive actions. This is very important for the experience of real-time interactive games.

[0004] In the current implementation of maps, the complete map needs to be divided into multiple connectable areas (such as Figure 1 M1, M2, M3 in the figure), where the black lines represent impassable boundaries and the areas connected have “gates” ( Figure 1 The gray circular icon in the middle is used for passage. When the door is closed, the two areas cannot pass through each other. Based on the map's walkable range and whether the doors between the two areas are connected, a planned route consisting of multiple coordinates from the starting point to the end point can be generated (for example Figure 1A1—>Point A), in this planned route, it passes through one or more areas and finally reaches the target location. When the control entity is moving on the planned route, if the state of the map changes at this time, and the area that was originally traversable becomes untraversable, it is necessary to re-correct the planned route, try to get closer to the target location set by the player, and recalculate the new achievable target location.

[0005] The existing method is to monitor changes in real time, by constantly monitoring the physical position and path, so as to react in time when the door closes. In the main loop logic of the server, monitor whether the front position is feasible. If it is not feasible, stop immediately. The existing implementation strategy is introduced as follows: Figure 1 As shown, assuming that the planned route of the entity is {A1, A2, A3, A4, A5, A}, the target moves from A1 to position A. At this time, the location of A1-A2 is the map area M1, and the map of A3-A4 is M2. The system will update the coordinate position in a frame-driven manner to simulate the movement behavior. The formula is: next position = current position + frame interval (unit ms) × speed. At this time, when the door of M1-M2 is closed to the player camp, when the player is about to reach the door (gray circle) in the middle of A2-A3, the next position is already within the range of the door and cannot continue to walk, so it stops at the current position. The logic of this implementation method is that after calculating the route in advance, the position is updated in real time at each step and whether the position is valid. It is a very common practice. The advantage is that the logic is simple and there will be no complex abnormal situations. This is called real-time path detection in this field.

[0006] However, the sandbox map is large in size, has many players, and has complex terrain, which places very high demands on the server's carrying capacity. When each player plays and finds a way on the large map, the existing real-time path detection method will put a lot of pressure on the server performance. The rationality of the position needs to be verified for each frame so that it can stop in time when entering an inaccessible area. In addition, real-time path detection is based on the current position and cannot perceive the position changes of the unreached area in advance. Therefore, when there is a lot of business logic processing, the consumption of real-time path detection will become an important part of the bottleneck limiting the game's carrying capacity. Summary of the invention

[0007] The technical problem to be solved by the present invention is to provide a server-side pathfinding method, device, equipment and medium for a sandbox game. By setting marks and associating doors and pathfinding routes respectively, the corresponding route can be corrected immediately when the state of the door changes from passable to impassable, without the need for real-time path detection, which greatly alleviates the pressure of path detection calculation.

[0008] In a first aspect, the present invention provides a server-side pathfinding method for a sandbox game, comprising: When the map data is generated, a first mark is set for the door; When generating a pathfinding route for each moving target, a second mark is set for the pathfinding route, and at the same time, a first mark of a door passed by the pathfinding route is obtained, so that the first mark of each door passed by is associated with the second mark of the pathfinding route corresponding to the moving target; When the state of the door changes from passable to impassable, the corresponding pathfinding route is obtained, and then the intersection of the original path of each pathfinding route and the area of ​​the door whose state has changed is judged, and the intersection point is used as the target point for path clipping.

[0009] Furthermore, if there are two or more intersection points when performing intersection judgment, the nearest intersection point is taken as the target point for path clipping.

[0010] Furthermore, it also includes: when generating map data, determining the range of the door as a circle and setting the radius length; when making an intersection judgment, using the line segment intersection method to obtain two intersection points, and taking the nearest intersection point as the target point for path clipping.

[0011] Furthermore, when the moving target reaches the target point of the path clipping and stops moving, a new pathfinding route is regenerated, a second mark is generated and associated with the passed door.

[0012] In a second aspect, the present invention provides a server-side pathfinding device for a sandbox game, comprising: A map generation module, used for setting a first mark for the door when the map data is generated; A path finding association module, used for setting a second mark on the path finding route when generating a path finding route for each moving target, and obtaining a first mark of a door passed by the path finding route, so as to associate each door point passed by with the path finding route of the corresponding moving target; The path correction module is used to obtain the corresponding path finding route when the door state changes from passable to impassable, and then make an intersection judgment between the original path of each path finding route and the area of ​​the door with the changed state, and use the intersection point as the target point for path clipping.

[0013] Furthermore, in the path correction module, if there are two or more intersection points when performing intersection judgment, the nearest intersection point is taken as the target point for path clipping.

[0014] Furthermore, in the map generation module, when generating map data, the range of the door is determined as a circle and the radius length is set; in the path correction module, when making an intersection judgment, the line segment intersection method is used to obtain two intersection points, and the nearest intersection point is taken as the target point for path clipping.

[0015] Furthermore, the path-finding association module is also used to regenerate a new path-finding route, generate a second mark and associate it with the door passed when the moving target reaches the target point of the path clipping and stops moving.

[0016] In a third aspect, the present invention provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect when executing the program.

[0017] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.

[0018] The technical solution provided in the embodiments of the present invention has at least the following technical effects: By marking and associating the door and the path-finding route respectively, the route data is immediately corrected when the state of the door changes from passable to impassable. This allows the change of the path state to be sensed earlier than the existing solution, and the route data is immediately corrected when the state changes. At the same time, there is no need for real-time detection as in the existing solution, which greatly alleviates the pressure of path detection calculation.

[0019] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The present invention will be further described below in conjunction with embodiments with reference to the accompanying drawings.

[0021] Figure 1 A schematic diagram of a map and a path-finding route in the prior art; Figure 2 is a flow chart of the method in Embodiment 1 of the present invention; Figure 3 Schematic diagram of using the line segment intersection circle method to perform intersection judgment in Embodiment 1 of the present invention; Figure 4 It is a structural schematic diagram of the device in the second embodiment of the present invention; Figure 5 This is a schematic diagram of the structure of an electronic device in Embodiment 3 of the present invention; Figure 6 Schematic diagram of the structure of the medium in the fourth embodiment of the present invention. DETAILED DESCRIPTION

[0022] The embodiments of the present invention provide a server-side pathfinding method, device, equipment and medium for a sandbox game. By setting marks and associating doors and pathfinding routes respectively, the corresponding route is immediately corrected when the state of the door changes from passable to impassable, without the need for real-time path detection, which greatly alleviates the pressure of path detection calculation.

[0023] The technical solution in the embodiment of the present invention has the following general idea: There are two designs to achieve more efficient course correction, firstly: 1) The strategy of exchanging space for time, through the state mapping of doors and routes, facilitates timely notification of changes to the corresponding player's path-finding route when the state of the door changes.

[0024] For example, you can build a system that adds tags to all doors and routes, and associate the door tags with the route tags. All pathfinding routes that pass through the door can be quickly found through the association relationship. You only need to associate and disassociate the route with the door passed when the route is generated and removed (reflected in the player's start and stop movement), for example, door 1 (route 1, route 2, route 3, ...), door 2 (route 1, route 3, route 5, ...).

[0025] The second is how to get a suitable end point coordinate: 2) Use the line segment intersection method to determine where to stop near the door, which can be used as the best position for route correction.

[0026] Embodiment 1 This embodiment provides a server-side path-finding method for a sandbox game, such as Figure 2 As shown, including: S1. When generating map data, set a first mark for the door; for example, each door may be numbered (door 1, door 2, ...).

[0027] S2. When generating a pathfinding route for each moving target, a second mark is set for the pathfinding route, and at the same time, a first mark of a door passed by the pathfinding route is obtained, so as to associate the first mark of each door passed by with the second mark of the pathfinding route corresponding to the moving target.

[0028] In a possible implementation, the door is open to all players in the same state, and the generated pathfinding route can be numbered (route 1, route 2, ...). The pathfinding route is associated with the door passed, for example: door 1 (route 1, route 2, route 3, ...), door 2 (route 1, route 3, route 5, ...).

[0029] In another possible implementation, the players do not belong to the same camp, and the door has different opening states for players from different camps. In this case, the second mark set may include the route number and the camp to which it belongs.

[0030] S3. When the state of the door changes from passable to impassable, the corresponding pathfinding route is obtained, and then the original path of each pathfinding route is judged to intersect with the area of ​​the door whose state has changed, and the intersection point is used as the target point for path clipping, that is, the end point of the route is re-modified so that the route does not enter the impassable area. If there are two or more intersection points when making the intersection judgment, the nearest intersection point is taken as the target point for path clipping. For example, if there are currently two routes that pass through door 1, then when the state of door 1 changes, route 1 and route 2 are notified in time, and then route 1 and route 2 are corrected (i.e. path clipping), so that the route can be changed at the moment the state of the door changes.

[0031] In a possible implementation, in order to obtain a suitable end point coordinate, the method further includes: when generating map data, determining the range of the door as a circle and setting a suitable radius length (to facilitate calculation of intersection points); when performing intersection judgment, using the line segment intersection method to obtain two intersection points, and taking the nearest intersection point as the target point for path clipping, such as Figure 3 As shown, two intersection points p1 and p2 are calculated, and the nearest intersection point p1 is taken as the target point for path segment clipping, so that the corrected path points A1, A2, and p1 can be obtained. It is a better implementation method to determine the range of the door as a circle and use the line segment intersection method to obtain the intersection as the appropriate end point coordinate. Those skilled in the art can also set the range of the door to other shapes, such as an ellipse or a rectangle, which can intersect with the original path to obtain the intersection.

[0032] When the door is closed only to players of the designated camp, the original path of the designated camp's pathfinding route through the door is obtained based on the association relationship and the second mark, and the intersection with the area of ​​the door that has changed its state is judged, and the path is clipped; the pathfinding routes of other camps are not processed.

[0033] When the moving target reaches the target point of the path clipping (such as Figure 3 When p1) in the figure stops moving, a new pathfinding route can be regenerated, a second marker is generated and associated with the door passed.

[0034] Based on the same inventive concept, the present application also provides a device corresponding to the method in Example 1, see Example 2 for details.

[0035] Embodiment 2 In this embodiment, a server-side path-finding device for a sandbox game is provided. Figure 4 As shown, including: A map generation module, used for setting a first mark for the door when the map data is generated; A path finding association module, used for setting a second mark on the path finding route when generating a path finding route for each moving target, and obtaining a first mark of a door passed by the path finding route, so as to associate each door point passed by with the path finding route of the corresponding moving target; The path correction module is used to obtain the corresponding path finding route when the door state changes from passable to impassable, and then make an intersection judgment between the original path of each path finding route and the area of ​​the door with the changed state, and use the intersection point as the target point for path clipping.

[0036] In this embodiment, in the path correction module, if there are two or more intersection points when performing intersection judgment, the nearest intersection point is taken as the target point for path clipping.

[0037] In this embodiment, in the map generation module, when generating map data, the range of the door is determined as a circle and the radius length is set; in the path correction module, when making an intersection judgment, the line segment intersection method is used to obtain two intersection points, and the nearest intersection point is taken as the target point for path clipping.

[0038] In this embodiment, the path-finding association module is also used to regenerate a new path-finding route, generate a second mark and associate it with the door passed when the moving target reaches the target point of the path clipping and stops moving.

[0039] Since the device introduced in the second embodiment of the present invention is a device used to implement the method of the first embodiment of the present invention, those skilled in the art can understand the specific structure and deformation of the device based on the method introduced in the first embodiment of the present invention, so it is not described here in detail. All devices used in the method of the first embodiment of the present invention belong to the scope of protection of the present invention.

[0040] Based on the same inventive concept, the present application provides an electronic device embodiment corresponding to the first embodiment, see the third embodiment for details.

[0041] Embodiment 3 This embodiment provides an electronic device, such as Figure 5 As shown, it includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, any implementation method in the first embodiment can be implemented.

[0042] Since the electronic device introduced in this embodiment is a device used to implement the method in the first embodiment of the present application, based on the method introduced in the first embodiment of the present application, a person skilled in the art can understand the specific implementation of the electronic device of the present embodiment and its various variations, so how the electronic device implements the method in the embodiment of the present application is not described in detail here. As long as a person skilled in the art implements the device used by the method in the embodiment of the present application, it belongs to the scope of protection of the present application.

[0043] Based on the same inventive concept, the present application provides a storage medium corresponding to the first embodiment, see the fourth embodiment for details.

[0044] Embodiment 4 This embodiment provides a computer-readable storage medium, such as Figure 6 As shown, a computer program is stored thereon, and when the computer program is executed by a processor, any implementation method in Example 1 can be implemented.

[0045] Since the computer-readable storage medium introduced in this embodiment is a computer-readable storage medium used to implement the method in the first embodiment of the present application, based on the method introduced in the first embodiment of the present application, a person skilled in the art can understand the specific implementation of the computer-readable storage medium of the present embodiment and its various variations, so how the computer-readable storage medium implements the method in the embodiment of the present application is not described in detail here. As long as a person skilled in the art implements the computer-readable storage medium used in the method in the embodiment of the present application, it belongs to the scope of protection of the present application.

[0046] The present invention sets marks and associates the door and the path-finding route respectively, and immediately corrects the route data when the door changes from passable to impassable, so that the change of the path state can be sensed earlier than the existing solution, and the route data can be corrected immediately when the state changes. At the same time, there is no need to detect in real time as in the existing solution, which greatly alleviates the pressure of path detection calculation. Further, the line segment intersection method is used to determine where to stop near the door, which can be used as the best position for route correction.

[0047] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0048] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0049] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0050] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0051] Although the specific implementation modes of the present invention are described above, those skilled in the art should understand that the specific implementation modes described are only illustrative and are not intended to limit the scope of the present invention. Equivalent modifications and changes made by those skilled in the art in accordance with the spirit of the present invention should be included in the scope of protection of the claims of the present invention.

Claims

1. A server-side pathfinding method for a sandbox game, characterized in that: include: When the map data is generated, a first mark is set for the door; When generating a pathfinding route for each moving target, a second mark is set for the pathfinding route, and at the same time, a first mark of a door passed by the pathfinding route is obtained, so that the first mark of each door passed by is associated with the second mark of the pathfinding route corresponding to the moving target; When the state of the door changes from passable to impassable, the corresponding pathfinding route is obtained, and then the intersection of the original path of each pathfinding route and the area of ​​the door whose state has changed is judged, and the intersection point is used as the target point for path clipping.

2. The method according to claim 1, characterized in that: If there are two or more intersection points when performing intersection judgment, take the nearest intersection point as the target point for path clipping.

3. The method according to claim 1, characterized in that: Also includes: When the map data is generated, the range of the door is determined as a circle and the radius length is set; when making an intersection judgment, the line segment intersection method is used to obtain two intersection points, and the nearest intersection point is taken as the target point for path clipping.

4. The method according to claim 1, characterized in that: When the moving target reaches the target point of path clipping and stops moving, a new pathfinding route is regenerated, a second mark is generated and associated with the passed door.

5. A server-side path-finding device for a sandbox game, characterized in that: include: A map generation module, used for setting a first mark for the door when the map data is generated; A path finding association module, used for setting a second mark on the path finding route when generating a path finding route for each moving target, and obtaining a first mark of a door passed by the path finding route, so as to associate each door point passed by with the path finding route of the corresponding moving target; The path correction module is used to obtain the corresponding path finding route when the door state changes from passable to impassable, and then make an intersection judgment between the original path of each path finding route and the area of ​​the door with the changed state, and use the intersection point as the target point for path clipping.

6. The device according to claim 5, characterized in that: In the path correction module, if there are two or more intersection points when performing intersection judgment, the nearest intersection point is taken as the target point for path clipping.

7. The device according to claim 5, characterized in that: In the map generation module, when the map data is generated, the range of the door is determined as a circle and the radius length is set; in the path correction module, when the intersection judgment is performed, the line segment intersection method is used to obtain two intersection points, and the nearest intersection point is taken as the target point for path clipping.

8. The device according to claim 5, characterized in that: The path-finding association module is also used to regenerate a new path-finding route, generate a second mark and associate it with the door passed when the moving target reaches the target point of the path clipping and stops moving.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 4 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.