CN111773687A - Map way finding method and device, storage medium and electronic device - Google Patents

Map way finding method and device, storage medium and electronic device Download PDF

Info

Publication number
CN111773687A
CN111773687A CN202010621469.2A CN202010621469A CN111773687A CN 111773687 A CN111773687 A CN 111773687A CN 202010621469 A CN202010621469 A CN 202010621469A CN 111773687 A CN111773687 A CN 111773687A
Authority
CN
China
Prior art keywords
path
map
target
area
navigation data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010621469.2A
Other languages
Chinese (zh)
Inventor
康世禹
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Perfect World Beijing Software Technology Development Co Ltd
Original Assignee
Perfect World Beijing Software Technology Development Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Perfect World Beijing Software Technology Development Co Ltd filed Critical Perfect World Beijing Software Technology Development Co Ltd
Priority to CN202010621469.2A priority Critical patent/CN111773687A/en
Publication of CN111773687A publication Critical patent/CN111773687A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/50Controlling the output signals based on the game progress
    • A63F13/52Controlling the output signals based on the game progress involving aspects of the displayed game scene
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/60Generating or modifying game content before or while executing the game program, e.g. authoring tools specially adapted for game development or game-integrated level editor
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
    • A63F2300/50Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game characterized by details of game servers
    • A63F2300/53Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game characterized by details of game servers details of basic data processing

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Navigation (AREA)

Abstract

本申请公开了一种地图寻路方法和装置、存储介质和电子装置。其中,该方法包括:确定移动起点所在的第一地图中的第一路径,其中,第一路径为移动起点至第一地图的目标出口的路径;确定移动终点所在的第二地图中的第二路径,其中,第二路径为第二地图的目标入口至移动终点的路径;根据第一路径、第二路径、以及预先存储的多个地图中的各个地图的入口与出口之间的路径,获取由移动起点至移动终点的第三路径,其中,多个地图包括第一地图和第二地图,在多个地图的具有关联关系的两个关联地图中,第一关联地图的出口与第二关联地图的入口关联。本申请解决了相关技术中的跨地图寻路方式存在由于需要加载的地图数量过多导致的游戏容易卡顿的问题。

Figure 202010621469

The present application discloses a map pathfinding method and device, a storage medium and an electronic device. Wherein, the method includes: determining a first path in a first map where the moving starting point is located, wherein the first path is a path from the moving starting point to a target exit of the first map; determining a second path in a second map where the moving end point is located path, wherein the second path is the path from the target entrance of the second map to the moving end point; obtain the path according to the first path, the second path, and the path between the entrance and the exit of each of the pre-stored multiple maps A third path from the moving start point to the moving end point, wherein the multiple maps include a first map and a second map, and in the two associated maps with an associated relationship among the multiple maps, the exit of the first associated map is associated with the second The map's entry association. The present application solves the problem that the game is easy to freeze due to the excessive number of maps to be loaded in the cross-map pathfinding method in the related art.

Figure 202010621469

Description

地图寻路方法和装置、存储介质和电子装置Map wayfinding method and device, storage medium and electronic device

技术领域technical field

本申请涉及互联网领域,具体而言,涉及一种地图寻路方法和装置、存储介质和电子装置。The present application relates to the field of the Internet, and in particular, to a map pathfinding method and device, a storage medium and an electronic device.

背景技术Background technique

目前,在游戏地图中,可以为游戏地图中的虚拟角色进行寻路,生成导航路径,上述游戏地图可以是MMO(Massive Multiplayer Online,大型多人在线)游戏大地图。寻路是指:给定地图上的起点和终点,寻找由起点到终点的一条路径。在进行寻路时,要求所寻的路径是可行的,且尽可能短。Currently, in a game map, pathfinding can be performed for a virtual character in the game map to generate a navigation path, and the game map may be an MMO (Massive Multiplayer Online, massively multiplayer online) game map. Pathfinding means: given a starting point and an ending point on the map, find a path from the starting point to the ending point. When performing pathfinding, the path sought is required to be feasible and as short as possible.

当起点和终点位于不同的地图中时,需要寻找一条跨越多个地图的路径,例如,从塔的当前层到目标层(如,19层至4层)的路径。如果向另一张地图发起寻路请求,该地图尚未加载,导航网格数据获取不到,则无法生成路径。相关技术中,一般采用在游戏运行时加载所有地图的导航数据,以便生成跨地图路径。然而,由于加载的地图数量较多,需要占用过多的内存,导致游戏容易卡顿的问题。When the start and end points are in different maps, it is necessary to find a path that spans multiple maps, for example, a path from the current level of the tower to the target level (eg, level 19 to level 4). If a wayfinding request is made to another map, the map has not been loaded and the navigation mesh data cannot be obtained, the route cannot be generated. In the related art, the navigation data of all maps is generally loaded when the game is running, so as to generate a cross-map path. However, due to the large number of loaded maps, it takes up too much memory, which leads to the problem that the game is prone to freeze.

因此,相关技术中的跨地图寻路方式,存在由于需要加载的地图数量过多导致的游戏容易卡顿的问题。Therefore, in the cross-map pathfinding method in the related art, there is a problem that the game is easy to freeze due to the excessive number of maps that need to be loaded.

发明内容SUMMARY OF THE INVENTION

本申请实施例提供了一种地图寻路方法和装置、存储介质和电子装置,以至少解决相关技术中的跨地图寻路方式存在由于需要加载的地图数量过多导致的游戏容易卡顿的问题。The embodiments of the present application provide a map pathfinding method and device, a storage medium, and an electronic device, so as to at least solve the problem that the game is easily stuck due to the excessive number of maps to be loaded in the cross-map pathfinding method in the related art .

根据本申请实施例的一个方面,提供了一种地图寻路方法,包括:确定移动起点所在的第一地图中的第一路径,其中,第一路径为移动起点至第一地图的目标出口的路径;确定移动终点所在的第二地图中的第二路径,其中,第二路径为第二地图的目标入口至移动终点的路径;根据第一路径、第二路径、以及预先存储的多个地图中的各个地图的入口与出口之间的路径,获取由移动起点至移动终点的第三路径,其中,多个地图包括第一地图和第二地图,在多个地图的具有关联关系的两个关联地图中,第一关联地图的出口与第二关联地图的入口关联。According to an aspect of the embodiments of the present application, a map path finding method is provided, including: determining a first path in a first map where a moving starting point is located, wherein the first path is a path from the moving starting point to a target exit of the first map path; determining a second path in the second map where the moving end point is located, wherein the second path is a path from the target entry of the second map to the moving end point; according to the first path, the second path, and a plurality of pre-stored maps The path between the entrance and the exit of each map in , obtains a third path from the moving start point to the moving end point, wherein the multiple maps include a first map and a second map, and two of the multiple maps have an associated relationship. In the associated map, the exit of the first associated map is associated with the entrance of the second associated map.

根据本申请实施例的另一个方面,提供了一种地图寻路装置,包括:第一确定单元,用于确定移动起点所在的第一地图中的第一路径,其中,第一路径为移动起点至第一地图的目标出口的路径;第二确定单元,用于确定移动终点所在的第二地图中的第二路径,其中,第二路径为第二地图的目标入口至移动终点的路径;第一获取单元,用于根据第一路径、第二路径、以及预先存储的多个地图中的各个地图的入口与出口之间的路径,获取由移动起点至移动终点的第三路径,其中,多个地图包括第一地图和第二地图,在多个地图的具有关联关系的两个关联地图中,第一关联地图的出口与第二关联地图的入口关联。According to another aspect of the embodiments of the present application, there is provided a map path finding device, comprising: a first determination unit configured to determine a first path in a first map where a moving starting point is located, wherein the first path is the moving starting point The path to the target exit of the first map; the second determination unit is used to determine the second path in the second map where the moving end point is located, wherein the second path is the path from the target entrance of the second map to the moving end point; an obtaining unit, configured to obtain a third path from the moving start point to the moving end point according to the first path, the second path, and the path between the entrance and the exit of each of the pre-stored multiple maps, wherein the multiple Each map includes a first map and a second map, and in the two associated maps having an associated relationship among the multiple maps, the outlet of the first associated map is associated with the inlet of the second associated map.

根据本申请实施例的又一个方面,还提供了一种计算机可读的存储介质,该存储介质中存储有计算机程序,其中,该计算机程序被设置为运行时执行上述任一项方法实施例中的步骤。According to yet another aspect of the embodiments of the present application, a computer-readable storage medium is also provided, where a computer program is stored in the storage medium, wherein the computer program is configured to execute any one of the above method embodiments when running. A step of.

根据本申请实施例的又一个方面,还提供了一种电子装置,包括存储器和处理器,存储器中存储有计算机程序,处理器被设置为运行计算机程序以执行上述任一项方法实施例中的步骤。According to yet another aspect of the embodiments of the present application, an electronic device is also provided, including a memory and a processor, where a computer program is stored in the memory, and the processor is configured to run the computer program to execute any of the above method embodiments. step.

在本申请实施例中,采用保存地图传送门之间(入口与出口之间)的路径之间路径的方式,通过确定移动起点所在的第一地图中的第一路径,其中,第一路径为移动起点至第一地图的目标出口的路径;确定移动终点所在的第二地图中的第二路径,其中,第二路径为第二地图的目标入口至移动终点的路径;根据第一路径、第二路径、以及预先存储的多个地图中的各个地图的入口与出口之间的路径,获取由移动起点至移动终点的第三路径,其中,多个地图包括第一地图和第二地图,在多个地图的具有关联关系的两个关联地图中,第一关联地图的出口与第二关联地图的入口关联,由于每张地图存储传送门之间的路径,在进行地图寻路时,只需加载起点所在地图和终点所在地图的全部或者部分导航数据,其他地图则无需加载或者只需加载很少的导航数据,因此,可以达到减少所需加载的地图数量的目的,达到减少导航数据对内存的占用、提高游戏运行流畅性的技术效果,进而解决了相关技术中的跨地图寻路方式存在由于需要加载的地图数量过多导致的游戏容易卡顿的问题。In the embodiment of the present application, the path between paths between the map portals (between the entrance and the exit) is saved, and the first path in the first map where the moving starting point is located is determined, wherein the first path is The path from the moving start point to the target exit of the first map; determine the second path in the second map where the moving end point is located, wherein the second path is the path from the target entrance of the second map to the moving end point; The second path and the path between the entrance and the exit of each of the pre-stored multiple maps are obtained, and the third path from the moving start point to the moving end point is obtained, wherein the multiple maps include a first map and a second map. In two associated maps with multiple maps, the exit of the first associated map is associated with the entrance of the second associated map. Since each map stores the path between the portals, when performing map pathfinding, only Load all or part of the navigation data of the map of the starting point and the destination map. Other maps do not need to be loaded or only need to load a small amount of navigation data. Therefore, it can achieve the purpose of reducing the number of maps that need to be loaded and reduce the amount of navigation data to memory. The technical effect of increasing the occupancy of the game and improving the running smoothness of the game further solves the problem that the game is easy to freeze due to the excessive number of maps that need to be loaded in the cross-map pathfinding method in the related art.

附图说明Description of drawings

此处所说明的附图用来提供对本申请的进一步理解,构成本申请的一部分,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:The drawings described herein are used to provide further understanding of the present application and constitute a part of the present application. The schematic embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation of the present application. In the attached image:

图1是根据本申请实施例的地图寻路方法的硬件环境的示意图;1 is a schematic diagram of a hardware environment of a map pathfinding method according to an embodiment of the present application;

图2是根据本申请实施例的一种可选的地图寻路方法的流程图;2 is a flowchart of an optional map path finding method according to an embodiment of the present application;

图3是根据本申请实施例的一种可选的地图寻路方法的示意图;3 is a schematic diagram of an optional map path finding method according to an embodiment of the present application;

图4是根据本申请实施例的另一种可选的地图寻路方法的示意图;4 is a schematic diagram of another optional map path finding method according to an embodiment of the present application;

图5是根据本申请实施例的又一种可选的地图寻路方法的示意图;5 is a schematic diagram of yet another optional map path finding method according to an embodiment of the present application;

图6是根据本申请实施例的又一种可选的地图寻路方法的示意图;6 is a schematic diagram of yet another optional map path finding method according to an embodiment of the present application;

图7是根据本申请实施例的又一种可选的地图寻路方法的示意图;7 is a schematic diagram of yet another optional map path finding method according to an embodiment of the present application;

图8是根据本申请实施例的又一种可选的地图寻路方法的示意图;8 is a schematic diagram of yet another optional map path finding method according to an embodiment of the present application;

图9是根据本申请实施例的又一种可选的地图寻路方法的示意图;9 is a schematic diagram of yet another optional map path finding method according to an embodiment of the present application;

图10是根据本申请实施例的又一种可选的地图寻路方法的示意图;10 is a schematic diagram of yet another optional map path finding method according to an embodiment of the present application;

图11是根据本申请实施例的另一种可选的地图寻路方法的流程图;11 is a flowchart of another optional map path finding method according to an embodiment of the present application;

图12是根据本申请实施例的一种可选的地图寻路装置的示意图;12 is a schematic diagram of an optional map path finding device according to an embodiment of the present application;

图13是根据本申请实施例的一种电子装置的结构框图。FIG. 13 is a structural block diagram of an electronic device according to an embodiment of the present application.

具体实施方式Detailed ways

为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分的实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本申请保护的范围。In order to make those skilled in the art better understand the solutions of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only The embodiments are part of the present application, but not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the scope of protection of the present application.

需要说明的是,本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本申请的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。It should be noted that the terms "first", "second", etc. in the description and claims of the present application and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific sequence or sequence. It is to be understood that data so used may be interchanged under appropriate circumstances so that the embodiments of the application described herein can be practiced in sequences other than those illustrated or described herein. Furthermore, the terms "comprising" and "having" and any variations thereof, are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those expressly listed Rather, those steps or units may include other steps or units not expressly listed or inherent to these processes, methods, products or devices.

根据本申请实施例的一方面,提供了一种地图寻路方法的方法实施例。可选地,在本实施例中,上述地图寻路方法可以应用于如图1所示的由终端101和服务器103所构成的硬件环境中。如图1所示,服务器102通过网络与终端101连接,可用于为终端或终端上安装的客户端提供服务(如游戏服务、应用服务等),可在服务器上或独立于服务器设置数据库105,用于为服务器103提供数据存储服务,上述网络包括但不限于:广域网、城域网或局域网,终端101并不限定于PC(Personal Computer,个人计算机)、手机、平板电脑等。本申请实施例的地图寻路方法可以由服务器103来执行,也可以由终端101来执行,还可以是由服务器103和终端101共同执行。其中,终端101执行本申请实施例的地图寻路方法也可以是由安装在其上的客户端来执行。According to an aspect of the embodiments of the present application, a method embodiment of a map path finding method is provided. Optionally, in this embodiment, the above-mentioned map path finding method may be applied to a hardware environment composed of a terminal 101 and a server 103 as shown in FIG. 1 . As shown in FIG. 1, the server 102 is connected to the terminal 101 through the network, and can be used to provide services (such as game services, application services, etc.) for the terminal or the client installed on the terminal, and the database 105 can be set on the server or independently from the server, For providing data storage services for the server 103, the above-mentioned network includes but is not limited to: a wide area network, a metropolitan area network or a local area network, and the terminal 101 is not limited to a PC (Personal Computer, personal computer), mobile phone, tablet computer, etc. The map path finding method in this embodiment of the present application may be executed by the server 103 , may also be executed by the terminal 101 , or may be executed jointly by the server 103 and the terminal 101 . Wherein, the terminal 101 may execute the map pathfinding method of the embodiment of the present application by a client installed on the terminal 101 .

可选地,本申请实施例中提供了一种地图寻路方法,图2是根据本申请实施例的一种可选的地图寻路方法的流程图,如图2所示,该方法可以包括以下步骤:Optionally, an embodiment of the present application provides a map path finding method. FIG. 2 is a flowchart of an optional map path finding method according to an embodiment of the present application. As shown in FIG. 2 , the method may include: The following steps:

步骤S202,确定移动起点所在的第一地图中的第一路径,其中,第一路径为移动起点至第一地图的目标出口的路径;Step S202, determining a first path in the first map where the moving starting point is located, wherein the first path is a path from the moving starting point to the target exit of the first map;

步骤S204,确定移动终点所在的第二地图中的第二路径,其中,第二路径为第二地图的目标入口至移动终点的路径;Step S204, determining the second path in the second map where the moving end point is located, wherein the second path is the path from the target entrance of the second map to the moving end point;

步骤S206,根据第一路径、第二路径、以及预先存储的多个地图中的各个地图的入口与出口之间的路径,获取由移动起点至移动终点的第三路径,其中,多个地图包括第一地图和第二地图,在多个地图的具有关联关系的两个关联地图中,第一关联地图的出口与第二关联地图的入口关联。Step S206, according to the first path, the second path, and the path between the entrance and the exit of each of the pre-stored multiple maps, obtain a third path from the moving start point to the moving end point, wherein the multiple maps include: In the first map and the second map, among the two associated maps of the plurality of maps that have an associated relationship, the exit of the first associated map is associated with the entrance of the second associated map.

通过上述步骤S202至步骤S206,通过确定移动起点所在的第一地图中的第一路径,其中,第一路径为移动起点至第一地图的目标出口的路径;确定移动终点所在的第二地图中的第二路径,其中,第二路径为第二地图的目标入口至移动终点的路径;根据第一路径、第二路径、以及预先存储的多个地图中的各个地图的入口与出口之间的路径,获取由移动起点至移动终点的第三路径,其中,多个地图包括第一地图和第二地图,在多个地图的具有关联关系的两个关联地图中,第一关联地图的出口与第二关联地图的入口关联,解决了相关技术中的跨地图寻路方式存在由于需要加载的地图数量过多导致的游戏容易卡顿的问题,减少了导航数据对内存的占用,提高了游戏运行流畅性。Through the above steps S202 to S206, by determining the first path in the first map where the moving starting point is located, wherein the first path is the path from the moving starting point to the target exit of the first map; the second path, wherein the second path is the path from the target entrance of the second map to the moving end point; according to the first path, the second path, and the path between the entrance and the exit of each of the pre-stored multiple maps path, obtains a third path from the moving start point to the moving end point, wherein the multiple maps include a first map and a second map, and in the two associated maps with an associated relationship among the multiple maps, the exit of the first associated map is The entry association of the second associated map solves the problem of the cross-map pathfinding method in the related art that the game is easy to freeze due to the excessive number of maps to be loaded, reduces the memory occupation of the navigation data, and improves the operation of the game. Fluency.

在步骤S202提供的技术方案中,确定移动起点所在的第一地图中的第一路径,其中,第一路径为移动起点至第一地图的目标出口的路径。In the technical solution provided in step S202, a first path in the first map where the moving starting point is located is determined, wherein the first path is a path from the moving starting point to the target exit of the first map.

本实施例中的地图寻路方法可以应用于地图中控制对象移动的场景,上述地图可以是游戏地图,或者其他场景地图(例如,购物地图等)。The map pathfinding method in this embodiment can be applied to a scene where objects are controlled to move in a map, and the above-mentioned map can be a game map, or another scene map (eg, a shopping map, etc.).

地图寻路可以是在多个地图之间进行的。对于多个地图中的各个地图,每个地图可以具有入口和出口,例如,传送门。在多个地图中可以包含具有关联关系的两个关联地图,在两个关联地图中,一个地图(第一关联地图)的出口可以与另一个地图(第二关联地图)的入口关联。每个地图具有至少一个关联地图。Map wayfinding can be done between multiple maps. For each of the multiple maps, each map can have an entrance and an exit, eg, a portal. A plurality of maps may include two associated maps with an associated relationship. In the two associated maps, the exit of one map (the first associated map) may be associated with the entrance of the other map (the second associated map). Each map has at least one associated map.

地图寻路所寻的路径为移动起点至移动终点的路径。移动起点所在的地图为第一地图。在进行地图寻路时,可以确定第一地图中的第一路径,该第一路径为移动起点至第一地图的目标出口的路径。The path searched by map pathfinding is the path from the moving start point to the moving end point. The map where the moving starting point is located is the first map. During map pathfinding, a first path in the first map may be determined, where the first path is a path from the moving starting point to the target exit of the first map.

确定第一地图中的第一路径的方式可以有多种,所有可以进行单一地图内寻路的方式,均可用于本实施例中的地图寻路方法,例如,基于A*算法的寻路,基于Dijkstra算法的寻路。对于单一地图内寻路的方式,本实施例中对此不作具体限定。There may be many ways to determine the first path in the first map, and all ways that can be used for pathfinding in a single map can be used for the map pathfinding method in this embodiment, for example, pathfinding based on the A* algorithm, Pathfinding based on Dijkstra's algorithm. The way of finding a way in a single map is not specifically limited in this embodiment.

该第一地图可以具有一个或多个出口,即,目标出口的数量可以有一个或多个,可以分别确定移动起点至各个目标出口的路径,得到多个第一路径。对于每个目标出口进行寻路所采用的方式可以相同,也可以不同,本实施例中对此不作限定。The first map may have one or more exits, that is, the number of target exits may be one or more, and paths from the moving starting point to each target exit may be determined respectively to obtain multiple first paths. The path-finding method for each target exit may be the same or different, which is not limited in this embodiment.

在步骤S204提供的技术方案中,确定移动终点所在的第二地图中的第二路径,其中,第二路径为第二地图的目标入口至移动终点的路径。In the technical solution provided in step S204, a second path in the second map where the moving end point is located is determined, wherein the second path is a path from the target entrance of the second map to the moving end point.

地图寻路所寻的路径为移动起点至移动终点的路径。移动终点所在的地图为第二地图。在进行地图寻路时,可以确定第二地图中的第二路径,该第二路径为第二地图的目标入口至移动终点的路径。The path searched by map pathfinding is the path from the moving start point to the moving end point. The map where the moving end is located is the second map. During map pathfinding, a second path in the second map may be determined, where the second path is a path from the target entry of the second map to the moving end point.

确定第二地图中的第二路径的方式可以有多种,所有可以进行单一地图内寻路的方式,均可用于本实施例中的地图寻路方法,例如,基于A*算法的寻路,基于Dijkstra算法的寻路。对于单一地图内寻路的方式,本实施例中对此不作具体限定。There may be many ways to determine the second path in the second map, and all the ways that can perform pathfinding in a single map can be used in the map pathfinding method in this embodiment, for example, pathfinding based on the A* algorithm, Pathfinding based on Dijkstra's algorithm. The way of finding a way in a single map is not specifically limited in this embodiment.

该第二地图可以具有一个或多个入口,即,目标入口的数量可以有一个或多个,可以分别确定各个目标入口至移动终点的路径,得到多个第二路径。对于每个目标入口进行寻路所采用的方式可以相同,也可以不同,本实施例中对此不作限定。The second map may have one or more entrances, that is, the number of target entrances may be one or more, and the paths from each target entrance to the moving end point may be determined respectively to obtain multiple second paths. The manner used for pathfinding for each target entry may be the same or different, which is not limited in this embodiment.

在步骤S206提供的技术方案中,根据第一路径、第二路径、以及预先存储的多个地图中的各个地图的入口与出口之间的路径,获取由移动起点至移动终点的第三路径,其中,多个地图包括第一地图和第二地图。In the technical solution provided in step S206, according to the first path, the second path, and the path between the entrance and the exit of each of the pre-stored multiple maps, a third path from the moving start point to the moving end point is obtained, Wherein, the multiple maps include a first map and a second map.

为了减少所需加载的导航数据,可以减少加载导航数据的地图数量,对于多个地图中的各个地图,可以预先存储各个地图的入口与出口之间的路径,也就是,传送门之间的路径。In order to reduce the navigation data that needs to be loaded, the number of maps for loading the navigation data can be reduced. For each map in multiple maps, the path between the entrance and the exit of each map can be pre-stored, that is, the path between the portals .

在游戏运行的过程中,客户端控制的对象当前所在地图(例如,第一地图)的导航网格数据被加载,而无需为每张图都加载导航网格。其它地图只需要一个被初始化但是只有传送门周围导航数据的dtNavMesh空壳。在进行寻路时,可以加载第二地图(终点所在地图)的全部或者部分地图数据。由于已经预先存储了其他地图的入口与出口之间的路径,即使不加载全部的导航数据,也可以得到起点至终点的路径。During the running of the game, the navigation mesh data of the map (for example, the first map) where the object controlled by the client is currently located is loaded, without the need to load the navigation mesh for each map. Other maps just need a dtNavMesh shell that is initialized but only has navigation data around the portal. During the pathfinding, all or part of the map data of the second map (the map where the destination is located) may be loaded. Since the routes between the entrances and exits of other maps are pre-stored, even if all the navigation data is not loaded, the route from the start point to the end point can be obtained.

可选地,在本实施例中,在进行地图寻路时,根据第一路径、第二路径、以及预先存储的多个地图中的各个地图的入口与出口之间的路径,可以获取由移动起点至移动终点的第三路径。Optionally, in this embodiment, when performing map pathfinding, according to the first path, the second path, and the path between the entrance and the exit of each map in the pre-stored multiple maps, it is possible to obtain the path from the mobile The third path from the start point to the end point of the move.

在第一路径、第二路径为多个情况下,移动起点和移动终点之间的路径可以有多条。可以基于最短路径算法或者其他寻路算法查找移动起点至移动终点之间的一条路径,该路径可以是移动起点至移动终点的最短路径,或者,最快查找到的一条路径。对于获取第三路径的具体方式,本实施例中对此不作具体限定。When there are multiple first paths and second paths, there may be multiple paths between the movement start point and the movement end point. A path between the moving start point and the moving end point can be found based on the shortest path algorithm or other path finding algorithms, and the path can be the shortest path from the moving start point to the moving end point, or the fastest path found. The specific manner of acquiring the third path is not specifically limited in this embodiment.

作为一种可选的实施例,确定移动起点所在的第一地图中的第一路径包括:As an optional embodiment, determining the first path in the first map where the movement starting point is located includes:

S11,确定第一地图的第一目标区域内的第一子路径,其中,第一目标区域为第一地图包含的多个第一区域中移动起点所在的区域,多个第一区域中的每个第一区域包含允许从每个第一区域进入到每个第一区域的相邻区域的邻接口,第一子路径为移动起点至第一目标区域的邻接口的路径;S11. Determine a first sub-path in the first target area of the first map, where the first target area is the area where the moving starting point is located in the plurality of first areas included in the first map, and each of the plurality of first areas The first area includes an adjacent interface that allows access from each first area to an adjacent area of each first area, and the first sub-path is a path from the moving start point to the adjacent interface of the first target area;

S12,根据第一子路径、以及预先存储的每个第一区域的邻接口之间的路径,获取由移动起点至目标出口的第一路径,其中,目标出口属于目标出口所在的第二目标区域的邻接口。S12, according to the first sub-path and the pre-stored paths between adjacent interfaces of each first area, obtain a first path from the moving starting point to the target exit, where the target exit belongs to the second target area where the target exit is located adjacent interface.

多个地图中的每个地图可以包含有地图单元,该地图单元可以是地图划分的最小单位,每个地图单元可以是多边形。该多边形可以是形状规则的多边形,例如,栅格地图的地图单元为地图中的栅格,栅格为规则的四边形(方格);该多边形也可以是形状不规则的凸多边形,例如,导航地图的地图单元为地图中的导航网格,导航网格为不规则的凸多边形。Each of the plurality of maps may contain a map unit, the map unit may be the smallest unit of map division, and each map unit may be a polygon. The polygon can be a polygon with regular shape, for example, the map unit of a grid map is a grid in the map, and the grid is a regular quadrilateral (square); the polygon can also be a convex polygon with irregular shape, for example, navigation The map unit of the map is the navigation mesh in the map, and the navigation mesh is an irregular convex polygon.

确定移动起点所在的第一地图中的第一路径的方式可以有多种,例如,基于A*算法的寻路,基于Dijkstra算法的寻路。There may be various ways to determine the first path in the first map where the moving starting point is located, for example, pathfinding based on the A* algorithm and pathfinding based on the Dijkstra algorithm.

以A*寻路为例,A*寻路是一种启发式搜索方式,基于导航区域中包含的多边形节点,通过对当前每一个搜索位置(多边形节点)进行估价,确定搜索的方向。A*寻路方式与地图中包含的多边形节点数量有关,多边形节点越多,寻路所需的时间越长,寻路效率越低。Taking A* wayfinding as an example, A* wayfinding is a heuristic search method. Based on the polygon nodes contained in the navigation area, the search direction is determined by evaluating each current search position (polygon node). The A* pathfinding method is related to the number of polygon nodes contained in the map. The more polygonal nodes, the longer the pathfinding time and the lower the pathfinding efficiency.

为了提高寻路效率,可以将第一地图(多个地图中的其他地图与第一地图类似)划分为多个第一区域(集群,每个集群可以作为划分的一个高层地图的地图单元),每个第一区域中包含多个基本地图单元;配置各第一区域的邻接口,即,允许从本区域进入到本区域的相邻区域的入口,并预先存储每个第一区域的邻接口之间的路径。基于保存的各第一区域的邻接口之间的路径,可以进行地图寻路。In order to improve the pathfinding efficiency, the first map (other maps in the multiple maps are similar to the first map) can be divided into multiple first regions (clusters, each cluster can be used as a map unit of a divided high-level map), Each first area contains a plurality of basic map units; configure the adjacency ports of each first area, that is, the entrances that allow access from this area to the adjacent areas of this area, and store the adjacency ports of each first area in advance path between. Based on the saved paths between adjacent interfaces of each first area, map pathfinding may be performed.

需要说明的是,在本实施例中,通过对各个地图进行分层,每一高层地图单元(每个集群,每个区域)的多边形(例如,栅格,导航网格)数量尽可能的平均。得到的层可以认为是地图中的多边形的高层,在多边形之间的寻路可以抽象为集群与集群之间的寻路,即,在更高层地图上进行寻路。It should be noted that, in this embodiment, by layering each map, the number of polygons (eg, grid, navigation mesh) of each high-level map unit (each cluster, each area) is as average as possible . The resulting layer can be considered as a high level of polygons in the map, and pathfinding between polygons can be abstracted into cluster-to-cluster pathfinding, ie, pathfinding is performed on a higher-level map.

例如,可以将栅格地图划分为多个区域(多个集群,每个区域对应于一个集群),每个区域为该区域包含的栅格的高层。第一栅格到第二栅格的寻路,可以抽象为第一栅格所在的区域到第二栅格所在的区域的寻路,也就是,在高层地图上进行寻路。For example, a raster map can be divided into multiple regions (multiple clusters, each region corresponding to a cluster), and each region is a high level of the raster contained in the region. The pathfinding from the first grid to the second grid can be abstracted into the pathfinding from the area where the first grid is located to the area where the second grid is located, that is, the pathfinding is performed on a high-level map.

可选地,在本实施例中,在使用第一地图(可以是多个地图中的任意一个)之前,可以先将第一地图划分为多个第一区域。第一地图可以是栅格地图或者导航地图,可以采用不同的方式将栅格地图和导航地图划分为多个区域。Optionally, in this embodiment, before using the first map (which may be any one of multiple maps), the first map may be divided into multiple first areas. The first map may be a grid map or a navigation map, and the grid map and the navigation map may be divided into multiple areas in different ways.

在第一地图为栅格地图的情况下,可以按照第一地图的地图长度和地图宽度,将第一地图划分为大小相等的多个区域。例如,可预先配置每个区域的区域长度和区域宽度,按照区域长度和区域宽度,将第一地图划分为多个区域。When the first map is a grid map, the first map may be divided into multiple regions of equal size according to the map length and map width of the first map. For example, the area length and area width of each area may be preconfigured, and the first map may be divided into multiple areas according to the area length and area width.

例如,如图3所示,游戏地图为栅格地图,可以对栅格地图中的栅格进行分层,抽象出栅格集群(每个集群相当于一个更高层次地图的地图单元),每个集群对应于栅格地图中的一片区域,包含该区域内的所有栅格。For example, as shown in Figure 3, the game map is a grid map, and the grids in the grid map can be layered to abstract grid clusters (each cluster is equivalent to a map unit of a higher-level map). A cluster corresponds to an area in the raster map and contains all the rasters within that area.

在第一地图为导航地图的情况下,可以按照第一地图包含的导航网格数量,将第一地图划分包含相同数量的导航网格的多个区域。例如,可预先配置每个区域中包含的导航网格的数量。按照预先配置的每个区域包含的导航网格的数量,可以将游戏地图划分为多个区域。When the first map is a navigation map, the first map may be divided into a plurality of areas including the same number of navigation grids according to the number of navigation grids included in the first map. For example, the number of navigation meshes contained in each area can be pre-configured. The game map can be divided into multiple zones according to the pre-configured number of navmesh each zone contains.

导航地图不像栅格地图那样规整,不能按照类似栅格地图一样利用坐标进行分层的方式。导航网格是一系列凸多边形节点组成的图,可以把导航地图中的凸多边形(导航网格)当作图论的节点,凸多边形之间的公共边作为图论的边,抽取出完整的图论模型,那么,对导航地图进行分层可以借助一些基于图论的分层算法:例如,multilevel bisectionalgorithm(多级二分算法)。该算法可以将任意给定的无向图均匀分成若干个集群,每个集群的节点数量在k个左右(k为输入值)。Navigation maps are not as organized as grid maps, and cannot be layered using coordinates like grid maps. The navigation mesh is a graph composed of a series of convex polygon nodes. The convex polygons (navigation meshes) in the navigation map can be regarded as the nodes of the graph theory, and the common edges between the convex polygons can be regarded as the edges of the graph theory. Graph theory model, then, the navigation map can be layered with the help of some layering algorithms based on graph theory: for example, multilevel bisectionalgorithm (multilevel bisectional algorithm). The algorithm can evenly divide any given undirected graph into several clusters, and the number of nodes in each cluster is about k (k is the input value).

对于导航地图,当图论的节点被分到各个集群之后,图论中的无向边可以分为两种:第一种无向边是边连接的两个节点都属于同一个集群,第二种无向边是边连接的两个节点属于不同的集群(这样的边可以称为“EdgeCut(割边)”)。第二种无向边连接两个不同的集群,等于就是集群与集群之间的连接关系,第二种无向边可以称为集群与集群的邻接边。For the navigation map, when the nodes of graph theory are divided into clusters, the undirected edges in graph theory can be divided into two types: the first undirected edge is that the two nodes connected by the edge belong to the same cluster, the second An undirected edge is an edge connecting two nodes that belong to different clusters (such an edge may be called an "EdgeCut"). The second type of undirected edge connects two different clusters, which is equivalent to the connection between clusters. The second type of undirected edge can be called an adjacency edge between clusters.

例如,如图4所示,游戏地图为导航地图,可以对导航地图中的导航网格进行分层,抽象出导航网格集群(每个集群相当于一个更高层次地图的节点),每个集群对应于导航地图中的一片区域,包含该区域内的所有导航网格,每个集群中包含的导航网格的数量为预定值。For example, as shown in Figure 4, the game map is a navigation map, and the navigation grids in the navigation map can be layered to abstract the navigation grid clusters (each cluster is equivalent to a node of a higher-level map), and each A cluster corresponds to an area in the navigation map, and includes all navigation meshes in the area, and the number of navigation meshes contained in each cluster is a predetermined value.

通过本实施例,通过对导航地图和栅格地图按照不同的方式划分为多个区域,可以保证区域划分的合理性,进而保证地图寻路的效率。Through this embodiment, by dividing the navigation map and the grid map into multiple areas in different ways, the rationality of the area division can be ensured, thereby ensuring the efficiency of map pathfinding.

可选地,在本实施例中,对于第一地图被划分为的多个第一区域,可以分别识别并配置每个第一区域的邻接口。Optionally, in this embodiment, for a plurality of first areas into which the first map is divided, adjacent interfaces of each first area may be separately identified and configured.

对于多个第一区域中的任意相邻的两个第一区域,两者如果是连通的,则两个第一区域的邻接位置可以作为区域连通位置。每个第一区域中的连通位置可以是本区域进入相邻区域的区域入口(即,邻接口),因此,每个第一区域可以包含允许从本区域进入到本区域的相邻区域的入口。For any two adjacent first regions in the plurality of first regions, if the two are connected, the adjacent position of the two first regions may be used as the region connecting position. The communication location in each first zone may be the zone entry (ie, the adjacency port) of the present zone into the adjacent zone, and thus, each first zone may contain the entrance allowing access from the present zone to the adjacent zone of the present zone .

除了本地图中的区域与区域之间的邻接口以外,部分第一区域可以包含由本地图进行到其他地图的出口,或者,由其他区域进入到本区域的入口。两个地图之间的出入口(传送门)可以是相同的,也就是说,该传送门即是本地图传送到另一地图的出口,也是另一地图传送到本地图的入口。本地图与不同地图的传送门可以位于地图的不同位置,不同位置可以是本地图的相同区域中的位置,或者不同区域中的位置。In addition to the adjacency interface between the areas in this map, some of the first areas may include exits from this map to other maps, or entrances into this area from other areas. The entrance and exit (portal) between the two maps can be the same, that is to say, the portal is the exit from this map to another map, and also the entrance from another map to this map. The portals of this map and different maps may be located in different locations on the map, and the different locations may be locations in the same area of this map, or locations in different areas.

例如,地图A与地图B之间的传送门位于地图A的一个区域中的位置1,地图A与地图C之间的传送门位于地图A的另一个区域中的位置2。For example, the portal between map A and map B is at position 1 in one area of map A, and the portal between map A and map C is at position 2 in another area of map A.

目标出口位于第一地图的第二目标区域内,目标出口允许从第二目标区域进入到另一个地图中与第二目标区域相邻的区域(逻辑上相邻),因此,目标出口属于第二目标区域的邻接口。The target exit is located in the second target area of the first map, and the target exit allows entry from the second target area to an area adjacent to the second target area in another map (logically adjacent), so the target exit belongs to the second target area. The neighbor interface of the target area.

需要说明的是,对于各个地图中的各个区域,其包含的邻接口除了包含本区域与本地图中的相邻区域之间的入口,还可以包含本地图的出口。如果一个地图的出入口相同的情况下,本地图的出口即为本地图的出入口。It should be noted that, for each area in each map, the adjacent port included in the adjacent port may also include the exit of the local map in addition to the entrance between the local area and the adjacent area in the local map. If the entrance and exit of a map are the same, the exit of this map is the entrance and exit of this map.

对于栅格地图和导航地图,可以采用不同的方式确定第一地图的各第一区域的邻接口以及邻接口之间的路径。For the grid map and the navigation map, the adjacent interfaces of each first area of the first map and the paths between the adjacent interfaces may be determined in different ways.

对于栅格地图,确定多个第一区域中的每个第一区域的邻接口的方式可以是:识别多个第一区域中的每个第一区域的候选邻接口,其中,候选邻接口为每个第一区域中允许从每个第一区域进入到每个第一区域的相邻区域的栅格;在候选邻接口包含连续的多个栅格的情况下,从多个栅格中选取一个栅格作为每个第一区域的一个邻接口;在候选邻接口包含不连续的一个或多个栅格的情况下,将一个或多个栅格确定为每个第一区域的一个或多个邻接口。For a grid map, the manner of determining the adjacent interface of each of the plurality of first regions may be: identifying candidate adjacent interfaces of each of the plurality of first regions, wherein the candidate adjacent interface is The grids in each first area that allow access from each first area to the adjacent areas of each first area; if the candidate adjacent interface contains multiple consecutive grids, select from multiple grids One grid is used as one adjacent interface for each first area; in the case that the candidate adjacent interface contains one or more grids that are not continuous, the one or more grids are determined as one or more grids for each first area. adjacent interface.

为了识别每个第一区域中包含的邻接口,则可以识别多个第一区域中的每个第一区域的候选邻接口。栅格地图中的候选邻接口为每个第一区域中允许从本区域进入到本区域的相邻区域的栅格。In order to identify adjacent interfaces contained in each of the first areas, candidate adjacent interfaces for each of the plurality of first areas may be identified. The candidate adjacency interface in the grid map is the grid in each first area that allows access from this area to the adjacent area of this area.

对于识别的候选入口,其可以包含连续的栅格,也可以包含离散的栅格,对于连续栅格,各个栅格均可以作为该区域的邻接口。为减少寻路复杂度,可以从连续栅格中选取一个栅格作为该区域的一个邻接口,连续栅格中的其他栅格不作该区域的邻接口。对于离散栅格,可以直接将其作为该区域的邻接口。For the identified candidate entrances, it can contain continuous grids or discrete grids, and for continuous grids, each grid can be used as the adjacent interface of the area. In order to reduce the complexity of pathfinding, one grid can be selected from the continuous grid as an adjacent interface of the area, and other grids in the continuous grid are not used as the adjacent interface of the area. For discrete rasters, you can directly use it as the neighbor interface for the area.

例如,如图5所示,如果相邻集群的入口块(邻接口)的数量有连续的多个,可以选择其中相邻的两个作为该相邻集群的入口,并将入口相连。选择的入口块可以抽象为抽象图中的两个节点,该两个节点之间的边的权重为1。For example, as shown in FIG. 5 , if there are multiple consecutive entry blocks (adjacent interfaces) of adjacent clusters, two adjacent ones can be selected as the entrances of the adjacent cluster, and the entrances can be connected. The selected entry block can be abstracted as two nodes in the abstract graph, and the weight of the edge between the two nodes is 1.

通过本实施例,在候选邻接口包含连续的多个栅格时选择其中的一个作为邻接口,可以减少寻路复杂度,提高寻路效率。With this embodiment, when the candidate adjacent interface includes a plurality of consecutive grids, one of them is selected as the adjacent interface, which can reduce the complexity of path finding and improve the efficiency of path finding.

每个第一区域中的邻接口的数量可以包含一个或者多个。如果一个第一区域中的邻接口的数量为一个,则该第一区域为出入口仅为一个,不存在邻接口之间的路径。如果一个第一区域中的邻接口的数量为多个,可以预先存储第一区域的邻接口之间的路径。The number of adjacent interfaces in each first area may include one or more. If the number of adjacent interfaces in a first area is one, the first area has only one entrance and exit, and there is no path between adjacent interfaces. If the number of adjacent interfaces in a first area is multiple, paths between adjacent interfaces in the first area may be pre-stored.

可选地,在本实施例中,可以首先确定多个第一区域中的每个第一区域的邻接口;在多个第一区域中包含具有多个邻接口的第一子区域的情况下,获取第一子区域内的多个邻接口之间的第一参考路径;并保存第一子区域内的多个邻接口之间的第一参考路径。Optionally, in this embodiment, an adjacent interface of each of the multiple first areas may be determined first; in the case that the multiple first areas include a first sub-area with multiple adjacent interfaces , obtain a first reference path between multiple adjacent interfaces in the first sub-area; and save the first reference path between multiple adjacent interfaces in the first sub-area.

多个第一区域中的第一子区域包含多个邻接口。如果两个邻接口之间是连通的,则可以查找到两者之间的一条路径(例如,第一参考路径)。如果两个邻接口之间是不连通的,则无法查找到两者之间的路径。A first sub-area of the plurality of first areas includes a plurality of adjacent interfaces. If the two adjacent interfaces are connected, a path (eg, the first reference path) between the two can be found. If the two adjacent interfaces are disconnected, the path between them cannot be found.

例如,如果一个集群有多个相邻集群,在该集群包含多个出入口,可以在集群内部连接入口,也就是,将每个集群中的各个入口进行连接,得到集群内连接路径。For example, if a cluster has multiple adjacent clusters, and the cluster contains multiple entrances and exits, the entrances can be connected within the cluster, that is, the entrances in each cluster are connected to obtain the intra-cluster connection path.

在得到每个第一区域中的邻接口之间的路径之后,可以保存得到的上述路径(例如,第一参考路径),得到的路径可以保存在目标数据库中。After obtaining the path between the adjacent interfaces in each first area, the obtained above-mentioned path (eg, the first reference path) may be saved, and the obtained path may be saved in the target database.

第一地图中的地图寻路可以抽象为抽象图中的寻路问题,该抽象图可以是基于图论模型的抽象图。每个第一区域的邻接口可以作为抽象图中的节点,邻接口之间的路径可以作为抽象图中的边,路径的长度可以作为边的权重。The map pathfinding in the first map can be abstracted as a pathfinding problem in an abstract graph, and the abstract graph can be an abstract graph based on a graph theory model. The adjacent interfaces of each first area can be used as nodes in the abstract graph, the paths between adjacent interfaces can be used as edges in the abstract graph, and the length of the paths can be used as the weights of the edges.

如图6所示,左侧圆圈中的栅格块为同一集群内的入口,对应于抽象图中的节点(右侧中的圆圈),两个入口之间的路径,对应于抽象图中节点之间的边,路径长度(所经过的栅格块数量),对应于抽象图中的边的权重(6、8、12等)。As shown in Figure 6, the grid blocks in the circle on the left are the portals within the same cluster, corresponding to the nodes in the abstract graph (circles on the right), and the path between the two portals corresponds to the nodes in the abstract graph The edges between, the path length (number of grid blocks traversed), corresponding to the weights of the edges in the abstract graph (6, 8, 12, etc.).

通过本实施例,通过识别并保存每个区域的入口之间的路径,可以便于在地图寻路的过程中使用,提高地图寻路效率。Through this embodiment, by identifying and saving the paths between the entrances of each area, it can be easily used in the process of map pathfinding, and the efficiency of map pathfinding can be improved.

对于导航地图,确定多个第一区域中的每个第一区域的邻接口可以为以下至少之一:For a navigation map, determining an adjacent interface of each of the plurality of first areas may be at least one of the following:

1)在邻接边上直接选取一个点作为高层集群与高层集群之间的入口。高层集群内路径保存一个入口点与另一个入口点之间的真实路径,最终路径由多个高层集群之间的真实路径拼接起来。1) Directly select a point on the adjacent edge as the entrance between the high-level cluster and the high-level cluster. The high-level intra-cluster path saves the real path between one entry point and another, and the final path is spliced by the real paths between multiple high-level clusters.

对于上述方式,可以确定多个第一区域中的每个第一区域与每个第一区域的相邻区域之间的邻接边;从每个第一区域的每个邻接边上选取一个邻接点作为每个邻接边上的邻接口,得到每个第一区域的邻接口;在多个第一区域中包含具有多个邻接口的第二子区域的情况下,获取第二子区域内的多个邻接口之间的第二参考路径;保存第二子区域内的多个邻接口之间的第二参考路径。For the above method, the adjoining edge between each of the multiple first regions and the adjacent regions of each first region can be determined; an adjoining point is selected from each adjoining edge of each first region As the adjacent interface on each adjacent edge, obtain the adjacent interface of each first area; in the case that the second sub-area with multiple adjacent interfaces is included in the multiple first areas, obtain the multiple adjacent interfaces in the second sub-area. A second reference path between multiple adjacent interfaces; and the second reference path between multiple adjacent interfaces in the second sub-area is saved.

在确定每个第一区域内的邻接口之间的路径时,可以首先确定每个第一区域与该区域的相邻区域之间的邻接边,然后在邻接边上直接选取一个点作为区域与区域(高层集群与高层集群)之间的入口(邻接口)。When determining the path between the adjacent interfaces in each first area, you can first determine the adjacent edge between each first area and the adjacent area of the area, and then directly select a point on the adjacent edge as the area and the adjacent area. Ingress (adjacent interface) between regions (high-level cluster and high-level cluster).

对于包含多个邻接口的第一区域(第二子区域),可以分别确定多个邻接口中的任意两个邻接口之间的路径。如果两个邻接口之间是连通的,则可以查找到两者之间的一条路径(例如,第二参考路径)。如果两个邻接口之间是不连通的,则无法查找到两者之间的路径。For the first area (second sub-area) including multiple adjacent interfaces, a path between any two adjacent interfaces among the multiple adjacent interfaces can be determined respectively. If two adjacent interfaces are connected, a path (eg, a second reference path) between the two can be found. If the two adjacent interfaces are disconnected, the path between them cannot be found.

在得到每个第一区域中的邻接口之间的路径之后,可以保存得到的上述路径(例如,第二参考路径),得到的路径可以保存在目标数据库中。After obtaining the path between the adjacent interfaces in each first area, the obtained path (eg, the second reference path) can be saved, and the obtained path can be saved in the target database.

可选地,在本实施例中,对于导航网格,高层集群与高层集群之间的边界是EdgeCut类型的公共边(邻接边),那么高层集群与高层集群之间的入口落在该公共边上。可以在相邻集群的公共边上直接选取一个点作为高层集群与高层集群之间的入口。高层集群内路径保存一个入口点与另一个入口点之间的真实路径(路点路径),最终路径由多个高层集群之间的真实路径拼接起来。Optionally, in this embodiment, for the navigation mesh, the boundary between the high-level cluster and the high-level cluster is a common edge (adjacent edge) of the EdgeCut type, then the entrance between the high-level cluster and the high-level cluster falls on the common edge. superior. A point can be directly selected on the common edge of adjacent clusters as the entrance between high-level clusters and high-level clusters. The high-level intra-cluster path saves the real path (waypoint path) between one entry point and another entry point, and the final path is spliced by the real paths between multiple high-level clusters.

对于上述场景,假设同一高层集群中与其它高层集群相连的有N个入口,那么该高层集群内一共计算N(N-1)/2次每两个入口间的路径,并存储O(N(N-1)/2)条路径。For the above scenario, assuming that there are N entries connected to other high-level clusters in the same high-level cluster, then the high-level cluster calculates the path between each two entries N(N-1)/2 times in total, and stores O(N( N-1)/2) paths.

通过本实施例,通过识别并保存每个第一区域的邻接口之间的路径,可以便于地图寻路的过程中使用,提高地图寻路效率。With this embodiment, by identifying and saving the paths between the adjacent interfaces of each first area, it is convenient to use in the process of map pathfinding, and the efficiency of map pathfinding can be improved.

2)先不直接选取一个点,以整条邻接边为入口。高层集群内路径保存的是一个入口邻接边和另一个入口邻接边之间的多边形路径(该路径为一片路径区域)。最终路径由多个高层集群之间的邻接边路径经过整体的StringPull算法等进行提炼得到。2) Do not directly select a point first, and use the entire adjacent edge as the entrance. The high-level intra-cluster path saves a polygonal path between one entry-adjacent edge and another entry-adjacent edge (the path is a path region). The final path is obtained by refining the adjacent edge paths between multiple high-level clusters through the overall StringPull algorithm.

对于上述方式,可以确定多个第一区域中的每个第一区域的邻接边,其中,每个第一区域的邻接边为每个第一区域与每个第一区域的相邻区域之间的邻接口;在多个第一区域中包含具有多个邻接边的第三子区域的情况下,以第三子区域内包含的导航网格为节点,以导航网格之间的公共边为边,搜索第三子区域内的多个邻接边之间的第一路径区域,其中,第一路径区域包含第一路径区域所经过的导航网格;保存第三子区域内的多个邻接边之间的第一路径区域。For the above manner, an adjacent edge of each first region in the plurality of first regions may be determined, wherein the adjacent edge of each first region is between each first region and an adjacent region of each first region The adjacency interface of ; in the case that multiple first regions include third subregions with multiple adjacent edges, take the navigation meshes contained in the third subregions as nodes, and take the common edges between the navigation meshes as edge, search the first path area between multiple adjacent edges in the third sub-area, wherein the first path area includes the navigation mesh passed by the first path area; save the multiple adjacent edges in the third sub-area the first path area in between.

对于导航地图中包含的多个第一区域,可以直接选择第一区域之间的整条邻接边作为邻接口,而先不直接选取一个点作为邻接口。对于导航地图中包含的多个第一区域,可以确定每个第一区域与该区域的相邻区域之间的邻接边(公共边),并将邻接边作为该区域的邻接口。For a plurality of first areas included in the navigation map, the entire adjacent edge between the first areas may be directly selected as the adjacent interface, instead of directly selecting a point as the adjacent interface. For a plurality of first areas included in the navigation map, the adjoining edge (common edge) between each first area and the adjacent areas of the area may be determined, and the adjoining edge may be used as the adjacency interface of the area.

对于包含多个邻接边的第一区域(第三子区域),可以分别确定多个邻接边中的任意两个邻接边之间的路径。如果两个邻接边之间是连通的,则可以查找到两者之间的一条路径(例如,第一路径区域)。如果两个邻接边之间是不连通的,则无法查找到两者之间的路径。For the first area (third sub-area) containing multiple adjacent edges, a path between any two adjacent edges among the multiple adjacent edges can be determined respectively. If two adjacent edges are connected, a path (eg, the first path region) between them can be found. If two adjacent edges are disconnected, the path between them cannot be found.

在区域内进行邻接边之间的寻路时,可以以区域内包含的导航网格为节点,以导航网格之间的公共边为边,搜索该区域内的任意两个邻接边之间的路径,该路径包含一串凸多边形(即,包含一串导航网格,以及导航网格之间的公共边),可以认为是一片路径区域(即,第一路径区域)。When pathfinding between adjacent edges in an area, the navigation mesh contained in the area can be used as a node, and the common edge between navigation meshes can be used as an edge to search for the path between any two adjacent edges in the area. A path, which contains a series of convex polygons (ie, contains a series of navigation meshes, and a common edge between the navigation meshes), can be considered as a path region (ie, the first path region).

在得到每个第一区域中的邻接边之间的路径区域之后,可以保存得到的上述路径区域(例如,第一路径区域),得到的路径区域可以保存在目标数据库中。After obtaining the path region between adjacent edges in each first region, the obtained path region (eg, the first path region) can be saved, and the obtained path region can be saved in the target database.

对于导航地图,集群内路径保存的是入口公共边(邻接边)和入口公共边(邻接边)之间的多边形路径。For navigation maps, the intra-cluster path holds the polygonal path between the entry common edge (adjacent edge) and the entry common edge (adjacent edge).

可选地,在本实施例中,在计算集群内不同入口之间的路径时,由于选择的是一整条公共边作为入口,这个信息属于抽象之后的图论模型上的信息。如果有多个节点A、B、C、D都要向点E进行寻路,可以以E为起点,反向地对所有节点调用单源最短路算法进行寻路。单源最短路算法最终输出的是以E点为根的最短路径搜索树。这样,如果一个集群有K个节点,N个入口点,一共需要保存N棵最短路径搜索树。对于保存一棵树的一种方法是直接存储每个节点的父亲节点,所以一共需要存储K*N个父亲节点即可。Optionally, in this embodiment, when calculating paths between different portals in the cluster, since a whole common edge is selected as the portal, this information belongs to the information on the abstracted graph theory model. If there are multiple nodes A, B, C, and D all need to find the path to point E, you can use E as the starting point, and call the single-source shortest path algorithm for all nodes in the reverse direction to find the path. The final output of the single-source shortest path algorithm is the shortest path search tree rooted at point E. In this way, if a cluster has K nodes and N entry points, a total of N shortest path search trees need to be saved. One way to save a tree is to directly store the parent node of each node, so a total of K*N parent nodes need to be stored.

通过本实施例,通过识别并保存每个区域的邻接边之间的路径,可以便于地图寻路的过程中使用,提高地图寻路效率。With this embodiment, by identifying and saving the paths between the adjacent edges of each area, it is convenient to use in the process of map pathfinding, and the efficiency of map pathfinding can be improved.

在地图寻路的过程中,可以首先确定移动起点到所在区域内的邻接口之间的路径。移动起点位于第一地图中的第一目标区域内,服务器可以确定移动起点至第一目标区域的邻接口的路径(即,第一子路径)。In the process of map pathfinding, the path between the moving starting point and the adjacent interface in the area may be determined first. The moving starting point is located within the first target area in the first map, and the server may determine a path (ie, a first sub-path) from the moving starting point to an adjacent interface of the first target area.

第一目标区域中的邻接口的数量可以有一个或多个,如果邻接口的数量为一个,该第一子路径可以包括该移动起点至该邻接口的一条路径。如果邻接口的数量为多个,该第一子路径可以包括该移动起点至每个邻接口的一条或多条路径。The number of adjacent interfaces in the first target area may be one or more. If the number of adjacent interfaces is one, the first sub-path may include a path from the moving starting point to the adjacent interface. If the number of adjacent interfaces is multiple, the first sub-path may include one or more paths from the moving origin to each adjacent interface.

在确定第一子路径时,对于栅格地图,可以采用相关技术中已有的地图寻路方法进行寻路,例如,基于A*算法的寻路,基于Dijkstra算法的寻路等,在此不做赘述。对于导航地图,对于邻接口为邻接边上的一个点的场景和为整条邻接边的场景,可以采用不同的方式确定子路径。When determining the first sub-path, for the grid map, the existing map path-finding methods in the related art can be used for path-finding, for example, path-finding based on A* algorithm, path-finding based on Dijkstra algorithm, etc. Do repeat. For the navigation map, the sub-path can be determined in different ways for the scene where the adjacent interface is a point on the adjacent edge and the scene where the adjacent interface is the entire adjacent edge.

对于邻接口为邻接边上的一个点的场景,在计算起点到本集群邻接口的路径时,可以分别从移动起点向各个邻接口发起寻路,例如,基于A*算法的寻路,基于Dijkstra算法的寻路等,在此不做赘述。For a scenario where an adjacent interface is a point on an adjacent edge, when calculating the path from the starting point to the adjacent interface of the cluster, pathfinding can be initiated from the moving starting point to each adjacent interface. For example, pathfinding based on A* algorithm, based on Dijkstra The pathfinding of the algorithm, etc., will not be repeated here.

例如,假如本集群入口分别是入口点A、B、C、D,起点是S,那么就需要从点S向A、B、C、D四个点发起四次寻路。For example, if the entry points of the cluster are entry points A, B, C, and D, and the starting point is S, then four pathfinding needs to be initiated from point S to points A, B, C, and D.

对于邻接口为整条邻接边的场景,在计算起点到本集群邻接口的路径时,由于已经对所有图论节点存储了最短路径树,可以首先将移动起点对应到所在的导航网格中,然后基于最短路径树查询该导航网格到各个邻接边的路径。For the scenario where the adjacent interface is the entire adjacent edge, when calculating the path from the starting point to the adjacent interface of the cluster, since the shortest path tree has been stored for all graph theory nodes, the moving starting point can be first mapped to the navigation mesh where it is located. The navigation mesh is then queried for paths to each adjacent edge based on the shortest path tree.

例如,在计算起点到本集群入口的路径时,由于已经对所有图论节点存储了最短路径树,不需要再进行寻路,如果要查询起点S到入口公共边P的路径,首先在导航网格上把起点S对应到凸多边形SS上,然后在以P为根的最短路径搜索树上,找到SS到P的路径即可(树上每两点间路径是唯一的)。For example, when calculating the path from the starting point to the entrance of the cluster, since the shortest path tree has been stored for all graph theory nodes, no further pathfinding is required. On the grid, the starting point S corresponds to the convex polygon SS, and then on the shortest path search tree with P as the root, the path from SS to P can be found (the path between every two points on the tree is unique).

在得到第一子路径之后,可以根据第一子路径、以及预先存储的每个第一区域的邻接口之间的路径,获取由移动起点至目标出口的第一路径。After the first sub-path is obtained, the first path from the moving starting point to the target exit can be obtained according to the first sub-path and the pre-stored paths between adjacent interfaces of each first area.

通过本实施例,通过将地图划分为多个区域,并预先存储各个区域的邻接口之间路径,可以减少寻路算法的搜索次数,提高地图的寻路效率。With this embodiment, by dividing the map into multiple areas and storing the paths between adjacent interfaces in each area in advance, the search times of the path-finding algorithm can be reduced, and the path-finding efficiency of the map can be improved.

作为一种可选的实施例,根据第一子路径、以及预先存储的每个第一区域的邻接口之间的路径,获取由移动起点至目标出口的第一路径包括:As an optional embodiment, according to the first sub-path and the pre-stored path between adjacent interfaces of each first area, obtaining the first path from the moving start point to the target exit includes:

S21,以移动起点、每个第一区域的邻接口为节点,以第一子路径、以及每个第一区域的邻接口之间的路径为边,搜索移动起点至目标出口之间的路径,得到第一路径。S21, take the moving starting point and the adjacent interface of each first area as a node, and use the first subpath and the path between the adjacent interfaces of each first area as an edge, search for the path between the moving starting point and the target exit, Get the first path.

对于栅格地图和导航地图,可以按照图论模型的方式在第一地图中进行寻路。第一地图可以抽象为图论模型,该图论模型为第一地图的抽象图。在该图论模型中,各个区域的邻接口为节点,各个邻接口之间的路径为边,路径的长度为边的权重。For grid maps and navigation maps, wayfinding can be performed in the first map in the manner of a graph theory model. The first map may be abstracted into a graph theory model, which is an abstract graph of the first map. In this graph theory model, the adjacent interface of each region is a node, the path between each adjacent interface is an edge, and the length of the path is the weight of the edge.

在得到移动起点至第一目标区域的邻接口之间的第一子路径之后,可以将移动起点作为节点添加到第一地图的图论模型中,将该第一子路径作为与移动起点对应的节点和与第一目标区域的邻接口对应的节点之间的边,该边的权重为第一子路径的长度。After the first sub-path between the moving starting point and the adjacent interface of the first target area is obtained, the moving starting point can be added as a node to the graph theory model of the first map, and the first sub-path can be used as the corresponding moving starting point. The edge between the node and the node corresponding to the adjacent interface of the first target area, the weight of the edge is the length of the first sub-path.

在该第一地图的图论模型中,可以查找与移动起点对应的节点到与目标出口对应的节点之间的路径,得到第一路径。In the graph theory model of the first map, the path between the node corresponding to the moving start point and the node corresponding to the target exit can be searched to obtain the first path.

例如,对于图3所示的栅格地图,其对应的集群入口和集群内入口之间的路径如图7所示,五角星位置为目标出口的位置。如图8所示,在进行地图寻路时,将起点加入到抽象图,圆圈位置为起点,生成起点到所在集群入口之间的路径。For example, for the grid map shown in Fig. 3, the path between the corresponding cluster entrance and the entrance in the cluster is shown in Fig. 7, and the position of the five-pointed star is the position of the target exit. As shown in Figure 8, when performing map pathfinding, the starting point is added to the abstract graph, and the position of the circle is the starting point, and the path between the starting point and the cluster entrance is generated.

在抽象图中寻路,并提炼路径:在抽象图中通过如A*等寻路方式确定起点至目标之间的路径,得到如图9所示的路径。Find the path in the abstract graph and refine the path: in the abstract graph, determine the path between the starting point and the target through path-finding methods such as A*, and obtain the path shown in Figure 9.

通过本实施例,采用图论算法进行地图寻路,可以适用于已有的图论算法,提高地图寻路方式的适用性。Through this embodiment, the graph theory algorithm is used for map pathfinding, which can be applied to the existing graph theory algorithm, and the applicability of the map pathfinding method is improved.

可选地,在本实施例中,对于导航地图中的邻接口为整条邻接边的场景,按照图论算法寻找到的是一片路径区域,可以在该路径区域内确定一条路径作为寻路结果。可以通过以下方式生成第一路径:以移动起点、以及每个第一区域的邻接边为节点,以第一子路径、和第一路径区域为边,搜索移动起点至目标出口的第二路径区域,其中,第二路径区域包含第二路径区域所经过的导航网格;从第二路径区域内获取由移动起点至目标出口的第一路径。Optionally, in this embodiment, for a scene in which the adjacent interface in the navigation map is the entire adjacent edge, a path area is found according to the graph theory algorithm, and a path can be determined in the path area as the path finding result. . The first path can be generated in the following way: take the moving starting point and the adjacent edges of each first area as nodes, take the first sub-path and the first path area as edges, and search for the second path area from the moving starting point to the target exit , wherein the second path area includes the navigation mesh passed by the second path area; the first path from the moving starting point to the target exit is obtained from the second path area.

对于导航地图,集群内路径保存的是入口公共边(邻接边)和入口公共边(邻接边)之间的多边形路径,最终可以由多个集群之间的公共边路径(多边形路径)经过路径提炼算法(如,StringPull算法)提炼出真实路径。For the navigation map, the intra-cluster path saves the polygonal path between the entrance common edge (adjacent edge) and the entrance common edge (adjacent edge), and finally can be refined by the common edge path (polygon path) between multiple clusters. Algorithms (eg, StringPull algorithm) extract the true path.

在进行地图寻路时,可以将移动起点加入到抽象图中,并将移动起点、以及每个第一区域的邻接边为节点,以第一子路径、和第一路径区域为边,按照图论模型中的寻路算法(例如,A*算法)搜索移动起点至目标出口的一条路径,该路径为一条多边形串,可以还原为导航地图中的一片路径区域,例如,第二路径区域,该第二路径区域包含第二路径区域所经过的导航网格。When performing map pathfinding, the moving starting point can be added to the abstract graph, and the moving starting point and the adjacent edges of each first area are nodes, and the first sub-path and the first path area are used as edges, according to the graph On the pathfinding algorithm (for example, the A* algorithm) in the model, it searches for a path from the moving starting point to the target exit. The path is a polygon string and can be restored to a path area in the navigation map, for example, the second path area, which is a The second path area contains the navigation mesh traversed by the second path area.

在得到第二路径区域之后,可以经过路径提炼算法提炼出移动起点至目标出口的第一路径,例如,按照公共边中点法确定移动起点至目标出口的第一路径。After obtaining the second path area, the first path from the moving starting point to the target exit can be extracted through a path extraction algorithm, for example, the first path from the moving starting point to the target exit is determined according to the common edge midpoint method.

可选地,在本实施例中,为了减少路径的拐点数量,以保证寻路得到的移动起点至目标出口的路径尽可能短,可以采用如StringPull等算法依靠多边形与多边形之间的公共边来确定路径最终的拐点,从而确定出第一路径。Optionally, in this embodiment, in order to reduce the number of inflection points of the path, to ensure that the path from the moving starting point to the target exit obtained by pathfinding is as short as possible, an algorithm such as StringPull can be used to rely on the common edge between polygons. The final inflection point of the path is determined, thereby determining the first path.

例如,如图10所示,在进行地图寻路时,可以采用StringPull算法减少拐点数量,维护单调递减的漏斗,将起点对应到凸多边形的公共边上,移动第一条边,漏斗角度减少,确定移动;移动第二条边,漏斗角度仍减少,确定移动;再移动第一条边,漏斗角度继续减少,确定移动;由于无法朝着同一方向移动第二条边,因此还是移动第一条边,此时漏斗的两个边的位置关系发生变化,不允许移动则确定此处需要一个拐点。确定好该拐点之后,可以继续以该拐点为起点调用StringPull算法提炼路径。For example, as shown in Figure 10, when performing map pathfinding, the StringPull algorithm can be used to reduce the number of inflection points, maintain a monotonically decreasing funnel, map the starting point to the common edge of the convex polygon, move the first edge, and reduce the angle of the funnel. Confirm the move; move the second side, the funnel angle is still reduced, confirm the move; move the first side again, the funnel angle continues to decrease, confirm the move; since the second side cannot be moved in the same direction, the first is still moved At this time, the positional relationship between the two sides of the funnel changes, and if movement is not allowed, it is determined that an inflection point is required here. After the inflection point is determined, you can continue to use the inflection point as the starting point to call the StringPull algorithm to refine the path.

通过本实施例,采用图论算法进行地图寻路,并将寻路得到的多边形串还原地图中的路径,不仅可以提高地图寻路效率,更保证了寻得的路径的可行性与更好的路径质量。Through this embodiment, the graph theory algorithm is used for map pathfinding, and the polygon string obtained by the pathfinding is restored to the path in the map, which not only improves the map pathfinding efficiency, but also ensures the feasibility and better performance of the found path. path quality.

作为一种可选的实施例,确定移动终点所在的第二地图中的第二路径包括:As an optional embodiment, determining the second path in the second map where the moving end point is located includes:

S31,确定第二地图的第三目标区域内的第二子路径,其中,第三目标区域为第二地图包含的多个第二区域中,移动终点所在的区域,多个第二区域中的每个第二区域包含允许从每个第二区域进入到每个第二区域的相邻区域的邻接口,第二子路径为第三目标区域的邻接口至移动终点的路径;S31: Determine the second sub-path in the third target area of the second map, where the third target area is the area where the moving end point is located among the multiple second areas included in the second map, and the Each second area includes an adjacency port that allows access from each second area to an adjacent area of each second area, and the second sub-path is a path from the adjacency port of the third target area to the moving destination;

S32,根据第二子路径、以及预先存储的每个第二区域的目标接口之间的路径,获取由目标入口至移动终点的第二路径,其中,每个第二区域的目标接口包括以下至少之一:每个第二区域的邻接口,目标入口。S32, according to the second sub-path and the pre-stored path between the target interfaces of each second area, obtain a second path from the target entrance to the moving destination, wherein the target interface of each second area includes the following at least One: the adjacent interface of each second area, the target entry.

确定第二地图的目标入口至移动终点的路径的方式可以有多种,例如,基于A*算法的寻路,基于Dijkstra算法的寻路。上述方式需要加载第二地图完整的导航数据,占用一部分的缓存空间。There may be various ways to determine the path from the target entry of the second map to the moving end point, for example, pathfinding based on the A* algorithm and pathfinding based on the Dijkstra algorithm. The above method needs to load the complete navigation data of the second map, which occupies a part of the cache space.

为了提高寻路效率,第二地图可以被划分为多个第二区域(集群,每个集群可以作为划分的一个高层地图的地图单元),每个第二区域中包含多个基本地图单元;配置各第二区域的邻接口,即,允许从本区域进入到本区域的相邻区域的入口,并预先存储每个第二区域的邻接口之间的路径。基于保存的各第二区域的邻接口之间的路径,可以进行地图寻路。In order to improve the pathfinding efficiency, the second map can be divided into multiple second areas (clusters, each cluster can be used as a map unit of a divided high-level map), and each second area contains multiple basic map units; configuration The adjacent ports of each second area, that is, the entrances that allow access from the current area to the adjacent areas of the current area, and the paths between the adjacent ports of each second area are stored in advance. Based on the saved paths between adjacent interfaces of each second area, map pathfinding may be performed.

将第二地图划分为多个第二区域的方式、配置各第二区域的邻接口的方式、预先存储每个第二区域的目标接口之间的路径的方式、以及基于存储的每个第二区域的邻接口之间的路径确定第二路径的方式与前述类似,在此不做赘述。The method of dividing the second map into a plurality of second areas, the method of configuring the adjacent interfaces of each second area, the method of storing the paths between the target interfaces of each second area in advance, and the method of storing each second area based on the method. The path between the adjacent interfaces of the area determines the second path in a manner similar to that described above, which will not be repeated here.

通过本实施例,通过将地图划分为多个区域,并预先存储各个区域的邻接口之间路径,可以减少寻路算法的搜索次数,提高地图的寻路效率。With this embodiment, by dividing the map into multiple areas and storing the paths between adjacent interfaces in each area in advance, the search times of the path-finding algorithm can be reduced, and the path-finding efficiency of the map can be improved.

作为一种可选的实施例,根据第二子路径、以及预先存储的每个第二区域的目标接口之间的路径,获取由目标入口至移动终点的第二路径包括:As an optional embodiment, according to the second sub-path and the pre-stored path between the target interfaces of each second area, acquiring the second path from the target entrance to the moving destination includes:

S41,以移动终点、每个第二区域的目标接口为节点,以第二子路径、以及每个第二区域的目标接口之间的路径为边,搜索目标入口至移动终点的路径,得到第二路径。S41, take the moving end point and the target interface of each second area as nodes, take the second sub-path and the path between the target interfaces of each second area as edges, search for the path from the target entrance to the moving end point, and obtain the first Second path.

可以按照图论模型的方式在第二地图中进行寻路。第二地图可以抽象为图论模型,该图论模型为第二地图的抽象图。在该图论模型中,各第二区域的目标接口为节点,各个目标接口之间的路径为边,路径的长度为边的权重。Pathfinding in the second map can be done in the manner of a graph theory model. The second map may be abstracted into a graph theory model, which is an abstract graph of the second map. In this graph theory model, the target interface of each second region is a node, the path between each target interface is an edge, and the length of the path is the weight of the edge.

在得到第三目标区域的邻接口至移动终点的第二子路径之后,可以将移动终点作为节点添加到第二地图的图论模型中,将该第二子路径作为与移动终点对应的节点和与第三目标区域的邻接口对应的节点之间的边,该边的权重为第二子路径的长度。After obtaining the second sub-path from the adjacency point of the third target area to the moving end point, the moving end point can be added as a node to the graph theory model of the second map, and the second sub-path can be regarded as the node corresponding to the moving end point and The edge between the nodes corresponding to the adjacent interface of the third target area, the weight of the edge is the length of the second sub-path.

在图论模型中查找目标入口至移动终点之间的第二路径的方式与前述类似,在此不做赘述。The manner of finding the second path between the target entry and the moving end point in the graph theory model is similar to that described above, and will not be repeated here.

通过本实施例,采用图论算法进行地图寻路,并将寻路得到的路径还原为地图中的路径,不仅可以提高地图寻路效率,更保证了寻得的路径的可行性与更好的路径质量。Through this embodiment, the graph theory algorithm is used for map path finding, and the path obtained by the path finding is restored to the path in the map, which not only improves the map path finding efficiency, but also ensures the feasibility and better performance of the found path. path quality.

作为一种可选的实施例,在确定第二地图的第三目标区域内的第二子路径之前,上述方法还包括:As an optional embodiment, before determining the second sub-path in the third target area of the second map, the above method further includes:

S51,确定第二地图中移动终点所在的第三目标区域;S51, determine the third target area where the moving end point is located in the second map;

S52,获取第三目标区域的第一导航数据。S52: Acquire the first navigation data of the third target area.

为了减少导航数据对缓存空间的占用,在跨地图寻路发起时,可以仅加载终点地图中终点所在的一小块导航即可,也就是,仅加载第二地图中移动终点所在的第三目标区域的导航数据。In order to reduce the occupation of the cache space by the navigation data, when the cross-map pathfinding is initiated, only a small piece of navigation where the end point is located in the destination map can be loaded, that is, only the third target area where the moving end point is located in the second map is loaded. navigation data.

根据移动终点的位置信息,可以确定第二地图中移动终点所在的第三目标区域。第三目标区域可以通过第二地图的地图标识和第三目标区域的区域标识进行表示。According to the location information of the moving end point, the third target area where the moving end point is located in the second map can be determined. The third target area may be represented by the map identifier of the second map and the area identifier of the third target area.

在确定出移动终点所在的第三目标区域之后,可以加载该第三目标区域的导航数据(第一导航数据),以便进行地图寻路,例如,确定第二子路径。而对于第二地图中除了第三目标区域以外的其他区域的导航数据,可以不进行加载。After the third target area where the moving end point is located, the navigation data (first navigation data) of the third target area can be loaded to perform map pathfinding, for example, to determine the second sub-path. However, the navigation data of other regions except the third target region in the second map may not be loaded.

移动终点的位置信息可以携带在寻路请求中,该位置信息可以通过地图标识和位置坐标的方式表示,或者,通过地图标识、区域标识和位置坐标的方式表示,根据寻路请求中携带的移动终点的位置信息,可以确定出第三目标区域。The location information of the moving destination can be carried in the wayfinding request, and the location information can be represented by a map identifier and location coordinates, or, represented by a map identifier, area identifier and location coordinates, according to the movement carried in the wayfinding request. The location information of the end point can determine the third target area.

通过本实施例,通过确定并加载终点地图中终点所在的一小块导航,可以减少加载的导航数据的数据量,进而减小导航数据对缓存空间的占用。Through this embodiment, by determining and loading a small piece of navigation where the end point is located in the end point map, the data amount of the loaded navigation data can be reduced, thereby reducing the occupation of the cache space by the navigation data.

作为一种可选的实施例,获取第三目标区域的第一导航数据包括:As an optional embodiment, acquiring the first navigation data of the third target area includes:

S61,从目标缓存中查找第三目标区域的导航数据,其中,目标缓存中缓存有多个导航数据的导航数据队列,多个导航数据为被访问过的导航数据;S61, search the navigation data of the third target area from the target cache, wherein the target cache has a plurality of navigation data queues of navigation data cached, and the plurality of navigation data are visited navigation data;

S62,在查找到第三目标区域的导航数据的情况下,确定获取到第三目标区域的第一导航数据;S62, when the navigation data of the third target area is found, determine that the first navigation data of the third target area is obtained;

S63,将第一导航数据移动到导航数据队列的队列头部。S63, move the first navigation data to the queue head of the navigation data queue.

寻路系统往往需要根据玩家所在的位置更新路径,在玩家还未到达目标之前,寻路请求可能发起多次,如果每一次都加载目标地图(终点所在地图)导航,即便是一小块,IO代价也会非常大,而如果改变目的地时,则重新加载导航。The pathfinding system often needs to update the path according to the player's location. Before the player reaches the target, the pathfinding request may be initiated multiple times. If the target map (the map of the destination) is loaded each time for navigation, even if it is a small piece, IO The cost is also very high, and if the destination is changed, the navigation is reloaded.

为了减少加载的导航数据的数据量,可以通过目标缓存来缓存导航数据,目标缓存中缓存有多个导航数据的导航数据队列,多个导航数据为被访问过的导航数据。In order to reduce the data amount of the loaded navigation data, the navigation data can be cached through the target cache. The target cache caches a plurality of navigation data queues of navigation data, and the plurality of navigation data are accessed navigation data.

服务器可以从目标缓存中查找第三目标区域的导航数据,例如,通过区域标识、或者地图标识和区域标识的组合进行导航数据查找。如果查找到第三目标区域的导航数据,确定获取到第三目标区域的该第一导航数据,则无需再加载第三目标区域的导航数据。The server may look up the navigation data of the third target area from the target cache, for example, the navigation data lookup is performed by using the area identifier or the combination of the map identifier and the area identifier. If the navigation data of the third target area is found and it is determined that the first navigation data of the third target area is obtained, it is unnecessary to load the navigation data of the third target area.

考虑到一片刚进入在内存中的导航数据,将来有很大可能会被继续使用(例如,发起一次新的请求时),因此,可以将第一导航数据移动到导航数据队列的队列头部,以便可以被继续使用。Considering that a piece of navigation data that has just entered the memory is likely to be used continuously in the future (for example, when a new request is initiated), the first navigation data can be moved to the queue head of the navigation data queue, so that it can continue to be used.

通过本实施例,通过目标缓存来缓存的导航数据,并将最近被使用的导航数据移动到导航数据队列的队列头部,可以减少加载的导航数据的数据量,同时保证数据调用的及时性。With this embodiment, the navigation data is cached through the target cache, and the most recently used navigation data is moved to the queue head of the navigation data queue, which can reduce the amount of loaded navigation data and ensure the timeliness of data calling.

作为一种可选的实施例,在从目标缓存中查找第三目标区域的导航数据之后,上述方法还包括:As an optional embodiment, after searching the navigation data of the third target area from the target cache, the above method further includes:

S71,在未查找到第三目标区域的导航数据的情况下,加载第三目标区域的第一导航数据;S71, in the case where the navigation data of the third target area is not found, load the first navigation data of the third target area;

S72,将第一导航数据保存到导航数据队列的队列头部。S72, save the first navigation data to the queue head of the navigation data queue.

如果从目标缓存中未查找到第三目标区域的导航数据,则可以确定第三目标区域的导航数据最近未被使用过,需要加载并保存第三目标区域的导航数据。If the navigation data of the third target area is not found from the target cache, it can be determined that the navigation data of the third target area has not been used recently, and the navigation data of the third target area needs to be loaded and saved.

可以通过区域标识、或者地图标识和区域标识的组合加载第三目标区域的导航数据,即,第一导航数据,并将第一导航数据保存到导航数据队列的队列头部,以便可以被继续使用。The navigation data of the third target area, that is, the first navigation data, can be loaded by the area identifier or the combination of the map identifier and the area identifier, and the first navigation data can be saved to the queue head of the navigation data queue, so that it can be used continuously .

通过本实施例,通过加载并将区域的导航数据保存到导航数据队列的队列头部,可以保证数据调用的及时性。Through this embodiment, by loading and saving the navigation data of the area to the queue head of the navigation data queue, the timeliness of data calling can be guaranteed.

作为一种可选的实施例,将第一导航数据保存到导航数据队列的队列头部包括:As an optional embodiment, saving the first navigation data to the queue head of the navigation data queue includes:

S81,在确定出目标缓存中未被使用的存储空间小于存储第一导航数据所需的存储空间的情况下,移除目标缓存中位于导航数据队列的队列尾部的第二导航数据;S81, when it is determined that the unused storage space in the target cache is less than the storage space required for storing the first navigation data, remove the second navigation data located at the tail of the queue of the navigation data queue in the target cache;

S82,将第一导航数据保存到导航数据队列的队列头部。S82, save the first navigation data to the queue head of the navigation data queue.

由于目标缓存的存储空间有限,因此,其仅能存储一定数量的导航数据。可以配置导航数据队列中的导航数据的数量,例如,导航数据队列仅保存目标数量(例如,5个)的导航数据,可以配置导航数据队列中的导航数据的数据量,例如,导航数据队列仅保存目标数据量(例如,2G)的导航数据。Due to the limited storage space of the target cache, it can only store a certain amount of navigation data. The number of navigation data in the navigation data queue can be configured, for example, the navigation data queue only saves the target number (for example, 5) of navigation data, the data volume of the navigation data in the navigation data queue can be configured, for example, the navigation data queue is only Navigation data of the target data amount (eg, 2G) is saved.

在将第一导航数据保存到导航数据队列的队列头部时,可以首先确定是否需要移除导航数据队列中的导航数据。如果目标缓存中未被使用的存储空间小于存储第一导航数据所需的存储空间,或者,导航数据队列中的导航数据的数量超过数量阈值,或者,导航数据队列中的导航数据的数据量超过数据量阈值,则需要移除导航数据队列中的导航数据。When saving the first navigation data to the queue head of the navigation data queue, it may be first determined whether the navigation data in the navigation data queue needs to be removed. If the unused storage space in the target cache is less than the storage space required for storing the first navigation data, or the amount of navigation data in the navigation data queue exceeds the quantity threshold, or the data amount of the navigation data in the navigation data queue exceeds If the data volume threshold is exceeded, the navigation data in the navigation data queue needs to be removed.

移除的导航数据可以是导航数据队列的队列尾部的导航数据,即,第二导航数据,由于最新被使用的导航数据会被移动到导航数据队列的队列首部,则导航数据队列的队列尾部的导航数据为一段时间内都未被访问到的导航数据,该导航数据将来被访问的可能性也很小,因此,可以被优先移除。The removed navigation data may be the navigation data at the end of the queue of the navigation data queue, that is, the second navigation data. Since the newly used navigation data will be moved to the head of the queue of the navigation data queue, the data at the tail of the queue of the navigation data queue is The navigation data is the navigation data that has not been accessed for a period of time, and the possibility of the navigation data being accessed in the future is very small, so it can be preferentially removed.

在移除导航数据队列的队列尾部的第二导航数据之后,可以再将第一导航数据保存到导航数据队列的队列头部。After the second navigation data at the end of the queue of the navigation data queue is removed, the first navigation data may be saved to the head of the queue of the navigation data queue.

例如,一片刚进入在内存中的导航,将来有很大可能继续使用(发起一次新的请求),而在一段时间内都未被访问到的导航,将来被访问的可能性也很小(改变目的地),因此,可以基于LRU(Least Recently Used,最近最少使用)算法缓存导航数据。For example, a piece of navigation that has just entered the memory is very likely to continue to be used in the future (a new request is initiated), while the navigation that has not been accessed for a period of time is also very unlikely to be accessed in the future (changed destination), therefore, the navigation data can be cached based on the LRU (Least Recently Used) algorithm.

通过本实施例,通过在满足数据移除条件时移除导航数据队列的队列尾部的导航数据,可以提高数据存储的合理性。With this embodiment, the rationality of data storage can be improved by removing the navigation data at the end of the queue of the navigation data queue when the data removal condition is satisfied.

作为一种可选的实施例,根据第一路径、第二路径、以及预先存储的多个地图中的各个地图的入口与出口之间的路径,获取由移动起点至移动终点的第三路径包括:As an optional embodiment, according to the first path, the second path, and the path between the entrance and the exit of each of the pre-stored multiple maps, obtaining the third path from the moving start point to the moving end point includes: :

S91,以移动起点、移动终点、以及各个地图的入口和各个地图的出口为节点,以第一路径、第二路径以及各个地图的入口与出口之间的路径为边,搜索移动起点至移动终点的路径,得到第三路径。S91, take the moving starting point, moving end point, and the entrance of each map and the exit of each map as nodes, take the first path, the second path and the path between the entrance and the exit of each map as edges, search for the moving starting point to the moving end point path to get the third path.

在得到第一路径和第二路径之后,可以按照图论模型的方式在多个地图之间进行寻路。多个地图可以抽象为图论模型,该图论模型为多个地图的抽象图。在该图论模型中,各个地图的出入口为节点,各个地图内的出入口之间的路径为边,路径的长度为边的权重。不同的地图之间,具有关联关系的出入口为该图论模型中的相同节点,从而可以通过一个图论模型标识多个地图。After the first path and the second path are obtained, pathfinding can be performed among multiple maps in the manner of a graph theory model. Multiple maps can be abstracted into a graph theory model, which is an abstract graph of multiple maps. In this graph theory model, the entrances and exits of each map are nodes, the paths between the entrances and exits in each map are edges, and the lengths of the paths are the weights of the edges. Between different maps, the entrances and exits with associated relationships are the same nodes in the graph theory model, so that multiple maps can be identified by one graph theory model.

在得到第一路径和第二路径之后,可以将移动起点和移动终点作为节点添加到多个地图的图论模型中,将该第一路径作为与移动起点对应的节点和与目标出口对应的节点之间的边,该边的权重为第一路径的长度,将该第二路径作为与目标入口对应的节点和与移动终点对应的节点之间的边,该边的权重为第二路径的长度。After the first path and the second path are obtained, the moving starting point and moving end point can be added to the graph theory model of multiple maps as nodes, and the first path can be used as the node corresponding to the moving starting point and the node corresponding to the target exit The weight of the edge is the length of the first path, and the second path is used as the edge between the node corresponding to the target entry and the node corresponding to the moving end point, and the weight of this edge is the length of the second path. .

在图论模型中查找移动起点至移动终点之间的第三路径的方式与前述类似,在此不做赘述。The manner of finding the third path between the moving start point and the moving end point in the graph theory model is similar to that described above, and will not be repeated here.

通过本实施例,采用图论算法进行地图寻路,并将寻路得到的路径还原为地图中的路径,可以提高地图寻路效率,保证寻得的路径的可行性。Through this embodiment, the graph theory algorithm is used for map path finding, and the path obtained by the path finding is restored to the path in the map, which can improve the map path finding efficiency and ensure the feasibility of the found path.

作为一种可选的实施例,在确定移动起点所在的第一地图中的第一路径之前,上述方法还包括:As an optional embodiment, before determining the first path in the first map where the moving starting point is located, the above method further includes:

S101,接收待移动对象的客户端发送的移动请求,移动请求用于请求控制待移动对象由移动起点移动至移动终点;S101, receiving a movement request sent by a client of the object to be moved, where the movement request is used to request to control the object to be moved from a moving starting point to a moving end point;

S102,响应移动请求,确定待移动对象的移动起点和移动终点。S102, in response to the movement request, determine the movement starting point and the moving end point of the object to be moved.

上述地图寻路过程可以是根据待移动对象的客户端发送的移动请求(寻路请求),该移动请求用于请求查找一条由移动起点至移动终点的路径,以控制待移动对象由移动起点移动至移动终点。The above-mentioned map pathfinding process can be based on a movement request (pathfinding request) sent by the client of the object to be moved, and the movement request is used to request to find a path from the moving starting point to the moving destination, so as to control the object to be moved to move from the moving starting point. to the moving end point.

上述多个地图可以是游戏地图或者其他地图。以游戏地图为例,游戏地图可以是目标游戏应用中的地图,该目标游戏可以包括但不限于MMO游戏。该目标游戏应用的用户可以使用其终端设备上运行的该目标游戏应用的客户端通过目标帐号登录到该目标游戏,以控制客户端与目标游戏应用的服务器之间的交互。同一帐号可以控制目标游戏中的一个虚拟角色,也可以同时控制目标游戏中的多个虚拟角色,本实施例中以控制一个虚拟角色为例进行说明。The above-mentioned multiple maps may be game maps or other maps. Taking a game map as an example, the game map may be a map in a target game application, and the target game may include, but is not limited to, an MMO game. The user of the target game application can use the client of the target game application running on his terminal device to log in to the target game through the target account to control the interaction between the client and the server of the target game application. The same account can control one virtual character in the target game, and can also control multiple virtual characters in the target game at the same time. In this embodiment, controlling one virtual character is used as an example for description.

目标用户可以使用目标帐号登录目标客户端,来启动目标游戏应用。该目标用户控制的虚拟角色为待移动对象。在操作待移动对象在游戏地图中移动的过程中,可以确定此次移动的移动起点和移动终点。该移动起点位于多个地图中的第一地图中,该移动终点位于多个地图中的第二地图中。The target user can use the target account to log in to the target client to start the target game application. The virtual character controlled by the target user is the object to be moved. In the process of operating the object to be moved to move in the game map, the moving starting point and moving end point of the moving can be determined. The moving start point is located in a first map of the plurality of maps, and the moving end point is located in a second map of the plurality of maps.

待移动对象的客户端(待移动对象可以是目标游戏中目标用户所控制的虚拟对象)可以检测对该客户端执行的操作,响应该操作,生成待移动对象的移动请求,该移动请求用于请求控制待移动对象由移动起点移动到移动终点,并通过与服务器之间的通信连接发送给服务器。The client of the object to be moved (the object to be moved may be a virtual object controlled by the target user in the target game) can detect the operation performed on the client, and in response to the operation, generate a movement request of the object to be moved, and the movement request is used for The request controls the object to be moved to move from the moving start point to the moving end point, and is sent to the server through the communication connection with the server.

服务器可以接收客户端发送的移动请求,响应该移动请求,服务器可以确定待移动对象的移动起点和移动终点。该移动起点和移动终点可以是通过地图标识和地图中的位置坐标确定的,也可以是通过位置标识确定的,也就是说,移动请求中携带有移动起点和/或移动终点的位置标识。服务器提取该移动请求中的该位置标识,并通过位置标识与位置之间的对应关系,确定出移动起点和/或移动终点所在的地图以及在地图中的位置坐标。The server may receive the movement request sent by the client, and in response to the movement request, the server may determine the movement origin and movement destination of the object to be moved. The moving starting point and moving end point may be determined by the map identifier and the position coordinates in the map, or may be determined by the location identifier, that is, the move request carries the location identifier of the moving starting point and/or the moving end point. The server extracts the location identifier in the movement request, and determines the map where the movement starting point and/or the moving end point are located and the location coordinates in the map through the correspondence between the location identifier and the location.

通过本实施例,通过移动请求触发待移动对象在多个地图中的移动,可以提高用户对于地图中的对象的控制能力。With this embodiment, the movement of the object to be moved in the multiple maps is triggered by the movement request, so that the user's control ability over the objects in the map can be improved.

作为一种可选的实施例,在获取由移动起点至移动终点的第三路径之后,上述方法还包括:As an optional embodiment, after obtaining the third path from the moving start point to the moving end point, the above method further includes:

S111,生成移动控制指令,其中,移动控制指令用于指示待移动对象按照第三路径进行移动;S111, generating a movement control instruction, wherein the movement control instruction is used to instruct the object to be moved to move according to a third path;

S112,将移动控制指令发送给上述待移动对象的客户端,以控制待移动对象按照第三路径由移动起点移动到移动终点。S112 , sending a movement control instruction to the client of the object to be moved, so as to control the object to be moved to move from the moving start point to the moving end point according to the third path.

在由服务器统一控制游戏地图中的对象的移动时,服务器可以使用该第三路径控制待移动对象由移动起点移动到移动终点,并将移动过程同步到显示有待移动对象的客户端上。When the movement of objects in the game map is uniformly controlled by the server, the server can use the third path to control the movement of the object to be moved from the moving starting point to the moving end point, and synchronize the moving process to the client that displays the to-be-moved object.

可选地,控制待移动对象由移动起点移动到移动终点也可以是由终端设备执行的。服务器可以生成移动控制指令,该移动控制指令用于指示待移动对象按照第三路径移动,并将移动控制指令发送给上述待移动对象的客户端。Optionally, controlling the object to be moved to move from the moving start point to the moving end point may also be performed by the terminal device. The server may generate a movement control instruction for instructing the object to be moved to move according to the third path, and send the movement control instruction to the client of the object to be moved.

客户端在接收到该移动控制指令之后,可以从移动控制指令中提取与该第三路径,并按照第三路径控制待移动对象由移动起点移动到移动终点。After receiving the movement control instruction, the client can extract the third path from the movement control instruction, and control the object to be moved to move from the moving start point to the moving end point according to the third path.

对于显示有待移动对象的其他客户端,可以由该客户端进行位置同步,将待移动对象的位置同步到服务器,并由服器将待移动对象的位置同步到其他客户端。For other clients displaying the object to be moved, the client can perform location synchronization, synchronize the location of the object to be moved to the server, and the server can synchronize the location of the object to be moved to other clients.

通过本实施例,通过客户端控制待移动对象的移动,可以减少服务器的运行负担,保证游戏运行的顺畅性。With this embodiment, by controlling the movement of the object to be moved by the client, the running burden of the server can be reduced, and the smooth running of the game can be ensured.

需要说明的是,本实施例中的地图寻路方法所寻到的路径不一定是最优的(最短路径),但是,由于集群之间的路径是预先定义并保存的,可以直接使用,无需关心所经过的集群内部的路径细节(因为是预先生成的,也就是定义好的,直接使用即可),因此该路径是能够快速找出一条路径。It should be noted that the path found by the map path finding method in this embodiment is not necessarily the optimal (shortest path). However, since the paths between clusters are predefined and saved, they can be used directly without the need for Care about the path details inside the cluster (because it is pre-generated, that is, it is defined and can be used directly), so the path can quickly find a path.

下面结合可选示例对本申请实施例中的地图寻路方法进行说明。本示例中的地图寻路方法应用有游戏场景,游戏地图为栅格地图,或者导航地图,地图划分为的区域为集群,每个集群对应于一个高层次地图中的地图单元。The map path finding method in this embodiment of the present application will be described below with reference to optional examples. The map pathfinding method in this example is applied to a game scene, where the game map is a grid map or a navigation map, and the areas into which the map is divided are clusters, and each cluster corresponds to a map unit in a high-level map.

如图11所示,本示例中的地图寻路方法的流程可以包括如下步骤:As shown in FIG. 11 , the flow of the map pathfinding method in this example may include the following steps:

步骤S1102,计算起点和终点在本地图中与入口的路径。Step S1102: Calculate the path between the starting point and the ending point in the local map and the entrance.

对于多个地图,无需为每张图都加载导航网格,可以加载玩家控制的虚拟对象当前所在地图的导航网格数据,其它地图只需要一个被初始化但是只有传送门周围导航数据的dtNavMesh空壳。For multiple maps, there is no need to load the navmesh for each map. You can load the navmesh data of the map where the virtual object controlled by the player is currently located. Other maps only need a dtNavMesh shell that is initialized but only has the navigation data around the portal. .

当发起跨地图寻路时,可以加载终点地图中终点所在的一小块导航数据,并计算在起点所在地图中起点与该地图的入口之间的路径,以及在终点所在地图中终点与该地图的入口之间的路径。When initiating cross-map pathfinding, you can load a small piece of navigation data where the end point is located in the end point map, and calculate the path between the start point in the start point map and the entrance of the map, and the end point and the map in the end point map. the path between the entrances.

步骤S1104,进行跨地图层寻路,得到起点所在地图的入口与终点所在地图的入口之间的路径。In step S1104, a path finding is performed across map layers to obtain a path between the entry of the map where the starting point is located and the entry of the map where the ending point is located.

地图与地图之间的连接方式可以是地图传送门,地图传送门可以是地图的入口,可以简化跨地图层寻路为单纯的表查询,预先计算并存储跨地图层每个传送门之间的路径。The connection method between the map and the map can be a map portal, and the map portal can be the entrance of the map, which can simplify the cross-map layer pathfinding into a simple table query, pre-compute and store the data between each portal across the map layer. path.

根据预先存储的传送门之间的路径,可以获取起点所在地图的入口与终点所在地图的入口之间的路径。According to the pre-stored paths between the portals, the path between the entrance of the map where the starting point is located and the entrance of the map where the ending point is located can be obtained.

步骤S1106,进行路径拼接,得到起点与终点之间的路径。Step S1106, performing path splicing to obtain a path between the start point and the end point.

将起点在本地图中与入口的路径、起点所在地图的入口与终点所在地图的入口之间的路径、以及终点在本地图中与入口的路径进行拼接,得到起点与终点之间的路径。The path between the starting point and the entrance in this map, the path between the entrance of the map where the starting point is located and the entrance of the map where the ending point is located, and the path of the ending point and the entrance in this map are spliced to obtain the path between the starting point and the ending point.

通过本示例,通过仅加载终点地图中终点所在的一小块导航数据来完成跨地图寻路,可以减少所需加载的数据量,提高内存利用率,提升寻路效率。Through this example, by loading only a small piece of navigation data in the destination map to complete cross-map pathfinding, the amount of data to be loaded can be reduced, memory utilization can be improved, and pathfinding efficiency can be improved.

需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本申请所必须的。It should be noted that, for the sake of simple description, the foregoing method embodiments are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited by the described action sequence. Because in accordance with the present application, certain steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根据上述实施例的方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本申请各实施例所述的方法。From the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is better implementation. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence or in a part that contributes to the prior art, and the computer software product is stored in a storage medium (such as ROM/RAM, magnetic disk, CD-ROM), including several instructions to make a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) execute the methods described in the embodiments of this application.

根据本申请实施例的另一个方面,还提供了一种用于实施上述地图寻路方法的地图寻路装置。该装置可以应用于上述动画创建设备。图12是根据本申请实施例的一种可选的地图寻路装置的示意图,如图12所示,该装置可以包括:According to another aspect of the embodiments of the present application, a map path finding device for implementing the above map path finding method is also provided. The apparatus can be applied to the above animation creation apparatus. FIG. 12 is a schematic diagram of an optional map path finding apparatus according to an embodiment of the present application. As shown in FIG. 12 , the apparatus may include:

(1)第一确定单元1202,用于确定移动起点所在的第一地图中的第一路径,其中,第一路径为移动起点至第一地图的目标出口的路径;(1) a first determination unit 1202, configured to determine a first path in the first map where the moving starting point is located, wherein the first path is a path from the moving starting point to the target exit of the first map;

(2)第二确定单元1204,与第一确定单元1202相连,与用于确定移动终点所在的第二地图中的第二路径,其中,第二路径为第二地图的目标入口至移动终点的路径;(2) The second determining unit 1204 is connected to the first determining unit 1202, and is used to determine the second path in the second map where the moving end point is located, wherein the second path is the distance between the target entrance of the second map and the moving end point path;

(3)第一获取单元1206,与第二确定单元1204相连,用于根据第一路径、第二路径、以及预先存储的多个地图中的各个地图的入口与出口之间的路径,获取由移动起点至移动终点的第三路径,其中,多个地图包括第一地图和第二地图,在多个地图的具有关联关系的两个关联地图中,第一关联地图的出口与第二关联地图的入口关联。(3) The first obtaining unit 1206, which is connected to the second determining unit 1204, is configured to obtain the path defined by the first path, the second path, and the path between the entrance and the exit of each of the pre-stored multiple maps A third path from the moving start point to the moving end point, wherein the multiple maps include a first map and a second map, and in the two associated maps with an associated relationship among the multiple maps, the exit of the first associated map is associated with the second associated map entry association.

需要说明的是,该实施例中的第一确定单元1202可以用于执行本申请实施例中的步骤S202,该实施例中的第二确定单元1202可以用于执行本申请实施例中的步骤S204,该实施例中的第一获取单元1206可以用于执行本申请实施例中的步骤S206。It should be noted that, the first determining unit 1202 in this embodiment may be configured to perform step S202 in this embodiment of the present application, and the second determining unit 1202 in this embodiment may be configured to perform step S204 in this embodiment of the present application , the first obtaining unit 1206 in this embodiment may be configured to perform step S206 in this embodiment of the present application.

通过上述模块,通过确定移动起点所在的第一地图中的第一路径,其中,第一路径为移动起点至第一地图的目标出口的路径;确定移动终点所在的第二地图中的第二路径,其中,第二路径为第二地图的目标入口至移动终点的路径;根据第一路径、第二路径、以及预先存储的多个地图中的各个地图的入口与出口之间的路径,获取由移动起点至移动终点的第三路径,其中,多个地图包括第一地图和第二地图,在多个地图的具有关联关系的两个关联地图中,第一关联地图的出口与第二关联地图的入口关联,解决了相关技术中的跨地图寻路方式存在由于需要加载的地图数量过多导致的游戏容易卡顿的问题,减少了导航数据对内存的占用,提高了游戏运行流畅性。Through the above modules, the first path in the first map where the moving starting point is located is determined, wherein the first path is the path from the moving starting point to the target exit of the first map; the second path in the second map where the moving ending point is located is determined , wherein the second path is the path from the target entrance of the second map to the moving end point; according to the first path, the second path, and the path between the entrance and the exit of each of the pre-stored multiple maps, the A third path from the moving start point to the moving end point, wherein the multiple maps include a first map and a second map, and in the two associated maps with an associated relationship among the multiple maps, the exit of the first associated map is associated with the second associated map It solves the problem that the game is easy to freeze due to the excessive number of maps to be loaded in the cross-map pathfinding method in the related art, reduces the memory occupation of the navigation data, and improves the running smoothness of the game.

作为一种可选的实施例,第一确定单元1202包括:As an optional embodiment, the first determining unit 1202 includes:

第一确定模块,用于确定第一地图的第一目标区域内的第一子路径,其中,第一目标区域为第一地图包含的多个第一区域中移动起点所在的区域,多个第一区域中的每个第一区域包含允许从每个第一区域进入到每个第一区域的相邻区域的邻接口,第一子路径为移动起点至第一目标区域的邻接口的路径;The first determination module is configured to determine the first sub-path in the first target area of the first map, wherein the first target area is the area where the moving starting point is located in the plurality of first areas included in the first map, and the plurality of first Each first area in the area includes an adjacent interface that allows access from each first area to an adjacent area of each first area, and the first sub-path is a path from the moving origin to the adjacent interface of the first target area;

第一获取模块,用于根据第一子路径、以及预先存储的每个第一区域的邻接口之间的路径,获取由移动起点至目标出口的第一路径,其中,目标出口属于目标出口所在的第二目标区域的邻接口。The first obtaining module is configured to obtain the first path from the moving starting point to the target exit according to the first sub-path and the pre-stored path between the adjacent interfaces of each first area, wherein the target exit belongs to where the target exit is located The adjacent interface of the second target area.

作为一种可选的实施例,第一获取模块包括:As an optional embodiment, the first acquisition module includes:

第一搜索子模块,用于以移动起点、每个第一区域的邻接口为节点,以第一子路径、以及每个第一区域的邻接口之间的路径为边,搜索移动起点至目标出口之间的路径,得到第一路径。The first search sub-module is used to search the moving starting point to the target with the moving starting point and the adjacent interface of each first area as the node, and the first sub-path and the path between the adjacent interfaces of each first area as the edge The path between exits, get the first path.

作为一种可选的实施例,第二确定单元1204包括:As an optional embodiment, the second determining unit 1204 includes:

第二确定模块,用于确定第二地图的第三目标区域内的第二子路径,其中,第三目标区域为第二地图包含的多个第二区域中,移动终点所在的区域,多个第二区域中的每个第二区域包含允许从每个第二区域进入到每个第二区域的相邻区域的邻接口,第二子路径为第三目标区域的邻接口至移动终点的路径;The second determination module is configured to determine the second sub-path in the third target area of the second map, wherein the third target area is the area where the moving end point is located among the multiple second areas included in the second map, and the multiple Each of the second areas contains an adjacency port that allows access from each second area to an adjacent area of each second area, and the second sub-path is a path from the adjacency port of the third target area to the moving destination ;

第二获取模块,用于根据第二子路径、以及预先存储的每个第二区域的目标接口之间的路径,获取由目标入口至移动终点的第二路径,其中,每个第二区域的目标接口包括以下至少之一:每个第二区域的邻接口,目标入口。The second obtaining module is configured to obtain the second path from the target entrance to the moving end point according to the second sub-path and the pre-stored path between the target interfaces of each second area, wherein the The target interface includes at least one of the following: an adjacent interface of each second area, a target portal.

作为一种可选的实施例,第二确定模块包括:As an optional embodiment, the second determining module includes:

第二搜索子模块,用于以移动终点、每个第二区域的目标接口为节点,以第二子路径、以及每个第二区域的目标接口之间的路径为边,搜索目标入口至移动终点的路径,得到第二路径。The second search sub-module is configured to take the movement end point and the target interface of each second area as a node, and use the second subpath and the path between the target interfaces of each second area as edges to search for the target entry to the mobile The path to the end point to get the second path.

作为一种可选的实施例,上述装置还包括:As an optional embodiment, the above device also includes:

第三确定单元,用于在确定第二地图的第三目标区域内的第二子路径之前,确定第二地图中移动终点所在的第三目标区域;a third determining unit, configured to determine the third target area in the second map where the moving end point is located before determining the second sub-path in the third target area of the second map;

第二获取单元,用于获取第三目标区域的第一导航数据。The second acquiring unit is configured to acquire the first navigation data of the third target area.

作为一种可选的实施例,第二获取单元包括:As an optional embodiment, the second obtaining unit includes:

查找模块,用于从目标缓存中查找第三目标区域的导航数据,其中,目标缓存中缓存有多个导航数据的导航数据队列,多个导航数据为被访问过的导航数据;A search module, used to search the navigation data of the third target area from the target cache, wherein the target cache is cached with a plurality of navigation data queues of navigation data, and the plurality of navigation data are visited navigation data;

第三确定模块,用于在查找到第三目标区域的导航数据的情况下,确定获取到第三目标区域的第一导航数据;a third determining module, configured to determine that the first navigation data of the third target area is obtained when the navigation data of the third target area is found;

移动模块,用于将第一导航数据移动到导航数据队列的队列头部。The moving module is used for moving the first navigation data to the queue head of the navigation data queue.

作为一种可选的实施例,上述装置还包括:As an optional embodiment, the above device also includes:

加载单元,用于在从目标缓存中查找第三目标区域的导航数据之后,在未查找到第三目标区域的导航数据的情况下,加载第三目标区域的第一导航数据;a loading unit, configured to load the first navigation data of the third target area when the navigation data of the third target area is not found after searching for the navigation data of the third target area from the target cache;

保存单元,用于将第一导航数据保存到导航数据队列的队列头部。The saving unit is used for saving the first navigation data to the queue head of the navigation data queue.

作为一种可选的实施例,保存单元包括:As an optional embodiment, the storage unit includes:

移除模块,用于在确定出目标缓存中未被使用的存储空间小于存储第一导航数据所需的存储空间的情况下,移除目标缓存中位于导航数据队列的队列尾部的第二导航数据;A removal module, configured to remove the second navigation data located at the tail of the queue of the navigation data queue in the target cache when it is determined that the unused storage space in the target cache is less than the storage space required for storing the first navigation data ;

保存模块,用于将第一导航数据保存到导航数据队列的队列头部。The saving module is used for saving the first navigation data to the queue head of the navigation data queue.

作为一种可选的实施例,第一获取单元1206包括:As an optional embodiment, the first obtaining unit 1206 includes:

搜索单元,用于以移动起点、移动终点、以及各个地图的入口和各个地图的出口为节点,以第一路径、第二路径以及各个地图的入口与出口之间的路径为边,搜索移动起点至移动终点的路径,得到第三路径。The search unit is used to search for the moving starting point with the moving start point, the moving end point, the entrance of each map and the exit of each map as nodes, and the first path, the second path and the path between the entrance and the exit of each map as edges The path to the end point of the move to get the third path.

作为一种可选的实施例,上述装置还包括:As an optional embodiment, the above device also includes:

接收单元,用于在确定移动起点所在的第一地图中的第一路径之前,接收待移动对象的客户端发送的移动请求,移动请求用于请求控制待移动对象由移动起点移动至移动终点;a receiving unit, configured to receive a moving request sent by the client of the object to be moved before determining the first path in the first map where the moving starting point is located, and the moving request is used to request to control the moving object to be moved from the moving starting point to the moving end point;

第四确定单元,用于响应移动请求,确定待移动对象的移动起点和移动终点。The fourth determining unit is used for determining the moving starting point and moving end point of the object to be moved in response to the moving request.

作为一种可选的实施例,上述装置还包括:As an optional embodiment, the above device also includes:

生成单元,用于在获取由移动起点至移动终点的第三路径之后,生成移动控制指令,其中,移动控制指令用于指示待移动对象按照第三路径进行移动;a generating unit, configured to generate a movement control instruction after acquiring the third path from the moving start point to the moving end point, wherein the movement control instruction is used to instruct the object to be moved to move according to the third path;

发送单元,用于将移动控制指令发送给待移动对象的客户端,以控制待移动对象按照第三路径由移动起点移动到移动终点。The sending unit is used for sending the movement control instruction to the client of the object to be moved, so as to control the object to be moved to move from the moving starting point to the moving end point according to the third path.

此处需要说明的是,上述模块与对应的步骤所实现的示例和应用场景相同,但不限于上述实施例所公开的内容。需要说明的是,上述模块作为装置的一部分可以运行在如图1所示的硬件环境中,可以通过软件实现,也可以通过硬件实现,其中,硬件环境包括网络环境。It should be noted here that the examples and application scenarios implemented by the foregoing modules and corresponding steps are the same, but are not limited to the contents disclosed in the foregoing embodiments. It should be noted that, as a part of the device, the above modules may run in the hardware environment as shown in FIG. 1 , and may be implemented by software or hardware, wherein the hardware environment includes a network environment.

根据本申请实施例的又一个方面,还提供了一种用于实施上述模型控制方法的电子装置,该电子装置可以是服务器、终端、或者其组合。According to yet another aspect of the embodiments of the present application, an electronic device for implementing the above model control method is also provided, where the electronic device may be a server, a terminal, or a combination thereof.

图13是根据本申请实施例的一种电子装置的结构框图,如图13所示,该电子装置包括存储器1302和处理器1304,该存储器1302中存储有计算机程序,该处理器1304被设置为通过计算机程序执行上述任一项方法实施例中的步骤。FIG. 13 is a structural block diagram of an electronic device according to an embodiment of the present application. As shown in FIG. 13 , the electronic device includes a memory 1302 and a processor 1304, where a computer program is stored in the memory 1302, and the processor 1304 is set to The steps in any one of the above method embodiments are performed by a computer program.

可选地,在本实施例中,上述电子装置可以位于计算机网络的多个网络设备中的至少一个网络设备。Optionally, in this embodiment, the above-mentioned electronic apparatus may be located in at least one network device among multiple network devices of a computer network.

可选地,在本实施例中,上述处理器可以被设置为通过计算机程序执行以下步骤:Optionally, in this embodiment, the above-mentioned processor may be configured to execute the following steps through a computer program:

S1,确定移动起点所在的第一地图中的第一路径,其中,第一路径为移动起点至第一地图的目标出口的路径;S1, determine the first path in the first map where the moving starting point is located, wherein the first path is the path from the moving starting point to the target exit of the first map;

S2,确定移动终点所在的第二地图中的第二路径,其中,第二路径为第二地图的目标入口至移动终点的路径;S2, determine the second path in the second map where the moving end point is located, wherein the second path is the path from the target entrance of the second map to the moving end point;

S3,根据第一路径、第二路径、以及预先存储的多个地图中的各个地图的入口与出口之间的路径,获取由移动起点至移动终点的第三路径,其中,多个地图包括第一地图和第二地图,在多个地图的具有关联关系的两个关联地图中,第一关联地图的出口与第二关联地图的入口关联。S3, according to the first path, the second path, and the path between the entrance and the exit of each of the pre-stored multiple maps, obtain a third path from the moving start point to the moving end point, wherein the multiple maps include the first path A map and a second map, in the two associated maps of the plurality of maps having an associated relationship, the outlet of the first associated map is associated with the inlet of the second associated map.

其中,存储器1302可用于存储软件程序以及模块,如本申请实施例中的模型控制方法和装置对应的程序指令/模块,处理器1304通过运行存储在存储器1302内的软件程序以及模块,从而执行各种功能应用以及数据处理,即实现上述模型控制方法。存储器1302可包括高速随机存储器,还可以包括非易失性存储器,如一个或多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器1302可进一步包括相对于处理器1304远程设置的存储器,这些远程存储器可以通过网络连接至终端。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The memory 1302 may be used to store software programs and modules, such as program instructions/modules corresponding to the model control method and device in the embodiments of the present application. The processor 1304 executes the software programs and modules stored in the memory 1302 by running the software programs and modules This kind of function application and data processing is to realize the above-mentioned model control method. Memory 1302 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, memory 1302 may further include memory located remotely from processor 1304, and these remote memories may be connected to the terminal through a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

作为一种示例,如图13所示,上述存储器1302中可以但不限于包括上述模型控制装置中的第一确定单元1202、第二确定单元1204和第一获取单元1206。此外,还可以包括但不限于上述模型控制装置中的其他模块单元,本示例中不再赘述。As an example, as shown in FIG. 13 , the foregoing memory 1302 may include, but is not limited to, the first determining unit 1202 , the second determining unit 1204 and the first obtaining unit 1206 in the foregoing model control apparatus. In addition, it may also include, but is not limited to, other module units in the above-mentioned model control apparatus, which will not be repeated in this example.

可选地,上述的传输装置1306用于经由一个网络接收或者发送数据。上述的网络具体实例可包括有线网络及无线网络。在一个实例中,传输装置1306包括一个NIC(NetworkInterface Controller,网络适配器),其可通过网线与其他网络设备与路由器相连从而可与互联网或局域网进行通讯。在一个实例中,传输装置1306为RF(Radio Frequency,射频)模块,其用于通过无线方式与互联网进行通讯。Optionally, the above-mentioned transmission means 1306 is configured to receive or transmit data via a network. Specific examples of the above-mentioned networks may include wired networks and wireless networks. In one example, the transmission device 1306 includes a NIC (Network Interface Controller, network adapter), which can be connected to other network devices and routers through a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 1306 is an RF (Radio Frequency, radio frequency) module, which is used to communicate with the Internet in a wireless manner.

此外,上述电子装置还包括:显示器1308,用于显示上述客户端的界面;和连接总线1310,用于连接上述电子装置中的各个模块部件。In addition, the above-mentioned electronic device further includes: a display 1308 for displaying the interface of the above-mentioned client; and a connection bus 1310 for connecting various module components in the above-mentioned electronic device.

可选地,本实施例中的具体示例可以参考上述实施例中所描述的示例,本实施例在此不再赘述。Optionally, for specific examples in this embodiment, reference may be made to the examples described in the foregoing embodiments, and details are not described herein again in this embodiment.

本领域普通技术人员可以理解,图13所示的结构仅为示意,实施上述模型控制方法的设备可以是终端设备,该终端设备可以是智能手机(如Android手机、iOS手机等)、平板电脑、掌上电脑以及MID(Mobile InternetDevices,移动互联网设备)、PAD等终端设备。图13其并不对上述电子装置的结构造成限定。例如,终端设备还可包括比图13中所示更多或者更少的组件(如网络接口、显示装置等),或者具有与图13所示不同的配置。Those skilled in the art can understand that the structure shown in FIG. 13 is for illustration only, and the device implementing the above model control method may be a terminal device, and the terminal device may be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a Handheld computers and terminal equipment such as MID (Mobile Internet Devices), PAD, etc. FIG. 13 does not limit the structure of the above electronic device. For example, the terminal device may also include more or less components than those shown in FIG. 13 (eg, a network interface, a display device, etc.), or have a different configuration than that shown in FIG. 13 .

本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令终端设备相关的硬件来完成,该程序可以存储于一计算机可读存储介质中,存储介质可以包括:闪存盘、ROM(Read-Only Memory,只读存储器)、RAM(Random AccessMemory,随机存取器)、磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, and the storage medium can Including: flash disk, ROM (Read-Only Memory, read-only memory), RAM (Random Access Memory, random access device), magnetic disk or optical disk, etc.

根据本申请实施例的又一个方面,还提供了一种存储介质。可选地,在本实施例中,上述存储介质可以用于执行模型控制方法的程序代码。According to yet another aspect of the embodiments of the present application, a storage medium is also provided. Optionally, in this embodiment, the above-mentioned storage medium may be used to execute the program code of the model control method.

可选地,在本实施例中,上述存储介质可以位于上述实施例所示的网络中的多个网络设备中的至少一个网络设备上。Optionally, in this embodiment, the foregoing storage medium may be located on at least one network device among multiple network devices in the network shown in the foregoing embodiment.

可选地,在本实施例中,存储介质被设置为存储用于执行以下步骤的程序代码:Optionally, in this embodiment, the storage medium is configured to store program codes for executing the following steps:

S1,确定移动起点所在的第一地图中的第一路径,其中,第一路径为移动起点至第一地图的目标出口的路径;S1, determine the first path in the first map where the moving starting point is located, wherein the first path is the path from the moving starting point to the target exit of the first map;

S2,确定移动终点所在的第二地图中的第二路径,其中,第二路径为第二地图的目标入口至移动终点的路径;S2, determine the second path in the second map where the moving end point is located, wherein the second path is the path from the target entrance of the second map to the moving end point;

S3,根据第一路径、第二路径、以及预先存储的多个地图中的各个地图的入口与出口之间的路径,获取由移动起点至移动终点的第三路径,其中,多个地图包括第一地图和第二地图,在多个地图的具有关联关系的两个关联地图中,第一关联地图的出口与第二关联地图的入口关联。S3, according to the first path, the second path, and the path between the entrance and the exit of each of the pre-stored multiple maps, obtain a third path from the moving start point to the moving end point, wherein the multiple maps include the first path A map and a second map, in the two associated maps of the plurality of maps having an associated relationship, the outlet of the first associated map is associated with the inlet of the second associated map.

可选地,本实施例中的具体示例可以参考上述实施例中所描述的示例,本实施例中对此不再赘述。Optionally, for specific examples in this embodiment, reference may be made to the examples described in the foregoing embodiments, which will not be repeated in this embodiment.

可选地,在本实施例中,上述存储介质可以包括但不限于:U盘、ROM、RAM、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。Optionally, in this embodiment, the above-mentioned storage medium may include, but is not limited to: U disk, ROM, RAM, removable hard disk, magnetic disk, or optical disk, and other mediums that can store program codes.

上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。The above-mentioned serial numbers of the embodiments of the present application are only for description, and do not represent the advantages or disadvantages of the embodiments.

上述实施例中的集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在上述计算机可读取的存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在存储介质中,包括若干指令用以使得一台或多台计算机设备(可为个人计算机、服务器或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。If the integrated units in the above-mentioned embodiments are implemented in the form of software functional units and sold or used as independent products, they may be stored in the above-mentioned computer-readable storage medium. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence, or the part that contributes to the prior art, or all or part of the technical solution, and the computer software product is stored in a storage medium, Several instructions are included to cause one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.

在本申请的上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the above-mentioned embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.

在本申请所提供的几个实施例中,应该理解到,所揭露的客户端,可通过其它的方式实现。其中,以上所描述的装置实施例仅仅是示意性的,例如所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,单元或模块的间接耦合或通信连接,可以是电性或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed client may be implemented in other manners. The apparatus embodiments described above are only illustrative, for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components may be combined or Integration into another system, or some features can be ignored, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of units or modules, and may be in electrical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.

另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.

以上所述仅是本申请的可选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本申请的保护范围。The above are only optional embodiments of the present application. It should be pointed out that for those skilled in the art, without departing from the principles of the present application, several improvements and modifications can also be made. These improvements and modifications It should also be regarded as the protection scope of this application.

Claims (15)

1. A map way-finding method is characterized by comprising the following steps:
determining a first path in a first map where a moving starting point is located, wherein the first path is a path from the moving starting point to a target exit of the first map;
determining a second path in a second map where the mobile terminal point is located, wherein the second path is a path from a target entrance of the second map to the mobile terminal point;
and acquiring a third path from the movement starting point to the movement destination point according to the first path, the second path and a path between an entrance and an exit of each map in a plurality of pre-stored maps, wherein the plurality of maps comprise the first map and the second map, and the exit of the first associated map is associated with the entrance of the second associated map in two associated maps with association relationship in the plurality of maps.
2. The method of claim 1, wherein determining the first path in the first map where the start of movement is located comprises:
determining a first sub-path in a first target area of the first map, wherein the first target area is an area where the movement starting point is located in a plurality of first areas included in the first map, each of the plurality of first areas includes an adjacent port allowing the movement starting point to enter an adjacent area of each first area, and the first sub-path is a path from the movement starting point to the adjacent port of the first target area;
and acquiring the first path from the moving starting point to the target outlet according to the first sub-path and a pre-stored path between adjacent ports of each first area, wherein the target outlet belongs to the adjacent port of a second target area where the target outlet is located.
3. The method according to claim 2, wherein the obtaining the first path from the movement start point to the target exit according to the first sub-path and a pre-stored path between adjacent ports of each first area comprises:
and searching a path from the movement starting point to the target exit by taking the movement starting point, the adjacent port of each first area as a node, and the first sub-path and a path between the adjacent ports of each first area as edges to obtain the first path.
4. The method of claim 1, wherein determining the second path in the second map of the mobile terminal comprises:
determining a second sub-path in a third target area of the second map, wherein the third target area is an area where the movement destination is located in a plurality of second areas included in the second map, each of the plurality of second areas includes a neighboring port allowing entry from the each second area to a neighboring area of the each second area, and the second sub-path is a path from the neighboring port of the third target area to the movement destination;
acquiring the second path from the target entrance to the mobile terminal according to the second sub-path and a pre-stored path between the target interfaces of each second area, wherein the target interface of each second area comprises at least one of the following: the adjacent port of each second region, the target inlet.
5. The method according to claim 4, wherein the obtaining the second path from the target entry to the mobile destination according to the second sub-path and a pre-stored path between the target interfaces of each second area comprises:
and searching a path from the target entrance to the mobile destination by taking the mobile destination and the target interface of each second area as nodes and taking the second sub-path and the path between the target interfaces of each second area as edges to obtain the second path.
6. The method of claim 4, wherein prior to said determining a second sub-path within a third target region of said second map, said method further comprises:
determining the third target area in the second map where the mobile terminal point is;
first navigation data of the third target area is acquired.
7. The method of claim 6, wherein the obtaining first navigation data for the third target region comprises:
searching navigation data of the third target area from a target cache, wherein a plurality of navigation data queues of the navigation data are cached in the target cache, and the navigation data are accessed navigation data;
determining to acquire the first navigation data of the third target area under the condition that the navigation data of the third target area is found;
moving the first navigation data to a queue head of the navigation data queue.
8. The method of claim 7, wherein after the retrieving the navigation data for the third target region from the target cache, the method further comprises:
loading the first navigation data of the third target area under the condition that the navigation data of the third target area is not found;
saving the first navigation data to a queue head of the navigation data queue.
9. The method of claim 8, wherein saving the first navigation data to a queue head of the navigation data queue comprises:
removing second navigation data positioned at the tail part of the navigation data queue in the target cache under the condition that the unused storage space in the target cache is determined to be smaller than the storage space required for storing the first navigation data;
saving the first navigation data to a queue head of the navigation data queue.
10. The method of claim 1, wherein obtaining a third path from the movement start point to the movement end point according to the first path, the second path, and a path between an entrance and an exit of each of a plurality of pre-stored maps comprises:
and searching a path from the moving starting point to the moving destination by taking the moving starting point, the moving destination, the entrance of each map and the exit of each map as nodes and taking the first path, the second path and the path between the entrance and the exit of each map as edges to obtain a third path.
11. The method according to any of claims 1 to 10, wherein prior to said determining the first path in the first map where the start of movement is located, the method further comprises:
receiving a moving request sent by a client of an object to be moved, wherein the moving request is used for requesting to control the object to be moved to move from the moving starting point to the moving destination;
and determining the movement starting point and the movement ending point of the object to be moved in response to the movement request.
12. The method of claim 11, wherein after said obtaining a third path from the start of movement to the end of movement, the method further comprises:
generating a movement control instruction, wherein the movement control instruction is used for indicating the object to be moved to move according to the third path;
and sending the movement control instruction to a client of the object to be moved so as to control the object to be moved to move from the movement starting point to the movement ending point according to the third path.
13. A map routing device, comprising:
a first determining unit, configured to determine a first path in a first map where a moving starting point is located, where the first path is a path from the moving starting point to a target exit of the first map;
the second determining unit is used for determining a second path in a second map where the mobile terminal point is located, wherein the second path is a path from a target entrance of the second map to the mobile terminal point;
a first obtaining unit, configured to obtain a third route from the movement starting point to the movement ending point according to the first route, the second route, and a route between an entrance and an exit of each of a plurality of pre-stored maps, where the plurality of maps include the first map and the second map, and an exit of a first associated map is associated with an entrance of a second associated map in two associated maps having an association relationship among the plurality of maps.
14. A computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to carry out the method of any one of claims 1 to 12 when executed.
15. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method of any of claims 1 to 12 by means of the computer program.
CN202010621469.2A 2020-06-30 2020-06-30 Map way finding method and device, storage medium and electronic device Pending CN111773687A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010621469.2A CN111773687A (en) 2020-06-30 2020-06-30 Map way finding method and device, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010621469.2A CN111773687A (en) 2020-06-30 2020-06-30 Map way finding method and device, storage medium and electronic device

Publications (1)

Publication Number Publication Date
CN111773687A true CN111773687A (en) 2020-10-16

Family

ID=72760001

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010621469.2A Pending CN111773687A (en) 2020-06-30 2020-06-30 Map way finding method and device, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN111773687A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112190946A (en) * 2020-10-21 2021-01-08 网易(杭州)网络有限公司 Path generation method and device in game scene
CN113842641A (en) * 2021-09-27 2021-12-28 网易(杭州)网络有限公司 Method, device, terminal and storage medium for determining nearest waypoint
CN114119925A (en) * 2021-11-30 2022-03-01 完美世界(北京)软件科技发展有限公司 Game image modeling method and device and electronic equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106110656A (en) * 2016-07-07 2016-11-16 网易(杭州)网络有限公司 At the method and apparatus that scene of game calculates route
CN106600708A (en) * 2016-12-15 2017-04-26 北京金山软件有限公司 Method and system for processing game map
WO2018130135A1 (en) * 2017-01-13 2018-07-19 腾讯科技(深圳)有限公司 Method and device for controlling way-finding of simulation object, and server
CN108434741A (en) * 2018-03-15 2018-08-24 网易(杭州)网络有限公司 Control method for movement in virtual reality and device
CN110141863A (en) * 2019-04-24 2019-08-20 深圳市腾讯网域计算机网络有限公司 Application scenarios acquisition methods, device, electronic equipment and medium
CN110721472A (en) * 2019-10-08 2020-01-24 上海莉莉丝科技股份有限公司 Path finding method, device, equipment and recording medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106110656A (en) * 2016-07-07 2016-11-16 网易(杭州)网络有限公司 At the method and apparatus that scene of game calculates route
CN106600708A (en) * 2016-12-15 2017-04-26 北京金山软件有限公司 Method and system for processing game map
WO2018130135A1 (en) * 2017-01-13 2018-07-19 腾讯科技(深圳)有限公司 Method and device for controlling way-finding of simulation object, and server
CN108434741A (en) * 2018-03-15 2018-08-24 网易(杭州)网络有限公司 Control method for movement in virtual reality and device
CN110141863A (en) * 2019-04-24 2019-08-20 深圳市腾讯网域计算机网络有限公司 Application scenarios acquisition methods, device, electronic equipment and medium
CN110721472A (en) * 2019-10-08 2020-01-24 上海莉莉丝科技股份有限公司 Path finding method, device, equipment and recording medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
希望图书创作室编著: "《中文Visual Foxpro 5.0实用教程》", 31 December 1997, 北京:宇航出版社, pages: 46 *
康凤举主编: "《现代仿真技术与应用》", 30 September 2001, 北京:国防工业出版社, pages: 232 *
曹华编著: "《游戏引擎原理与应用》", 31 August 2016, 武汉:武汉大学出版社, pages: 267 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112190946A (en) * 2020-10-21 2021-01-08 网易(杭州)网络有限公司 Path generation method and device in game scene
CN113842641A (en) * 2021-09-27 2021-12-28 网易(杭州)网络有限公司 Method, device, terminal and storage medium for determining nearest waypoint
CN113842641B (en) * 2021-09-27 2024-09-03 网易(杭州)网络有限公司 Method, device, terminal and storage medium for determining closest point
CN114119925A (en) * 2021-11-30 2022-03-01 完美世界(北京)软件科技发展有限公司 Game image modeling method and device and electronic equipment

Similar Documents

Publication Publication Date Title
CN111773687A (en) Map way finding method and device, storage medium and electronic device
CN110812844B (en) Path finding method in game, terminal and readable storage medium
CN110772791B (en) Route generation method, device and storage medium of three-dimensional game scene
CN106412277B (en) The loading method and device of virtual scene
CN111773717A (en) Object control method and device, storage medium and electronic device
CN108268971B (en) Path searching method, device, processor and electronic device
CN104506435B (en) Shortest path in SDN controllers and SDN determines method
WO2016175768A1 (en) Map tables for hardware tables
CN111375205A (en) Processing method and device for path finding path in game, electronic equipment and storage medium
CN104769573A (en) Dynamically allocating network addresses
CN112807682B (en) Path searching method, terminal and computer readable storage medium
CN116776978A (en) Inference acceleration method, device and storage medium
CN113730915B (en) Determination method and device of target path, storage medium and electronic equipment
CN112231428A (en) Vehicle path planning method fusing battlefield situation information
CN109451557B (en) Dynamic clustering routing method and device for wireless sensor network
CN114053713B (en) Pathfinding method, device, electronic device and readable storage medium
CN113413601B (en) Road searching method and device
CN112121435B (en) Game way finding method, device, server and storage medium
CN112263836A (en) Virtual scene processing method and device and storage medium
CN117224961A (en) Game path finding method and device and electronic equipment
CN108710514B (en) Object jump control method and device, storage medium and electronic device
KR102317870B1 (en) Method of creating non-interstitial full-cover nested containers of the same layer and readable storage medium
CN115779424A (en) Navigation grid path finding method, device, equipment and medium
CN112995280B (en) Data distribution method and device for multi-content demand service
CN116307325A (en) Line planning method and device for power distribution network, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20201016

RJ01 Rejection of invention patent application after publication