A method and system for gridding a dynamic model of a game
Through the dynamic model nine-grid grid method, the model is split into border grids and center grids, and the final model grid is merged to generate, which solves the rendering lag caused by excessive art assets in game development, and achieves the effect of reducing CPU and GPU memory usage, improving game rendering performance.
Patent Information
- Application Number
- CN202510069288.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-16
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2045-01-16
AI Technical Summary
During the real-time rendering process of game development, too many or too thin art assets will increase the pressure on the GPU and CPU, resulting in lag in rendering and affecting the experience of gamers. Although prior art such as GPU instantiation, dynamic batches and static batches can optimize the rendering and submission pressure of the CPU, it increases the memory pressure and does not effectively optimize the GPU side.
The dynamic model nine-grid grid method is used to split the model into a border grid and a central grid, and the model is sliced and reorganized through a specific algorithm to generate new grid information. This method generates the final model mesh by combining the border mesh and the center mesh, reducing the memory footprint of the CPU and GPU, and optimizing the drawing pressure of the GPU.
Through the dynamic model nine-grid grid method, the CPU submission pressure is reduced, and the CPU and GPU memory usage is reduced, the GPU drawing pressure is optimized, the game rendering performance is improved, and the player experience is improved.
Smart Images

Figure CN119478126B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of real-time rendering technology for game development, and in particular to a method and system for gridding a dynamic model of a game. Background Art
[0002] In the process of real-time rendering in game development, too many and too detailed art assets in the scene may put considerable pressure on both the GPU and the CPU, eventually causing rendering jams and affecting the gamer experience.
[0003] The current mainstream optimization solutions include but are not limited to GPU instancing, dynamic batching, static batching, etc. Among them, GPU instancing mainly optimizes the rendering of multiple copies of the same object, while dynamic batching and static batching mainly combine multiple object meshes into a whole, thereby reducing the CPU's rendering submission pressure. However, although dynamic mesh splicing can bring submission optimization on the CPU side, it will also increase memory pressure. In addition, there is almost no optimization on the GPU side; and the general GPU instancing solution can only be used for objects that are exactly the same.
[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present invention, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0005] The purpose of the present invention is to solve the technical problems existing in the background technology. To this end, a method and system for gridding a dynamic model nine-square grid for games are provided.
[0006] In order to achieve the above object, the technical solution adopted by the present invention is as follows:
[0007] A method for gridding a dynamic model of a game, comprising the following steps:
[0008] Step S1: The system identifies the model and generates a grid area covering the model;
[0009] Step S2: Slice, reorganize and merge the edges of the model to generate a border grid: poll all grid cells, generate a border in any direction where there are blocks around the real-time polled grid, record the matrix information of the generated border, and obtain the final border matrix array;
[0010] Step S3: Slice, reorganize and merge the center of the model to generate a central grid: establish a two-dimensional coordinate system with the grid area, traverse each row of grids horizontally from top to bottom, and for a single row of grids, traverse all grid cells from right to left in reverse, record the g(x,y) value of the corresponding coordinate of the traversed grid, and record the prefix information s(x,y), where s(x,y) represents the starting point of the continuous blocks and the number of continuous blocks; when there is a block in the traversed grid, g(x,y)=1, then s(x,y)=s(x,y+1)+1; when there is no block in the traversed grid, g(x,y)=0, then s(x,y)=0;
[0011] Traverse each column of grids from left to right. For a single column of grids, traverse the prefix information s(x,y) corresponding to all grid cells from top to bottom. Merge the grid areas corresponding to the consecutive same prefix information and generate a quadrilateral. Otherwise, generate a quadrilateral for the grid areas corresponding to the prefix information.
[0012] Record all quadrilaterals and obtain the final center matrix array;
[0013] Step S4: Merge the center grid in step S3 and the border grid in step S2 to obtain the final model grid.
[0014] The following is a technical solution further defined by the method of the present invention, which monitors mouse events in real time and locates the grid pointed by the real-time mouse after generating a quadrilateral grid area covering the model.
[0015] The following is a technical solution further defined by the method of the present invention, which includes:
[0016] Determine the system mode, where the system mode includes editor mode and run mode;
[0017] If the system is in editor mode, the mesh is drawn via the game object creator;
[0018] If the system is in run mode, the grid is drawn by the grid drawer.
[0019] The following is a technical solution further defined by the method of the present invention, in the process of locating the grid grid pointed by the real-time mouse, including:
[0020] Determine the system mode, where the system mode includes editor mode and run mode;
[0021] If the system is in editor mode, the mouse click is determined by the event view by listening to the mouse events;
[0022] If the system is in running mode, the pointing ray is obtained through the main screen pointing ray camera, and collision detection is performed on the pointing ray to obtain the mouse click;
[0023] Highlight the grid cell where the mouse is pointing.
[0024] The following is a technical solution further defined in the method of the present invention, in which when the system is in running mode, a grid instance is dynamically created, including:
[0025] Create a new empty game object as the root and mount it on the root node of the grid;
[0026] Initialize all art asset information, store the original art asset information, and recycle the current mesh instance;
[0027] A mesh instance is created according to the original art asset information, the border mesh generated in step S2, and the center mesh generated in step S3.
[0028] The following is a technical solution further defined by the method in the present invention, where the original art asset information includes a border, a top surface, and a bottom surface.
[0029] A nine-square grid gridding system for a dynamic model for a game, used to implement the above-mentioned nine-square grid gridding method for a dynamic model for a game, comprising:
[0030] A model identification module is used to identify the regional scope of the model;
[0031] A grid region generating module, used for generating a grid region covering the model, the grid region being larger than the region range of the model;
[0032] Mouse monitoring module, used to monitor events when the mouse points to the grid;
[0033] The mouse positioning module is used to locate the grid where the real-time mouse is pointing and highlight the pointing position;
[0034] A system mode determination module is used to determine whether the system is in editor mode or running mode;
[0035] Border mesh generation module, used to slice, reorganize and merge the edges of the model;
[0036] The center grid generation module is used to slice, reorganize and merge the center of the model;
[0037] The model mesh generation module is used to merge the border mesh and the center mesh.
[0038] The following is a technical solution further defined by the system in the present invention, wherein the border grid generation module includes:
[0039] The grid polling component is used to poll all grid grids and the grids around the grid being polled in real time;
[0040] The block detection component is based on the recognized model and combined with the coordinates of the grid area. When there is a model at the position corresponding to the coordinates, the block is detected.
[0041] The border generation component is used to generate borders in the direction of the detected blocks around the grid;
[0042] The border record component is used to record the matrix information of each generated border unit and form the border matrix array information.
[0043] The following is a technical solution further defined by the system in the present invention, wherein the central grid generation module comprises:
[0044] The grid area coordinate system building component is used to establish a two-dimensional coordinate system based on the grid area, where the grid position coordinates of the upper left corner are (0, 0), and the row direction of the grid area is the Y-axis direction, and the column direction is the X-axis direction;
[0045] A continuous block recording component is used to record the number of continuous blocks and determine the starting point of continuous blocks;
[0046] The grid traversal component is used to traverse all grid cells according to a certain rule;
[0047] The block detection component is based on the recognized model and combined with the coordinates of the grid area. When there is a model at the position corresponding to the coordinates, the block is detected.
[0048] The continuous block attribute filtering component is used to filter out the same number of connected blocks and the starting points of the continuous blocks are in the same grid column direction;
[0049] Quadrilateral generation component, used to generate quadrilaterals in the grid area corresponding to continuous blocks;
[0050] The center record component is used to record the matrix information of all generated quadrilateral units and form a center matrix array.
[0051] The following is a technical solution further defined by the system in the present invention, wherein the model grid generation module comprises:
[0052] The original art asset providing component is used to provide original art asset information, wherein the original art asset information includes a border, a top surface, and a bottom surface;
[0053] Initialization component, used to initialize all art asset information and reduce the rendering of complex art assets;
[0054] The mesh instance creation component performs mesh merging based on the newly generated border mesh and center mesh, and then creates a mesh instance using the border, top and bottom surfaces of the original art asset to render the game object.
[0055] Compared with the prior art, the present invention has the following technical effects:
[0056] The present invention grids the dynamic model, splits it into a border grid and a center grid, and slices and reorganizes the model through a specific algorithm according to the scene data provided by the art planner or the player, and regenerates new grid information. The generated new model grid information has no terrain or space restrictions. The artist only needs to provide the original assets, and the player can piece out any shape he wants through operations similar to a jigsaw puzzle. Therefore, it is possible to reduce the submission pressure on the CPU side while reducing the occupancy of the CPU and GPU memory and the drawing pressure of the GPU.
[0057] The present invention is further described below in conjunction with the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0059] Figure 1 It is a schematic flow chart of the method of the present invention;
[0060] Figure 2 It is a schematic diagram of the process of generating a border grid in the present invention;
[0061] Figure 3 It is a schematic diagram of the process of generating a central grid in the present invention;
[0062] Figure 4 It is a schematic diagram of scene rendering of a grid highlighted by a mouse in the present invention;
[0063] Figure 5 It is a schematic diagram of scene rendering of the border and center in the present invention;
[0064] Figure 6 It is a schematic diagram of scene rendering for recording s(x,y) values in the present invention;
[0065] Figure 7 is a schematic diagram of a model grid example of the present invention;
[0066] Figure 8 It is the original art asset information map of the present invention. DETAILED DESCRIPTION
[0067] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways different from those described herein, and those skilled in the art can make similar improvements without violating the connotation of the present invention, so the present invention is not limited by the specific embodiments disclosed below.
[0068] In the description of the present invention, it is necessary to understand that the terms "up", "down", "left", "right", etc., indicating directions or positional relationships are based on the directions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore cannot be understood as a limitation on the present invention.
[0069] like Figure 1 As shown, a method for gridding a dynamic model of a game is provided, which mainly includes the following steps:
[0070] Step S1: The system identifies the model and generates a grid area covering the model. It should be noted that the grid area is larger than the area range of the model.
[0071] Step S2: Slice, reassemble and merge the edges of the model to generate a border mesh.
[0072] Step S3: Slice, reorganize and merge the center of the model to generate a central mesh.
[0073] Step S4: Merge the center grid in step S3 and the border grid in step S2 to obtain the final model grid.
[0074] like Figure 2 As shown, in the process of generating the border grid in step S2, the following steps are specifically included:
[0075] Step S21: poll all grid cells to detect whether there are blocks in the four cells around the cell being polled in real time.
[0076] Step S22: If there are squares in any direction around the grid being polled in real time, a border is generated in the corresponding direction of the grid being polled in real time.
[0077] For example, in Figure 5 In the real-time polling grid, the location is Figure 5If the yellow grid is in the middle, then the four grids around the yellow grid (U direction, R direction, D direction, L direction) are checked to see if there are squares. It is found that the grid corresponding to the yellow grid in the R direction has a square. Therefore, a border is generated in the R direction of the yellow grid. In this way, the polling of all grid grids is completed.
[0078] Step S23: Record the matrix information of each generated border unit.
[0079] Step S24: Obtain the final border matrix array and generate a border grid, such as Figure 5 The border shown in F.
[0080] It should be noted that Figure 5 The frame F in the figure is the rendered frame. Step S2 only generates a frame grid, which is a procedural mark and has not been rendered yet. Therefore, only Figure 5 The border of F in the figure is to facilitate the understanding of the unrendered border grid by those skilled in the art.
[0081] like Figure 3 As shown, in the process of generating the central grid in step S3, the following steps are specifically included:
[0082] Step S31: Establish a two-dimensional coordinate system based on the grid area, such as Figure 6 As shown, the grid position coordinates of the upper left corner are (0, 0), and the row direction of the grid area is the Y-axis direction, and the column direction is the X-axis direction.
[0083] Step S32: Initially, define the s(x, y) values corresponding to all coordinates to be zero, where s(x, y) represents the starting point of a continuous block and the number of continuous blocks.
[0084] Step S33: Traverse each row of grids horizontally from top to bottom. For a single row of grids, traverse all grid cells from right to left in reverse order, and record the g(x,y) value of the corresponding coordinate of the traversed grid, where g(x,y) indicates whether there is a block in the traversed grid, and record the prefix information s(x,y):
[0085] ;
[0086] Among them, when there is a block in the traversed grid, g(x,y)=1, so s(x,y)=s(x,y+1)+1; when there is no block in the traversed grid, g(x,y)=0, so s(x,y)=0.
[0087] For example, Figure 6The position marked with "1" in the first row of marks indicates that there is one continuous block (that is, the number of continuous blocks is 1) and the position corresponding to it is the starting point of the continuous blocks. The corresponding coordinates of the grid corresponding to this position are g(x,y)=1, s(x,y)=s(x,y+1)+1; then the corresponding coordinates of the grid corresponding to the grid to the right of this position are g(x,y+1)=0, s(x,y+1)=0; therefore, the corresponding coordinates of the grid corresponding to this position are g(x,y)=1, s(x,y)=1.
[0088] Figure 6 The position marked "6" in the second row of the mark in the _ indicates that there are 6 consecutive blocks and the corresponding position is the starting point of the consecutive blocks. The corresponding coordinates of the grid corresponding to this position are g(x,y)=1, s(x,y)=s(x,y+1)+1; then the corresponding coordinates of the grid corresponding to the grid to the right of this position are g(x,y+1)=1, s(x,y+1)=s(x,y+2)+1; then the corresponding coordinates of the grid two grids to the right of this position are g(x,y+2)=1, s(x,y+2)=s(x,y+3)+1; then the corresponding coordinates of the grid three grids to the right of this position are g(x,y+3)=1, s(x,y+3)=s(x ,y+4)+1; then the coordinates of the grids four squares to the right of the position are g(x,y+4)=1, s(x,y+4)=s(x,y+5)+1; then the coordinates of the grids five squares to the right of the position are g(x,y+5)=1, s(x,y+5)=s(x,y+6)+1; then the coordinates of the grids six squares to the right of the position are g(x,y+6)=0, s(x,y+6)=0; therefore, the coordinates of the grids corresponding to this position are g(x,y)=1, s(x,y)=6.
[0089] Figure 6 The position marked "4" in the third row of marks in indicates that there are 4 consecutive blocks and the corresponding position is the starting point of the consecutive blocks. The coordinates of the grid corresponding to this position are g(x,y)=1, s(x,y)=s(x,y+1)+1; then the coordinates of the grid corresponding to the grid one grid to the right of this position are g(x,y+1)=1, s(x,y+1)=s(x,y+2)+1; then the coordinates of the grid corresponding to the grid two grids to the right of this position are g(x,y+2)=1, s(x,y+2)=s(x,y+3)+1; then the coordinates of the grid corresponding to the grid three grids to the right of this position are g(x,y+3)=1, s(x,y+3)=s(x,y+4)+1; then the coordinates of the grid corresponding to the grid four grids to the right of this position are g(x,y+4)=0, s(x,y+4)=0; therefore, the coordinates of the grid corresponding to this position are g(x,y)=1, s(x,y)=4.
[0090] By analogy, we can conclude Figure 6 The meanings of the marks "1", "2", "4", "5", and "6" are indicated.
[0091] Step S34: traverse each column of grids from left to right. For a single column of grids, traverse the prefix information s(x,y) corresponding to all grid cells from top to bottom.
[0092] Step S35: Determine whether there is continuous identical prefix information;
[0093] If there is continuous identical prefix information s(x+k,y), where k≥0, the grid areas corresponding to the continuous identical prefix information s(x+k,y) are merged to generate a quadrilateral, and s(x+k,y)=0 is set;
[0094] For example, in Figure 6 In a single-column grid, Figure 6 The fifth line mark "2" and the sixth line mark "2" in the figure are continuous identical prefix information. Specifically, the coordinates of the grid corresponding to the position of the fifth line mark "2" are g(x,y)=1, s(x,y)=2, and the coordinates of the grid corresponding to the position of the sixth line mark "2" are g(x+1,y)=1, s(x+1,y)=2; at this time, k=0 and 1. Therefore, the grid areas corresponding to the continuous identical prefix information s(x,y) and s(x+1,y) are merged to generate a quadrilateral.
[0095] However, the prefix information corresponding to the position marked "2" in the seventh row and the prefix information corresponding to the position marked "2" in the sixth row are not in the same column, so the grid areas corresponding to the two cannot be merged.
[0096] Otherwise, based on the prefix information s(x,y), generate a quadrilateral in the corresponding grid area and set s(x,y)=0;
[0097] It should be noted that setting s(x,y)=0 or s(x+k,y)=0 is for recalculation in the next traversal.
[0098] Step S36: Record all quadrilaterals, obtain the final center matrix array, and generate the center grid, such as Figure 5 The center is shown in C.
[0099] It should be noted that Figure 5 , 6 The center C in the figure is the center after rendering. Step S3 only generates the center grid, which is a procedural mark and has not been rendered yet. Therefore, only Figure 5 , 6 The center C in the figure is used to facilitate the understanding of the non-rendered center grid by those skilled in the art.
[0100] In the process of merging the center grid and the border grid in step S4, a grid instance is usually dynamically created in the running mode, including:
[0101] Create a new empty game object as the root and mount it on the root node of the grid;
[0102] Initialize all art asset information, store the original art asset information, and recycle the current mesh instance;
[0103] According to the original art asset information, the border grid generated in step S2, and the center grid generated in step S3, a grid instance is created to obtain the final model grid, that is, the grid instance of the model, such as Figure 7 shown.
[0104] The original art asset information includes the border (wall), top (also called water if it is a pool) and bottom (bottom). Figure 8 shown.
[0105] It should be noted that for grid drawing in the grid area, the edge is softened as the distance approaches to avoid jagged edges or moiré patterns in the distant grid; the line width also needs to be attenuated according to the distance.
[0106] The process of generating a quadrilateral mesh region includes:
[0107] Determine the system mode, where the system mode includes editor mode and run mode;
[0108] If the system is in editor mode, the mesh is drawn via the game object creator and needs to be edited;
[0109] If the system is in run mode, the grid is drawn by the grid painter without editing and placement.
[0110] After generating a quadrilateral mesh region covering the model, it listens to mouse events in real time and positions the mesh grid pointed by the real-time mouse.
[0111] The process of locating the grid grid pointed by the real-time mouse includes:
[0112] Determine the system mode, where the system mode includes editor mode and run mode;
[0113] If the system is in editor mode, the mouse click is determined by the event view by listening to the mouse events;
[0114] If the system is in running mode, the pointing ray is obtained through the main screen pointing ray camera, and collision detection is performed on the pointing ray to obtain the mouse click;
[0115] The grid cell pointed by the mouse is highlighted, so as to support the highlighted selection of the grid, such as Figure 4 shown.
[0116] A dynamic model nine-square grid system for games, comprising:
[0117] The model identification module is used to identify the regional scope of the model.
[0118] The grid area generation module is used to generate a grid area covering the model, and the grid area is larger than the area range of the model.
[0119] The mouse monitoring module is used to monitor events when the mouse points to the grid.
[0120] The mouse positioning module is used to locate the grid grid where the real-time mouse is pointing and highlight the pointing position.
[0121] The system mode judgment module is used to judge whether the system is in editor mode or running mode.
[0122] The border grid generation module is used to slice, reorganize and merge the edges of the model. The border grid generation module includes a grid polling component, a block detection component, a border generation component and a border recording component.
[0123] The grid polling component is used to poll all grid grids and the grids around the grid being polled in real time.
[0124] The block detection component is based on the recognized model and combined with the coordinates of the grid area. When a model exists at the position corresponding to the coordinates, a block is detected.
[0125] The border generation component is used to generate borders in the direction of the detected blocks around the grid.
[0126] The border record component is used to record the matrix information of each generated border unit and form the border matrix array information.
[0127] The center grid generation module is used to slice, reorganize and merge the center of the model. The center grid generation module includes a grid area coordinate system building component, a continuous block recording component, a grid traversal component, a block detection component, a continuous block attribute screening component, a quadrilateral generation component and a center recording component.
[0128] The grid area coordinate system building component is used to establish a two-dimensional coordinate system based on the grid area, where the grid position coordinates of the upper left corner are (0, 0), and the row direction of the grid area is the Y-axis direction, and the column direction is the X-axis direction.
[0129] The continuous block recording component is used to record the number of continuous blocks and determine the starting point of continuous blocks.
[0130] The grid traversal component is used to traverse all grid cells according to a certain rule.
[0131] The block detection component is based on the recognized model and combined with the coordinates of the grid area. When a model exists at the position corresponding to the coordinates, a block is detected.
[0132] The continuous block attribute filtering component is used to filter out the same number of connected blocks and the starting points of the continuous blocks are in the same grid column direction.
[0133] The quadrilateral generation component is used to generate quadrilaterals in the grid area corresponding to continuous blocks.
[0134] The center record component is used to record the matrix information of all generated quadrilateral units and form a center matrix array.
[0135] The model mesh generation module is used to merge the border mesh and the center mesh. The model mesh generation module includes an original art asset providing component, an initialization component, and a mesh instance creation component.
[0136] The original art asset providing component is used to provide original art asset information, wherein the original art asset information includes a border, a top surface, and a bottom surface.
[0137] Initialization component, used to initialize all art asset information and reduce the rendering of complex art assets.
[0138] The mesh instance creation component performs mesh merging based on the newly generated border mesh and center mesh, and then creates a mesh instance using the border, top and bottom surfaces of the original art asset to render the game object.
[0139] The above is only a preferred embodiment of the present invention, and does not limit the present invention in any form. Any technician familiar with the art can make many possible changes and modifications to the technical solution of the present invention by using the above disclosed methods and technical contents without departing from the scope of the technical solution of the present invention, or modify it into an equivalent embodiment of equivalent changes. Therefore, all equivalent changes made according to the shape, structure and principle of the present invention without departing from the content of the technical solution of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for gridding a dynamic model of a game, characterized in that: The following steps are involved: Step S1: The system identifies the model and generates a grid area covering the model; The process of generating a quadrilateral mesh region includes: Determine the system mode, where the system mode includes editor mode and run mode; If the system is in editor mode, the mesh is drawn via the game object creator; If the system is in the running mode, the grid is drawn by the grid drawer; Step S2: Slice, reorganize and merge the edges of the model to generate a border grid: poll all grid cells, generate a border in any direction where there are blocks around the real-time polled grid, record the matrix information of the generated border, and obtain the final border matrix array; Step S3: Slice, reorganize and merge the center of the model to generate a central grid: establish a two-dimensional coordinate system with the grid area, traverse each row of grids horizontally from top to bottom, and for a single row of grids, traverse all grid cells from right to left in reverse, record the g(x,y) value of the corresponding coordinate of the traversed grid, and record the prefix information s(x,y), where s(x,y) represents the starting point of the continuous blocks and the number of continuous blocks; when there is a block in the traversed grid, g(x,y)=1, then s(x,y)=s(x,y+1)+1; when there is no block in the traversed grid, g(x,y)=0, then s(x,y)=0; Traverse each column of grids from left to right. For a single column of grids, traverse the prefix information s(x,y) corresponding to all grid cells from top to bottom. Merge the grid areas corresponding to the consecutive same prefix information and generate a quadrilateral. Otherwise, generate a quadrilateral for the grid areas corresponding to the prefix information. Record all quadrilaterals and obtain the final center matrix array; Step S4: Merge the center grid in step S3 and the border grid in step S2 to obtain the final model grid.
2. A method for gridding a dynamic model of a game according to claim 1, characterized in that: After generating a quadrilateral mesh region covering the model, it listens to mouse events in real time and positions the mesh grid pointed by the real-time mouse.
3. A method for gridding a dynamic model of a game according to claim 1, characterized in that: The process of locating the grid grid pointed by the real-time mouse includes: Determine the system mode, where the system mode includes editor mode and run mode; If the system is in editor mode, the mouse click is determined by the event view by listening to the mouse events; If the system is in running mode, the pointing ray is obtained through the main screen pointing ray camera, and collision detection is performed on the pointing ray to obtain the mouse click; Highlight the grid cell where the mouse is pointing.
4. A method for gridding a dynamic model of a game according to claim 1, characterized in that: When the system is in run mode, a grid instance is created dynamically, including: Create a new empty game object as the root and mount it on the root node of the grid; Initialize all art asset information, store the original art asset information, and recycle the current mesh instance; A mesh instance is created according to the original art asset information, the border mesh generated in step S2, and the center mesh generated in step S3.
5. A method for gridding a dynamic model of a game according to claim 4, characterized in that: The original art asset information includes the border, top surface, and bottom surface.
6. A nine-square grid system for a dynamic model used in a game, used to implement a nine-square grid method for a dynamic model used in a game as described in any one of claims 1 to 5, characterized in that: include: A model identification module is used to identify the regional scope of the model; A grid region generating module, used for generating a grid region covering the model, the grid region being larger than the region range of the model; Mouse monitoring module, used to monitor events when the mouse points to the grid; The mouse positioning module is used to locate the grid where the real-time mouse is pointing and highlight the pointing position; A system mode determination module is used to determine whether the system is in editor mode or running mode; Border mesh generation module, used to slice, reorganize and merge the edges of the model; The center grid generation module is used to slice, reorganize and merge the center of the model; The model mesh generation module is used to merge the border mesh and the center mesh.
7. A nine-square grid system for dynamic model used in games as claimed in claim 6, characterized in that: The border grid generation module includes: The grid polling component is used to poll all grid grids and the grids around the grid being polled in real time; The block detection component is based on the recognized model and combined with the coordinates of the grid area. When there is a model at the position corresponding to the coordinates, the block is detected. The border generation component is used to generate borders in the direction of the detected blocks around the grid; The border record component is used to record the matrix information of each generated border unit and form the border matrix array information.
8. A nine-square grid system for dynamic model games as claimed in claim 6, characterized in that: The central grid generation module comprises: The grid area coordinate system building component is used to establish a two-dimensional coordinate system based on the grid area, where the grid position coordinates of the upper left corner are (0, 0), and the row direction of the grid area is the Y-axis direction, and the column direction is the X-axis direction; A continuous block recording component is used to record the number of continuous blocks and determine the starting point of continuous blocks; The grid traversal component is used to traverse all grid cells according to a certain rule; The block detection component is based on the recognized model and combined with the coordinates of the grid area. When there is a model at the position corresponding to the coordinates, the block is detected. The continuous block attribute filtering component is used to filter out the same number of connected blocks and the starting points of the continuous blocks are in the same grid column direction; Quadrilateral generation component, used to generate quadrilaterals in the grid area corresponding to continuous blocks; The center record component is used to record the matrix information of all generated quadrilateral units and form a center matrix array.
9. A nine-square grid system for dynamic model games as claimed in claim 6, characterized in that: The model grid generation module includes: The original art asset providing component is used to provide original art asset information, wherein the original art asset information includes a border, a top surface, and a bottom surface; Initialization component, used to initialize all art asset information and reduce the rendering of complex art assets; The mesh instance creation component performs mesh merging based on the newly generated border mesh and center mesh, and then creates a mesh instance using the border, top and bottom surfaces of the original art asset to render the game object.
Citation Information
Patent Citations
Rendering engine, implementation method and producing tools for 3D web game
CN105354872A
Method for rendering game, and method, apparatus and device for generating game resource file
WO2019015591A1