Path determination method and device, medium and product
By automatically identifying and determining the target plot, and using a graph search algorithm to determine feasible paths, the problems of low efficiency in plot labeling and difficulty in data reuse in the existing technology are solved, and the efficiency of level editing is improved.
Patent Information
- Application Number
- CN202410930497.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2024-10-18
AI Technical Summary
The efficiency of land parcel labeling in the existing technology is low, and when the level is changed, the land parcel labeling needs to be modified accordingly, resulting in a heavy workload and the inability to reuse data.
By automatically identifying the basic plots in the level, the target plot is determined based on the preset two-dimensional plane, and then the starting plot and the end plot are determined. The graph search algorithm is used to determine the feasible path, reducing manual intervention and errors.
It improves the efficiency of level editing, reduces the workload of plot labeling, solves the problem of data being unable to be reused, and realizes automated path determination.
Smart Images

Figure CN118787940A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, medium and product for determining a path. Background Art
[0002] In some puzzle games, game developers often use the principle of visual deception to cleverly design levels. Players can solve puzzles based on visual clues, which not only tests the player's spatial perception ability, but also increases the game's strategy and exploration. For example, under an orthogonal camera at a specific angle, two basic plots that were originally disconnected in three-dimensional space are projected on a two-dimensional screen, making the player's eyes and brain think that they are connected in three-dimensional space, thus achieving the purpose of optical illusion.
[0003] Regarding how to obtain the walkable paths of the three-dimensional space level on the two-dimensional screen, the common practice is for the game developer to mark the walkable surfaces of the basic plots in the three-dimensional space projected on the two-dimensional screen. In this way, when the game is running, the marked plots in the three-dimensional space are projected on the two-dimensional screen. If the connection points of the marked plots coincide, they are considered to be connected in the three-dimensional space.
[0004] However, the inventors have found that there are at least the following technical problems in the related art: on the one hand, the efficiency of plot annotation is low because it needs to be manually marked. On the other hand, the plots of the walkable surface in different levels are different, so the data after the plot annotation cannot be reused, which means that when the level is changed, the plot annotation needs to be modified accordingly, which requires a certain amount of work. Summary of the invention
[0005] One purpose of the present application is to provide a path determination method, device, medium and product, at least to solve the technical problem that the efficiency of plot marking in the related technology is low, and when the level changes, the plot marking also needs to be modified accordingly, which has a certain amount of work.
[0006] To achieve the above objectives, some embodiments of the present application provide the following aspects:
[0007] In a first aspect, some embodiments of the present application also provide a method for determining a path, the method comprising: determining a target plot based on basic plots in a level; wherein the target plot is determined based on the basic plot and a preset two-dimensional plane; the target plot represents a unit on which a player character can walk; determining a starting plot and an end plot based on the target plot; and determining a feasible path based on the starting plot and the end plot.
[0008] In a second aspect, some embodiments of the present application further provide an electronic device, comprising: one or more processors; and a memory storing computer program instructions, wherein the computer program instructions, when executed, cause the processor to perform the steps of the method described above.
[0009] In a third aspect, some embodiments of the present application further provide a computer-readable medium having computer program instructions stored thereon, wherein the computer program instructions can be executed by a processor to implement the method as described above.
[0010] In a fourth aspect, some embodiments of the present application further provide a computer program product, comprising a computer program / instruction, which implements the steps of the method described above when executed by a processor.
[0011] Compared with the related art, the solution provided in the embodiment of the present application adopts a processing method that is completely different from the traditional manual marking method. In the solution provided in the embodiment of the present application, the target plot is automatically determined according to the basic plots in the level; and then the starting plot and the end plot are determined according to the target plot, so as to determine the feasible path according to the starting plot and the end plot. Among them, the target plot is determined according to the basic plot and the preset two-dimensional plane; the target plot represents the unit on which the player character can walk. In this way, since the target plot can be automatically identified from the camera angle in the embodiment of the present application, there is no need for manual intervention, and there is no need to rely on relevant personnel to manually mark the plots that can be walked; and since there is no need for relevant personnel to manually mark the plots that can be walked, instead of relying on the visual judgment of relevant personnel, the possibility of human error can be reduced, the probability of configuration errors can be reduced, and the efficiency of level editing can be improved. By adopting the solution provided in the embodiment of the present application, relevant personnel (especially level designers) only need to focus on the construction of the level itself, ensuring that the target plots seen by the player are visually connected using orthogonal projection technology under a specific viewing angle (even if the target plots may not be directly connected in three-dimensional space), and no additional manual marking of the traversable plots is required. In this way, the technical problem of low efficiency of plot marking in the related technology is better solved. When the level is changed, there is no need to modify the plot marking accordingly, thereby solving the technical problem that the data after plot marking cannot be reused, which will bring a certain amount of workload. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0013] Figure 1An exemplary flow chart of a method for determining a path according to some embodiments of the present application;
[0014] Figure 2 An exemplary schematic diagram of a basic plot in a method for determining a path according to some embodiments of the present application;
[0015] Figure 3 and Figure 4 Both are exemplary schematic diagrams of marking plots in a method for determining a path provided in the related art;
[0016] Figure 5 This is an exemplary flow chart of step S101 in a method for determining a path according to some embodiments of the present application;
[0017] Figure 6 Another exemplary flowchart of step S101 in a method for determining a path provided according to some embodiments of the present application;
[0018] Figure 7 This is an exemplary flow chart of step S1011 in a method for determining a path according to some embodiments of the present application;
[0019] Figure 8 This is an exemplary flow chart of step S1012 in a method for determining a path according to some embodiments of the present application;
[0020] Fig. 9 This is an exemplary flow chart of step S1013 in a method for determining a path according to some embodiments of the present application;
[0021] Fig.10 This is an exemplary flow chart of step S1014 in a method for determining a path according to some embodiments of the present application;
[0022] Fig.11 This is an exemplary flow chart of step S10143 in a method for determining a path according to some embodiments of the present application;
[0023] Fig.12 and Fig.13 An exemplary schematic diagram showing whether basic plots have overlapping relationships in a method for determining a path according to some embodiments of the present application;
[0024] Fig.14 This is an exemplary schematic diagram of a path determination method provided according to some embodiments of the present application, in which the right side of the walkable surface of the basic plot is blocked;
[0025] Fig.15This is an exemplary schematic diagram of a left side of a walkable surface of a basic plot being blocked in a method for determining a path according to some embodiments of the present application;
[0026] Fig.16 This is an exemplary schematic diagram of a stacking relationship between basic plots in a vertical direction in a method for determining a path according to some embodiments of the present application;
[0027] Fig.17 This is an exemplary flow chart of step S102 in a method for determining a path according to some embodiments of the present application;
[0028] Fig.18 This is an exemplary flow chart of step S103 in a method for determining a path according to some embodiments of the present application;
[0029] Fig.19 This is an exemplary structural diagram of an electronic device provided according to some embodiments of the present application. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, 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 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 are within the scope of protection of this application.
[0031] The following terms are used in this article.
[0032] Orthographic projection is a graphic projection technique that maintains the size and shape of objects, but does not shrink as the distance increases, as in perspective projection. In orthographic projection, all parallel lines remain parallel after projection, unlike perspective projection, which converges parallel lines to one or more vanishing points.
[0033] First embodiment
[0034] The first embodiment of the present application relates to a method for determining a path. Figure 1 As shown, the method may include the following steps:
[0035] Step S101, determining a target plot according to basic plots in the level; wherein the target plot is determined according to the basic plot and a preset two-dimensional plane; the target plot represents a unit on which the player character can walk;
[0036] Step S102, determining a starting point plot and an end point plot according to the target plot;
[0037] Step S103, determining a feasible path according to the starting plot and the end plot.
[0038] The solution provided in this application can be applied to game scenes or other virtual reality environments. This embodiment of the application does not specifically limit this. The following is a detailed description of each of the above steps.
[0039] Regarding step S101, specifically, in some examples, all basic plots of the level may be traversed to automatically identify all basic plots of the level based on the camera's lens angle, and then automatically identify target plots based on all basic plots of the level, wherein the target plots represent units on which the player character can walk (or move). Figure 2 As shown, the basic plot can be a platform, a ground, etc. In three-dimensional space, the basic plots can be stacked or layered to form a module with a complex structure.
[0040] Exemplarily, the basic plots may be cubes of the same size. If the basic plots in the level are of different sizes, it is necessary to pre-process the basic plots of different sizes to obtain basic plots of the same size before executing the method provided in the embodiment of the present application.
[0041] Exemplarily, the preset two-dimensional plane refers to a two-dimensional plane where a basic land parcel in a three-dimensional space is projected into a two-dimensional space. On the preset two-dimensional plane, at least one basic land parcel is projected and displayed. Specifically, the preset two-dimensional plane may be a preset two-dimensional grid plane.
[0042] Regarding step S102, specifically, since the target plot represents the unit on which the player character can walk, it means that the unwalkable plots in the basic plots on which the player character cannot walk have been deleted. The starting plot and the end plot can be determined only based on the unit representing the unit on which the player character can walk, without relying on plot marking.
[0043] The plot corresponding to the starting position of the level or the player is the starting plot, and the plot corresponding to the ending position is the ending plot. Figure 2 In the example shown, the plot where the "little man" is located corresponds to the starting plot, and the plot where the white "gear-shaped object" is located corresponds to the end plot.
[0044] Regarding step S103, specifically, a common path-finding algorithm such as a graph search algorithm may be used on the preset two-dimensional plane, and a feasible path may be determined in combination with the starting plot and the end plot.
[0045] It can be understood that in the related art, such as Figure 3 and Figure 4 As shown, the feasible plots are marked by relevant personnel. The information marked on the plots generally includes: nodes, connection points and boundary points. In this way, when the game is running, the marked plots in the three-dimensional space are projected on the two-dimensional screen. If the connection points of the marked plots coincide, they are considered to be connected in the three-dimensional space.
[0046] It is not difficult to find that compared with the related art, the embodiment of the present application adopts a processing method that is completely different from the traditional manual marking method. In the solution provided by the embodiment of the present application, the target plot is automatically determined according to the basic plot in the level; and then the starting plot and the end plot are determined according to the target plot, so as to determine the feasible path according to the starting plot and the end plot. Among them, the target plot is determined according to the basic plot and the preset two-dimensional plane; the target plot represents the unit on which the player character can walk. In this way, since the target plot can be automatically identified from the camera angle in the embodiment of the present application, there is no need for manual intervention, and there is no need to rely on relevant personnel to manually mark the plots that can be walked; and since there is no need for relevant personnel to manually mark the plots that can be walked, instead of relying on the visual judgment of relevant personnel, the possibility of human error can be reduced, the probability of configuration errors can be reduced, and the efficiency of level editing can be improved. By adopting the solution provided in the embodiment of the present application, relevant personnel (especially level designers) only need to focus on the construction of the level itself, ensuring that the target plots seen by the player are visually connected using orthogonal projection technology under a specific viewing angle (even if the target plots may not be directly connected in three-dimensional space), and no additional manual marking of the traversable plots is required. In this way, the technical problem of low efficiency of plot marking in the related technology is better solved. When the level is changed, there is no need to modify the plot marking accordingly, thereby solving the technical problem that the data after plot marking cannot be reused, which will bring a certain amount of workload.
[0047] Second embodiment
[0048] The second embodiment of the present application relates to a method for determining a path. The second embodiment is an improvement on the first embodiment, and the specific improvement is: in the second embodiment, a specific implementation method for determining a target plot according to basic plots in a level is provided.
[0049] Specifically, the step S101 of determining the target plot according to the basic plots in the level may further include the following steps: Figure 5 As shown:
[0050] Step S1011', performing vertical projection according to the basic plot, so as to project the basic plot onto a preset two-dimensional plane whose Y-axis coordinate in the game scene is zero;
[0051] Step S1012': determining the target plot according to the position coordinates of each basic plot corresponding to the preset two-dimensional plane.
[0052] Specifically, each basic plot has coordinate values of three coordinate axes in three-dimensional space: X-axis, Y-axis, and Z-axis. Through the basic plot, these coordinate values in three-dimensional space are converted into coordinates on a preset two-dimensional plane, which means that the height (Y-axis coordinate) of the basic plot is not considered, and only the coordinate values of the basic plot on the X-axis and Z-axis are considered.
[0053] Furthermore, there are position coordinates corresponding to each basic plot on the preset two-dimensional plane. In this way, the unwalkable plots in the basic plots where the player character cannot walk can be deleted according to the position coordinates of each basic plot corresponding to the preset two-dimensional plane to determine the target plot.
[0054] It is not difficult to find that in the embodiment of the present application, a specific implementation method for determining the target plot according to the basic plots in the level is provided. Since the vertical projection ignores the height information compared to the method of projecting onto the screen along the camera direction, and does not require complex perspective transformation, it can reduce the amount of calculation and improve efficiency.
[0055] Third embodiment
[0056] The third embodiment of the present application relates to a method for determining a path. The third embodiment is an improvement on the first embodiment, and the specific improvement is that in the first embodiment, another specific implementation method for determining a target plot based on basic plots in a level is provided.
[0057] Specifically, the step S101 of determining the target plot according to the basic plots in the level may further include the following steps: Figure 6 As shown:
[0058] Step S1011, determining the three-dimensional coordinates of the anchor point;
[0059] Step S1012, determining the target three-dimensional coordinates of each basic plot according to the three-dimensional coordinates of the anchor point and the three-dimensional coordinates of each basic plot; wherein the target three-dimensional coordinates are used to characterize the relative position of each basic plot and the anchor point;
[0060] Step S1013, determining the depth data of each basic block relative to the camera;
[0061] Step S1014: determining a target plot according to the target three-dimensional coordinates, the depth data and the preset two-dimensional plane.
[0062] Exemplarily, the anchor point is located in the three-dimensional space of the game scene as a reference point; by determining the three-dimensional coordinates of the anchor point, it is convenient to determine the relative position of each basic plot and the anchor point, thereby obtaining the target three-dimensional coordinates.
[0063] Exemplarily, the depth data of each basic plot relative to the camera is used to characterize the distance of each basic plot relative to the camera (or player) in three-dimensional space.
[0064] Exemplarily, the unwalkable plots in the basic plots where the player character cannot walk can be determined according to the target three-dimensional coordinates, the depth data and the preset two-dimensional plane, so as to delete the unwalkable plots and obtain the target plot.
[0065] There is no restriction on the execution order of step S1011 and step S1013, for example, step S1013 may be executed first, and then step S1011. This embodiment of the present application does not make any specific limitation on this.
[0066] It should be noted that the third embodiment of the present application may also be an improvement based on the second embodiment.
[0067] It is not difficult to find that in the embodiment of the present application, the three-dimensional coordinates of the anchor point are determined, and the target three-dimensional coordinates of each basic plot are determined according to the three-dimensional coordinates of the anchor point and the three-dimensional coordinates of each basic plot; wherein the target three-dimensional coordinates are used to characterize the relative position of each basic plot and the anchor point, so that all basic plots can be positioned relative to a common reference point, namely the anchor point, which is conducive to improving calculation efficiency; and the depth data of each basic plot relative to the camera is determined; according to the target three-dimensional coordinates, the depth data and the preset two-dimensional plane, the target plot is automatically determined, which is conducive to further reducing human errors and improving the efficiency of determining the target plot.
[0068] Fourth embodiment
[0069] The fourth embodiment of the present application relates to a method for determining a path. The fourth embodiment is an improvement on the third embodiment, and the specific improvement is that: in the fourth embodiment, a specific implementation method for determining the three-dimensional coordinates of an anchor point is provided.
[0070] Specifically, the step of determining the three-dimensional coordinates of the anchor point, i.e., step S1011, may further include the following steps: Figure 7 As shown:
[0071] Step S10111, according to the three-dimensional coordinates of each basic plot, determine the minimum value of each basic plot on the X axis, Y axis, and Z axis respectively;
[0072] Step S10112: determine the three-dimensional coordinates of the anchor point according to the minimum value.
[0073] For example, all basic blocks B1, ..., B in the level can be identified and collected. n ; For each basic plot, obtain its coordinate values of the X-axis, Y-axis, and Z-axis in the three-dimensional space, and determine the minimum value (x min ,y min ,z min ), and then according to the minimum value (x min ,y min ,z min ), determine the three-dimensional coordinates of the anchor point.
[0074] Optionally, in some other embodiments, the determining the three-dimensional coordinates of the anchor point according to the minimum value, that is, step S1013, may further include the following steps:
[0075] Step S10131, determining a reference value according to the size of each basic plot; wherein the reference value is used to make the basic plot have a positive value relative to the anchor point after the module composed of the basic plot is moved or rotated;
[0076] Step S10132: determine the three-dimensional coordinates of the anchor point according to the reference value and the minimum value.
[0077] Exemplarily, since the size of each basic plot is the same, only the size of one of the basic plots can be obtained to obtain the size s of each basic plot. Since the basic plot is in a cubic shape, each basic plot has a uniform length, width, and height. Usually, the size s of each basic plot can be 1; 1 = 1 (length) × 1 (width) × 1 (height).
[0078] Exemplarily, the reference value offset can be determined according to the multiple of the size of each basic plot. For example, offset = k × s, where k is a coefficient and the coefficient is a positive integer. In some examples, the value of k can be 100, 1000, etc., and relevant personnel can determine the value of k according to actual needs. Exemplarily, the selection criteria for the value of k can be: no matter how the modules composed of the basic plots are moved or rotated, their coordinate values relative to the anchor point can be positive values, and the embodiments of the present application do not specifically limit this.
[0079] Optionally, in some embodiments, the three-dimensional coordinates of the anchor point are determined according to the benchmark value and the minimum value, that is, step S10132 may further include: determining the anchor point according to the difference between the minimum value of each basic plot on the X-axis, Y-axis, and Z-axis and the benchmark value.
[0080] Exemplarily, the three-dimensional coordinates of the anchor point Anchor may be obtained by subtracting the minimum value of each basic plot on the X-axis, Y-axis, and Z-axis from the reference value:
[0081] Anchor=(x min -offset,y min -offset,z min -offset)
[0082] It should be noted that the fourth embodiment of the present application may also be an improvement based on the first embodiment and / or the second embodiment.
[0083] It is not difficult to find that in the embodiment of the present application, by determining the minimum value of each basic plot on the X-axis, Y-axis, and Z-axis respectively according to the three-dimensional coordinates of each basic plot; and then determining the three-dimensional coordinates of the anchor point according to the minimum value, a specific implementation method for determining the three-dimensional coordinates of the anchor point is provided.
[0084] Fifth embodiment
[0085] The fifth embodiment of the present application relates to a method for determining a path. The fifth embodiment is an improvement on the third embodiment, and the specific improvement is: in the fifth embodiment, a specific implementation method for determining the target three-dimensional coordinates of each basic plot is provided based on the three-dimensional coordinates of the anchor point and the three-dimensional coordinates of each basic plot.
[0086] Specifically, the target three-dimensional coordinates of each basic plot are determined according to the three-dimensional coordinates of the anchor point and the three-dimensional coordinates of each basic plot, that is, step S1012 may further include the following steps: Figure 8 As shown:
[0087] Step S10121, determining a first difference between the three-dimensional coordinates of each basic plot and the three-dimensional coordinates of the anchor point;
[0088] Step S10122: performing normalization processing based on the first difference and the three-dimensional coordinates of each basic plot to determine the target three-dimensional coordinates of each basic plot.
[0089] For example, traverse all basic blocks B1,...,B n, subtract the three-dimensional coordinates of the anchor point from the three-dimensional coordinates of each basic plot to obtain a first difference, which is used to characterize the position coordinates of each basic plot relative to the anchor point. i Let's take this as an example. Assume that the basic plot B i The three-dimensional coordinates of i =(x i ,y i ,z i ), the basic plot B i The first difference between the three-dimensional coordinates of and the three-dimensional coordinates of the anchor point is:
[0090] (x i -Anchor.x),(y i -Anchor.y),(z i -Anchor.z);
[0091] Where Anchor.x = x min -offset, Anchor.y = y min -offset,Anchor.z=z min -offset.
[0092] Exemplarily, normalization processing is performed based on the first difference and the three-dimensional coordinates of each basic plot, so that the target three-dimensional coordinates of each basic plot are determined to be within a suitable range, which is conducive to further improving calculation efficiency.
[0093] Optionally, in some embodiments, the normalization process is performed based on the first difference and the three-dimensional coordinates of each basic plot to determine the target three-dimensional coordinates of each basic plot, that is, step S10122 may further include the following steps:
[0094] Step S101221, determining the size of each basic plot;
[0095] Step S101222: determining the target three-dimensional coordinates of each basic plot according to the ratio between the first difference and the size of each basic plot.
[0096] Exemplarily, the determination of the size of each basic plot in step S101221 is substantially the same as the explanation of the size of each basic plot in step S10131 provided in the fourth embodiment, and will not be repeated here to avoid repetition.
[0097] For example, continue with basic plot B i The ratio between the first difference and the size of each basic plot is used to determine the basic plot B. iThe target 3D coordinates relative to the anchor point α i , please refer to the following formula for details:
[0098]
[0099] Among them, "round()" means rounding to the nearest integer; the target three-dimensional coordinate α i Each coordinate value in is a positive integer.
[0100] It should be noted that the fifth embodiment of the present application may also be an improvement based on any one or more of the first embodiment to the second embodiment and the fourth embodiment.
[0101] It is not difficult to find that in the embodiment of the present application, by determining the first difference between the three-dimensional coordinates of each basic plot and the three-dimensional coordinates of the anchor point, and then performing normalization processing based on the first difference and the three-dimensional coordinates of each basic plot, the target three-dimensional coordinates of each basic plot are determined, and a specific implementation method for determining the target three-dimensional coordinates of each basic plot based on the three-dimensional coordinates of the anchor point and the three-dimensional coordinates of each basic plot is provided. In the embodiment of the present application, the target three-dimensional coordinates of each basic plot are obtained by performing normalization processing based on the first difference and the three-dimensional coordinates of each basic plot, which facilitates calculation and is conducive to further improving calculation efficiency.
[0102] Sixth embodiment
[0103] The sixth embodiment of the present application relates to a method for determining a path. The sixth embodiment is an improvement on the third embodiment, and the specific improvement is that: in the sixth embodiment, a specific implementation method for determining the depth data of each basic block relative to the camera is provided.
[0104] Specifically, the step of determining the depth data of each basic block relative to the camera, i.e., step S1013, may further include the following steps: Fig. 9 As shown:
[0105] Step S10131, determining the position of the camera and the direction vector of the camera;
[0106] Step S10132: Determine the depth data of each basic plot relative to the camera according to the position of the camera, the direction vector of the camera and the three-dimensional coordinates of each basic plot.
[0107] Exemplarily, the position of the camera is used to represent the specific position of the camera in three-dimensional space, and the position of the camera is usually represented by a coordinate point. The direction vector of the camera is used to represent the orientation of the camera. The direction vector of the camera is usually a vector pointing from the position of the camera to the front of the camera.
[0108] Exemplarily, assuming that the position of the camera is P camera , the direction vector of the camera is R camera ; then according to the position of the camera P camera , the direction vector R of the camera camera And the three-dimensional coordinates of each basic block, determine the depth data of each basic block relative to the camera.
[0109] Optionally, in some embodiments, the depth data of each basic plot relative to the camera is determined according to the position of the camera, the direction vector of the camera and the three-dimensional coordinates of each basic plot, that is, step S10132 may further include the following steps:
[0110] Step S101321, determining a second difference between the three-dimensional coordinates of each basic land block and the position of the camera;
[0111] Step S101322: Determine the depth data of each basic block relative to the camera according to the direction vector of the camera and the second difference.
[0112] For example, one of the basic plots B i Take the following as an example, assuming that the basic plot B i The three-dimensional coordinates of i =(x i ,y i ,z i ), then determine the basic plot B i The second difference of the three-dimensional coordinates and the position of the camera: p i -p camera .
[0113] Next, the direction vector R of the camera can be camera and the second difference p i -p camera , determine the basic plot B i Depth data d relative to the camera i Specifically, the direction vector R of the camera can be camera and the second difference p i -p camera The dot product result is used to represent the basic block B i Depth data d relative to the camera i , the reference formula is as follows:
[0114] d i =dot(R camera ,p i -P camera )
[0115] Among them, dot(x,y) represents the dot product of vectors x and y.
[0116] It should be noted that the sixth embodiment of the present application may also be an improvement based on any one or more of the first embodiment, the second embodiment, the fourth embodiment, and the fifth embodiment.
[0117] It is not difficult to find that in the embodiment of the present application, by determining the position of the camera and the direction vector of the camera, and determining the depth data of each basic plot relative to the camera based on the position of the camera, the direction vector of the camera and the three-dimensional coordinates of each basic plot, a specific implementation method for determining the depth data of each basic plot relative to the camera is provided.
[0118] Seventh embodiment
[0119] The seventh embodiment of the present application relates to a method for determining a path. The seventh embodiment is an improvement based on the third embodiment, and the specific improvement is: in the seventh embodiment, a specific implementation method for determining a target plot according to the target three-dimensional coordinates, the depth data and the preset two-dimensional plane is provided.
[0120] Specifically, the target land parcel is determined according to the target three-dimensional coordinates, the depth data and the preset two-dimensional plane, that is, step S1014 may further include the following steps: Fig.10 As shown:
[0121] Step S10141, determining a calculation factor according to the target three-dimensional coordinates;
[0122] Step S10142, determining the position coordinates of each basic land block corresponding to the preset two-dimensional plane according to the target three-dimensional coordinates and the calculation factor;
[0123] Step S10143, determining the target plot according to the position coordinates and the depth data.
[0124] The calculation factor is used to assist in converting the target three-dimensional coordinates of each basic plot into position coordinates corresponding to the preset two-dimensional plane.
[0125] Optionally, in some embodiments, the step of determining the calculation factor according to the target three-dimensional coordinates, i.e., step S10141, may further include the following steps:
[0126] Step S101411, determining the y value of the target three-dimensional coordinates;
[0127] Step S101412, determining the y value of the direction vector of the camera;
[0128] Step S101413, determining a calculation factor according to the y value of the target three-dimensional coordinates and the y value of the direction vector of the camera.
[0129] For example, the basic plot B i The y value of the target 3D coordinate can be expressed using α i .y represents; the y value of the direction vector of the camera can be expressed by R camera .y means that the y value α of the target three-dimensional coordinates can be calculated i .y and the y value of the camera's direction vector R camera .y ratio, and obtain the calculation factor factor i , the reference formula is as follows:
[0130]
[0131] Optionally, in some embodiments, determining the position coordinates of each basic land parcel corresponding to the preset two-dimensional plane according to the target three-dimensional coordinates and the calculation factor, that is, step S10142 may further include the following steps:
[0132] Step S101421, determining the x value and z value of the target three-dimensional coordinates;
[0133] Step S101422, determining a first product of the calculation factor and the x value of the direction vector of the camera;
[0134] Step S101423, determining a second product of the calculation factor and the z value of the direction vector of the camera;
[0135] Step S101424, determining a first coordinate of each basic land parcel corresponding to the preset two-dimensional plane according to the x value of the target three-dimensional coordinate and the first product;
[0136] Step S101425, determining the second coordinate of each basic plot corresponding to the preset two-dimensional plane according to the z value of the target three-dimensional coordinate and the second product;
[0137] Step S101426: Determine the position coordinates of each basic plot corresponding to the preset two-dimensional plane according to the first coordinates and the second coordinates.
[0138] For example, the basic plot B i The x and z values of the target three-dimensional coordinates can be expressed by α i .x and α i .z represents; the x value and z value of the direction vector of the camera can be expressed by R camera .x and R camera .z means;
[0139] Exemplarily, the first product of the calculation factor and the x value of the direction vector of the camera is: factor i ×Rcamer a .x;
[0140] Exemplarily, the second product of the calculation factor and the z value of the direction vector of the camera is: factor i ×Rcamer a .z;
[0141] Exemplarily, the basic block B may be determined according to the x value of the target three-dimensional coordinate and the first product. i The first coordinate corresponding to the preset two-dimensional plane. Specifically, the x value of the target three-dimensional coordinate and the first product can be subtracted to obtain the basic block B i Corresponding to the first coordinate of the preset two-dimensional plane: round(α i .x-factor i ×R camera .x)
[0142] Exemplarily, the basic block B is determined according to the z value of the target three-dimensional coordinates and the second product. i The second coordinate corresponding to the preset two-dimensional plane. Specifically, the z value of the target three-dimensional coordinate and the second product can be subtracted to obtain the basic block B i The second coordinate corresponding to the preset two-dimensional plane: round(α i .z-factor i ×R camera .z)
[0143] It can be understood that “round()” means rounding to the nearest integer.
[0144] For example, the basic plot B corresponds to i According to the first coordinate and the second coordinate, the basic block B is determined i The position coordinate β corresponding to the preset two-dimensional plane i You can refer to the following formula:
[0145] β i =(round(α i .x-factor i ×R camera .x),round(α i .z-factor i ×R camera .z)
[0146] It should be noted that the seventh embodiment of the present application may also be an improvement based on any one or more of the first embodiment, the second embodiment, and the fourth embodiment to the sixth embodiment.
[0147] It is not difficult to find that in the embodiment of the present application, by determining the calculation factor according to the target three-dimensional coordinates, and determining the position coordinates of each basic plot corresponding to the preset two-dimensional plane according to the target three-dimensional coordinates and the calculation factor, so as to determine the target plot according to the position coordinates and the depth data, a specific implementation method for determining the target plot according to the target three-dimensional coordinates, the depth data and the preset two-dimensional plane is provided. In this way, it is conducive to further simplifying the calculation to improve the calculation efficiency.
[0148] Eighth embodiment
[0149] The eighth embodiment of the present application relates to a method for determining a path. The eighth embodiment is an improvement based on the seventh embodiment, and the specific improvement is: in the eighth embodiment, a specific implementation method for determining a target land parcel according to the position coordinates and the depth data is provided.
[0150] Specifically, the target land parcel is determined according to the position coordinates and the depth data, that is, step S10143 may further include the following steps: Fig.11 As shown:
[0151] Step S101431, matching is performed according to a preset rule based on the position coordinates and the depth data to obtain a matching result; the matching result is used to indicate an unwalkable land block; the unwalkable land block represents a unit on which the player character cannot walk;
[0152] Step S101432: according to the matching result, the unwalkable plot is deleted from the basic plot to obtain the target plot.
[0153] Exemplarily, in three-dimensional space, each basic plot has multiple faces. Among them, the player character can walk or stand on some faces of the basic plot, and the faces on which these player characters can walk or stand are the walkable faces of the basic plot. If the walkable face of the basic plot is blocked by other basic plots, then, from the player's perspective, the walkable face of the basic plot is invisible or inaccessible, and these invisible or inaccessible faces are blocked faces. If there is a blocked face in the basic plot, the corresponding basic plot is an unwalkable plot, and the player character cannot walk on the corresponding basic plot. In an embodiment of the present application, it is intended to match according to the position coordinates and the depth data according to preset rules to obtain a matching result, and the matching result is used to indicate an unwalkable plot.
[0154] Optionally, in some embodiments, the preset rules at least include:
[0155] (1) determining whether there is an overlapping relationship between the basic plots;
[0156] Specifically, based on a preset two-dimensional plane, it is determined whether there is an overlapping relationship between the basic plots. For example, see Fig.12 and Fig.13 As shown, on the preset two-dimensional plane, the basic plot B i and basic plot B j Overlap, that is, B j =B i .
[0157] Specifically, even if some basic plots are separated in the three-dimensional space, the entire areas of at least two basic plots overlap visually on the preset two-dimensional plane. It is understandable that in the process of projection from three-dimensional to two-dimensional, the actual distance and relative position in the space may change, causing the originally non-overlapping plots to overlap after projection.
[0158] (2) Determine whether the left side or the right side of the walkable surface of the basic plot is blocked by other basic plots.
[0159] Specifically, based on a preset two-dimensional plane, it is determined whether the right side of the walkable surface of the basic plot is blocked by other basic plots. Fig.14 As shown, the basic plot B i The right side of the walkable surface is covered by basic block B j Occlusion, that is, there is a basic plot B j , basic plot B j and basic plot B i The following formula is satisfied:
[0160] β j .x=β i .x+A1 and d j <d i ;
[0161] Among them, A1 represents the case of right side occlusion, when R camera .x is greater than zero or less than zero, β j Indicates basic plot B j Corresponding to the position coordinates of the preset two-dimensional plane, d j Indicates the basic plot B j Depth data relative to the camera. Correspondingly, β j .x represents the basic plot B jThe x value corresponding to the position coordinate of the preset two-dimensional plane, β i .x represents the basic plot B i The x value corresponding to the position coordinate of the preset two-dimensional plane.
[0162] Specifically, based on a preset two-dimensional plane, it is determined whether the left side of the walkable surface of the basic plot is blocked by other basic plots. Fig.15 As shown, the basic plot B i The left side of the walkable surface is occupied by basic block B j Occlusion, that is, there is a basic plot B j , basic plot B j and basic plot B i The following formula is satisfied:
[0163] β j .y=β i .y+A2 and d j <d i ;
[0164] Among them, A2 represents the case of left occlusion, when R camera .The value when z is greater than zero or less than zero, β j Indicates basic plot B j Corresponding to the position coordinates of the preset two-dimensional plane, d j Indicates the basic plot B j Depth data relative to the camera. Correspondingly, β j .y represents the basic plot B j The y value corresponding to the position coordinate of the preset two-dimensional plane, β i .y represents the basic plot B i The y value corresponding to the position coordinate of the preset two-dimensional plane.
[0165] Correspondingly, deleting the non-walkable plot in the basic plot according to the matching result to obtain the target plot may include: if there is an overlapping relationship between the basic plots, and / or whether the left or right side of the walkable surface of the basic plot is blocked by other basic plots, then deleting the blocked plot in the basic plot to obtain the target plot.
[0166] In addition, it should be noted that, in some embodiments, the preset rules may also include:
[0167] (3) Determine whether there is a stacking relationship between the basic plots in the vertical direction.
[0168] For example, Fig.16 As shown, in three-dimensional space, the basic plot Bi There are other basic plots vertically above, such as basic plot B j , that is, α j .y=α i .y+1.
[0169] Among them, α j .y represents the basic plot B j The y value of the target three-dimensional coordinate, α i .y represents the basic plot B i The y value of the target 3D coordinate.
[0170] It can be understood that if the upper basic plot completely blocks the lower basic plot, then the lower basic plot is a non-walkable plot.
[0171] In summary, three different conditions that can be included in the preset rules are listed. By matching according to the preset rules, it is possible to determine which plots in the basic plots belong to non-walkable plots. The above three different conditions are generally in an "or" relationship, that is, if the basic plot meets any one of the three different conditions, it can be determined that the corresponding basic plot belongs to a non-walkable plot and is deleted.
[0172] Furthermore, it is worth mentioning that among the three different conditions that the preset rules may include, conditions (1) and (2) need to be determined based on the position coordinates and the depth data; while condition (3) does not need to be determined based on the position coordinates and the depth data, and therefore, pre-matching may be performed based on condition 3. For example, after determining the target three-dimensional coordinates, pre-matching may be performed directly based on condition 3, and the non-walkable plot located at the bottom of the stacking relationship may be deleted.
[0173] It should be noted that the eighth embodiment of the present application may also be an improvement based on any one or more embodiments from the first embodiment to the sixth embodiment.
[0174] It is not difficult to find that in the embodiment of the present application, a matching result is obtained by matching according to preset rules based on the position coordinates and the depth data; the matching result is used to indicate an unwalkable plot; the unwalkable plot represents a unit on which the player character cannot walk; according to the matching result, the unwalkable plot is deleted from the basic plot to obtain the target plot. A specific implementation method for determining the target plot based on the position coordinates and the depth data is provided. In the embodiment of the present application, the unwalkable plots on which the player character cannot walk are automatically detected, identified and deleted, and the remaining valid plots are the target plots. In the later stage, it is only necessary to determine the path based on the target plot.
[0175] Ninth embodiment
[0176] The ninth embodiment of the present application relates to a method for determining a path. The ninth embodiment is an improvement on the first embodiment, and the specific improvement is that: in the ninth embodiment, a specific implementation method for determining a starting plot and an end plot according to the target plot is provided.
[0177] Specifically, according to the target plot, the starting plot and the end plot are determined, that is, step S102 may further include the following steps: Fig.17 As shown:
[0178] Step S1021, determining a target dictionary constructed based on the target plot;
[0179] Step S1022: determining a starting point plot and an end point plot according to the target dictionary and the target plot.
[0180] Exemplarily, a target dictionary may be constructed based on the target plot to facilitate data query.
[0181] Optionally, in some embodiments, the method for constructing the target dictionary includes:
[0182] Step S201, determining a key according to the position coordinates of each target plot corresponding to the preset two-dimensional plane;
[0183] Step S202, determining a value according to each target plot;
[0184] Step S203, construct the target dictionary according to the key and the value.
[0185] Exemplarily, the basic plot can be uniquely determined by the position coordinates, and the key of the target dictionary can be composed of the components of the position coordinates. For example, the key determined according to the position coordinates of each target plot corresponding to the preset two-dimensional plane can be: key i =β i .x<<16+β i .y;
[0186] Among them, key i Indicates the assumption that the basic plot B i In the case of the target plot, the target plot B i The key of the basic plot B i . The key of the target dictionary is used for retrieval. The number of bits of the key can be expanded according to the actual situation. For example, if the level is large or complex, more information may be needed to retrieve the target plot. The value of the target dictionary is used to represent the object corresponding to the key, that is, the target plot.
[0187] Among them, <<16 means shifting left by 16 bits in operation, that is, 2 16 Of course, as mentioned above, the number of digits of the key can be expanded according to actual conditions.
[0188] Optionally, in some embodiments, the determining of the starting plot and the ending plot according to the target dictionary and the target plot, that is, step S1022, may further include the following steps:
[0189] Step S10221, determining that the starting point position and the end point position correspond to the starting point position coordinates and the end point position coordinates of the preset two-dimensional plane respectively;
[0190] Step S10222, determining the key according to the starting point position coordinates and the end point position coordinates;
[0191] Step S10223: According to the key, query in the target dictionary to obtain the starting plot and the end plot.
[0192] For example, the starting position p of the player in the game level can be obtained. start and the end position p end . Set the starting point position p in the three-dimensional space start and the end position p end Mapped to the starting point position coordinates β of the preset two-dimensional plane s and the end point position coordinates β e The method here is roughly the same as the method S10142 provided in the seventh embodiment of the present application, and will not be described again here to avoid repetition.
[0193] Specifically, the starting position coordinates and the end position coordinates obtained after conversion are used as keys in the target dictionary. s and the end point position coordinates β e Convert to key s and key e , the start and end points will be used. s and key e , query in the target dictionary to obtain the starting plot B s and the end plot B e .
[0194] It should be noted that the ninth embodiment of the present application may also be an improvement based on any one or more embodiments from the second embodiment to the eighth embodiment.
[0195] It is not difficult to find that in the embodiment of the present application, a target dictionary constructed based on the target plot is determined; and the starting plot and the end plot are determined based on the target dictionary and the target plot. A specific implementation method for determining the starting plot and the end plot based on the target plot is provided. In the embodiment of the present application, by constructing a target dictionary, the starting plot and the end plot can be quickly searched and accessed based on the key value, which is conducive to improving the calculation efficiency of the path during real-time pathfinding.
[0196] Tenth embodiment
[0197] The tenth embodiment of the present application relates to a method for determining a path. The tenth embodiment is an improvement on the first embodiment, and the specific improvement is: in the tenth embodiment, a specific implementation method for determining a feasible path according to the starting plot and the end plot is provided.
[0198] Specifically, the step S103 of determining a feasible path according to the starting plot and the end plot may further include the following steps: Fig.18 As shown:
[0199] Step S1031, determining whether any two target plots between the starting plot and the end plot meet a preset connectivity condition; the connectivity condition is used to determine whether the player character can directly walk between any two target plots;
[0200] Step S1032, determining a feasible path according to the judgment result.
[0201] For example, it is assumed that any two target plots between the starting plot and the end plot are target plots B and B. i and target plot B j Then, determine the target plot B i and target plot B j The conditions for connectivity can be:
[0202] β i .x=β j .x and |β j .y-β i .y|=1, or;
[0203] β i .y=β j .y and |β j .x-β i .x|=1.
[0204] Specifically, in the process of determining the feasible path, the target dictionary can be directly accessed to determine whether there are other basic plots adjacent to the current basic plot. Exemplarily, the current basic plot can be detected from the four directions of top, bottom, left and right to determine whether there are other basic plots adjacent to the current basic plot.
[0205] Optionally, in some embodiments, determining a feasible path based on the judgment result, that is, step S1032 may further include: if it is determined that any two target plots between the starting plot and the end plot meet a preset connectivity condition, using a graph search algorithm to determine a feasible path starting from the starting plot.
[0206] Exemplarily, the graph search algorithm may include but is not limited to: depth-first search DFS or breadth-first search BFS. By using depth-first search DFS or breadth-first search BFS, the search may be started from the starting plot, and one or more paths to the end plot may be gradually explored and found. The algorithm records the path from the starting plot to the end plot.
[0207] That is, if it is determined that any two target plots between the starting plot and the end plot meet the preset connectivity condition, then the starting plot B can be connected to the end plot. s First, use depth-first search DFS or breadth-first search BFS to determine the starting point B s and the end plot B e feasible paths between them.
[0208] It is not difficult to find that in the embodiment of the present application, by judging whether any two target plots between the starting plot and the end plot meet the preset connectivity condition; the connectivity condition is used to determine whether the player character can walk directly between any two target plots; and according to the judgment result, a feasible path is determined, and a specific implementation method for determining the feasible path according to the starting plot and the end plot is provided. In this way, a feasible path from the starting plot and the end plot can be effectively found.
[0209] The step division of the above methods is only for the purpose of clear description. When implemented, they can be combined into one step or some steps can be split and decomposed into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this patent; adding insignificant modifications to the algorithm or process or introducing insignificant designs without changing the core design of the algorithm and process are all within the scope of protection of this patent.
[0210] In addition, some embodiments of the present application also provide an electronic device. The electronic device may be a digital computer in various forms, such as a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, etc. The electronic device may also be a mobile device in various forms, such as a personal digital processing, a cellular phone, a smart phone, a wearable device, and other similar computing devices.
[0211] The electronic device includes: one or more processors; and a memory storing computer program instructions, wherein when the computer program instructions are executed, the processor executes the steps of the method provided in any one or more of the above embodiments. Fig.19 An exemplary structural diagram of the electronic device is disclosed. Fig.19 As shown, the electronic device includes: one or more processors 1101, memory 1102, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are connected to each other using different buses, and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some other embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Among them, the components shown in this article, their connections and relationships, and their functions are only used as examples, and are not intended to limit the implementation of the present application described and / or required herein.
[0212] The electronic device may further include: an input device 1103 and an output device 1104. The processor 1101, the memory 1102, the input device 1103 and the output device 1104 may be connected via a bus or other means. Fig.18 The example of connecting through bus is taken in the following.
[0213] The input device 1103 can receive input digital or character information, and generate key signal input related to the user settings and function control of the electronic device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator rod, one or more mouse buttons, a track ball, a joystick and other input devices. The output device 1104 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display and a plasma display. In some embodiments, the display device may be a touch screen.
[0214] To provide interaction with a user, the electronic device may be a computer. The computer has: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball), through which the user can provide input to the computer. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0215] In the embodiments of the present application, a computer program / instruction is stored on a computer-readable medium, and when the computer program / instruction is executed by a processor, the steps of the method provided by any one or more of the above embodiments are implemented. The computer-readable medium may be included in the electronic device described in the above embodiments; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more computer-readable instructions.
[0216] The memory 1102 can be used as a non-transient computer-readable storage medium, which can be used to store non-transient software programs, non-transient computer executable programs and modules. The processor 1101 executes various functional applications and data processing of the server by running the non-transient software programs, instructions and modules stored in the memory 1102, so as to implement the program instructions / modules corresponding to the method provided by any one or more embodiments in the embodiments of the present application.
[0217] The memory 1102 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 1102 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory 1102 may optionally include a memory remotely arranged relative to the processor 1101, and these remote memories may be connected to the electronic device 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.
[0218] It should be noted that the computer-readable medium described in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer 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 of the above. In the present application, a computer-readable medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device.
[0219] Computer readable media include permanent and non-permanent, removable and non-removable media, and can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, modules of programs or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
[0220] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0221] In the above-described embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. For example, it can be implemented by using an application specific integrated circuit (ASIC), a general-purpose computer or any other similar hardware device. In certain embodiments, the software program of the present application can be executed by a processor to implement the above steps or functions. Similarly, the software program of the present application (including relevant data structures) can be stored in a computer-readable recording medium, for example, a RAM memory, a magnetic or optical drive or a floppy disk and similar devices. In addition, some steps or functions of the present application can be implemented by hardware, for example, as a circuit that cooperates with a processor to perform each step or function.
[0222] The computer program product provided in the embodiment of the present application includes one or more computer programs / instructions, and when the computer program / instructions are executed by the processor, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from a computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state disk (SSD)), etc.
[0223] The flow chart or block diagram in the accompanying drawings shows the possible architecture, function and operation of the equipment, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated system for hardware that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0224] The scope of the present application is defined by the appended claims rather than the above description, and it is intended that all changes that fall within the meaning and scope of the equivalent elements of the claims are included in the present application. Any figure mark in the claims should not be regarded as limiting the claims involved. In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the device claim may also be implemented by one unit or device through software or hardware. The words "first", "second", etc. are only used to distinguish the description, and do not indicate any particular order, nor can they be understood as indicating or implying relative importance.
[0225] The above is only a specific embodiment of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily mention changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims, and the above embodiments should be regarded as exemplary and non-restrictive.
Claims
1. A method for determining a path, characterized in that: The method comprises: Determine a target plot according to the basic plots in the level; wherein the target plot is determined according to the basic plot and a preset two-dimensional plane; the target plot represents a unit on which the player character can walk; According to the target plot, determine the starting plot and the end plot; A feasible path is determined according to the starting plot and the end plot.
2. The method according to claim 1, characterized in that Determining the target plot according to the basic plots in the level includes: Performing vertical projection on the basic plot to project the basic plot onto a preset two-dimensional plane with a Y-axis coordinate of zero in the game scene; The target plot is determined according to the position coordinates of each basic plot corresponding to the preset two-dimensional plane.
3. The method according to claim 1, characterized in that Determining the target plot according to the basic plots in the level includes: Determine the three-dimensional coordinates of the anchor point; Determine the target three-dimensional coordinates of each basic plot according to the three-dimensional coordinates of the anchor point and the three-dimensional coordinates of each basic plot; wherein the target three-dimensional coordinates are used to characterize the relative position of each basic plot and the anchor point; Determine the depth data of each basic plot relative to the camera; A target plot is determined according to the target three-dimensional coordinates, the depth data and the preset two-dimensional plane.
4. The method according to claim 3, characterized in that Determining the three-dimensional coordinates of the anchor point includes: According to the three-dimensional coordinates of each basic plot, determine the minimum value of each basic plot on the X axis, Y axis, and Z axis respectively; The three-dimensional coordinates of the anchor point are determined according to the minimum value.
5. The method according to claim 4, characterized in that Determining the three-dimensional coordinates of the anchor point according to the minimum value includes: Determine a reference value according to the size of each basic plot; wherein the reference value is used to make the basic plot a positive value relative to the anchor point after the module composed of the basic plot is moved or rotated; The three-dimensional coordinates of the anchor point are determined according to the reference value and the minimum value.
6. The method according to claim 5, characterized in that Determining the three-dimensional coordinates of the anchor point according to the reference value and the minimum value includes: The three-dimensional coordinates of the anchor point are determined according to the difference between the minimum value of each basic plot on the X-axis, the Y-axis, and the Z-axis and the reference value.
7. The method according to claim 3, characterized in that Determining the target three-dimensional coordinates of each basic plot according to the three-dimensional coordinates of the anchor point and the three-dimensional coordinates of each basic plot comprises: Determine a first difference between the three-dimensional coordinates of each basic plot and the three-dimensional coordinates of the anchor point; Normalization processing is performed based on the first difference and the three-dimensional coordinates of each basic plot to determine the target three-dimensional coordinates of each basic plot.
8. The method according to claim 7, characterized in that The performing normalization processing according to the first difference and the three-dimensional coordinates of each basic land block to determine the target three-dimensional coordinates of each basic land block comprises: Determine the dimensions of each basic plot; The target three-dimensional coordinates of each basic block are determined according to the ratio between the first difference and the size of each basic block.
9. The method according to claim 3, characterized in that: Determining the depth data of each basic block relative to the camera includes: Determining the position of the camera and the direction vector of the camera; Depth data of each basic block relative to the camera is determined according to the position of the camera, the direction vector of the camera and the three-dimensional coordinates of each basic block.
10. The method according to claim 9, characterized in that Determining the depth data of each basic plot relative to the camera according to the position of the camera, the direction vector of the camera and the three-dimensional coordinates of each basic plot comprises: determining a second difference between the three-dimensional coordinates of each elementary land mass and the position of the camera; Depth data of each basic block relative to the camera is determined according to the direction vector of the camera and the second difference value.
11. The method according to claim 3, characterized in that The determining of the target land parcel according to the target three-dimensional coordinates, the depth data and the preset two-dimensional plane comprises: Determining a calculation factor according to the target three-dimensional coordinates; Determine the position coordinates of each basic land block corresponding to the preset two-dimensional plane according to the target three-dimensional coordinates and the calculation factor; A target plot is determined according to the position coordinates and the depth data.
12. The method according to claim 11, characterized in that Determining the calculation factor according to the target three-dimensional coordinates includes: Determine the y value of the target three-dimensional coordinates; Determine the y value of the direction vector of the camera; A calculation factor is determined according to the y value of the target three-dimensional coordinates and the y value of the direction vector of the camera.
13. The method according to claim 11, characterized in that Determining the position coordinates of each basic land block corresponding to the preset two-dimensional plane according to the target three-dimensional coordinates and the calculation factor includes: Determine the x value and z value of the three-dimensional coordinates of the target; Determining a first product of the calculation factor and the x value of the direction vector of the camera; determining a second product of the calculation factor and the z value of the direction vector of the camera; Determine, according to the x value of the target three-dimensional coordinate and the first product, a first coordinate of each basic plot corresponding to the preset two-dimensional plane; Determine, according to the z value of the target three-dimensional coordinate and the second product, the second coordinate of each basic plot corresponding to the preset two-dimensional plane; The position coordinates of each basic land block corresponding to the preset two-dimensional plane are determined according to the first coordinates and the second coordinates.
14. The method according to claim 11, characterized in that Determining the target land parcel according to the position coordinates and the depth data includes: According to the position coordinates and the depth data, matching is performed according to a preset rule to obtain a matching result; the matching result is used to indicate an unwalkable land block; the unwalkable land block represents a unit on which the player character cannot walk; According to the matching result, the unwalkable plot is deleted from the basic plot to obtain the target plot.
15. The method according to claim 14, characterized in that The preset rules at least include: Determine whether there is an overlapping relationship between the basic plots; and / or, Determine whether the left side or the right side of the walkable surface of the basic plot is blocked by other basic plots; Correspondingly, deleting the unwalkable plot from the basic plot according to the matching result to obtain the target plot includes: If there is an overlapping relationship between the basic plots, and / or the left side or the right side of the walkable surface of the basic plot is blocked by other basic plots, the blocked plots are deleted from the basic plots to obtain the target plot.
16. The method according to any one of claims 1 to 15, characterized in that: Determining the starting point plot and the end point plot according to the target plot includes: Determining a target dictionary constructed based on the target plot; A starting point plot and an end point plot are determined according to the target dictionary and the target plot.
17. The method according to claim 16, characterized in that The method for constructing the target dictionary includes: Determining a key according to the position coordinates of each target plot corresponding to the preset two-dimensional plane; Based on each target plot, determine the value; The target dictionary is constructed according to the key and the value.
18. The method according to claim 17, characterized in that The determining of the starting plot and the ending plot according to the target dictionary and the target plot comprises: Determine that the starting point position and the ending point position correspond to the starting point position coordinates and the ending point position coordinates of the preset two-dimensional plane respectively; Determine the key according to the starting point position coordinates and the end point position coordinates; According to the key, the target dictionary is searched to obtain the starting plot and the end plot.
19. The method according to any one of claims 1 to 15, characterized in that: Determining a feasible path according to the starting plot and the end plot includes: Determine whether any two target plots between the starting plot and the end plot meet a preset connectivity condition; the connectivity condition is used to determine whether the player character can directly walk between any two target plots; Determine a feasible path based on the judgment results.
20. The method according to claim 19, wherein determining a feasible path according to the judgment result comprises: If it is determined that any two target plots between the starting plot and the end plot meet the preset connectivity condition, a graph search algorithm is used to determine a feasible path starting from the starting plot.
21. An electronic device, characterized in that: The electronic device comprises: one or more processors; and A memory storing computer program instructions which, when executed, cause the processor to perform the steps of the method as claimed in any one of claims 1 to 20.
22. A computer readable medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 20 are implemented.
23. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 20 are implemented.
