CN113144607A - Path finding method and device for virtual object in game and electronic equipment - Google Patents

Path finding method and device for virtual object in game and electronic equipment Download PDF

Info

Publication number
CN113144607A
CN113144607A CN202110433303.2A CN202110433303A CN113144607A CN 113144607 A CN113144607 A CN 113144607A CN 202110433303 A CN202110433303 A CN 202110433303A CN 113144607 A CN113144607 A CN 113144607A
Authority
CN
China
Prior art keywords
target
navigation
game
navigation grid
grids
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.)
Granted
Application number
CN202110433303.2A
Other languages
Chinese (zh)
Other versions
CN113144607B (en
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.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network 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 Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202110433303.2A priority Critical patent/CN113144607B/en
Priority claimed from CN202110433303.2A external-priority patent/CN113144607B/en
Publication of CN113144607A publication Critical patent/CN113144607A/en
Application granted granted Critical
Publication of CN113144607B publication Critical patent/CN113144607B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/55Controlling game characters or game objects based on the game progress
    • A63F13/56Computing the motion of game characters with respect to other game characters, game objects or elements of the game scene, e.g. for simulating the behaviour of a group of virtual soldiers or for path finding
    • 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/60Methods for processing data by generating or executing the game program
    • A63F2300/65Methods for processing data by generating or executing the game program for computing the condition of a game character

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The invention provides a method and a device for finding a path of a virtual object in a game and electronic equipment. Wherein, the method comprises the following steps: acquiring position information of a virtual object in a game, wherein the position information comprises an initial position and a target position of the virtual object in a game scene; generating a navigation grid map corresponding to the game scene in real time according to the position information and the game scene; the method comprises the steps that a target path from an initial position to a target position is determined based on a navigation grid map, and compared with the existing two-dimensional grid-based path finding method, the determining efficiency of the target path, namely the path finding efficiency, is improved; when the game scene changes, the navigation grid map is generated in real time through the position information and the updated game scene, the accuracy of the target path is guaranteed, meanwhile, frequent scanning of the game map is avoided, the problem of overlarge path searching consumption is relieved, and the method has good practical value.

Description

Path finding method and device for virtual object in game and electronic equipment
Technical Field
The present invention relates to the field of game technologies, and in particular, to a method and an apparatus for routing a virtual object in a game, and an electronic device.
Background
The biological way finding in the game mainly refers to a path generated by walking a certain organism towards a target position in the game, and generally, the biological way finding can be divided into two steps: game scene map representation and path search; the game scene map representation mainly converts a game scene into a specific mathematical model for representing the structure of the game scene, barrier information and the like, and the path search is to execute a path-finding algorithm on the mathematical model to obtain a biological path-finding path.
The existing game scene map representation mainly divides a game scene into two-dimensional grids with equal size, path search is a route searching algorithm based on the two-dimensional grids, and the route searching algorithm mainly comprises a pure A-x algorithm, a depth-first searching algorithm and a greedy algorithm.
For sandbox games, the routing algorithm can realize biological routing, but because the map environment changes frequently, the game scene map needs to be scanned frequently, and the routing algorithm is executed based on the latest game scene map, so that the routing consumption is high, and the routing calculation efficiency is influenced.
Disclosure of Invention
In view of the above, the present invention provides a method, an apparatus and an electronic device for routing a virtual object in a game, so as to alleviate the above problems, improve the routing efficiency and have a good practical value.
In a first aspect, an embodiment of the present invention provides a method for finding a path of a virtual object in a game, where a game scene of the game is displayed by an electronic device, the method including: acquiring position information of a virtual object in a game, wherein the position information comprises an initial position and a target position of the virtual object in a game scene; generating a navigation grid map corresponding to the game scene in real time according to the position information and the game scene; the navigation grids in the navigation grid map are corresponding to height information and communication information; determining a target path from the initial position to the target position based on the navigation grid map; the target path comprises a same-height navigation grid with connectivity and a different-height navigation grid which meets a preset height difference range and has connectivity.
With reference to the first aspect, an embodiment of the present invention provides a first possible implementation manner of the first aspect, where the step of generating a navigation grid map corresponding to a game scene in real time according to the position information and the game scene includes dividing the game scene into a plurality of unit areas of a preset size according to a division rule; determining a set of target unit areas based on the location information; wherein the target unit area set includes a plurality of target unit areas from an initial position to a target position; and generating a navigation grid map corresponding to the game scene in real time according to the target unit area set and the corresponding game scene.
With reference to the first possible implementation manner of the first aspect, an embodiment of the present invention provides a second possible implementation manner of the first aspect, where the game scene includes multiple scene models, and the step of generating a navigation grid map corresponding to the game scene in real time according to the target unit area set and the corresponding game scene includes obtaining a scene model in each unit area; the scene model comprises a plurality of basic grids, and each basic grid carries parameter information; determining an effective walking area of a unit area according to the parameter information of the basic grid; wherein the effective walking area comprises a plurality of target basic grids; merging target basic grids at the same height in the effective walking area according to an adjacent relation to obtain a navigation grid in a preset shape; and determining the communication relation among the navigation grids to obtain a navigation grid map corresponding to the game scene.
With reference to the second possible implementation manner of the first aspect, an embodiment of the present invention provides a third possible implementation manner of the first aspect, where the parameter information includes size information and attribute information, and the step of determining the effective walking area of the unit area according to the parameter information of the base mesh includes: determining a plurality of target basic grids according to the size information of the basic grids and the preset size so as to obtain an effective walking area of a unit area; and/or; determining a plurality of target basic grids according to the attribute information of the basic grids so as to obtain an effective walking area of a unit area; wherein the attribute information is used for representing whether the virtual object can walk on the base grid.
With reference to the second possible implementation manner of the first aspect, an embodiment of the present invention provides a fourth possible implementation manner of the first aspect, where the step of determining a connectivity relationship between navigation grids includes: calculating connectivity between any navigation grid and its neighboring navigation grids; wherein the virtual object is moveable between two navigation grids having connectivity.
With reference to the fourth possible implementation manner of the first aspect, an embodiment of the present invention provides a fifth possible implementation manner of the first aspect, where the step of calculating connectivity between any navigation grid and its neighboring navigation grids includes: calculating a height difference according to the height information of two adjacent navigation grids; and determining connectivity between adjacent navigation grids according to the height difference.
With reference to the fifth possible implementation manner of the first aspect, an embodiment of the present invention provides a sixth possible implementation manner of the first aspect, wherein the step of determining connectivity between adjacent navigation grids according to a height difference includes: judging whether the height difference meets the height difference range or not; if so, it is determined that two adjacent navigation grids have connectivity moving in both directions.
With reference to the sixth possible implementation manner of the first aspect, an embodiment of the present invention provides a seventh possible implementation manner of the first aspect, where the method further includes: and if the height difference does not meet the height difference range, determining that the two adjacent navigation grids have connectivity of one-way movement.
With reference to the second possible implementation manner of the first aspect, an embodiment of the present invention provides an eighth possible implementation manner of the first aspect, where the method further includes: responding to the change operation aiming at the scene model, and obtaining a change navigation grid corresponding to the change scene model; calculating a target height difference according to the height information of the changed navigation grid and the adjacent navigation grid; determining connectivity between the changed navigation grid and the adjacent navigation grid according to the target height difference; and updating the connectivity information in the navigation grid map according to the connectivity.
With reference to the first aspect, an embodiment of the present invention provides a ninth possible implementation manner of the first aspect, where the step of determining a target path from an initial position to a target position based on a navigation grid map includes: determining a target navigation grid set from an initial position to a target position based on the navigation grid map; the target navigation grid group comprises a same-height navigation grid with connectivity and a different-height navigation grid which meets a preset height difference range and has connectivity; and determining a target path from the initial position to the target position based on the target navigation grid set. With reference to the ninth possible implementation manner of the first aspect, an embodiment of the present invention provides a tenth possible implementation manner of the first aspect, where the step of determining a target navigation grid group from an initial position to a target position based on a navigation grid map includes: and executing a way-finding algorithm on the navigation grids in the navigation grid map based on the A-algorithm to obtain a target navigation grid group from the initial position to the target position.
With reference to the ninth possible implementation manner of the first aspect, an embodiment of the present invention provides an eleventh possible implementation manner of the first aspect, wherein the step of determining a target path from an initial position to a target position based on a target navigation grid set includes: determining path points corresponding to the target navigation grids in the target navigation grid group based on a funnel algorithm; and obtaining a target path from the initial position to the target position according to the plurality of path points.
With reference to the first aspect, an embodiment of the present invention provides a twelfth possible implementation manner of the first aspect, where after the step of determining the target path from the initial position to the target position, the method further includes: and controlling the virtual object to move to the target position according to the target path in response to the movement operation aiming at the virtual object.
With reference to the first aspect, an embodiment of the present invention provides a thirteenth possible implementation manner of the first aspect, where the step of acquiring location information of a virtual object in a game includes: in response to an automatic way-finding operation for a virtual object, position information of the virtual object is determined. In a second aspect, an embodiment of the present invention further provides a path finding device for a virtual object in a game, where a game scene of the game is displayed by an electronic device, the device includes: the position information acquisition module is used for acquiring the position information of the virtual object in the game, wherein the position information comprises an initial position and a target position of the virtual object in a game scene; the navigation grid map generation module is used for generating a navigation grid map corresponding to a game scene in real time according to the position information and the game scene; the navigation grids in the navigation grid map are corresponding to height information and communication information; a target path determination module for determining a target path from an initial position to a target position based on the navigation grid map; the target path comprises a same-height navigation grid with connectivity and a different-height navigation grid which meets a preset height difference range and has connectivity.
In a third aspect, an embodiment of the present invention further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the method for routing a virtual object in a game according to the first aspect when executing the computer program.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method for finding a path of a virtual object in a game according to the first aspect are executed.
The embodiment of the invention has the following beneficial effects:
the embodiment of the invention provides a method, a device and electronic equipment for finding a path of a virtual object in a game, wherein a navigation grid map corresponding to a game scene is generated in real time according to position information of the virtual object and the game scene, and a target path from an initial position to a target position is determined based on a navigation grid carrying height information and communication information; when the game scene changes, the navigation grid map is generated in real time through the position information and the updated game scene, the accuracy of the target path is guaranteed, meanwhile, frequent scanning of the game map is avoided, the problem of overlarge path searching consumption is relieved, and the method has good practical value.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and drawings.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a flowchart of a method for routing a virtual object in a game according to an embodiment of the present invention;
FIG. 2 is a flowchart of another method for routing a virtual object in a game according to an embodiment of the present invention;
FIG. 3 is a flowchart of another method for routing a virtual object in a game according to an embodiment of the present invention;
fig. 4 is a schematic diagram of a principle of a pure a-algorithm according to an embodiment of the present invention;
FIG. 5 is a schematic diagram illustrating a depth-first search algorithm according to an embodiment of the present invention;
FIG. 6 is a schematic diagram illustrating a greedy algorithm according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of a path finding apparatus for a virtual object in a game according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Biorouting is a common requirement in the gaming industry and has wide application in many games, such as monster AI (Artificial Intelligence), player automation mode, show-through animation scenario, etc. However, with the development of sandbox games and the improvement of requirements of players on game contents, the existing way-finding method cannot provide efficient support for the sandbox games. How to find an efficient method to organize scene information and give a way finding result is a problem concerned by the game industry.
For sandbox games, the game scene mainly has the characteristic of dynamic change, for example, the map environment is changed or a monster chases a player to cause the player to move continuously, and the path searching method can realize the path searching of the game scene in the sandbox games, but the game scene map needs to be scanned frequently, and the path searching algorithm is executed based on the latest game scene map, so that the path searching consumption is large, and the calculation efficiency of the path searching is influenced. Based on this, the embodiment of the invention provides a path finding method and device for a virtual object in a game and an electronic device, and the technology can be applied to various game scenes, especially to the game scenes of sandbox games, the game scenes of open world and randomly generated terrain, and the like.
To facilitate understanding of the present embodiment, first, a detailed description is given below of a path finding method for a virtual object in a game according to an embodiment of the present invention. The execution main body is electronic equipment, a NavMesh component of a game is stored in the electronic equipment, the NavMesh component is a technology for realizing automatic path finding of a dynamic object in a 3D (3D) game world, a complex structural organization relation in the game is simplified into a grid with certain information, the grid is also called a navigation grid, and therefore automatic path finding is realized through a path finding algorithm on the basis of the grid. In practical applications, the electronic device provides a game scene and a virtual object of a game, the virtual object may also be called as a virtual character or a game character, the game scene is a sandbox game scene, an open world game scene, a randomly generated terrain game scene, and the like, and the electronic device controls the virtual object to move in the game scene; the electronic device can be a mobile phone, a computer, a notebook, a tablet computer and the like.
Based on the above electronic device, an embodiment of the present invention provides a method for finding a path of a virtual object in a game, as shown in fig. 1, the method includes the following steps:
step S102, acquiring position information of a virtual object in a game;
specifically, in response to an automatic way finding operation for a virtual object, determining position information of the virtual object; the position information includes an initial position and a target position of the virtual object in the game scene, where the initial position is a current position of the virtual object, or the position of the virtual object in the game scene when the game is loaded, and the target position is a position corresponding to the automatic routing operation. For example, if a player (also referred to as a game player or a user) controls a virtual object to execute a task, a position corresponding to the task is a target position of the virtual object, and the automatic routing operation is an operation for executing the task, if the player is to obtain a certain game treasure or collect a specific item such as a game item, a position where the game treasure or the game item is located is the target position.
It should be noted that, if the interface provided by the electronic device is a touch screen, the user can implement an automatic route finding operation of the virtual object through a pressing operation; if the interface is a non-touch screen, the user may implement an automatic way-finding operation of the virtual object through a click operation of a mouse and/or a keyboard to obtain the position information of the virtual object, and therefore, the embodiment of the present invention is not limited herein with respect to a specific form of the automatic way-finding operation. The player is also referred to as a game player or a user.
Step S104, generating a navigation grid map corresponding to the game scene in real time according to the position information and the game scene;
after the position information of the virtual object is obtained, a NavMesh component of a game, which is pre-stored by the electronic equipment, generates a navigation grid map corresponding to a game scene in real time according to the position information and the game scene; the navigation grid map is generated in real time, so that when a game scene changes, the electronic equipment can realize that the generated navigation grid map corresponds to the current game scene without scanning the whole game map of the game, namely, the navigation grid map corresponding to the game scene is generated in real time through the position information and the game scene, and the problem of high route searching consumption caused by repeated scanning of the whole game map for many times in the route searching process is solved.
The navigation grid map comprises a plurality of navigation grids, each navigation grid carries height information and communication information and is distributed on different planes in the navigation grid map according to the height information; in addition, the connected information includes connectivity and non-connectivity, the virtual object can be movable between two navigation grids with connectivity, and is not movable between two navigation grids with non-connectivity, where the non-connectivity indicates that the two navigation grids are not connected, so that the virtual object is not movable; therefore, the navigation grid with the height information and the communication information is used for searching the path, compared with the existing two-dimensional grid, the problem that the path searching efficiency is low due to the fact that a large amount of path searching calculation consumption between adjacent navigation grids in a navigation grid map is large is solved, and therefore the path searching efficiency is improved.
Step S106, determining a target path from the initial position to the target position based on the navigation grid map.
The target path comprises a same-height navigation grid with connectivity and a different-height navigation grid which meets a preset height difference range and has connectivity; specifically, according to the height information and the connectivity information of the navigation grids, the navigation grids with the same height and connectivity can be quickly determined, and the problem that a virtual object cannot move due to the fact that two adjacent navigation grids with non-connectivity exist in a target navigation grid group is solved; in addition, for navigation grids with different heights, the preset height difference range is required to be met, and the navigation grids are connected, so that the virtual object can stably move in the navigation grids with different heights, and further, the target path from the initial position to the target position is determined based on the navigation grid map, the calculation efficiency of the target path is improved, the stability of the virtual object moving on the target path is also ensured, and the game experience of a user is improved.
According to the method for finding the path of the virtual object in the game, the navigation grid map corresponding to the game scene is generated in real time according to the position information of the virtual object and the game scene, the target path from the initial position to the target position is determined based on the navigation grid carrying the height information and the communication information, and compared with the existing path finding method based on the two-dimensional grid, the method for finding the path of the virtual object in the game improves the determination efficiency of the target path, namely the path finding efficiency; when the game scene changes, the navigation grid map is generated in real time through the position information and the updated game scene, the accuracy of the target path is guaranteed, meanwhile, frequent scanning of the game map is avoided, the problem of overlarge path searching consumption is relieved, and the method has good practical value.
On the basis of the above method embodiment, another way-finding method for virtual objects in a game is also provided in the embodiments of the present invention, where the method mainly describes a process of generating a navigation grid map corresponding to a game scene in real time according to position information and the game scene. As shown in fig. 2, the method comprises the steps of:
step S202, acquiring position information of a virtual object in a game;
step S204, dividing a game scene into a plurality of unit areas with preset sizes according to a division rule;
specifically, a game scene is divided into a plurality of unit areas with preset sizes according to a preset division rule; the preset dividing rule may be a dividing size, and the whole game scene or the game scene currently displayed by the electronic device is divided into a plurality of unit areas according to the preset size, for example, the game scene is divided into a plurality of unit areas with a preset size of 16 × 16; the division rule can also be a division area criterion, such as a preset area from the initial position of the virtual object to the target position, or a division area with a preset size around the virtual object, and the preset area or the division area is divided into a plurality of unit areas with the preset size.
It should be noted that the preset size of the unit area may be set before the game is loaded, or may be set in the navigation grid map generated in real time after the game is loaded, which is not limited in the embodiment of the present invention. In addition, in the dividing process, the game scene can also be divided according to a preset angle, for example, the game scene is divided according to a depression angle of the user or the player relative to the electronic device, so that the player can perceive the dividing process more clearly.
In addition, the preset size of the unit area is also used as the basic size of a game scene formed in the corresponding sandbox game, namely when the game scene is changed, the preset size is updated according to the preset size, and a navigation grid map corresponding to the updated game scene is generated, so that the problem of high consumption caused by frequent scanning of the whole game map when the game scene is changed is solved. And for the game scene, the game scene further includes various element geometries, such as monsters, obstacles, plants, buildings, and the like, when a certain element geometry is located at a dividing line of two unit areas, the unit area may be further divided, for example, a certain 16 × 16 unit area is divided into 4 8 × 8 areas, and the like, which may be specifically set according to actual situations, and the embodiment of the present invention does not limit the description.
Step S206, determining a target unit area set based on the position information; wherein the target unit area set includes a plurality of target unit areas from an initial position to a target position;
for the divided unit areas, a target unit area set can be further determined according to the position information of the virtual object, wherein the target unit area set comprises a plurality of target unit areas from an initial position to a target position, namely a plurality of unit areas from the unit area where the initial position is located to the unit area where the target position is located, so that a navigation grid map is generated in real time according to the target unit area set and the corresponding game scene, the problem that the navigation grid map is slow in generation efficiency due to the fact that the divided unit areas comprise a plurality of invalid unit areas is solved, and the routing efficiency is further improved.
Step S208, generating a navigation grid map corresponding to the game scene in real time according to the target unit area set and the corresponding game scene;
specifically, the game scene includes scene models corresponding to multiple element geometric objects, where each scene model is composed of corresponding basic grids, such as a scene model corresponding to a flower, and is composed of 4 basic grids, and a scene model corresponding to a mountain may be composed of multiple basic grids, and because the size of the scene models is different, the size of the basic grids composing each scene model may be the same or different, such as 2 × 2 for the basic grids composing the scene model of the flower, and 6 × 6 for the basic grids composing the scene model of the mountain, which may be determined according to actual conditions, such as a play setting of the game.
Since the scene models in the game scenes corresponding to the divided unit areas may be the same or different, the process of generating the navigation grid map corresponding to the game scene in real time according to the target unit area set and the corresponding game scene is as follows:
step A1, acquiring a scene model in each unit area;
the scene model comprises a plurality of basic grids, and the scene models in the game scene are different, so the basic grids can also be called a plurality of basic grids forming the scene model, each basic grid carries parameter information, the parameter information comprises size information and attribute information, and the size information refers to the size of the basic grid, such as 2 × 2 or 6 × 6; the attribute information is used for representing whether the virtual object can walk on the basic grid, for example, for the basic grid of the scene model forming the flower, the attribute information of the basic grid is not walking, and for the basic grid of the scene model forming the road, the carried attribute information is walking, so that the basic grid can be classified through the attribute information, the basic grid of the virtual object which can not walk is realized in the walking process, and the walking efficiency and accuracy are further improved.
Step A2, determining the effective walking area of the unit area according to the parameter information of the basic grid; wherein the effective walking area comprises a plurality of target basic grids;
since the parameter information carried by the basic grid includes the size information and the attribute information, the effective walking area of each unit area can be determined according to the parameter information of the basic grid. One possible effective walking area determination method includes: determining a plurality of target basic grids according to the size information of the basic grids and the preset size so as to obtain an effective walking area of the unit area; specifically, the size information of each basic grid may be compared with a preset size, or the size information of a grid composed of a plurality of adjacent basic grids may be compared with a preset size, so as to obtain the effective walking area of the unit area according to the determined target basic grid.
For convenience of understanding, it is illustrated here that, for example, if the size information of the basic grid with the size information of 6 × 6 is larger than a preset size for a plurality of basic grids in a certain unit area, the size information of 4 × 4 is preset, and then the basic grid with the size information of 6 × 6 is determined as the target basic grid; and/or, for a plurality of adjacent 2 x 2 basic grids, if the size of the formed grid is greater than or equal to the preset size, taking the grid formed by the plurality of adjacent 2 x 2 basic grids as a target basic grid, for example, taking the grid formed by the adjacent 4 2 x 2 basic grids as a target basic grid, where the size of the grid is greater than the preset size, and then taking the grid as a target basic grid; therefore, for the basic grids in each unit area, the size information of each basic grid can be directly compared with the preset size, or the size information of the grids formed by a plurality of adjacent basic grids can be directly compared with the preset size, or the size information of each basic grid is directly compared with the preset size, and for the basic grids smaller than the preset size, the size information of the grids formed by a plurality of adjacent basic grids is compared with the preset size so as to determine a plurality of target basic grids, thereby obtaining the effective walking area of the unit area.
Another possible effective walking area determination method includes: determining a plurality of target basic grids according to the attribute information of the basic grids so as to obtain an effective walking area of a unit area; specifically, the target basic grids meeting the virtual object walking are determined directly according to the attribute information of the basic grids, and the determination mode can rapidly determine the target basic grids, so that the routing efficiency is improved. It should be noted that, here, the attribute information includes not only that the virtual object can move on the base grid by walking, but also that the virtual object can stand on the base grid, that is, the virtual object can stand on the base grid and move to the next target base grid.
In addition, in practical application, the two effective walking area determining modes can be set according to actual conditions, and the effective walking area can be determined by adopting the two determining modes at the same time, so that the efficiency and the precision of the effective walking area are improved, and the path searching precision is improved.
Step A3, merging target basic grids at the same height in the effective walking area according to the adjacent relation to obtain a navigation grid in a preset shape;
for the multiple determined target basic grids of each unit area, firstly, the multiple target basic grids are grouped according to the height, and multiple groups of target basic grids with the same height can be obtained. Specifically, because the scene models in the game scene have different sizes, the size information of the basic grid forming each scene model corresponds to the height information in addition to the plane size, so that the navigation grid formed according to the basic grid carries the height information.
For convenience of understanding, for example, for a three-dimensional space, the same height may be understood as the same y-axis plane, for example, on a plane where y is 200, there is one target basic grid a, (x, z) ═ 0, which is classified into a first group, on a plane where y is 200, there is another target basic grid B, (x, z) ═ 0,1, which is classified into the same group because the target basic grid B and the target basic grid a have the same height; and for the target basic grid C on the plane where y is 201 and (x, z) is (0,2), the target basic grid C cannot be grouped with the target basic grid a and the target basic grid B because the target basic grid C and the target basic grid a (or the target basic grid B) are different in height.
Merging the target basic grids with the same height in the same group into a navigation grid with a preset shape according to an adjacent relation so as to obtain a navigation grid map corresponding to a game scene; the preset shape includes, but is not limited to, a square, a rectangle, etc., and the preset shape is preferably a rectangle or a square in the embodiment of the present invention.
And step A4, determining the communication relation among the navigation grids to obtain a navigation grid map corresponding to the game scene.
Calculating the connectivity between any navigation grid and the adjacent navigation grid for the navigation grids in the navigation grid map; the virtual object is movable between two navigation grids with connectivity, where the navigation grid and its neighboring navigation grid may be in the same unit area or in neighboring unit areas.
Specifically, the calculation process of connectivity is as follows: calculating a height difference according to the height information of two adjacent navigation grids; judging whether the height difference meets the height difference range; if so, determining that the two adjacent navigation grids have connectivity of bidirectional movement, and if the height difference does not meet the height difference range, determining that the two adjacent navigation grids have connectivity of unidirectional movement. Therefore, the embodiment of the invention determines the connectivity among the navigation grids through the height information of the navigation grids, and improves the route searching efficiency compared with the existing route searching among the navigation grids through a large amount of calculation. The height difference range may be set according to actual conditions, and is not limited in the embodiment of the present invention.
For the convenience of understanding, it is illustrated here that the height difference range is [ -2,2], if two adjacent navigation grids in the same unit area, such as navigation grid a and navigation grid B, calculate the height difference according to the height information thereof, if the height difference is less than 2, that is, the height difference range is satisfied, then navigation grid a and navigation grid B have connectivity, and are connectivity for bidirectional movement, then the virtual object may be moved from navigation grid a to navigation grid B, or from navigation grid B to navigation grid a; if the absolute value of the height difference is greater than or equal to 2, namely the height difference range is not satisfied, and the height information of the navigation grid A is greater than that of the navigation grid B, the navigation grid A and the navigation grid B have connectivity and are in one-way moving connectivity, and the virtual object can only move from the navigation grid A to the navigation grid B, namely from a higher navigation grid to a lower navigation grid.
Step S210, a target path from the initial position to the target position is determined based on the navigation grid map.
According to the method for finding the path of the virtual object in the game, the navigation grid map corresponding to the game scene is generated in real time according to the position information and the game scene, and the connectivity among the navigation grids is determined according to the height information of the navigation grids.
Further, the method further comprises: responding to the change operation aiming at the scene model, and obtaining a change navigation grid corresponding to the change scene model; calculating a target height difference according to the height information of the changed navigation grid and the adjacent navigation grid; determining connectivity between the changed navigation grid and the adjacent navigation grid according to the target height difference; and updating the connectivity information in the navigation grid map according to the connectivity.
Specifically, the above-mentioned change operation includes, but is not limited to, a build operation and a detach operation, for example, a player detaches or builds a scene model in a game scene, so that a navigation grid corresponding to the scene model is changed, that is, a target basic grid forming the navigation grid is detached and reassembled into a changed navigation grid, where the changed navigation grid may be one or more, and compared with an original navigation grid, the changed navigation grid may lack one or more basic grids, so that height information of the changed navigation grid is changed, and therefore, connectivity of the changed navigation grid and an adjacent navigation grid thereof needs to be recalculated, that is, a target height difference is calculated according to the height information of the changed navigation grid and the adjacent navigation grid thereof; determining connectivity between the changed navigation grid and the adjacent navigation grid according to the target height difference; and updating the connectivity information in the navigation grid map according to the connectivity. It should be noted that the changed navigation grid and the adjacent navigation grid may be in the same unit area or different unit areas, and the specific connectivity calculation process may refer to the foregoing embodiment, which is not described in detail herein.
Therefore, according to the method for finding the path of the virtual object in the game provided by the embodiment of the invention, when the game scene is changed, the navigation grid map is generated in real time through the position information and the updated game scene, namely the communication information of the navigation grid map is updated through changing the height information of the navigation grid, the accuracy of the target path in the path finding process is ensured, meanwhile, the frequent scanning of the game map is avoided, the problem of overlarge path finding consumption is alleviated, and the method has a good practical value.
On the basis of fig. 1, another way-finding method for a virtual object in a game is provided in the embodiment of the present invention, which focuses on the process of determining a target path from an initial position to a target position based on a navigation grid map. As shown in fig. 3, the method comprises the steps of:
step S302, acquiring position information of a virtual object in a game;
step S304, generating a navigation grid map corresponding to the game scene in real time according to the position information and the game scene;
in the above steps S302 to S304, reference may be made to the foregoing method embodiments, which are not described in detail herein.
Step S306, determining a target navigation grid group from the initial position to the target position based on the navigation grid map;
the existing biological way-finding algorithm mainly comprises: a pure a-algorithm, a depth-first search algorithm, and a greedy algorithm; as shown in fig. 4, for the pure a-x algorithm, for an end point B to which a living being arrives, a map range scan including the living being and the end point B is performed, then, F-value calculation is performed on surrounding squares from the start point a, and a grid with the minimum F-value is selected until the end point B is found or all scans of the map are found, where F is G + H, G represents a distance between a grid to be moved and the start point, and F represents a distance between a grid to be moved and the end point. For the depth-first search algorithm, as shown in fig. 5, a limited map range including a living being and an end point is scanned, then, from a start point a, any azimuth is selected randomly from four azimuths for straight line detection until an obstacle exists, as shown in fig. 5, the azimuth corresponding to a grid part with oblique lines is detected, and detection is continued towards any azimuth in the other azimuths until the end point is found or the end point is returned to the start point; for the greedy algorithm, as shown in fig. 6, a map range including living beings and a terminal is scanned, then, distances from the starting point to the terminal are calculated for four grids to be moved respectively, the grid with the minimum distance is selected to move until the four grids are moved to the terminal or the map is scanned completely, if bowl-shaped obstacles exist in a game scene, such as a dotted line part in fig. 6, redundant routes are calculated, so that the route searching efficiency is low, and the actual application requirements cannot be met.
Because the game scene of the sandbox game is dynamically changed, if a depth-first search algorithm and a greedy algorithm are adopted, the way finding of the navigation grid map can be realized, but the efficiency is low. Therefore, the embodiment of the invention adopts the A-x algorithm, and because the number of the navigation grids in the navigation grid map generated according to the basic grid is less than that of the basic grid, the calculation amount is reduced when the navigation grid with the minimum F value is selected, and the determination efficiency of the target path is improved.
Specifically, in the navigation grid map, according to the navigation grid corresponding to the initial position and the target position, the path-finding problem of the virtual object can be converted into a shortest path solving problem formed by the navigation grid. The embodiment of the invention executes a routing algorithm for navigation grids in a navigation grid map based on an A-algorithm to obtain a target navigation grid group corresponding to the shortest path from an initial position to a target position; the target navigation grid group comprises a same-height navigation grid with connectivity and a different-height navigation grid which meets a preset height difference range and has connectivity. In the process of executing the route searching algorithm, the navigation grid map is generated in real time according to the position information and the scene information, so compared with the existing pure A-star algorithm, the route searching algorithm does not need to repeatedly include limited map range scanning of the virtual object and the target position, and the problem of overlarge route searching consumption caused by repeated map scanning is solved.
Step S308, determining a target path from the initial position to the target position based on the target navigation grid group.
For the target navigation grid group, determining path points corresponding to target navigation grids in the target navigation grid group based on a funnel algorithm; and obtaining a target path from the initial position to the target position according to the plurality of path points. Specifically, for a plurality of target navigation grids in the target navigation grid set, from an initial position, path points corresponding to the plurality of target navigation grids can be obtained through a funnel algorithm, where a path point may be a path point corresponding to each target navigation grid, or may be a path point corresponding to a part of target navigation grids in the target navigation grid set, and may be specifically set according to an actual situation, which is not described in the embodiment of the present invention.
Further, after the step of determining the target path from the initial position to the target position, the method further comprises: and controlling the virtual object to move to the target position according to the target path in response to the movement operation aiming at the virtual object. Because the target navigation grids corresponding to each path point in the target path have connectivity, the stability of the virtual object moving on the target path is ensured, and the moving effect of the virtual object in the game process is further improved.
Therefore, the method for finding the path of the virtual object in the game determines the target path through the plurality of target navigation grids, so that the path finding efficiency can be improved, the virtual object can be kept natural and stable in the moving process, the moving effect of the virtual object is improved, and in addition, as the game scene in the sandbox game can be dynamically changed, the path finding efficiency is improved, meanwhile, the tracking distance can be expanded for the game scene of the virtual object corresponding to a monster chasing the player, so that the method has a good practical value and improves the game experience of the player.
On the basis of the method embodiment, the embodiment of the invention also provides a path finding device for the virtual object in the game, and the game scene of the game is displayed through the electronic equipment. As shown in fig. 7, the apparatus comprises, connected in sequence: a position information acquisition module 71, a navigation grid map generation module 72 and a target path determination module 73; the functions of each module are as follows:
a position information obtaining module 71, configured to obtain position information of a virtual object in a game, where the position information includes an initial position and a target position of the virtual object in a game scene;
a navigation grid map generation module 72, configured to generate a navigation grid map corresponding to a game scene in real time according to the position information and the game scene; the navigation grids in the navigation grid map are corresponding to height information and communication information;
a target path determination module 73 for determining a target path from the initial position to the target position based on the navigation grid map; the target path comprises a same-altitude navigation grid with connectivity and a different-altitude navigation grid with connectivity, which meets a preset altitude difference range.
The path finding device for the virtual object in the game provided by the embodiment of the invention generates the navigation grid map corresponding to the game scene in real time according to the position information of the virtual object and the game scene, and determines the target path from the initial position to the target position based on the navigation grid carrying the height information and the communication information, so that compared with the existing path finding method based on the two-dimensional grid, the path finding device improves the determination efficiency of the target path, namely the path finding efficiency; when the game scene changes, the navigation grid map is generated in real time through the position information and the updated game scene, the accuracy of the target path is guaranteed, meanwhile, frequent scanning of the game map is avoided, the problem of overlarge path searching consumption is relieved, and the method has good practical value.
In one possible implementation, the navigation grid map generating module 72 is further configured to divide the game scene into a plurality of unit areas with preset sizes according to a division rule; determining a set of target unit areas based on the location information; wherein the target unit area set includes a plurality of target unit areas from an initial position to a target position; and generating a navigation grid map corresponding to the game scene in real time according to the target unit area set and the corresponding game scene.
In another possible implementation, the game scene comprises a plurality of scene models, and the real-time generation of the navigation grid map corresponding to the game scene according to the target unit area set and the corresponding game scene comprises the steps of acquiring the scene model in each unit area; the scene model comprises a plurality of basic grids, and each basic grid carries parameter information; determining an effective walking area of a unit area according to the parameter information of the basic grid; wherein the effective walking area comprises a plurality of target basic grids; merging target basic grids at the same height in the effective walking area according to an adjacent relation to obtain a navigation grid in a preset shape; and determining the communication relation among the navigation grids to obtain a navigation grid map corresponding to the game scene.
In another possible embodiment, the determining the effective travel area of the unit area based on the parameter information of the base mesh includes: determining a plurality of target basic grids according to the size information of the basic grids and the preset size so as to obtain an effective walking area of a unit area; and/or; determining a plurality of target basic grids according to the attribute information of the basic grids so as to obtain an effective walking area of a unit area; wherein the attribute information is used for representing whether the virtual object can walk on the base grid.
In another possible implementation, the determining the connectivity relationship between the navigation grids includes: calculating connectivity between any navigation grid and its neighboring navigation grids; wherein the virtual object is moveable between two navigation grids having connectivity.
In another possible embodiment, the calculating connectivity between any navigation grid and its neighboring navigation grid includes: calculating a height difference according to the height information of two adjacent navigation grids; and determining connectivity between adjacent navigation grids according to the height difference.
In another possible embodiment, the determining the connectivity between adjacent navigation grids according to the height difference includes: judging whether the height difference meets the height difference range or not; if so, it is determined that two adjacent navigation grids have connectivity moving in both directions.
In another possible embodiment, the apparatus further comprises: and if the height difference does not meet the height difference range, determining that the two adjacent navigation grids have connectivity of one-way movement.
In another possible embodiment, the apparatus further comprises: responding to the change operation aiming at the scene model, and obtaining a change navigation grid corresponding to the change scene model; calculating a target height difference according to the height information of the changed navigation grid and the adjacent navigation grid; determining connectivity between the changed navigation grid and the adjacent navigation grid according to the target height difference; and updating the connectivity information in the navigation grid map according to the connectivity.
In another possible implementation, the target path determining module 73 is further configured to: determining a target navigation grid set from an initial position to a target position based on the navigation grid map; the target navigation grid group comprises a same-height navigation grid with connectivity and a different-height navigation grid which meets a preset height difference range and has connectivity; and determining a target path from the initial position to the target position based on the target navigation grid set.
In another possible embodiment, the determining the target navigation grid group from the initial position to the target position based on the navigation grid map includes: and executing a way-finding algorithm on the navigation grids in the navigation grid map based on the A-algorithm to obtain a target navigation grid group from the initial position to the target position.
In another possible embodiment, the determining the target path from the initial position to the target position based on the target navigation grid set includes: determining path points corresponding to the target navigation grids in the target navigation grid group based on a funnel algorithm; and obtaining a target path from the initial position to the target position according to the plurality of path points.
In another possible implementation, after the target path determining module 73, the apparatus further includes: and controlling the virtual object to move to the target position according to the target path in response to the movement operation aiming at the virtual object.
In another possible implementation, the location information obtaining module 71 is further configured to: in response to an automatic way-finding operation for a virtual object, position information of the virtual object is determined.
The route searching device for the virtual object in the game provided by the embodiment of the invention has the same technical characteristics as the route searching method for the virtual object in the game provided by the embodiment, so that the same technical problems can be solved, and the same technical effects can be achieved.
The embodiment of the invention also provides electronic equipment which comprises a processor and a memory, wherein the memory stores machine executable instructions capable of being executed by the processor, and the processor executes the machine executable instructions to realize the path searching method of the virtual object in the game.
Referring to fig. 8, the electronic device includes a processor 80 and a memory 81, the memory 81 stores machine executable instructions capable of being executed by the processor 80, and the processor 80 executes the machine executable instructions to implement the path finding method for the virtual object in the game.
Further, the electronic device shown in fig. 8 further includes a bus 82 and a communication interface 83, and the processor 80, the communication interface 83, and the memory 81 are connected through the bus 82.
The Memory 81 may include a high-speed Random Access Memory (RAM) and may also include a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. The communication connection between the network element of the system and at least one other network element is realized through at least one communication interface 83 (which may be wired or wireless), and the internet, a wide area network, a local network, a metropolitan area network, etc. may be used. The bus 82 may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, an EISA (Enhanced Industry Standard Architecture) bus, or the like. The above-mentioned bus may be classified into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one double-headed arrow is shown in FIG. 8, but that does not indicate only one bus or one type of bus.
The processor 80 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 80. The Processor 80 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the device can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in a memory 81, and the processor 80 reads information in the memory 81 and performs the steps of the method of the previous embodiment in combination with hardware thereof.
The present embodiments also provide a machine-readable storage medium storing machine-executable instructions that, when invoked and executed by a processor, cause the processor to implement the above-described in-game virtual object routing method.
The method, the apparatus, and the computer program product for searching for a virtual object in a game provided in the embodiments of the present invention include a computer-readable storage medium storing a program code, where instructions included in the program code may be used to execute the method described in the foregoing method embodiments, and specific implementation may refer to the method embodiments, and will not be described herein again.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the system and the apparatus described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In addition, in the description of the embodiments of the present invention, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, and are only for convenience of description and simplicity of description, but do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus, should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present invention, which are used for illustrating the technical solutions of the present invention and not for limiting the same, and the protection scope of the present invention is not limited thereto, although the present invention is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present invention, and they should be construed as being included therein. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (17)

1. A method for finding a path of a virtual object in a game, wherein a game scene of the game is displayed through an electronic device, the method comprising:
acquiring position information of a virtual object in the game, wherein the position information comprises an initial position and a target position of the virtual object in the game scene;
generating a navigation grid map corresponding to the game scene in real time according to the position information and the game scene; the navigation grids in the navigation grid map are corresponding to height information and communication information;
determining a target path from the initial location to the target location based on the navigation grid map; the target path comprises a same-height navigation grid with connectivity and a different-height navigation grid which meets a preset height difference range and has connectivity.
2. The method of claim 1, wherein the step of generating a navigation grid map corresponding to the game scene in real time according to the position information and the game scene comprises:
dividing the game scene into a plurality of unit areas with preset sizes according to a division rule;
determining a set of target unit areas based on the location information; wherein the set of target unit areas includes a plurality of target unit areas from the initial position to the target position;
and generating a navigation grid map corresponding to the game scene in real time according to the target unit area set and the corresponding game scene.
3. The method of claim 2, wherein the game scene comprises a plurality of scene models, and the step of generating a navigation grid map corresponding to the game scene in real time according to the target unit area set and the corresponding game scene comprises:
acquiring a scene model in each unit area; the scene model comprises a plurality of basic grids, and each basic grid carries parameter information;
determining an effective walking area of the unit area according to the parameter information of the basic grid; wherein the active walking area comprises a plurality of target base meshes;
merging the target basic grids at the same height in the effective walking area according to an adjacent relation to obtain a navigation grid in a preset shape;
and determining the communication relation among the navigation grids to obtain a navigation grid map corresponding to the game scene.
4. The method according to claim 3, wherein the parameter information includes size information and attribute information, and the step of determining the effective walking area of the unit area based on the parameter information of the base mesh includes:
determining a plurality of target basic grids according to the size information of the basic grids and a preset size so as to obtain an effective walking area of the unit area; and/or;
determining a plurality of target basic grids according to the attribute information of the basic grids so as to obtain an effective walking area of the unit area; wherein the attribute information is used to characterize whether the virtual object is walkable on the base mesh.
5. The method of claim 3, wherein the step of determining connectivity between the navigation grids comprises:
calculating connectivity between any navigation grid and its neighboring navigation grids; wherein the virtual object is movable between two navigation grids having the connectivity.
6. The method of claim 5, wherein the step of calculating connectivity between any navigation grid and its neighboring navigation grids comprises:
calculating a height difference according to the height information of two adjacent navigation grids;
determining the connectivity between the adjacent navigation grids according to the height difference.
7. The method of claim 6, wherein the step of determining the connectivity between the neighboring navigation grids from the height differences comprises:
judging whether the height difference meets the height difference range or not;
if so, it is determined that two of the neighboring navigation grids have connectivity for two-way movement.
8. The method of claim 7, further comprising:
and if the height difference does not meet the height difference range, determining that the two adjacent navigation grids have connectivity of one-way movement.
9. The method of claim 3, further comprising:
responding to the change operation aiming at the scene model to obtain a change navigation grid corresponding to the change scene model;
calculating a target height difference according to the height information of the changed navigation grid and the adjacent navigation grid;
determining the connectivity between the changed navigation grid and its neighboring navigation grid according to the target height difference;
and updating the connectivity information in the navigation grid map according to the connectivity.
10. The method of claim 1, wherein the step of determining a target path from the initial location to the target location based on the navigation grid map comprises:
determining a target navigation grid set of the initial position to the target position based on the navigation grid map; the target navigation grid group comprises a same-height navigation grid with connectivity and a different-height navigation grid which meets a preset height difference range and has connectivity;
and determining a target path from the initial position to the target position based on the target navigation grid set.
11. The method of claim 10, wherein the step of determining a target navigation grid set from the initial location to the target location based on the navigation grid map comprises:
and executing a way-finding algorithm on the navigation grids in the navigation grid map based on an A-algorithm to obtain a target navigation grid group from the initial position to the target position.
12. The method of claim 10, wherein determining the target path from the initial location to the target location based on the target navigation grid set comprises:
determining path points corresponding to the target navigation grids in the target navigation grid set based on a funnel algorithm;
and obtaining a target path from the initial position to the target position according to the plurality of path points.
13. The method of claim 1, wherein after the step of determining the target path from the initial position to the target position, the method further comprises:
and controlling the virtual object to move to the target position according to the target path in response to the movement operation aiming at the virtual object.
14. The method of claim 1, wherein the step of obtaining location information of a virtual object in the game comprises: determining location information for the virtual object in response to an automatic way finding operation for the virtual object.
15. A device for routing a virtual object in a game, wherein a game scene of the game is displayed by an electronic device, the device comprising:
the position information acquisition module is used for acquiring the position information of a virtual object in the game, wherein the position information comprises an initial position and a target position of the virtual object in the game scene;
the navigation grid map generation module is used for generating a navigation grid map corresponding to the game scene in real time according to the position information and the game scene; the navigation grids in the navigation grid map are corresponding to height information and communication information;
a target path determination module for determining a target path from the initial position to the target position based on the navigation grid map; the target path comprises a same-height navigation grid with connectivity and a different-height navigation grid which meets a preset height difference range and has connectivity.
16. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the method for routing a virtual object in a game according to any one of claims 1 to 14 when executing the computer program.
17. A computer-readable storage medium, having a computer program stored thereon, which, when executed by a processor, performs the steps of the method for routing a virtual object in a game according to any one of claims 1 to 14.
CN202110433303.2A 2021-04-21 Method and device for searching path of virtual object in game and electronic equipment Active CN113144607B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110433303.2A CN113144607B (en) 2021-04-21 Method and device for searching path of virtual object in game and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110433303.2A CN113144607B (en) 2021-04-21 Method and device for searching path of virtual object in game and electronic equipment

Publications (2)

Publication Number Publication Date
CN113144607A true CN113144607A (en) 2021-07-23
CN113144607B CN113144607B (en) 2024-07-09

Family

ID=

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115869624A (en) * 2022-12-08 2023-03-31 腾讯科技(深圳)有限公司 Game area marking method, device, equipment and storage medium
WO2023109326A1 (en) * 2021-12-14 2023-06-22 腾讯科技(深圳)有限公司 Method and apparatus for determining navigation path, and device, storage medium and program product
WO2023155517A1 (en) * 2022-02-15 2023-08-24 腾讯科技(深圳)有限公司 Navigation mesh updating method and apparatus, electronic device, computer readable storage medium, and computer program product
CN117482518A (en) * 2023-11-02 2024-02-02 深圳市洲禹科技有限公司 Navigation method and device based on pedestrian behavior prediction and electronic equipment

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180012403A1 (en) * 2016-07-07 2018-01-11 Netease (Hangzhou) Network Co., Ltd. Method and device for computing a path in a game scene
CN110523081A (en) * 2019-08-08 2019-12-03 腾讯科技(深圳)有限公司 The method and device for planning in navigation pathfinding path
CN110772791A (en) * 2019-11-05 2020-02-11 网易(杭州)网络有限公司 Route generation method and device for three-dimensional game scene and storage medium
US20200338450A1 (en) * 2019-04-24 2020-10-29 Take-Two Interactive Software, Inc. System and method for virtual navigation in a gaming environment
CN112370788A (en) * 2020-11-11 2021-02-19 网易(杭州)网络有限公司 Navigation method of virtual object in game and electronic equipment
CN112386914A (en) * 2019-08-14 2021-02-23 上海幻电信息科技有限公司 Virtual object-oriented path planning method and device and computer equipment
CN112386911A (en) * 2020-12-08 2021-02-23 网易(杭州)网络有限公司 Navigation grid generation method and device, nonvolatile storage medium and electronic device
CN112619150A (en) * 2020-12-15 2021-04-09 成都完美天智游科技有限公司 Path finding method and device based on game scene, equipment and medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180012403A1 (en) * 2016-07-07 2018-01-11 Netease (Hangzhou) Network Co., Ltd. Method and device for computing a path in a game scene
US20200338450A1 (en) * 2019-04-24 2020-10-29 Take-Two Interactive Software, Inc. System and method for virtual navigation in a gaming environment
CN110523081A (en) * 2019-08-08 2019-12-03 腾讯科技(深圳)有限公司 The method and device for planning in navigation pathfinding path
CN112386914A (en) * 2019-08-14 2021-02-23 上海幻电信息科技有限公司 Virtual object-oriented path planning method and device and computer equipment
CN110772791A (en) * 2019-11-05 2020-02-11 网易(杭州)网络有限公司 Route generation method and device for three-dimensional game scene and storage medium
CN112370788A (en) * 2020-11-11 2021-02-19 网易(杭州)网络有限公司 Navigation method of virtual object in game and electronic equipment
CN112386911A (en) * 2020-12-08 2021-02-23 网易(杭州)网络有限公司 Navigation grid generation method and device, nonvolatile storage medium and electronic device
CN112619150A (en) * 2020-12-15 2021-04-09 成都完美天智游科技有限公司 Path finding method and device based on game scene, equipment and medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023109326A1 (en) * 2021-12-14 2023-06-22 腾讯科技(深圳)有限公司 Method and apparatus for determining navigation path, and device, storage medium and program product
WO2023155517A1 (en) * 2022-02-15 2023-08-24 腾讯科技(深圳)有限公司 Navigation mesh updating method and apparatus, electronic device, computer readable storage medium, and computer program product
CN115869624A (en) * 2022-12-08 2023-03-31 腾讯科技(深圳)有限公司 Game area marking method, device, equipment and storage medium
CN117482518A (en) * 2023-11-02 2024-02-02 深圳市洲禹科技有限公司 Navigation method and device based on pedestrian behavior prediction and electronic equipment

Similar Documents

Publication Publication Date Title
CN107198883B (en) Path finding method and device for game object in virtual game
JP6783957B2 (en) Virtual resource generation method and device in 3D game scene
US8111257B2 (en) System and method for the generation of navigation graphs in real-time
CN110812844A (en) Path finding method in game, terminal and readable storage medium
CN112090078B (en) Game character movement control method, device, equipment and medium
CN111054074A (en) Method and device for moving virtual object in game and electronic equipment
CN111013146B (en) Dynamically modifiable way finding navigation method and device for oversized map
CN104941180A (en) Collision detecting method and device for 2D games
KR102096196B1 (en) How to configure model objects, servers, and systems
CN113244619B (en) Data processing method, device, equipment and storage medium
US11045732B2 (en) Non-transitory computer readable storage medium storing image processing program, image processing method, and image processing device
CN113144607A (en) Path finding method and device for virtual object in game and electronic equipment
CN113144607B (en) Method and device for searching path of virtual object in game and electronic equipment
CN114168696A (en) Method, device, equipment and readable medium for dividing and rendering ground grids
JP7341801B2 (en) Video game processing program and video game processing system
CN112667648A (en) Terrain dynamic updating method and device, electronic equipment and readable storage medium
CN115430152A (en) Navigation path generation method and device and electronic equipment
CN114493383B (en) Interest point searching method and device and computer readable storage medium
JP2013196648A (en) Information processing device, information processing method, program and computer readable storage medium
CN113599808B (en) Method and device for constructing topography in virtual scene
CN112999658B (en) Path finding method, device and medium for game three-dimensional space flight
CN114404948A (en) Game map display method and device, electronic equipment and computer readable storage medium
CN116392814A (en) Method, device, equipment and medium for searching path in virtual world
CN116943206A (en) Method and device for determining moving path, storage medium and electronic equipment
CN115779422A (en) Method and device for determining scene parcel in game and electronic equipment

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
GR01 Patent grant