Game object pathfinding method and apparatus, and computer readable storage medium
By coordinating the processing of map servers and pathfinding servers, movement paths that avoid static and dynamic obstacles are generated, solving the problem of path penetration in game object pathfinding and improving the game experience and resource utilization efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- LILITH TECH (SHANGHAI) CO LTD
- Filing Date
- 2020-07-03
- Publication Date
- 2026-06-09
AI Technical Summary
In existing technologies, the pathfinding methods for game objects cannot effectively avoid dynamic obstacles, leading to path penetration and resource waste, which affects the game experience.
The calculation of movement paths for game objects is separated from the map. Position prediction is introduced, and the map server and pathfinding server work together to generate movement paths that avoid static and dynamic obstacles.
It achieves efficient movement path planning for game objects, avoids wasting client resources and redundant pathfinding, and improves the game experience.
Smart Images

Figure CN113877208B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of gaming devices, and more particularly to a method, apparatus, and computer-readable storage medium for pathfinding game objects. Background Technology
[0002] With the continuous development of internet technology, the gaming industry has also grown significantly. Gamers are paying particular attention to the performance of game AI and other players within the game. Taking strategy games (SLGs) as an example, during the strategic planning and gameplay, the game objects controlled by the player, as well as the game's NPCs, will continuously move. Therefore, pathfinding for game objects from one location to another is a common behavior in games.
[0003] During pathfinding, the best path is often obstructed. Generally, obstructions are divided into two types: static obstructions and dynamic obstructions. Static obstructions are those determined when the game map is generated, such as terrain obstructions, trees, and houses. Dynamic obstructions are those that can change at any time, such as the obstruction caused by the game object controlled by the player during its movement.
[0004] Currently, most player unit movement in games is handled through client-side pathfinding and movement. Client-driven movement generally doesn't consider dynamic obstacles, treating movement as a straight line from start to finish (unit movement on the map is a straight line, regardless of whether it passes through obstacles). Even when obstacles are present, they can pass through each other, negatively impacting the gaming experience.
[0005] Furthermore, when it comes to mobile pathfinding, the general approach is to implement it on the terminal. While this helps to distribute the overhead and pressure of pathfinding and reduce the server load, it cannot guarantee path optimization and the requirement to completely avoid obstacles.
[0006] Therefore, a new method for pathfinding game objects is needed to calculate the shortest movement path with the high computing power of the server, and to avoid obstructing the movement path. Summary of the Invention
[0007] In order to overcome the above-mentioned technical defects, the present invention aims to provide a method, device and computer-readable storage medium for pathfinding in games, which separates the movement calculation of objects in the game from the map, introduces position prediction when considering dynamic obstruction of the map, and reduces the probability of object movement collision and re-pathfinding.
[0008] This invention discloses a method for pathfinding game objects, comprising the following steps:
[0009] A game object receives a move request and sends its starting and ending points to the map server.
[0010] The map server packages the received starting point, ending point, obstruction information, and registered paths into map information and sends it to the route-finding server.
[0011] The pathfinding server generates a movement path based on the map information and sends the movement path to the map server;
[0012] The map server determines whether there are static obstruction objects and future dynamic obstruction objects in the movement path;
[0013] When there are no static blocking objects or future dynamic blocking objects, the map server marks the movement path as valid and registers the map units passed through in the movement path to control the movement of game objects along the movement path.
[0014] When there are static blocking objects and future dynamic blocking objects, the map server sends a re-pathing request to the route-finding server. The route-finding server generates an updated path based on the re-pathing request and sends the updated path to the map server until the map server determines that the updated path does not have static blocking objects and future dynamic blocking objects.
[0015] Preferably, the step of a game object receiving a movement request and sending its starting point and ending point of movement to the map server includes:
[0016] The game object receives a move request;
[0017] The game object sends its starting point, ending point, and movement path length threshold to the movement agent node;
[0018] The mobile agent node sends the starting point, ending point, and path length threshold to the map server.
[0019] The steps by which the map server packages the received starting point, ending point, obstruction information, and registered paths into map information and sends it to the route-finding server include:
[0020] The map server packages the received starting point, ending point, obstruction information, registered map units, and their registration times into map information and sends it to the route-finding server.
[0021] Preferably, the step of the map server determining whether there are static obstructing objects and future dynamic obstructing objects in the movement path includes:
[0022] The map server reads the desired map cell for the movement path and compares the desired map cell with the registered map cells.
[0023] When at least one of the desired map units overlaps with at least one of the registered map units, the map server determines that there are static blocking objects and future dynamic blocking objects in the movement path.
[0024] When all elements in the desired map cell do not overlap with all elements in the registered map cells, the map server determines that there are no static or future dynamic obstruction objects in the movement path.
[0025] Preferably, the registered map units include: registered static map units with a constant registration time and registered dynamic map units with a registration start time and a registration end time;
[0026] When at least one of the desired map units overlaps with at least one of the registered map units, and the desired registration period between the desired registration start time and the desired registration end time of the desired map unit partially overlaps with the registered period between the registration start time and the registration end time, the map server determines that there are future dynamic obstruction objects in the movement path.
[0027] When all of the desired map units do not overlap with all of the registered map units, or at least one of the desired map units overlaps with at least one of the registered map units, and the desired registration period between the desired registration start time and the desired registration end time of the desired map unit does not overlap with the registered period between the registration start time and the registration end time, the map server determines that there are no future dynamic obstruction objects in the movement path.
[0028] Preferably, when there are no static blocking objects or future dynamic blocking objects, the map server marks the movement path as valid and registers the map units traversed in the movement path to control the movement of game objects along the movement path. The steps include:
[0029] When there are no static blocking objects and no future dynamic blocking objects, the map server divides the movement path into at least two path units, marks the path unit with the movement starting point as the end as legal, and registers the map units in the legal path units to control the movement of game objects through the registered map units.
[0030] When a game object moves, the map server sequentially checks whether there are static blocking objects and future dynamic blocking objects in the unmarked path cell;
[0031] When an unmarked path cell does not have a static blocking object or a future dynamic blocking object, the map server sequentially marks the path cell as valid and registers the map cells in the valid path cell to control the movement of game objects through the registered map cells.
[0032] When an unmarked path unit has static blocking objects and future dynamic blocking objects, the map server sends a re-pathing request to the route-finding server. The route-finding server generates an updated path based on the re-pathing request and sends the updated path to the map server until the map server determines that the updated path does not have static blocking objects and future dynamic blocking objects.
[0033] Preferably, when there are static blocking objects and future dynamic blocking objects, the map server sends a re-search request to the route-finding server. The route-finding server generates an updated path based on the re-search request and sends the updated path to the map server. The steps until the map server determines that the updated path does not have static blocking objects or future dynamic blocking objects include:
[0034] When there are static and future dynamic obstruction objects, the map server registers a portion of the map units for the movement path starting from the movement origin and controls the game object to move through these map units. At the same time, the map server sends a re-pathing request to the pathfinding server, with the static or future dynamic obstruction object as the update origin. The pathfinding server generates an updated path based on the re-pathing request and sends the updated path to the map server until the map server determines that the updated path does not have static or future dynamic obstruction objects.
[0035] Preferably, the map cells are regular hexagonal;
[0036] When there are static blocking objects and future dynamic blocking objects, the map server sends a re-pathing request to the route-finding server. The route-finding server generates an updated path based on the re-pathing request and sends the updated path to the map server. The steps until the map server determines that the updated path does not have static blocking objects and future dynamic blocking objects include:
[0037] When there are static blocking objects and future dynamic blocking objects, the map server reads the edge strip and the direction of entry of the future dynamic blocking object into the map cell;
[0038] The map server reads the expected borders and expected entry directions of objects entering the map unit from the movement path, and compares them with the borders and entry directions of dynamically blocking objects entering the map unit in the future.
[0039] When the expected edge strips are different from each other and the expected entry direction is similar to the entry direction, the map server marks the movement path as valid and registers the map units passed through in the movement path to control the movement of game objects through the movement path.
[0040] When the desired edge is the same as the desired edge, or the desired direction of entry is opposite to the desired direction of entry, the map server sends a re-search request to the pathfinding server. The pathfinding server generates an updated path based on the re-search request and sends the updated path to the map server until the map server determines that the updated path does not have static blocking objects or future dynamic blocking objects.
[0041] Preferably, when the desired edge strips are different from each other, and the desired entry direction is similar to the entry direction, the map server marks the movement path as valid and registers the map units traversed in the movement path. The step of controlling the game object's movement along the movement path is replaced by:
[0042] When the desired edge strips are different from the edge strips, and the desired direction of entry is similar to the direction of entry, the map server will replace the map cells passed through in the movement path with the adjacent edge strips that are adjacent to the desired edge strips, so that the movement path passes through the connecting edge strips of two adjacent map cells.
[0043] The map server marks the movement path as valid and registers the map units traversed along the movement path to control the movement of game objects along the movement path.
[0044] The present invention also discloses an apparatus comprising:
[0045] The interaction module displays game objects and accepts a movement request, sending the starting and ending points of the game object's movement.
[0046] The map server receives the starting and ending points of game objects' movement from the interactive module, and packages the starting and ending points, obstruction information, and registered paths into map information.
[0047] The pathfinding server receives map information from the map server, generates a movement path, and returns it to the map server.
[0048] The map server determines whether there are static obstruction objects and future dynamic obstruction objects in the movement path;
[0049] When there are no static blocking objects or future dynamic blocking objects, the map server marks the movement path as valid and registers the map units passed through in the movement path to control the movement of game objects along the movement path.
[0050] When there are static blocking objects and future dynamic blocking objects, the map server sends a re-pathing request to the route-finding server. The route-finding server generates an updated path based on the re-pathing request and sends the updated path to the map server until the map server determines that the updated path does not have static blocking objects and future dynamic blocking objects.
[0051] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the game object pathfinding method described above.
[0052] Compared with existing technologies, the above technical solution has the following advantages:
[0053] 1. The game application can implement relatively complex movement and pathfinding rules with dynamic obstacles;
[0054] 2. It can avoid various performance problems caused by simultaneous pathfinding operations by the client and server, such as resource waste and duplicate pathfinding;
[0055] 3. The design incorporates positional exclusivity prediction, ensuring that each object moves along the optimal route without collision. Attached Figure Description
[0056] Figure 1 This is a flowchart illustrating the game object pathfinding method in a preferred embodiment of the present invention;
[0057] Figure 2 A schematic diagram of the device in accordance with a preferred embodiment of the present invention. Detailed Implementation
[0058] The advantages of the present invention will be further illustrated below with reference to the accompanying drawings and specific embodiments.
[0059] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0060] The terminology used in this disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The singular forms “a,” “the,” and “the” as used in this disclosure and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
[0061] It should be understood that although the terms first, second, third, etc., may be used in this disclosure to describe various information, such information should not be limited to these terms. These terms are used only to distinguish information of the same type from one another. For example, without departing from the scope of this disclosure, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."
[0062] In the description of this invention, it should be understood that the terms "longitudinal", "lateral", "up", "down", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this invention.
[0063] In the description of this invention, unless otherwise specified and limited, it should be noted that the terms "installation", "connection" and "linking" should be interpreted broadly. For example, they can refer to mechanical or electrical connections, or internal connections between two components. They can be direct connections or indirect connections through an intermediate medium. Those skilled in the art can understand the specific meaning of the above terms according to the specific circumstances.
[0064] In the following description, suffixes such as "module," "part," or "unit" used to denote elements are used only for the convenience of the description of the invention and have no specific meaning in themselves. Therefore, "module" and "part" can be used interchangeably.
[0065] See Figure 1 To conform to the flowchart of the game object pathfinding method in a preferred embodiment of the present invention, the game object pathfinding method includes the following steps in this embodiment:
[0066] S100: A game object receives a move request and sends its starting and ending points to the map server.
[0067] When a user plays a game on a device such as a smartphone or tablet, a game application is activated. For example, strategy games or MOBA games control the movement of in-game objects based on the user's swipes on the device. Specifically, the user moves the game object by tapping, dragging, or rotating a joystick on the device's screen using their finger, stylus, or other means. The device interprets these user inputs as movement requests. Based on these requests, the game application sends the starting point (current position, initial position, etc.) and ending point (stopping position, termination position, target position, etc.) of the game object to a map server.
[0068] Map servers are peripheral devices, such as servers used by game applications developed by game application developers. Because map servers are isolated from devices, the pathfinding process for game objects will be completed outside the device, without occupying device resources, thus preventing the device from overheating, running slow, or other issues caused by excessive computing power being used.
[0069] S200: The map server packages the received starting point, ending point, obstruction information, and registered paths into map information and sends it to the routing server.
[0070] After receiving the starting point and ending point of movement from the device, the map server packages the above two pieces of information, along with the obstruction information within the current map state of the game application currently running on the device (such as which locations on the map have static obstructions, mountains, rivers, fixed or stable NPC movement positions, etc.), and the registered paths (the positions that other user-controlled game objects are currently moving at, about to move to, etc.), to form a map information. After being formed by the map server, this map information will be sent to a pathfinding server connected to the map server (such as a communication connection, one or more servers / server modules integrated within a server / server group).
[0071] S300: The route-finding server generates a movement path based on map information and sends the movement path to the map server.
[0072] After receiving the map information, the route-finding server will generate a movement path based on the starting and ending points of the movement. Specifically, the path will be generated according to logic such as finding the shortest path and avoiding known static obstacles. This path will then be returned to the map server by the route-finding server.
[0073] It's understandable that the pathfinding server may not store map information from the game application; it may only contain the logic for processing map information. For example, based on two points—the starting point and the ending point—it calculates the shortest possible path between them, which is the shortest path mentioned above, or a path that bypasses obstacles and passes through the desired areas specified by the game application (such as shops, the player's base, etc.). The calculation logic can be freely defined by the game application developer or tailored to the user's needs.
[0074] S400: The map server determines whether there are static obstructions and future dynamic obstructions in the movement path.
[0075] After receiving a movement path, the map server, based on existing information, will determine whether the path still contains static obstacles (such as newly created static objects created by other users) or future dynamic obstacles (such as newly added mobile game objects) within the current map information center. This determination can be made by considering that the movement path consists of multiple map units. Both static and dynamic obstacles will reside on a specific map unit. If a map unit on the path contains static or dynamic obstacles, or is a map unit where other mobile game objects are registering or have already registered, then it is considered to "have" such obstacles. Otherwise, it is considered to "not have" such obstacles.
[0076] It is understandable that the execution of step S400 is not limited to immediately following step S300. For example, step S400 can be executed during the movement of the game object. That is, after the map server receives the movement path, the moving object moves directly along it. During the movement, at a certain point, it is determined whether there are static blocking objects and future dynamic blocking objects in the unmoved path.
[0077] S500: When there are no static or future dynamic blocking objects, the map server marks the movement path as valid and registers the map units traversed along the movement path to control the movement of game objects along the path.
[0078] If the judgment result is "not present," then the movement path generated by the pathfinding server is a path that the game object can move on. Therefore, the map server will mark it as valid and register the map units within the movement path. Once registered, other game objects will not be allowed to enter the registered map units when the game object begins or during its movement. In other words, the registration system provides an exclusive setting for movement paths, preventing collisions between game objects and other game objects. After the movement path is registered, the game object can move from the starting point to the ending point along the path until it reaches the ending point. At this point, the movement ends, and the registered map units are released, restoring these map units to a non-exclusive, re-registerable state.
[0079] S500': When there are static blocking objects and future dynamic blocking objects, the map server sends a re-search request to the route finding server. The route finding server generates an updated path based on the re-search request and sends the updated path to the map server, until the map server determines that the updated path does not have static blocking objects and future dynamic blocking objects.
[0080] When the judgment result is "has," meaning that if the game object moves along the movement path, it will encounter an obstacle during the movement. To improve the user experience and avoid this situation, the map server will send a re-pathing request to the pathfinding server. After receiving the re-pathing request, the pathfinding server will generate an updated path. It can be understood that when the map server sends a re-pathing request to the pathfinding server, it will also send information about the static obstacles present in the verified movement path and the future dynamic obstacles (specifically, which map units or groups of them) to the pathfinding server, so that the pathfinding server can bypass these map units when generating the updated path.
[0081] The above process can be repeated until the map server determines that there are no more static or future dynamic obstruction objects in a certain updated path generated by the pathfinding server, and then controls the game objects to move according to the final updated path.
[0082] With the above configuration, on the one hand, the relationship between the movement path of game objects and the decoupling of map nodes can be calculated in real time. On the other hand, by predicting future movements, a large number of game object movement scenarios can be realized. After transferring this part of the computation to the map server and the pathfinding server, the device's resources and configuration are saved.
[0083] In a preferred embodiment, step S100 includes:
[0084] S110: The game object receives a move request.
[0085] The user's operation on the device (i.e., the device mentioned above) will be recognized by the device's capacitive screen. After pointing to the game object in the game application, the user's operation will be recognized as the user's desired movement method of the game object, and then as the user's movement request for the game object.
[0086] S120: The game object sends its starting point, ending point, and path length threshold to the mobile agent node.
[0087] After a user inputs a movement request, the current position of the game object, or the map cell it is located in, serves as the starting point of the movement. The direction the user points to and the specific map cell represent the device. The device then sends the data to a movement proxy node based on a specific value of the movement path length threshold preset by the game application (the longest path the game object can move in a single movement). In this embodiment, the movement proxy node acts as an intermediary between the pathfinding server and the map server. On one hand, it serves as a data cache and forwarding mechanism; on the other hand, it prioritizes data processing to prevent the pathfinding server from receiving too many processing requests and thus slowing down data processing speed.
[0088] S130: The mobile agent node sends the mobile origin, mobile destination, and mobile path length threshold to the map server.
[0089] After receiving the map information, the mobile agent node forwards it to the map server. By buffering the data at the mobile agent node, all map information sent to the map server can be transmitted in an orderly manner, avoiding situations where the map server is overloaded and processing slows down.
[0090] Then, step S200 includes:
[0091] S210: The map server packages the received origin, destination, obstruction information, registered map units, and their registration times into map information and sends it to the routing server.
[0092] After receiving the aforementioned map information, the map server packages its other stored map information (such as map modeling information pre-stored by the game application developer on its own map server, information generated by other players moving on the map, etc.) along with the starting point and ending point of the movement, and sends them together to the pathfinding server. This includes registered map units and their registration times. Registered map units indicate which map units (such as each cell in a grid map, or the location of the game object's unit movement distance) have been registered when the user initiates a movement request. Registered map units are locked by the registered game objects, preventing other game objects from entering and thus avoiding collisions. Considering that game objects are dynamic when moving, once a registered map unit has been passed through, it will not move back. Therefore, the registration time of each registered map unit, that is, the time when a game object enters and leaves the registered map unit, will also be included. This ensures that multiple game objects can move within the same map at the same time without entering the same map unit at the same moment. This increases the utilization rate of map units and reduces the idle rate. On the one hand, it can speed up the game process and improve the user experience; on the other hand, it can enrich the gameplay and increase the real-time nature of the game.
[0093] In a preferred or optional embodiment, the step S400 of the map server determining whether there are static obstructing objects and future dynamic obstructing objects in the movement path includes:
[0094] S410: The map server reads the desired map unit for the movement path and compares the desired map unit with the registered map units.
[0095] To determine whether there are static or future dynamic obstructions in the movement path, the map server will first read the expected map units in the movement path. These expected map units are the map units that will be involved in the pre-generated movement path of the game object to be moved. For example, if the starting point of the movement is point A and the ending point is point B, and the movement path from point A to point B will pass through points C, D, and E, then points A, B, C, D, and E are the expected map units.
[0096] After the desired map unit is invoked, the map server will compare the desired map unit with the registered map units to confirm whether the desired map unit can be registered, thus preventing multiple game objects from entering the same map unit at the same time.
[0097] S420: When at least one of the desired map units coincides with at least one of the registered map units, the map server determines that the movement path contains both static obstruction objects and future dynamic obstruction objects.
[0098] When the comparison result in step S410 is that at least one of the expected map units overlaps with at least one of the registered map units, meaning the game object's movement path intersects with other registered movement paths, it indicates that the overlapping map unit will be passed by both the game object and other game objects that are not moving (or are in the process of moving). This signifies that the movement path contains a future dynamic blocking object. It is understood that if other game objects stop or abort precisely at the overlapping map unit, then those other game objects are static blocking objects in the movement path.
[0099] S420': When all elements in the desired map cell do not overlap with all registered map cells, the map server determines that the movement path does not contain static or future dynamic obstruction objects.
[0100] Conversely, if it is desired that all map units do not overlap with all registered map units, that is, the movement path of the game object does not intersect with other registered movement paths, and the movement path of the game object does not have static blocking objects or future dynamic blocking objects, then the movement path can be registered by the game object normally, and the game object can move normally along the movement path.
[0101] In the above embodiments, when comparing registered map units with desired map units, the information included specifically includes registered static map units with a constant registration time and registered dynamic map units with a registration start time and a registration end time. Registered static map units with a constant registration time are static objects pre-set by the game application developer in the map. Regardless of the game duration, these static objects always reside within the same map unit, thus their registration time is constant, and these map units are always in a registered state on the timeline. As for registered dynamic map units, considering that game objects are not always occupied, based on their dynamic state, each game object's registration start time when entering a registered map unit and its registration end time when leaving a registered map unit will be recorded within the registered map unit.
[0102] It is understandable that the registration period between the registration start time and the registration end time can be a regular period when the game object is not paused in a registered map cell, such as the time taken by dividing the width of the map cell by the movement speed of the game object, or the period when the game object stays in a registered map cell.
[0103] Based on this, when comparing expected map units with registered map units, if movement paths intersect, the expected registration period between the expected registration start time and the expected registration end time of the expected map unit will be further compared with the registered period between the registration start time and the registration end time. The map server will determine that there is a dynamic blocking object in the movement path if and only if the expected registration period and the registered period partially overlap (i.e., multiple game objects will enter the same map unit at a certain time). Conversely, if all expected map units do not overlap with all registered map units, or if at least one expected map unit overlaps with at least one registered map unit, and the expected registration period between the expected registration start time and the expected registration end time of the expected map unit does not partially overlap with the registered period between the registration start time and the registration end time, it means that although one or more map units will be registered by multiple game objects simultaneously, the times when the multiple game objects enter the map unit are not repeated, and they enter and exit in a sequential manner. For multiple game objects, there will be no collision. Therefore, the map server determines that there is no future dynamic blocking object in the movement path.
[0104] Furthermore, when there are no static blocking objects or future dynamic blocking objects, the map server marks the movement path as valid and registers the map units traversed in the movement path. The specific steps S500 for controlling the movement of game objects along the movement path include:
[0105] S510: When there are no static or future dynamic obstructing objects, the map server divides the movement path into at least two path units, marks the path unit with the movement origin as the starting point as valid, and registers the map units within the valid path units to control the movement of game objects through the registered map units.
[0106] In this embodiment, when the movement path is determined to have no static or future dynamic obstructions, the map server will segment the movement path into at least two path units. That is, the game unit's movement along the path is not completed all at once; instead, it is segmented and the movement of the game unit along the path is determined multiple times to analyze dynamic changes on the map in real time. More specifically, after the segmentation is determined, the first path unit starting from the movement origin is marked as valid, and then map units within the valid path units are registered. In other words, the remaining path units in the movement path are in an unregistered open state, allowing other game objects to enter. Thus, the game object moves within the registered map units.
[0107] S520: When a game object moves, the map server sequentially checks whether there are static blocking objects and future dynamic blocking objects in the unmarked path cells.
[0108] When a game object moves, it can move freely because the map unit of the path unit has been registered. At the same time, the map server sequentially determines whether the unmarked path unit has static blocking objects and future dynamic blocking objects. In simpler terms, when a game object moves in the previous path unit, the map server determines whether the next path unit can be registered for the game object to move in, thereby saving the map server's word resource requirements.
[0109] S530: When an unmarked path cell does not have a static blocking object or a future dynamic blocking object, the map server sequentially marks the path cell as valid and registers the map cells within the valid path cell to control the movement of game objects through the registered map cells.
[0110] When one or more subsequent unmarked path units do not have static or future dynamic obstruction objects, the map server sequentially marks the path units as valid and registers the map units within the valid path units to control the movement of game objects through the registered map units, allowing game objects to move sequentially within the subsequent map units.
[0111] S540: When an unmarked path cell has static blocking objects and future dynamic blocking objects, the map server sends a re-search request to the route finding server. The route finding server generates an updated path based on the re-search request and sends the updated path to the map server, until the map server determines that the updated path does not have static blocking objects and future dynamic blocking objects.
[0112] If, due to dynamic changes in other game objects within the map, a game object's movement necessitates other higher-priority game objects entering certain map units first, then unmarked path units will contain both static and future dynamic obstructions. Consequently, the map server will send a re-pathing request to the pathfinding server. This means that during the game object's movement, its subsequent path will be redefined. Based on this re-pathing request, the pathfinding server generates an updated path, using the endpoint of the registered path unit as the updated starting point. This updated path is then sent to the map server, which again determines whether it contains static and future dynamic obstructions. It's understandable that the map server can use either a holistic or segmented judgment method for each subsequent judgment. The holistic method checks the validity of the entire updated path, while the segmented method checks the validity of each segment or multiple endpoints within the updated path. The specific method used depends on the user's server computing power and the number of game objects on the map. The above judgment is most preferably made until the updated path no longer has static blocking objects or future dynamic blocking objects. This judgment can be made after the game object moves one path unit, until a segmented legal path is continuously updated.
[0113] In a preferred embodiment, when there are static blocking objects and future dynamic blocking objects, the map server sends a re-search request to the route-finding server. The route-finding server generates an updated path based on the re-search request and sends the updated path to the map server. The step S600, until the map server determines that the updated path does not have static blocking objects and future dynamic blocking objects, specifically includes:
[0114] S610: When there are static and future dynamic blocking objects, unlike the situation where the game object needs to wait for a legal movement path to appear, movement begins even if there are obstacles on the known movement path (thus greatly reducing the latency for the user). Then, on the map server side, it registers a portion of the map units along the movement path starting from the movement origin and controls the game object to move through these map units. Simultaneously, the map server sends a re-search request to the pathfinding server, using either the static or future dynamic blocking object as the update starting point. The pathfinding server generates an updated path based on the re-search request and sends the updated path to the map server until the map server determines that the updated path does not have any static or future dynamic blocking objects. In other words, since obstacles usually appear in the middle of the movement path, the initial part of the movement path is freely movable for the game object. Therefore, to speed up processing, the map server sends a pathfinding request to the pathfinding server simultaneously with the game object's movement, performing multiple steps in parallel. For the user of the game application, their movement requests will be responded to faster, improving the user experience.
[0115] Understandably, if the movement encounters an inability to register any of the n path points after the starting point during the initial movement, the movement will be considered a failure, and the pathfinding process will be restarted. Furthermore, when the moving object reaches a target point (not the final destination), if that target point is obstructed, it can be configured to revert to the previous target point and restart the pathfinding process.
[0116] In another preferred embodiment, each map cell is configured as a regular hexagon, so the game object can enter from any side of the hexagon and leave from any side. It is understood that if the entering side and the leaving side are not opposite sides, the game object provides a turning interaction to the user within that map cell. Further, step S600 specifically includes:
[0117] S610': When there are static obstructing objects and future dynamic obstructing objects, the map server reads the edge strip and entry direction of the future dynamic obstructing object entering the map cell.
[0118] After the map server determines whether there are static blocking objects and future dynamic blocking objects in the movement path, it will read the specific blocking information of the future dynamic blocking objects, such as which side of the map unit they enter and the direction of entry, that is, how the future dynamic blocking objects will specifically enter the map unit.
[0119] S620': The map server reads the expected border and expected entry direction of objects entering the map unit from the movement path, and compares them with the border and entry direction of future dynamically obstructed objects entering the map unit.
[0120] Similarly, for a map cell in the movement path that may collide with a future dynamically obstructing object, the map server will read the expected border and expected entry direction of the game object entering the same map object. After obtaining the expected border and expected entry direction, it will be compared with the border and entry direction of the future dynamically obstructing object entering the map cell. It can be understood that in this embodiment, multiple game objects are allowed to enter the same map cell at the same time, as long as the borders for these game objects to enter or leave are inconsistent. That is, from the user's perspective, even if a game object enters and leaves the same map cell from opposite sides, there will be no obvious collision interaction when the model of the game object is small. Therefore, this embodiment provides an application with minimal or near-collision in certain scenarios (multiple melee game objects are in confrontation, game objects need to make contact), increasing the applicability of this embodiment in different game applications.
[0121] S630': When the desired edge strips are different from each other, and the desired entry direction is similar to the entry direction, the map server marks the movement path as valid and registers the map units traversed in the movement path to control the game object's movement along the path.
[0122] If the comparison results show that the expected edge strips are different from each other and the expected entry direction is similar to the entry direction, then the game object is allowed to share movement with other game objects in the same map unit. Therefore, the map server marks the movement path as legal and registers it in the map unit, so that the map unit can be registered multiple times / repeatedly (repeated registration is enabled in this embodiment), and finally controls the movement of the game object within the movement path.
[0123] S640': When the desired edge strip is the same as the desired edge strip, or the desired entry direction is opposite to the entry direction, the map server sends a re-search request to the pathfinding server. The pathfinding server generates an updated path based on the re-search request and sends the updated path to the map server, until the map server determines that the updated path does not have static blocking objects or future dynamic blocking objects.
[0124] Conversely, if the expected borders are the same, or the expected entry directions are opposite, it means that the game object enters or leaves the map unit at the same location as other game objects. Even with open permissions allowing duplicate registration of map units, multiple game objects will still collide. Therefore, the map server will send a re-pathing request to the pathfinding server. The pathfinding server generates an updated path based on the re-pathing request and sends the updated path to the map server until the map server determines that the updated path does not have any static or future dynamic blocking objects.
[0125] Furthermore, step S630' can be replaced with:
[0126] S631”: When the desired edge strip is different from the edge strip, and the desired entry direction is similar to the entry direction, the map server replaces the map cells traversed in the movement path with adjacent edge strips that are adjacent to the desired edge strip, so that the movement path passes through the connecting edge strips of two adjacent map cells.
[0127] Similarly, when the desired borders differ from each other, and the desired entry direction is similar to the entry direction, the game object and one of the other game objects will move entirely within the map cell, while the other will move through the connection point of adjacent map cells. Specifically, the map server replaces the map cells traversed in the movement path with adjacent borders adjacent to the desired border; that is, the movement path does not completely pass through a map cell, but rather through the connecting border of two adjacent map cells. This configuration further utilizes the space within the map, reducing the difficulty and size of map development for game development, thereby saving development resources.
[0128] S632”: The map server marks the movement path as valid and registers the map units traversed along the movement path to control the movement of game objects along the path.
[0129] Subsequently, the map server marks the movement path as still valid and registers the map units traversed along the path. However, when moving to the desired map unit, the moving object will not enter the desired map unit but will instead pass through the connecting strip. More preferably, when a game object moves, there may be two adjacent map units where two game objects are already located or have passed through them at the same time, while a third game object can move through the connecting strip between the two map units. In other words, at the same time, three game objects can occupy only two map units without hindrance to movement under a basically collision-free interaction representation, further reducing the difficulty of map development.
[0130] See Figure 2 This invention discloses an apparatus, such as a terminal or server group for pathfinding in games, comprising:
[0131] The interaction module displays game objects and accepts a movement request, sending the starting and ending points of the game object's movement.
[0132] The map server receives the starting and ending points of game objects' movement from the interactive module, and packages the starting and ending points, obstruction information, and registered paths into map information.
[0133] The pathfinding server receives map information from the map server, generates a movement path, and returns it to the map server.
[0134] The map server determines whether there are static obstruction objects and future dynamic obstruction objects in the movement path;
[0135] When there are no static blocking objects or future dynamic blocking objects, the map server marks the movement path as valid and registers the map units passed through in the movement path to control the movement of game objects along the movement path.
[0136] When there are static blocking objects and future dynamic blocking objects, the map server sends a re-pathing request to the route-finding server. The route-finding server generates an updated path based on the re-pathing request and sends the updated path to the map server until the map server determines that the updated path does not have static blocking objects and future dynamic blocking objects.
[0137] The present invention also discloses a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the game object pathfinding method described above.
[0138] It should be noted that the embodiments of the present invention have better implementability and are not intended to limit the present invention in any way. Any person skilled in the art may use the above-disclosed technical content to change or modify it into equivalent effective embodiments. However, any modifications or equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention shall still fall within the scope of the technical solution of the present invention.
Claims
1. A method for pathfinding game objects, characterized in that, Includes the following steps: A game object receives a move request and sends its starting and ending points to the map server. The map server packages the received starting point, ending point, obstruction information, and registered paths into map information and sends it to the routing server. The pathfinding server generates a movement path based on the map information and sends the movement path to the map server; The map server determines whether there are static blocking objects and future dynamic blocking objects in the movement path; When there are no static blocking objects or future dynamic blocking objects, the map server marks the movement path as legal and registers the map units passed through the movement path to control the game object to move through the movement path; When there are static blocking objects and future dynamic blocking objects, the map server sends a re-pathing request to the route finding server. The route finding server generates an updated path based on the re-pathing request and sends the updated path to the map server, until the map server determines that the updated path does not have static blocking objects and future dynamic blocking objects. The steps by which the map server determines whether there are static obstructing objects and future dynamic obstructing objects in the movement path include: The map server reads the desired map unit of the movement path and compares the desired map unit with the registered map unit; When at least one of the desired map units overlaps with at least one of the registered map units, the map server determines that the movement path contains both static blocking objects and future dynamic blocking objects. When all of the desired map units do not overlap with all of the registered map units, the map server determines that the movement path does not contain any static or future dynamic obstruction objects. The registered map units include: registered static map units with a constant registration time and / or registered dynamic map units with a registration start time and a registration end time; When at least one of the desired map units overlaps with at least one of the registered map units, and the desired registration period between the desired registration start time and the desired registration end time of the desired map unit partially overlaps with the registered period between the registration start time and the registration end time, the map server determines that there are future dynamic blocking objects in the movement path. When all of the desired map units do not overlap with all of the registered map units, or at least one of the desired map units overlaps with at least one of the registered map units, and the desired registration period between the desired registration start time and the desired registration end time of the desired map unit does not partially overlap with the registered period between the registration start time and the registration end time, the map server determines that there are no future dynamic blocking objects in the movement path.
2. The game object pathfinding method as described in claim 1, characterized in that, The steps for a game object to receive a move request and send its starting and ending points to the map server include: The game object receives a move request; The game object sends its starting point, ending point, and movement path length threshold to the movement agent node; The mobile agent node sends the starting point, ending point, and path length threshold to the map server. The steps by which the map server packages the received starting point, ending point, obstruction information, and registered paths into map information and sends it to the route-finding server include: The map server packages the received starting point, ending point, obstruction information, registered map units, and their registration times into map information and sends it to the route-finding server.
3. The game object pathfinding method as described in claim 1, characterized in that, When there are no static or future dynamic blocking objects, the map server marks the movement path as valid and registers the map units traversed along the movement path. The steps for controlling the movement of the game object along the movement path include: When there are no static blocking objects and no future dynamic blocking objects, the map server divides the movement path into at least two path units, marks the path unit with the movement starting point as the starting point as legal, and registers the map units in the legal path units to control the game object to move through the registered map units. When the game object moves, the map server sequentially determines whether there are static blocking objects and future dynamic blocking objects in the unmarked path unit; When an unmarked path unit does not have a static blocking object or a future dynamic blocking object, the map server sequentially marks the path unit as valid and registers the map units in the valid path unit to control the movement of the game object through the registered map units. When an unmarked path unit has static blocking objects and future dynamic blocking objects, the map server sends a re-search request to the route-finding server. The route-finding server generates an updated path based on the re-search request and sends the updated path to the map server until the map server determines that the updated path does not have static blocking objects and future dynamic blocking objects.
4. The game object pathfinding method as described in claim 1, characterized in that, When there are static blocking objects and future dynamic blocking objects, the map server sends a re-pathing request to the route finding server. The route finding server generates an updated path based on the re-pathing request and sends the updated path to the map server. The steps until the map server determines that the updated path does not have static blocking objects and future dynamic blocking objects include: When there are static and future dynamic blocking objects, the map server registers a portion of the map units for the movement path starting from the starting point of the movement, and controls the game object to move through the portion of the map units. At the same time, the map server sends a re-pathing request to the pathfinding server with the static or future dynamic blocking object as the update starting point. The pathfinding server generates an updated path based on the re-pathing request and sends the updated path to the map server until the map server determines that the updated path does not have static or future dynamic blocking objects.
5. The game object pathfinding method as described in claim 1, characterized in that, The map unit is in the shape of a regular hexagon; When there are static blocking objects and future dynamic blocking objects, the map server sends a re-pathing request to the route finding server. The route finding server generates an updated path based on the re-pathing request and sends the updated path to the map server. The steps until the map server determines that the updated path does not have static blocking objects and future dynamic blocking objects include: When there are static blocking objects and future dynamic blocking objects, the map server reads the edge strip and the direction of entry of the future dynamic blocking object into the map cell; The map server reads the expected edge strip and expected entry direction of the moving path into the map unit, and compares it with the edge strip and entry direction of the future dynamically blocking object entering the map unit. When the expected edge strips are different from the expected edge strips and the expected entry direction is similar to the entry direction, the map server marks the movement path as valid and registers the map units passed through the movement path to control the game object to move through the movement path; When the desired edge is the same as the desired edge, or the desired direction of entry is opposite to the desired direction of entry, the map server sends a re-search request to the routing server. The routing server generates an updated path based on the re-search request and sends the updated path to the map server until the map server determines that the updated path does not have static blocking objects or future dynamic blocking objects.
6. The game object pathfinding method as described in claim 5, characterized in that, When the desired edge strips are different from each other, and the desired entry direction is similar to the entry direction, the map server marks the movement path as valid and registers the map units traversed by the movement path. The step of controlling the game object to move along the movement path is replaced with: When the desired edge strips are different from the edge strips, and the desired direction of entry is similar to the direction of entry, the map server replaces the map units passed through in the movement path with the adjacent edge strips that are adjacent to the desired edge strips, so that the movement path passes through the connecting edge strips of two adjacent map units. The map server marks the movement path as valid and registers the map units traversed along the movement path to control the game object to move along the movement path.
7. An apparatus, characterized in that, The device includes: An interaction module displays game objects, accepts a movement request, and sends out the starting and ending points of the movement of the game objects. The map server receives the starting point and ending point of the game object from the interaction module, and packages the starting point, ending point, obstruction information and registered paths into map information. The pathfinding server receives map information from the map server, generates a movement path, and returns it to the map server. The map server determines whether there are static blocking objects and future dynamic blocking objects in the movement path; When there are no static blocking objects or future dynamic blocking objects, the map server marks the movement path as legal and registers the map units passed through the movement path to control the game object to move through the movement path; When there are static blocking objects and future dynamic blocking objects, the map server sends a re-pathing request to the route finding server. The route finding server generates an updated path based on the re-pathing request and sends the updated path to the map server, until the map server determines that the updated path does not have static blocking objects and future dynamic blocking objects. The steps by which the map server determines whether there are static obstructing objects and future dynamic obstructing objects in the movement path include: The map server reads the desired map unit of the movement path and compares the desired map unit with the registered map unit; When at least one of the desired map units overlaps with at least one of the registered map units, the map server determines that the movement path contains both static blocking objects and future dynamic blocking objects. When all of the desired map units do not overlap with all of the registered map units, the map server determines that the movement path does not contain any static or future dynamic obstruction objects. The registered map units include: registered static map units with a constant registration time and / or registered dynamic map units with a registration start time and a registration end time; When at least one of the desired map units overlaps with at least one of the registered map units, and the desired registration period between the desired registration start time and the desired registration end time of the desired map unit partially overlaps with the registered period between the registration start time and the registration end time, the map server determines that there are future dynamic blocking objects in the movement path. When all of the desired map units do not overlap with all of the registered map units, or at least one of the desired map units overlaps with at least one of the registered map units, and the desired registration period between the desired registration start time and the desired registration end time of the desired map unit does not partially overlap with the registered period between the registration start time and the registration end time, the map server determines that there are no future dynamic blocking objects in the movement path.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the game object pathfinding method as described in any one of claims 1-6.