Path generation method and device, storage medium and electronic device
By obtaining the floor plan of the virtual scene and using the multi-vertex pathfinding method to generate the pass path, the problems of low efficiency and poor authenticity of virtual path generation in the prior art are solved, and efficient and diversified path generation is achieved.
Patent Information
- Application Number
- CN202411400582.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-08
- Publication Date
- 2025-02-07
AI Technical Summary
The prior art is inefficient and poorly authentic when generating virtual paths, so it is impossible to effectively simulate the walking trajectory of the crowd. And when the virtual scene changes, the path needs to be manually remade, resulting in low generation efficiency.
By obtaining the floor plan of the specified area in the virtual scene, extract the allowed pass areas, and generate the target pass path in the area using a multi-vertex road-seeking method, set multiple path endpoints and perform road search operations from each endpoint to obtain multiple pass paths , forming a closed-loop curve.
It realizes efficient generation of diversified pass paths within the allowed pass area, improves the efficiency and authenticity of path generation, and solves the problems of low generation efficiency and poor path authenticity.
Smart Images

Figure CN119386461A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a path generation method, device, storage medium and electronic device. Background Art
[0002] Rich passages in virtual scenes can increase the playability and fun of the game, give users more choices and decision-making space in virtual scenes, and enhance the depth and challenge of virtual space. In related technologies, the generation of virtual paths mainly relies on manual or preset rules. However, the virtual paths generated in this way are relatively simple and less realistic, and cannot effectively simulate the walking trajectory of people in the virtual scene. In addition, when the virtual scene changes, the virtual path needs to be manually remade for the changed scene, which results in low efficiency in generating virtual paths and a long production cycle.
[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0004] At least some embodiments of the present application provide a path generation method, device, storage medium and electronic device to at least solve the technical problems of low generation efficiency and poor path authenticity in generating virtual paths in the related art.
[0005] According to one embodiment of the present application, a path generation method is provided, comprising: obtaining a plan view of a specified area in a virtual scene, wherein the specified area is a surface area covered by a set of virtual elements to be deployed in the virtual scene, and the plan view is used to depict a layout plan of the specified area; extracting a passable area in the set of virtual elements from the plan view; and generating a target passable path in the passable area using a multi-vertex pathfinding method, wherein the multi-vertex pathfinding method is used to set a plurality of path endpoints in the passable area, and respectively select a start endpoint and an end endpoint from the plurality of path endpoints, and obtain a plurality of passable paths in the specified area by performing pathfinding operations from the start endpoint to the end endpoint and from the end endpoint to the start endpoint, and the plurality of passable paths form a closed-loop curve.
[0006] According to one embodiment of the present application, a path generation device is also provided, including: an acquisition module, used to obtain a plan view of a specified area in a virtual scene, wherein the specified area is a surface area covered by a set of virtual elements to be deployed in the virtual scene, and the plan view is used to depict the layout plan of the specified area; an extraction module, used to extract the allowed pass area in the set of virtual elements from the plan view; a generation module, used to generate a target pass path in the allowed pass area using a multi-vertex pathfinding method, wherein the multi-vertex pathfinding method is used to set multiple path endpoints in the allowed pass area, and respectively select a start endpoint and an end endpoint from the multiple path endpoints, and obtain multiple pass paths in the specified area by performing pathfinding operations from the start endpoint to the end endpoint and from the end endpoint to the start endpoint, and the multiple pass paths form a closed-loop curve.
[0007] According to one embodiment of the present application, a computer-readable storage medium is further provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned path generation method in each embodiment of the present application when running.
[0008] According to one embodiment of the present application, an electronic device is also provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the above-mentioned path generation method in each embodiment of the present application.
[0009] According to one embodiment of the present application, a computer program product is also provided, including a computer program, and when the computer program is executed by a processor, the above-mentioned path generation method in each embodiment of the present application is implemented.
[0010] According to one embodiment of the present application, a computer program product is also provided, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned path generation method in each embodiment of the present application is implemented.
[0011] According to one embodiment of the present application, a computer program is also provided. When the computer program is executed by a processor, the above-mentioned path generation method in each embodiment of the present application is implemented.
[0012] In at least some embodiments of the present application, a plan view of a specified area in a virtual scene is obtained, and then a permitted area in a set of virtual elements is extracted from the plan view, multiple path endpoints are set in the permitted area, and multiple path-finding operations are performed based on the multiple path endpoints to obtain multiple passage paths in the specified area. This achieves the purpose of efficiently generating diversified passage paths in the permitted area, thereby achieving the technical effect of improving path generation efficiency and path authenticity, and thereby solving the technical problems of low generation efficiency and poor path authenticity in generating virtual paths in related technologies. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0014] Figure 1 is a hardware structure block diagram of a mobile terminal according to a path generation method in one embodiment of the present application;
[0015] Figure 2 is a flow chart of a path generation method according to one embodiment of the present application;
[0016] Figure 3 is a schematic diagram of a virtual element set according to one embodiment of the present application;
[0017] Figure 4 is a schematic diagram of a plan view according to one embodiment of the present application;
[0018] Figure 5 is a schematic diagram of a first grid diagram according to one embodiment of the present application;
[0019] Figure 6 is a schematic diagram of a first marking result according to one embodiment of the present application;
[0020] Figure 7 is a schematic diagram of a second grid diagram according to one embodiment of the present application;
[0021] Figure 8 is a schematic diagram of a first vertex according to one embodiment of the present application;
[0022] Fig. 9 is a schematic diagram of a passage-allowed area according to one embodiment of the present application;
[0023] Fig.10 is a schematic diagram of a random vertex according to one embodiment of the present application;
[0024] Fig.11is a schematic diagram of a path endpoint according to one embodiment of the present application;
[0025] Fig.12 is a schematic diagram of a first passage according to one embodiment of the present application;
[0026] Fig.13 is a schematic diagram of a second passage according to one embodiment of the present application;
[0027] Fig.14 is a schematic diagram of a target passage path according to one embodiment of the present application;
[0028] Fig.15 is a schematic diagram of another target passage path according to one embodiment of the present application;
[0029] Fig.16 is a schematic diagram of another target passage path according to one embodiment of the present application;
[0030] Fig.17 is a schematic diagram of another target passage path according to one embodiment of the present application;
[0031] Fig.18 is a schematic diagram of another target passage path according to one embodiment of the present application;
[0032] Fig.19 is a schematic diagram of a merging result of a target travel path according to one embodiment of the present application;
[0033] Fig. 20 is a schematic diagram of a second marking result according to one embodiment of the present application;
[0034] Fig.21 is a structural block diagram of a path generation device according to one embodiment of the present application;
[0035] Fig. 22 is a schematic diagram of an electronic device according to one embodiment of the present application. DETAILED DESCRIPTION
[0036] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0037] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0038] The above method embodiments involved in the present disclosure can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, the mobile terminal can be a smart phone, a tablet computer, a handheld computer, a mobile Internet device, a PAD, a game console and other terminal devices. Figure 1 FIG. 1 is a hardware structure block diagram of a mobile terminal of a path generation method according to an embodiment of the present application. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processing (DSP) chip, a microprocessor (MCU), a field-programmable logic device (FPGA), a neural network processor (NPU), a tensor processing unit (TPU), an artificial intelligence (AI) type processor, etc.) and a memory 104 for storing data. In one embodiment of the present application, it may also include: an input and output device 108 and a display device 110.
[0039] In some optional embodiments based on virtual scenes, the above-mentioned device can also provide a human-computer interaction interface with a touch-sensitive surface, which can sense finger contact and / or gestures to perform human-computer interaction with a graphical user interface (GUI). The human-computer interaction function may include the following interactions: creating web pages, drawing, word processing, making electronic documents, games, video conferencing, instant messaging, sending and receiving emails, call interface, playing digital videos, playing digital music and / or web browsing, etc. The executable instructions for executing the above-mentioned human-computer interaction functions are configured / stored in a computer program product or readable storage medium executable by one or more processors.
[0040] Those skilled in the art will understand that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1More or fewer components as shown, or with Figure 1 Different configurations shown.
[0041] According to one embodiment of the present application, an embodiment of a path generation method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0042] Figure 2 is a flow chart of a path generation method according to one embodiment of the present application. Figure 2 As shown, the method comprises the following steps:
[0043] Step S21, obtaining a plan view of a designated area in the virtual scene, wherein the designated area is a surface area covered by a set of virtual elements to be deployed in the virtual scene, and the plan view is used to depict a layout plan of the designated area;
[0044] Step S22, extracting the allowed passage area in the virtual element set from the plan view;
[0045] Step S23, using a multi-vertex pathfinding method to generate a target pass path in the allowed pass area, wherein the multi-vertex pathfinding method is used to set multiple path endpoints in the allowed pass area, and select a start endpoint and an end endpoint from the multiple path endpoints, respectively, by performing pathfinding operations from the start endpoint to the end endpoint and from the end endpoint to the start endpoint, respectively, to obtain multiple pass paths in the specified area, and the multiple pass paths form a closed-loop curve.
[0046] The above virtual scenes include but are not limited to strategy game scenes, role-playing game scenes, shooting game scenes, etc. In game development, special software tools are usually used to create the floor plan of the game scene. For example, the Unreal Engine can help developers quickly and accurately design and arrange the game scene.
[0047] The above-mentioned set of virtual elements to be deployed is a set of various different types of virtual elements in a virtual scene. The virtual elements may specifically include but are not limited to buildings, roads, vegetation, water bodies, etc. In the virtual scene, various virtual elements can be placed, combined or laid out to simulate scenes in the real world or for planning and design.
[0048] Exemplarily, in game design, a city can be regarded as a complex set of virtual elements, which contains multiple different components and attributes. When defining the city as a virtual element set, it includes but is not limited to the following types of virtual elements: geographical elements, architectural elements, resource elements, population elements, interactive elements, visual and sound elements, and game mechanism elements. Specifically, the geographical elements specifically include location information and terrain information. The location information can be the coordinates of the city on the game map, and the terrain information includes the terrain features around the city, such as mountains, rivers, plains, etc. The architectural elements can define the defensive structure of the city, such as the height, thickness, durability, etc. of the city wall, the entrance type, durability, whether it can be destroyed, etc., and can also include internal buildings, such as residences, markets, barracks, warehouses, administrative centers, etc. Resource elements can include economic resources, that is, resources that can be produced by the city, such as gold coins, wood, food, etc., and resource storage, such as the warehouse capacity of the city. The population element can include the number and type of residents in the city, as well as the labor force that can be used to build and maintain the city. Interactive elements include player interaction and non-player interaction, such as the interactions that players can have with the city, such as trade, taxation, construction, etc., and the interactions between non-player characters and the city can also be defined. Visual and sound elements include the visual style and art elements of the city, the background music of the city, environmental sound effects, etc. Game mechanics elements can include tasks and events related to the city. When defining a collection of virtual elements of a city, the importance and level of detail of these elements can be adjusted according to the type and style of the game. For example, a strategy game will focus more on economic elements, while a role-playing game will focus more on cultural and interactive elements.
[0049] Figure 3 is a schematic diagram of a virtual element set according to one embodiment of the present application, such as Figure 3 As shown, in the city in the virtual scene, players can carry out various game activities, such as exploration, fighting, task completion, etc. It should be noted that the embodiment of the present application uses the city as an example of the virtual element set to be deployed, but it does not constitute a specific limitation.
[0050] The above-mentioned designated area is the surface area covered by the set of virtual elements to be deployed in the virtual scene. The designated area can be a virtual world or a real-world geographical location. During the game development process, designers will determine the size and scope of the virtual scene based on the needs and theme of the game. The designated area usually includes various terrains, buildings, roads, waters and other elements in the game, as well as game mechanisms and interaction methods related to multiple elements. The size and complexity of the virtual scene will vary depending on the type of game and player needs. Some games may only include a small area, such as a room or a block, while other games may cover the entire virtual world or the scale of a real city.
[0051] Figure 4 is a schematic diagram of a plan view according to one embodiment of the present application, such as Figure 4 As shown, the floor plan is used to depict the layout plan of the specified area, usually including elements such as building pattern, road direction, green area, etc. The floor plan can help game developers better plan the layout of the virtual scene and ensure the relationship and coordination between the various elements. In the floor plan, buildings can be represented by boxes, roads can be represented by lines, and green areas can be represented by color filling. The size, position and relationship of each area can be clearly seen through the floor plan, so as to better design and arrange the virtual scene. Exemplarily, when obtaining the floor plan of the specified area, it can be achieved through a game editor or related tools. First, it is necessary to determine the area range to be obtained, and then select the area in the editor or tool and export it as a floor plan file.
[0052] Further, after obtaining the plan view, the allowed pass area in the virtual element set is extracted from the plan view. The allowed pass area may be an area in the plan view where people or vehicles can freely pass. For example, the allowed pass area may be a polygonal area in a city other than buildings. When extracting the allowed pass area, areas such as roads, corridors, doors, and stairs where people or vehicles can pass may be identified.
[0053] A multi-vertex pathfinding method is used to generate a target pass path in the allowed pass area. The multi-vertex pathfinding method can realize the generation of multiple pass paths by setting multiple path endpoints, and the pass paths form a closed-loop curve. First, multiple path endpoints are determined in the allowed pass area, and then multiple pathfinding operations are performed with these path endpoints as the starting point and the end point, so as to obtain multiple pass paths, thereby ensuring that the generated path can cover all parts of the specified area and improving the accuracy and efficiency of path planning. By flexibly selecting different starting endpoints and ending endpoints, and by performing pathfinding operations from the starting endpoint to the ending endpoint and from the ending endpoint to the starting endpoint, more complex and diversified path planning can be achieved to meet the passage requirements in different scenarios. At the same time, the multi-vertex pathfinding method can also improve the real-time and adaptability of path planning, making path planning more intelligent and flexible.
[0054] The above-mentioned target traffic path can simulate the walking trajectory of the crowd in the virtual scene, and can also be used for path planning, space planning, safety assessment, tourism planning, environmental optimization, etc. For example, the target traffic path can be used to plan the traffic flow lines inside the city or building, helping designers to better layout roads, passages and traffic facilities and improve traffic efficiency. By analyzing the direction and connection relationship of multiple traffic paths, it can provide a reference for urban planning and architectural design, and optimize space utilization and layout. According to the trend and density of multiple traffic paths, the safety inside the city or building can be evaluated, and possible congestion, evacuation difficulties and other problems can be found, so as to take corresponding safety measures. By simulating the walking trajectory of the crowd, it can help plan the tour routes in tourist attractions, enhance the tourist experience and increase the tourist attraction. By analyzing the distribution and density of the target traffic path, it can provide a reference for urban environmental improvement and optimize the layout of greening, landscape and public facilities.
[0055] Based on the above steps S21 to S23, by obtaining a plan view of a specified area in a virtual scene, and then extracting a passable area in a set of virtual elements from the plan view, multiple path endpoints are set in the passable area, and multiple path-finding operations are performed based on the multiple path endpoints to obtain multiple pass paths in the specified area, thereby achieving the purpose of efficiently generating diversified pass paths in the passable area, thereby achieving the technical effect of improving path generation efficiency and path authenticity, and thus solving the technical problems of low generation efficiency and poor path authenticity when generating virtual paths in related technologies.
[0056] The path generation method in the embodiment of the present application is further introduced below.
[0057] Optionally, in step S21, obtaining a plan view of a specified area in a virtual scene includes:
[0058] Step S211, determining the three-dimensional surface corresponding to the designated area;
[0059] Step S212: convert the three-dimensional surface into a two-dimensional plane according to a preset projection method to obtain a plane view.
[0060] Specifically, a virtual building complex adapted to the game style is located on the three-dimensional surface corresponding to the designated area, and the virtual building complex includes but is not limited to castles, towers, palaces and other buildings of different styles. The layout of the virtual building complex can follow the undulating terrain, or be scattered in the designated area. The overall game style can be determined according to the game settings, which can be medieval European style, oriental ancient style, fantasy magic style, etc. The virtual building complex can serve as a player's base or mission location, and plays an important role in the game.
[0061] Further, the three-dimensional surface is converted into a two-dimensional plane according to a preset projection method to obtain a plane map, and the preset projection method includes but is not limited to Mercator projection, polar coordinate projection, equidistant projection, etc. It should be noted that different preset projection methods have different implementation methods, and the specific implementation steps may be different. When performing the conversion, it is necessary to select a suitable projection method according to the specific situation, and ensure the calculation accuracy and visualization effect of the graphics.
[0062] Mercator projection is a conformal cylindrical projection, and the projection center is usually located on the earth's equator. After determining the projection center, the three-dimensional surface can be divided into several grids of latitude and longitude. According to the longitude and latitude of each point on the three-dimensional surface, the points on the three-dimensional surface are projected onto a two-dimensional plane through calculation. The calculated projection coordinate points are plotted on the two-dimensional plane to form a plane map. In addition, the plane map can be beautified and annotated as needed to more intuitively show the shape and characteristics of the three-dimensional surface.
[0063] Polar coordinate projection is a method of projecting a three-dimensional surface onto a two-dimensional plane. It is usually used to project curved surfaces such as spheres or cylinders onto a plane. In polar coordinate projection, points in a three-dimensional coordinate system can be expressed as polar coordinates, and the corresponding coordinate values on the two-dimensional plane can be obtained by calculation.
[0064] Isometric projection is a projection method that projects a three-dimensional object onto a two-dimensional plane, keeping the relative positions and distances of all points and lines on the object unchanged. In isometric projection, each point on the object is projected onto the plane in the same direction and distance. In the process of converting a three-dimensional plane to a two-dimensional plane, the direction and position of the projection are first determined, that is, a direction is selected, and the three-dimensional surface is projected onto a plane parallel to the direction, and then each point is projected onto the plane along the selected direction and distance, and then the projected points are drawn on the plane, and adjacent points are connected to reconstruct the shape of the original surface.
[0065] Based on the above optional embodiments, by determining the three-dimensional surface corresponding to the specified area, and then converting the three-dimensional surface into a two-dimensional plane according to a preset projection method, a plan view can be quickly obtained, which is convenient for further game design and planning, and further improves the visual effects and user experience of the game.
[0066] Optionally, in step S22, extracting the passage-allowed area in the virtual element set from the plan view includes:
[0067] Step S221, meshing the plane map to obtain a first mesh map;
[0068] Step S222, in the first grid map, color-marking a portion of the area occupied by the virtual building complex to obtain a first marking result, wherein the first marking result is used to determine a prohibited area within the designated area;
[0069] Step S223, deleting the target area from the first grid map to obtain a second grid map, wherein the target area includes: the annotated area corresponding to the first annotation result, and the area in the first grid map whose occupied area is less than a preset threshold;
[0070] Step S224: determining the passage-allowed area based on the second grid map.
[0071] Specifically, Figure 5 is a schematic diagram of a first grid diagram according to one embodiment of the present application, such as Figure 5 As shown in the figure, in a 3D animation application (HOUDINI), the plane image is meshed (Remesh) to obtain a first mesh image containing multiple triangular faces, and the vertices of the triangular faces are assigned black in the first mesh image. The Remesh process is the process of subdividing a polygonal mesh and redistributing mesh vertices. During the Remesh process, each face of the mesh will be divided into smaller faces, and the vertex positions of the mesh will be readjusted to ensure that the shape of the mesh is smoother and more uniform, which can help optimize and improve the topological structure of the mesh, making it more suitable for subsequent editing and processing operations.
[0072] In the first grid map, a partial area occupied by the virtual building complex is marked with color to obtain a first marking result, and the first marking result is used to determine a prohibited area in the designated area. Figure 6 is a schematic diagram of a first marking result according to one embodiment of the present application, such as Figure 6 As shown, part of the area occupied by the virtual building complex is marked in white to highlight the prohibited areas within the designated area.
[0073] Figure 7 is a schematic diagram of a second grid diagram according to one embodiment of the present application, such as Figure 7 As shown, the target area is deleted from the first grid map to obtain a second grid map, and the target area includes the marked area corresponding to the first marking result, that is, Figure 6 The white area in the first grid map and the area with an occupied area less than a preset threshold in the first grid map. The vertices included in the second grid map are multiple second vertices. Further, the allowed passage area in the specified area can be determined based on the second grid map.
[0074] Based on the above optional embodiment, by meshing and coloring the plan, the prohibited areas and allowed areas are effectively determined, thereby providing a reliable reference and basis for the planning and design of the designated area. At the same time, by deleting the target area to further refine the grid map, the determination of the pass area is more accurate and refined.
[0075] Optionally, in step S222, in the first grid map, a partial area occupied by the virtual building complex is color-annotated, and the first annotation result includes:
[0076] Step S2221, assigning colors to the virtual building complex to obtain a first assignment result;
[0077] Step S2222: In the first grid map, attribute mapping is performed on the first assignment result to obtain a first labeling result.
[0078] Specifically, the virtual building complex is assigned a color, for example, the virtual building complex is assigned a white color, thereby obtaining a first assignment result, and the first assignment result is attribute mapped in the first grid map to obtain a first labeling result. By assigning colors and attribute mapping to the virtual building complex, it is easier to identify and understand the information of the building complex, helping users to better manage and plan paths.
[0079] Optionally, in step S224, determining the passage-allowed area based on the second grid map includes:
[0080] Step S2241, obtaining an edge vertex group of the second mesh graph;
[0081] Step S2242, calculating a distance set between a plurality of first vertices and a plurality of second vertices, wherein the plurality of first vertices are vertices included in the edge vertex group, the plurality of second vertices are vertices included in the second mesh graph, and the distance set is used to determine the shortest path distance from the plurality of first vertices along the geometric contour of the second mesh graph to the plurality of second vertices;
[0082] Step S2243, determining the allowed passage area based on the distance set.
[0083] Figure 8 is a schematic diagram of a first vertex according to one embodiment of the present application, such as Figure 8 As shown, an edge vertex group of the second mesh graph is obtained, and the edge vertex group includes all vertices without shared edges, that is, first vertices. Further, a distance set between multiple first vertices and multiple second vertices is calculated, the multiple first vertices are vertices included in the edge vertex group, and the multiple second vertices are vertices included in the second mesh graph. The distance set is used to determine the shortest path distance from the multiple first vertices along the geometric contour of the second mesh graph to the multiple second vertices.
[0084] Specifically, after calculating the shortest path distance from the multiple first vertices along the geometric outline of the second grid graph to the multiple second vertices, the preset value is subtracted from the shortest path distance, so that the short path distance can be inverted, and the inverted processing result is recorded as the value of the preset parameter (Cost), and the preset value can be set to 1000. The larger the Cost value, the smaller the shortest path distance from the first vertex along the geometric outline of the second grid graph to the multiple second vertices, and the less likely the vertex will be selected during the path finding process, so that the path finding vertex can be as close to the middle of the road as possible, thereby further determining the allowed pass area based on the distance set. Fig. 9 is a schematic diagram of a passage-allowed area according to one embodiment of the present application, such as Fig. 9 As shown, the preset parameters are assigned colors for visualization. It can be seen that the edge of the allowed area is white, and the color becomes darker towards the middle of the road.
[0085] Based on the above optional embodiments, by obtaining edge vertex groups and calculating distance sets, the shortest path distances from multiple first vertices along the geometric contour of the second grid graph to multiple second vertices can be determined, thereby determining the allowed passage area, thereby improving the efficiency and accuracy of path planning, and at the same time ensuring the safety and rationality of the passage area.
[0086] Optionally, in step S23, using a multi-vertex pathfinding method to generate a target pass path in the passable area includes:
[0087] Step S231, scattering multiple random vertices according to a multi-vertex pathfinding method;
[0088] Step S232, selecting a third vertex and a fourth vertex from a plurality of random vertices, wherein the third vertex is a vertex at one end of a passage path to be generated in the passage-allowed area, and the fourth vertex is a vertex at the other end of the passage path;
[0089] Step S233: In the passage-allowed area, multiple pathfinding operations are performed on the third vertex and the fourth vertex to obtain a target passage path.
[0090] Fig.10 is a schematic diagram of a random vertex according to one embodiment of the present application, such as Fig.10 As shown, according to the multi-vertex pathfinding method, 1000 random vertices are scattered in the allowed pass area, and then the vertices at both ends of the pass path to be generated are selected from the multiple random vertices.
[0091] Fig.11 is a schematic diagram of a path endpoint according to one embodiment of the present application, such as Fig.11As shown, a third vertex and a fourth vertex are selected from multiple random vertices, the third vertex is a vertex at one end of a passage path to be generated in the passage-allowed area, and the fourth vertex is a vertex at the other end of the passage path. In the passage-allowed area, multiple pathfinding operations are performed on the third vertex and the fourth vertex to obtain a target passage path.
[0092] Based on the above optional embodiments, the diversity of paths can be increased by multi-vertex pathfinding, avoiding the situation where a single path is too concentrated. By selecting different third vertices and fourth vertices, a more complex and variable passage path can be generated, improving the flexibility and adaptability of path planning. At the same time, multiple pathfinding operations can make the final generated path more optimized and stable, improving the accuracy and reliability of path planning.
[0093] Optionally, in step S233, in the passage-allowed area, performing multiple pathfinding operations on the third vertex and the fourth vertex to obtain a target passage path includes:
[0094] Step S2331, in the passable area, taking the third vertex as the path starting point, performing a shortest path search operation from the third vertex to the fourth vertex to obtain a first passable path;
[0095] Step S2332, in the area of the allowed pass area except the first pass path, taking the fourth vertex as the path starting point, performing a shortest path search operation from the fourth vertex to the third vertex to obtain a second pass path;
[0096] Step S2333: merge the first pass path and the second pass path to obtain a target pass path.
[0097] Specifically, a third vertex and a fourth vertex are selected from a plurality of random vertices, and two shortest path finding operations are performed based on the third vertex and the fourth vertex, one of which is to perform a shortest path finding operation from the third vertex to the fourth vertex with the third vertex as the path starting point, and the other is to perform a shortest path finding operation from the fourth vertex to the third vertex with the fourth vertex as the path starting point. By performing several cycles on a plurality of random vertices, several target pass paths are obtained, and the target pass paths are closed curves. The number of cycles can be set as needed, for example, the number of path finding cycles in a small city is less than that in a large city.
[0098] Fig.12 is a schematic diagram of a first passage according to one embodiment of the present application, such as Fig.12 As shown, within the allowed pass area, the third vertex is used as the path starting point, and the shortest path finding operation is performed from the third vertex to the fourth vertex to obtain the first pass path.
[0099] Fig.13is a schematic diagram of a second passage according to one embodiment of the present application, such as Fig.13 As shown, in the area of the allowed pass area except the first pass path, the fourth vertex is used as the path starting point, and the shortest path finding operation is performed from the fourth vertex to the third vertex to obtain the second pass path.
[0100] Fig.14 is a schematic diagram of a target passage path according to one embodiment of the present application, such as Fig.14 As shown, the first pass path and the second pass path are merged to obtain the target pass path obtained by a single path-finding cycle. Fig.15 , Fig.16 , Fig.17 , Fig.18 is a schematic diagram of the target path generated by selecting the third vertex and the fourth vertex at different positions. By merging multiple different target paths, the following can be obtained: Fig.19 The merged result of the target pass path obtained by multiple path-finding cycles is shown.
[0101] Based on the above optional embodiment, by finding the first pass path and the second pass path, and then merging the first pass path and the second pass path, a more efficient target pass path is obtained, thereby reducing the pass time and the pass distance, and improving the efficiency and accuracy of path planning.
[0102] Optionally, the path generation method in the embodiment of the present application also includes: assigning a color to the first pass path to obtain a second assignment result; within the allowed passage area, performing attribute mapping on the second assignment result to obtain a second annotation result, wherein the second annotation result is used to indicate avoiding repeated passage through the first pass path during the pathfinding process of the second pass path.
[0103] Specifically, Fig. 20 is a schematic diagram of a second marking result according to one embodiment of the present application, such as Fig. 20 As shown, the first pass path is assigned a color, and the Cost value of each vertex on the first pass path is multiplied by a specified value, such as 999. The larger the Cost value, the less likely the vertex will be selected. The color of the first pass path is assigned to white, thereby obtaining a second assignment result, and the second assignment result is attribute mapped to obtain a second annotation result, thereby indicating to avoid repeatedly passing through the first pass path during the pathfinding process of the second pass path.
[0104] Based on the above optional embodiments, by assigning colors and mapping attributes to the travel paths, it is possible to avoid repeatedly passing through the same path during the path finding process, thereby improving the efficiency and accuracy of path planning. This can more effectively optimize path selection, avoid repeating the same route, and reduce path finding time and resource consumption.
[0105] Optionally, the path generation method in the embodiment of the present application further includes: performing path marking on the target pass path to obtain a marking result, wherein the marking result is used to distinguish different pass paths so that the target engine can call the target pass path based on the marking result.
[0106] Specifically, the target path obtained in each path-finding cycle is path-marked to obtain a marking result. For example, a path identification (ID) is set for each target path, and the ID is used to distinguish different paths so that the target engine can call the target path according to the ID.
[0107] Based on the above optional embodiments, by marking the target pass path, it is possible to distinguish and identify different pass paths. The target engine can call and process different pass paths according to the marking results, thereby improving the target engine's recognition and processing efficiency of the target pass path, thereby improving the smoothness of the game and user experience.
[0108] In the embodiment of the present application, by obtaining the plan view of the designated area in the virtual scene, the allowed pass area in the virtual element set is extracted from the plan view, multiple path endpoints are set in the allowed pass area, and the starting endpoint and the ending endpoint are selected from the multiple path endpoints, and the path finding operation is performed from the starting endpoint to the ending endpoint and from the ending endpoint to the starting endpoint to obtain multiple pass paths in the designated area, and the multiple pass paths form a closed loop curve, so that multiple pass paths can be generated at the same time as the city is generated, and it can be used in any graphical interface platform, and it can be easily used in mainstream engines without platform restrictions, thereby reducing the adaptation problems in the development process. By using programmatic automation, iteration can be performed at any time, saving manpower and time, especially when making large maps, it can effectively improve the efficiency of path generation. In addition to applying the city trajectory route, it can also be used to make some trajectory routes in other areas, which has good scalability, can significantly improve the efficiency of path generation and path authenticity, and thus solve the technical problems of low generation efficiency and poor path authenticity when generating virtual paths in the related technology.
[0109] Through the description of the above implementation methods, 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 by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0110] In this embodiment, a path generation device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0111] Fig.21 is a structural block diagram of a path generation device according to one embodiment of the present application, such as Fig.21 As shown, the device comprises:
[0112] The acquisition module 2101 is used to acquire a plan view of a specified area in the virtual scene, wherein the specified area is a surface area covered by a set of virtual elements to be deployed in the virtual scene, and the plan view is used to depict a layout plan of the specified area;
[0113] An extraction module 2102 is used to extract the allowed passage area in the virtual element set from the plan view;
[0114] The generation module 2103 is used to generate a target pass path in the allowed pass area by adopting a multi-vertex path finding method, wherein the multi-vertex path finding method is used to set multiple path endpoints in the allowed pass area, and select a start endpoint and an end endpoint from the multiple path endpoints, respectively, and obtain multiple pass paths in the specified area by performing path finding operations from the start endpoint to the end endpoint and from the end endpoint to the start endpoint, and the multiple pass paths form a closed-loop curve.
[0115] Optionally, the acquisition module 2101 is further used to: determine a three-dimensional surface corresponding to the specified area; and convert the three-dimensional surface into a two-dimensional plane according to a preset projection method to obtain a plane map.
[0116] Optionally, the extraction module 2102 is also used to: grid-subdivide the plan view to obtain a first grid map; in the first grid map, color-mark a portion of the area occupied by the virtual building complex to obtain a first marking result, wherein the first marking result is used to determine the prohibited area within the specified area; delete the target area from the first grid map to obtain a second grid map, wherein the target area includes: the marked area corresponding to the first marking result, and the area in the first grid map that occupies an area less than a preset threshold; determine the allowed area based on the second grid map.
[0117] Optionally, the extraction module 2102 is further used to: assign colors to the virtual building complex to obtain a first assignment result; and perform attribute mapping on the first assignment result in the first grid map to obtain a first labeling result.
[0118] Optionally, the extraction module 2102 is also used to: obtain an edge vertex group of the second grid graph; calculate a distance set between multiple first vertices and multiple second vertices, wherein the multiple first vertices are vertices included in the edge vertex group, and the multiple second vertices are vertices included in the second grid graph, and the distance set is used to determine the shortest path distance from the multiple first vertices along the geometric contour of the second grid graph to the multiple second vertices; determine the allowed passage area based on the distance set.
[0119] Optionally, the generation module 2103 is also used to: scatter multiple random vertices according to a multi-vertex pathfinding method; select a third vertex and a fourth vertex from the multiple random vertices, wherein the third vertex is a vertex at one end of the passage path to be generated in the allowed passage area, and the fourth vertex is a vertex at the other end of the passage path; in the allowed passage area, perform multiple pathfinding operations on the third vertex and the fourth vertex to obtain the target passage path.
[0120] Optionally, the generation module 2103 is also used to: within the allowed pass area, take the third vertex as the path starting point, perform the shortest path finding operation from the third vertex to the fourth vertex, and obtain a first pass path; within the allowed pass area other than the first pass path, take the fourth vertex as the path starting point, perform the shortest path finding operation from the fourth vertex to the third vertex, and obtain a second pass path; merge the first pass path and the second pass path to obtain a target pass path.
[0121] Optionally, the path generation device also includes: a processing module 2104, used to assign a color to the first pass path to obtain a second assignment result; a mapping module 2105, used to perform attribute mapping on the second assignment result within the allowed passage area to obtain a second marking result, wherein the second marking result is used to indicate avoiding repeated passage through the first pass path during the path finding process of the second pass path.
[0122] Optionally, the path generation device further includes: a marking module 2106, which is used to mark the target pass path to obtain a marking result, wherein the marking result is used to distinguish different pass paths so that the target engine can call the target pass path according to the marking result.
[0123] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0124] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0125] Optionally, in this embodiment, the above-mentioned computer-readable storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.
[0126] Optionally, in this embodiment, the computer-readable storage medium may be located in any one of the computer terminals in a computer terminal group in a computer network, or in any one of the mobile terminals in a mobile terminal group.
[0127] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0128] S1, obtaining a plan view of a specified area in a virtual scene, wherein the specified area is a surface area covered by a set of virtual elements to be deployed in the virtual scene, and the plan view is used to depict a layout plan of the specified area;
[0129] S2, extracting the allowed passage area in the virtual feature set from the plan view;
[0130] S3, adopts a multi-vertex pathfinding method to generate a target pass path in the allowed pass area, wherein the multi-vertex pathfinding method is used to set multiple path endpoints in the allowed pass area, and select a start endpoint and an end endpoint from the multiple path endpoints, respectively, and obtain multiple pass paths in the specified area by performing pathfinding operations from the start endpoint to the end endpoint and from the end endpoint to the start endpoint, and the multiple pass paths form a closed-loop curve.
[0131] Optionally, the computer-readable storage medium is further configured to store program codes for executing the following steps: determining a three-dimensional surface corresponding to a designated area; converting the three-dimensional surface into a two-dimensional plane according to a preset projection method to obtain a plan view.
[0132] Optionally, the computer-readable storage medium is further configured to store program codes for executing the following steps: gridding the plan to obtain a first grid map; in the first grid map, color-marking a portion of the area occupied by the virtual building complex to obtain a first marking result, wherein the first marking result is used to determine areas in the designated area where passage is prohibited; deleting the target area from the first grid map to obtain a second grid map, wherein the target area includes: the marked area corresponding to the first marking result, and the area in the first grid map where the occupied area is less than a preset threshold; and determining the area where passage is allowed based on the second grid map.
[0133] Optionally, the computer-readable storage medium is further configured to store program codes for executing the following steps: assigning colors to the virtual building complex to obtain a first assignment result; and performing attribute mapping on the first assignment result in a first grid map to obtain a first labeling result.
[0134] Optionally, the above-mentioned computer-readable storage medium is also configured to store program code for executing the following steps: obtaining an edge vertex group of the second grid graph; calculating a distance set between multiple first vertices and multiple second vertices, wherein the multiple first vertices are vertices included in the edge vertex group, and the multiple second vertices are vertices included in the second grid graph, and the distance set is used to determine the shortest path distance from the multiple first vertices along the geometric contour of the second grid graph to the multiple second vertices; determining the allowed passage area based on the distance set.
[0135] Optionally, the computer-readable storage medium is also configured to store program codes for executing the following steps: scattering multiple random vertices according to a multi-vertex pathfinding method; selecting a third vertex and a fourth vertex from the multiple random vertices, wherein the third vertex is a vertex at one end of a passage path to be generated in the passage-allowed area, and the fourth vertex is a vertex at the other end of the passage path; performing multiple pathfinding operations on the third vertex and the fourth vertex in the passage-allowed area to obtain a target passage path.
[0136] Optionally, the computer-readable storage medium is further configured to store program codes for executing the following steps: within the passage-allowed area, taking the third vertex as the path starting point, performing the shortest path finding operation from the third vertex to the fourth vertex to obtain a first passage path; within the passage-allowed area other than the first passage path, taking the fourth vertex as the path starting point, performing the shortest path finding operation from the fourth vertex to the third vertex to obtain a second passage path; merging the first passage path and the second passage path to obtain a target passage path.
[0137] Optionally, the computer-readable storage medium is also configured to store program codes for executing the following steps: assigning a color to the first pass path to obtain a second assignment result; and performing attribute mapping on the second assignment result within the allowed passage area to obtain a second annotation result, wherein the second annotation result is used to indicate avoiding repeated passage through the first pass path during pathfinding of the second pass path.
[0138] Optionally, the computer-readable storage medium is further configured to store program code for executing the following steps: path marking the target pass path to obtain a marking result, wherein the marking result is used to distinguish different pass paths so that the target engine can call the target pass path based on the marking result.
[0139] In the computer-readable storage medium of this embodiment, by obtaining a plan view of a specified area in a virtual scene, and then extracting a permitted area in a set of virtual elements from the plan view, multiple path endpoints are set in the permitted area, and multiple path-finding operations are performed based on the multiple path endpoints to obtain multiple passage paths in the specified area, thereby achieving the purpose of efficiently generating diversified passage paths in the permitted area, thereby achieving the technical effect of improving path generation efficiency and path authenticity, and thus solving the technical problems of low generation efficiency and poor path authenticity when generating virtual paths in related technologies.
[0140] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a computer-readable storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation methods of the present application.
[0141] In an exemplary embodiment of the present application, a program product capable of implementing the above method of the present embodiment is stored on a computer-readable storage medium. In some possible implementations, various aspects of the embodiments of the present application can also be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary implementations of the present application described in the above "Exemplary Method" section of the present embodiment.
[0142] According to the program product for implementing the above method in the embodiment of the present application, it can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the embodiment of the present application is not limited thereto. In the embodiment of the present application, the computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.
[0143] The program product may be in any combination of one or more computer-readable media. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples (non-exhaustive) of computer-readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0144] It should be noted that the program code contained in the computer-readable storage medium can be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above.
[0145] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0146] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0147] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0148] S1, obtaining a plan view of a specified area in a virtual scene, wherein the specified area is a surface area covered by a set of virtual elements to be deployed in the virtual scene, and the plan view is used to depict a layout plan of the specified area;
[0149] S2, extracting the allowed passage area in the virtual feature set from the plan view;
[0150] S3, adopts a multi-vertex pathfinding method to generate a target pass path in the allowed pass area, wherein the multi-vertex pathfinding method is used to set multiple path endpoints in the allowed pass area, and select a start endpoint and an end endpoint from the multiple path endpoints, respectively, and obtain multiple pass paths in the specified area by performing pathfinding operations from the start endpoint to the end endpoint and from the end endpoint to the start endpoint, and the multiple pass paths form a closed-loop curve.
[0151] Optionally, the processor may also be configured to execute the following steps through a computer program: determining a three-dimensional surface corresponding to a designated area; converting the three-dimensional surface into a two-dimensional plane according to a preset projection method to obtain a plane view.
[0152] Optionally, the processor can also be configured to perform the following steps through a computer program: gridding the plan to obtain a first grid map; in the first grid map, color-marking a portion of the area occupied by the virtual building complex to obtain a first marking result, wherein the first marking result is used to determine areas in the designated area where passage is prohibited; deleting the target area from the first grid map to obtain a second grid map, wherein the target area includes: the marked area corresponding to the first marking result, and the area in the first grid map where the occupied area is less than a preset threshold; and determining the area where passage is allowed based on the second grid map.
[0153] Optionally, the processor may also be configured to execute the following steps through a computer program: assigning colors to the virtual building complex to obtain a first assignment result; and performing attribute mapping on the first assignment result in a first grid map to obtain a first labeling result.
[0154] Optionally, the above-mentioned processor can also be configured to perform the following steps through a computer program: obtain an edge vertex group of the second grid graph; calculate a distance set between multiple first vertices and multiple second vertices, wherein the multiple first vertices are vertices included in the edge vertex group, and the multiple second vertices are vertices included in the second grid graph, and the distance set is used to determine the shortest path distance from the multiple first vertices along the geometric contour of the second grid graph to the multiple second vertices; determine the allowed passage area based on the distance set.
[0155] Optionally, the processor can also be configured to perform the following steps through a computer program: scatter multiple random vertices according to a multi-vertex pathfinding method; select a third vertex and a fourth vertex from the multiple random vertices, wherein the third vertex is a vertex at one end of a passage path to be generated in the passage-allowed area, and the fourth vertex is a vertex at the other end of the passage path; perform multiple pathfinding operations on the third vertex and the fourth vertex in the passage-allowed area to obtain a target passage path.
[0156] Optionally, the above-mentioned processor can also be configured to perform the following steps through a computer program: within the allowed pass area, taking the third vertex as the starting point of the path, performing the shortest path finding operation from the third vertex to the fourth vertex to obtain a first pass path; within the allowed pass area other than the first pass path, taking the fourth vertex as the starting point of the path, performing the shortest path finding operation from the fourth vertex to the third vertex to obtain a second pass path; merging the first pass path and the second pass path to obtain a target pass path.
[0157] Optionally, the processor can also be configured to execute the following steps through a computer program: assigning a color to the first pass path to obtain a second assignment result; performing attribute mapping on the second assignment result within the allowed passage area to obtain a second annotation result, wherein the second annotation result is used to indicate avoiding repeated passage through the first pass path during the pathfinding process of the second pass path.
[0158] Optionally, the processor may also be configured to perform the following steps through a computer program: path marking the target pass path to obtain a marking result, wherein the marking result is used to distinguish different pass paths, so that the target engine can call the target pass path based on the marking result.
[0159] In the electronic device of this embodiment, by obtaining a plan view of a specified area in a virtual scene, and then extracting a permitted area in a set of virtual elements from the plan view, multiple path endpoints are set in the permitted area, and multiple path-finding operations are performed based on the multiple path endpoints to obtain multiple passage paths in the specified area, thereby achieving the purpose of efficiently generating diversified passage paths in the permitted area, thereby achieving the technical effect of improving path generation efficiency and path authenticity, and thus solving the technical problems of low generation efficiency and poor path authenticity when generating virtual paths in related technologies.
[0160] Fig. 22 is a schematic diagram of an electronic device according to an embodiment of the present application. Fig. 22 As shown, the electronic device 2200 is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0161] like Fig. 22 As shown, the electronic device 2200 is in the form of a general computing device. The components of the electronic device 2200 may include but are not limited to: at least one processor 2210, at least one memory 2220, a bus 2230 connecting different system components (including the memory 2220 and the processor 2210), and a display 2240.
[0162] The memory 2220 stores program codes, which can be executed by the processor 2210, so that the processor 2210 executes the steps described in the method part of the embodiment of the present application according to various exemplary embodiments of the present application.
[0163] The memory 2220 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 22201 and / or a cache memory unit 22202, and may further include a read-only memory unit (ROM) 22203, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory.
[0164] In some examples, the memory 2220 may also include a program / utility 22204 having a set (at least one) of program modules 22205, such program modules 22205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination thereof may include the implementation of a network environment. The memory 2220 may further include a memory remotely disposed relative to the processor 2210, and these remote memories may be connected to the electronic device 2200 via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0165] The bus 2230 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a local bus of the processor 2210, or a bus using any of a variety of bus architectures.
[0166] The display 2240 may be, for example, a touch screen type liquid crystal display (LCD) that enables a user to interact with a user interface of the electronic device 2200 .
[0167] Optionally, the electronic device 2200 may also communicate with one or more external devices 2300 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), one or more devices that enable a user to interact with the electronic device 2200, and / or any device that enables the electronic device 2200 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed through an input / output (I / O) interface 2250. Furthermore, the electronic device 2200 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 2260. Fig. 22As shown, the network adapter 2260 communicates with other modules of the electronic device 2200 via the bus 2230. It should be understood that although Fig. 22 Not shown, other hardware and / or software modules may be used in conjunction with the electronic device 2200, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0168] The electronic device 2200 may further include: a keyboard, a cursor control device (such as a mouse), an input / output interface (I / O interface), a network interface, a power supply and / or a camera.
[0169] It can be understood by those skilled in the art that Fig. 22 The structure shown is for illustration only and does not limit the structure of the above electronic device. Fig. 22 More or fewer components as shown, or with Figure 1 The memory 2220 may be used to store computer programs and corresponding data, such as the computer programs and corresponding data corresponding to the path generation method in the embodiment of the present application. The processor 2210 executes various functional applications and data processing by running the computer programs stored in the memory 2220, that is, implementing the above-mentioned path generation method.
[0170] The embodiment of the present application further provides a computer program product. Optionally, in this embodiment, the computer program product may include a computer program, and the computer program implements the method provided in the embodiment when executed by a processor.
[0171] Optionally, the computer program included in the above-mentioned computer program product is executed by a processor to perform the following steps:
[0172] S1, obtaining a plan view of a specified area in a virtual scene, wherein the specified area is a surface area covered by a set of virtual elements to be deployed in the virtual scene, and the plan view is used to depict a layout plan of the specified area;
[0173] S2, extracting the allowed passage area in the virtual feature set from the plan view;
[0174] S3, adopts a multi-vertex pathfinding method to generate a target pass path in the allowed pass area, wherein the multi-vertex pathfinding method is used to set multiple path endpoints in the allowed pass area, and select a start endpoint and an end endpoint from the multiple path endpoints, respectively, and obtain multiple pass paths in the specified area by performing pathfinding operations from the start endpoint to the end endpoint and from the end endpoint to the start endpoint, and the multiple pass paths form a closed-loop curve.
[0175] The embodiments of the present application also provide a computer program product. Optionally, the computer program product may include a non-volatile computer-readable storage medium, which may be used to store a computer program, and when the computer program is executed by a processor, the method provided in the embodiments is implemented.
[0176] Optionally, the computer program stored in the non-volatile computer-readable storage medium is used by the processor to execute the following steps:
[0177] S1, obtaining a plan view of a specified area in a virtual scene, wherein the specified area is a surface area covered by a set of virtual elements to be deployed in the virtual scene, and the plan view is used to depict a layout plan of the specified area;
[0178] S2, extracting the allowed passage area in the virtual feature set from the plan view;
[0179] S3, adopts a multi-vertex pathfinding method to generate a target pass path in the allowed pass area, wherein the multi-vertex pathfinding method is used to set multiple path endpoints in the allowed pass area, and select a start endpoint and an end endpoint from the multiple path endpoints, respectively, and obtain multiple pass paths in the specified area by performing pathfinding operations from the start endpoint to the end endpoint and from the end endpoint to the start endpoint, and the multiple pass paths form a closed-loop curve.
[0180] The embodiment of the present application further provides a computer program. Optionally, in this embodiment, when the computer program is executed by a processor, the method provided in the above embodiment is implemented.
[0181] Optionally, the computer program is executed by a processor to perform the following steps:
[0182] S1, obtaining a plan view of a specified area in a virtual scene, wherein the specified area is a surface area covered by a set of virtual elements to be deployed in the virtual scene, and the plan view is used to depict a layout plan of the specified area;
[0183] S2, extracting the allowed passage area in the virtual feature set from the plan view;
[0184] S3, adopts a multi-vertex pathfinding method to generate a target pass path in the allowed pass area, wherein the multi-vertex pathfinding method is used to set multiple path endpoints in the allowed pass area, and select a start endpoint and an end endpoint from the multiple path endpoints, respectively, and obtain multiple pass paths in the specified area by performing pathfinding operations from the start endpoint to the end endpoint and from the end endpoint to the start endpoint, and the multiple pass paths form a closed-loop curve.
[0185] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0186] In the above 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, please refer to the relevant description of other embodiments.
[0187] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0188] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0189] 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 separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0190] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0191] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A path generation method, characterized in that: include: Acquire a plan view of a designated area in a virtual scene, wherein the designated area is a surface area covered by a set of virtual elements to be deployed in the virtual scene, and the plan view is used to depict a layout plan of the designated area; Extracting the allowed passage area in the virtual element set from the plan view; A multi-vertex pathfinding method is adopted to generate a target pass path in the allowed pass area, wherein the multi-vertex pathfinding method is used to set multiple path endpoints in the allowed pass area, and select a start endpoint and an end endpoint from the multiple path endpoints, respectively, and obtain multiple pass paths in the specified area by performing pathfinding operations from the start endpoint to the end endpoint and from the end endpoint to the start endpoint, and the multiple pass paths form a closed-loop curve.
2. The path generation method according to claim 1, characterized in that: Acquiring the plan view of the designated area in the virtual scene includes: Determine a three-dimensional surface corresponding to the designated area; The three-dimensional surface is converted into a two-dimensional plane according to a preset projection method to obtain the plane diagram.
3. The path generation method according to claim 2, characterized in that: Extracting the passage-allowed area in the virtual element set from the plan view includes: Subdividing the plane graph into grids to obtain a first grid graph; In the first grid map, color marking is performed on a portion of the area occupied by the virtual building complex to obtain a first marking result, wherein the first marking result is used to determine a prohibited area within the designated area; Deleting a target area from the first grid map to obtain a second grid map, wherein the target area includes: a marked area corresponding to the first marking result, and an area in the first grid map that occupies an area less than a preset threshold; The passage-allowed area is determined based on the second grid map.
4. The path generation method according to claim 3, characterized in that: In the first grid map, a partial area occupied by the virtual building complex is marked with a color, and the first marking result includes: Assigning colors to the virtual building complex to obtain a first assignment result; In the first grid map, attribute mapping is performed on the first assignment result to obtain the first labeling result.
5. The path generation method according to claim 3, characterized in that: Determining the passage-allowed area based on the second grid map includes: Obtain an edge vertex group of the second grid graph; Calculating a distance set between a plurality of first vertices and a plurality of second vertices, wherein the plurality of first vertices are vertices included in the edge vertex group, the plurality of second vertices are vertices included in the second mesh graph, and the distance set is used to determine the shortest path distance from the plurality of first vertices along the geometric contour of the second mesh graph to the plurality of second vertices; The passage-allowed area is determined based on the distance set.
6. The path generation method according to claim 1, characterized in that: Using the multi-vertex pathfinding method, generating the target pass path in the allowed pass area includes: According to the multi-vertex pathfinding method, scattering a plurality of random vertices; Selecting a third vertex and a fourth vertex from the plurality of random vertices, wherein the third vertex is a vertex at one end of a passage path to be generated in the passage-allowed area, and the fourth vertex is a vertex at the other end of the passage path; In the passage-allowed area, multiple pathfinding operations are performed on the third vertex and the fourth vertex to obtain the target passage path.
7. The path generation method according to claim 6, characterized in that: In the passage-allowed area, performing multiple pathfinding operations on the third vertex and the fourth vertex to obtain the target passage path includes: In the passage-allowed area, taking the third vertex as the path starting point, performing a shortest path search operation from the third vertex to the fourth vertex to obtain a first passage path; In the area of the allowed passage area other than the first pass path, taking the fourth vertex as the path starting point, performing a shortest path search operation from the fourth vertex to the third vertex to obtain a second pass path; The first pass path and the second pass path are merged to obtain the target pass path.
8. The path generation method according to claim 7, characterized in that: The path generation method further includes: Assigning a color to the first pass path to obtain a second assignment result; In the allowed passage area, attribute mapping is performed on the second assignment result to obtain a second annotation result, wherein the second annotation result is used to indicate to avoid repeatedly passing through the first passage path during the path finding process of the second passage path.
9. The path generation method according to claim 1, characterized in that: The path generation method further includes: The target pass path is path-marked to obtain a marking result, wherein the marking result is used to distinguish different pass paths, so that the target engine can call the target pass path according to the marking result.
10. A path generation device, characterized in that: include: An acquisition module, used to acquire a plan view of a specified area in a virtual scene, wherein the specified area is a surface area covered by a set of virtual elements to be deployed in the virtual scene, and the plan view is used to depict a layout plan of the specified area; An extraction module, used for extracting the passage-allowed area in the virtual element set from the plan view; A generation module is used to generate a target pass path in the allowed pass area by adopting a multi-vertex path finding method, wherein the multi-vertex path finding method is used to set a plurality of path endpoints in the allowed pass area, and respectively select a start endpoint and an end endpoint from the plurality of path endpoints, and obtain a plurality of pass paths in the specified area by performing a path finding operation from the start endpoint to the end endpoint and performing a path finding operation from the end endpoint to the start endpoint, and the plurality of pass paths form a closed-loop curve.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the path generation method described in any one of claims 1 to 9 when executed by a processor.
12. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to execute the path generation method described in any one of claims 1 to 9.
13. A computer program product, characterized in that The invention comprises a computer program, which implements the path generation method described in any one of claims 1 to 9 when being executed by a processor.