A 2D game scene hierarchical configuration method, device and computer program product
By using an automated generation and review-based correction method for hierarchical configuration, the problem of time-consuming and labor-intensive item hierarchy configuration in 2D game scenes has been solved, achieving efficient and accurate hierarchical relationship management and reducing the error rate.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING JINGJIA TECH CO LTD
- Filing Date
- 2024-09-04
- Publication Date
- 2026-07-21
AI Technical Summary
In traditional 2D game scenes, the method of configuring item hierarchy requires manual deployment, which is time-consuming, labor-intensive, and prone to operational errors, leading to incorrect visual relationships.
By constructing a standard coordinate system, a hierarchical vector is established for each prefabricated body. Based on the hierarchical relationship configuration rules, hierarchical relationships are automatically generated. Combined with the correction information from the review end, a hierarchical relationship topology diagram of the prefabricated body is constructed. Topological loops are checked to ensure the correctness of the hierarchical relationships, and automatic configuration is performed when necessary.
It enables automated configuration of multiple prefab layers in 2D game scenes, reducing error rates, improving configuration efficiency, and ensuring the accuracy of visual relationships and efficient management of complex scenes.
Smart Images

Figure CN119201104B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, and computer program product for hierarchical configuration of 2D game scenes. Background Technology
[0002] During game development, items within a scene need to be configured and displayed in a hierarchical manner according to visual relationships to ensure an immersive gameplay experience for players. Traditional methods of configuring these hierarchical levels require manual deployment by scene designers, arranging each art scene and prefab individually—a time-consuming and labor-intensive process. In complex scenes with many objects, manually setting the hierarchy one by one can lead to operational errors, causing visual relationship inconsistencies when introducing new items or when characters are present. Therefore, a new solution for efficiently configuring hierarchical levels is urgently needed. Summary of the Invention
[0003] In view of this, embodiments of the present invention provide a hierarchical configuration method, apparatus and computer program product for 2D game scenes, so as to eliminate or improve one or more defects existing in the prior art and solve the problem that the prior art cannot efficiently perform automated hierarchical configuration of a large number of items in 2D game scenes.
[0004] One aspect of the present invention provides a method for hierarchical configuration of a 2D game scene, the method comprising the following steps: Construct a standard coordinate system. For multiple prefabs deployed in the target scene, starting from the lower left pixel of the prefab, establish a corresponding hierarchical vector along the positive X-axis of the standard coordinate system with the width of the prefab as the vector length. Obtain hierarchical relationship configuration rules, which determine the hierarchical relationship between the prefabs based on the hierarchical vector of the prefab; among the prefabs that overlap, according to the relative positional relationship between adjacent hierarchical vectors, the prefab located on the side closer to the observer's angle is configured as a higher display level, and the prefab located on the side farther from the observer's angle is configured as a lower display level; When a display hierarchy error exists, the system receives hierarchy vector correction information from a preset review end. The hierarchy vector correction information marks a hierarchy vector correction instruction that adjusts the starting point, length, direction, and / or splits each of the hierarchy vectors. The hierarchy vector correction instruction reconfigures the corresponding hierarchy vectors for prefabricated objects that display overlap and have incorrect hierarchy relationships according to the shape of the prefabricated object's landing surface. The corrected direction is either the positive X-axis or the negative Y-axis of the standard coordinate system, and the corrected hierarchy vectors do not intersect each other. Construct a hierarchical relationship topology diagram of the prefabricated body, which is used to record the displayed hierarchical relationship between each hierarchical vector and other adjacent hierarchical vectors; Check if there is a topological cycle in the hierarchical relationship topology diagram of the prefabricated body. If the topological cycle exists, generate an error message to the preset review terminal to prompt the preset review terminal to provide new hierarchical vector correction information. If the topological cycle does not exist, output the prefabricated body topology queue and generate a hierarchical configuration for the prefabricated body according to the prefabricated body topology queue.
[0005] In some embodiments, the method further includes: The prefabricated structures in the target scene are divided into multiple scene groups according to scene relationships; Receive scene group hierarchy configuration instructions, configure hierarchy values for each scene group respectively, and distinguish the display hierarchy according to the size of the hierarchy values.
[0006] In some embodiments, if the method displays the target scene from a 45° top-down perspective, then the side on the right of the adjacent layer vectors is the side closest to the observer's angle and has a higher display layer; the side on the left of the adjacent layer vectors is the side furthest from the observer's angle and has a lower display layer.
[0007] In some embodiments, the method further includes: A character positioning point is set for a character moving in the target scene, and the character positioning point moves in the target scene based on the user's action command; Based on the real-time position of the character in the target scene and the size of the image displayed by the character, determine one or more intermediate prefabs in the target scene that overlap with the character; Determine the relative positional relationship between the character's positioning point and the hierarchical vector of the intermediate prefab, and determine the display level of the character according to the hierarchical relationship configuration rules and the hierarchical configuration of the intermediate prefab in the target scene.
[0008] In some embodiments, before constructing a standard coordinate system and establishing a corresponding hierarchical vector for each prefab deployed in the target scene, taking the lower left corner pixel of the prefab as the starting point and the width of the prefab as the vector length along the positive X-axis of the standard coordinate system, the method further includes: The prefabricated body is divided into a background layer, a ground layer, and an object layer. The background layer and the ground layer are configured to have a lower display level than the object layer. Subsequently, only the prefabricated body within the object layer is configured with a higher display level.
[0009] In some embodiments, after checking whether a topological cycle exists in the hierarchical relationship topology diagram of the prefabricated body, and if the topological cycle exists, generating an error message to the preset review terminal, the method further includes: Find the identification information of all relevant abnormal prefabricated bodies within the topology ring, and highlight the abnormal prefabricated bodies according to the identification information in a preset format.
[0010] In some embodiments, the preset format includes: adding an anomaly indicator display, highlighting the anomaly, or adding a red-temperature tinting display.
[0011] On the other hand, the present invention also provides a hierarchical configuration device for prefabs in a 2D game scene, including a processor, a memory, and a computer program / instructions stored in the memory. The processor is used to execute the computer program / instructions, and when the computer program / instructions are executed, the device implements the steps of the above method.
[0012] On the other hand, the present invention also provides a computer-readable storage medium having a computer program / instructions stored thereon, which, when executed by a processor, implements the steps of the method described above.
[0013] On the other hand, the present invention also provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the above-described method.
[0014] The beneficial effects of the present invention are at least as follows: The 2D game scene layer configuration method, device, and computer program product described in this invention automatically generates layer vectors based on the images of prefabs formed during the art creation stage. The relative positional relationships between these layer vectors reflect the relative relationships of the prefabs in the display hierarchy. Combined with the correction of the layer vectors by the review process, a topology graph of the prefab layer relationships is constructed. The correctness of the layer relationships is verified by checking for the existence of topological cycles in the topology graph. When no topological cycle exists, the topology queue is directly output, automatically generating the layer configuration for each prefab. This achieves automated configuration of multiple prefab layers in complex scenes, reducing the error rate.
[0015] Furthermore, by setting the overall hierarchy of the established scene groups, it is possible to split and combine the configuration tasks of complex scene hierarchy, enabling more efficient setting of hierarchy for complex scenes.
[0016] Furthermore, for characters in the scene, by constructing character positioning points, identifying the relative positional relationship of the hierarchical vectors of the intermediate prefabs that overlap with them, and combining the already determined hierarchical configuration of the intermediate prefabs in the target scene, the display level of the character can be directly determined, which can ensure real-time dynamic updates and is more efficient.
[0017] Additional advantages, objects, and features of the invention will be set forth in part in the description which follows, and will also become apparent in part to those skilled in the art upon studying the description, or may be learned by practice of the invention. The objects and other advantages of the invention can be realized and obtained by means of the structures specifically pointed out in the description and drawings.
[0018] Those skilled in the art will understand that the objectives and advantages achievable with the present invention are not limited to those specifically described above, and that the above and other objectives achievable with the present invention will become clearer from the following detailed description. Attached Figure Description
[0019] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, are not intended to limit the scope of the invention. In the drawings: Figure 1 This is a flowchart illustrating a hierarchical configuration method for a 2D game scene according to an embodiment of the present invention.
[0020] Figure 2 This is a schematic diagram illustrating the process of executing scene group hierarchical configuration in a hierarchical configuration method for a 2D game scene according to an embodiment of the present invention.
[0021] Figure 3 This is a schematic diagram illustrating the process of executing character hierarchy configuration in a hierarchical configuration method for a 2D game scene according to an embodiment of the invention.
[0022] Figure 4 This is a diagram illustrating the generation of layer vectors for each prefab in the layer configuration method of a 2D game scene according to an embodiment of the present invention.
[0023] Figure 5 This is a diagram illustrating the method for configuring the hierarchy of a 2D game scene according to an embodiment of the present invention, specifically for correcting the hierarchy vectors of vertical railings and steps. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the embodiments and accompanying drawings. Here, the illustrative embodiments and descriptions of this invention are used to explain the invention, but are not intended to limit the invention.
[0025] It should also be noted that, in order to avoid obscuring the invention with unnecessary details, only the structures and / or processing steps closely related to the solution according to the invention are shown in the accompanying drawings, while other details that are not closely related to the invention are omitted.
[0026] It should be emphasized that the term "including / comprises" as used herein refers to the presence of a feature, element, step, or component, but does not exclude the presence or addition of one or more other features, elements, steps, or components.
[0027] In 2D game scenes, the main challenge in setting up item hierarchy lies in handling the relationship between characters and multiple objects in dynamic scenes, especially in isometric perspectives or complex interactive scenes. Ensuring that characters and items maintain reasonable occlusion effects across different positions and actions, while avoiding visual clutter and hierarchy conflicts, is a challenge requiring meticulous tuning and management. Typically, scene designers need to manually set the item hierarchy based on design drawings. Due to the large number of objects in a scene, this workload is considerable, and manual layer setting is prone to errors. Furthermore, the presence of walking characters in the scene exposes even more hierarchy issues, which are not easily detected during the scene setup phase.
[0028] To address the aforementioned issues, this application provides a method for configuring the hierarchy of 2D game scenes, such as... Figure 1 As shown, the method includes the following steps S101~S105: Step S101: Construct a standard coordinate system. For the multiple prefabs deployed in the target scene, starting from the lower left corner pixel of the prefab, establish a corresponding hierarchical vector along the positive X-axis of the standard coordinate system with the width of the prefab as the vector length.
[0029] Step S102: Obtain the hierarchical relationship configuration rules. The hierarchical relationship configuration rules determine the hierarchical relationship between prefabs based on the hierarchical vector of the prefab. Among the prefabs that overlap, according to the relative positional relationship between adjacent hierarchical vectors, the prefab located on the side closer to the observer's angle is configured as a higher display level, and the prefab located on the side farther from the observer's angle is configured as a lower display level.
[0030] Step S103: When there is a display hierarchy error, receive the hierarchy vector correction information from the preset review end. The hierarchy vector correction information marks the hierarchy vector correction instructions to adjust the starting point, length, direction and / or split the hierarchy vectors. The hierarchy vector correction instructions reconfigure the corresponding hierarchy vectors of the prefabricated bodies with overlapping and incorrect hierarchy relationships according to the shape of the prefabricated body's landing surface. The corrected direction is the positive X-axis or negative Y-axis of the standard coordinate system, and there is no intersection between the corrected hierarchy vectors.
[0031] Step S104: Construct a prefab hierarchical relationship topology diagram. The prefab hierarchical relationship topology diagram is used to record the displayed hierarchical relationship between each level vector and other adjacent level vectors.
[0032] Step S105: Check if there is a topological cycle in the prefabricated body hierarchical relationship topology diagram. If a topological cycle exists, generate an error message to the preset review terminal to prompt the preset review terminal to provide new hierarchical vector correction information. If no topological cycle exists, output the prefabricated body topology queue and generate hierarchical configuration for the prefabricated body according to the prefabricated body topology queue.
[0033] In step S101, the standard coordinate system can be deployed according to the blocks presented on the display interface, with the lower left corner as the origin, the positive X-axis to the right, and the positive Y-axis upwards. The target scene is a 2D game scene where items need to be deployed, which is the environment in which the characters move in the game. The prefabs deployed in the target scene include buildings, furniture, props, plants, animals, and other items created by the artists. The prefabs are presented in the form of images. Each prefab is created independently and placed in the target scene by the scene creators.
[0034] In this invention, the initial stage involves the program directly generating a hierarchical vector for each prefab. Starting from the bottom left pixel of the prefab, the vector length is the width of the prefab along the positive X-axis of the standard coordinate system. This process is fully automated and requires no human intervention. For multiple prefabs in complex scenes, the corresponding hierarchical vectors can be generated with a single click. For example... Figure 4 As shown, corresponding hierarchical vectors were automatically generated for all prefabs in the figure.
[0035] In step S102, the hierarchical relationship configuration rule is a standard for determining the hierarchical relationship based on the relative positions of hierarchical vectors. Effectively, the side closest to the observer's angle is configured as a higher display level, and vice versa. For example, if the method sets the target scene to be displayed from a 45° overhead viewpoint, then among adjacent hierarchical vectors, the one on the right is the side closest to the observer's angle and has a higher display level; the one on the left is the side furthest from the observer's angle and has a lower display level. Specifically, in the initial stage, all vectors have the same direction. For two adjacent hierarchical vectors, the direction of observation from the vector's starting point towards the X-axis is used to distinguish whether the adjacent vector is on the left or right, where the right side has a higher display level than the left.
[0036] In step S103, the hierarchical vectors of each automatically generated prefab may exhibit display errors due to the hierarchical relationship configuration rules. In this case, adjustments are made by receiving hierarchical vector correction information from the review end to eliminate these errors. Specifically, considering the prefab table and floor conditions, the hierarchical vectors of erroneous objects are corrected. For example, for a prefab with a vertically arranged, elongated railing image, the hierarchical vectors can be adjusted to be deployed from left to right and top to bottom according to the shape of its contact surface, but the direction must be along the negative Y-axis, ensuring no vector intersections. Generally, all prefabs in the scene are arranged along the axes of the standard coordinate system, so the automatically generated and corrected hierarchical vectors are either along the positive X-axis or the negative Y-axis. Figure 5 As shown, vector 1 represents the level vector of the vertical railing, and vector 2 represents the level vector of the steps. The level vectors of the vertical railing and steps are corrected to point in the negative Y-axis direction according to the ground plane; at this point, the level displayed on the right is higher than that on the left.
[0037] In steps S104 and S105, according to the hierarchical relationship configuration rules, the relative hierarchical relationships between all corrected hierarchical vectors are analyzed. Based on this relationship, a prefab hierarchical relationship topology diagram can be constructed. In principle, on each topology link, the hierarchical relationship should descend step by step, and there should be no topology loop, i.e., A's level is higher than B, B's level is higher than C, and C's level is higher than A. By checking whether a topology loop exists, hierarchical relationship errors can be directly reviewed. If a topology loop exists, the preset review terminal is prompted to process it. Otherwise, a prefab topology queue is output based on the prefab hierarchical relationship topology diagram, and hierarchical configurations are automatically generated according to the order of the queue. For example, in a prefab topology queue, the objects whose hierarchical vector position relationships are recorded from left to right are A, B, C, and D, respectively. Then, the level of A is configured as 1, the level of B as 2, the level of C as 3, and the level of D as 4. There is also a prefab queue that records the hierarchical vector positional relationships of objects A, E and F, and C and F from left to right. Therefore, the hierarchical level of E is configured as 2, and the hierarchical level of F is configured as 4.
[0038] In some embodiments, such as Figure 2 As shown, the method further includes steps S201-S202: Step S201: Divide the prefabs in the target scene into multiple scene groups according to scene relationships.
[0039] Step S202: Receive scene group hierarchy configuration instructions, configure hierarchy values for each scene group respectively, and distinguish the display hierarchy according to the size of the hierarchy values.
[0040] In some embodiments, such as Figure 3As shown, the method further includes steps S301 to S303: Step S301: Set a character positioning point for the character moving in the target scene. The character positioning point moves in the target scene based on the user's action commands.
[0041] Step S302: Based on the real-time position of the character in the target scene and the size of the image displayed by the character, determine one or more intermediate prefabs in the target scene that overlap with the character.
[0042] Step S303: Determine the relative positional relationship between the character's positioning point and the hierarchical vector of the intermediate prefab. According to the hierarchical relationship configuration rules and the hierarchical configuration of the intermediate prefab in the target scene, determine the character's display level.
[0043] In steps S301-S303, the movement of characters in the game, including player characters and non-player characters, needs to be updated and determined in real time. Based on steps S101-S105 and steps S201-S204, the hierarchical vectors of prefabs and scene groups in the target scene, along with their corresponding hierarchical levels, are determined. A character positioning point is set for the character, and this vector should be configured to allow movement within the scene based on player control. When the position changes, the positional relationship between the character positioning point and the hierarchical vectors of other prefabs or scene groups also changes. For one or more intermediate prefabs or scene groups with overlapping display, the positional relationship between the character positioning point and the relevant hierarchical vectors is redefined. Based on this, combined with the pre-configured hierarchical levels of the prefabs and scene groups, the character's display level is determined.
[0044] In some embodiments, a standard coordinate system is constructed. For multiple prefabs deployed in the target scene, starting from the lower left pixel of the prefab, a vector is constructed along the positive X-axis of the standard coordinate system with the width of the prefab as the vector length. Before establishing a corresponding hierarchical vector for each prefab, the method further includes: dividing the prefab into a background layer, a ground layer, and an object layer; configuring the background layer and the ground layer to have a display hierarchy lower than the object layer; and subsequently configuring the hierarchy only for the prefabs within the object layer.
[0045] In some embodiments, after checking whether there is a topological loop in the hierarchical relationship topology diagram of the prefabricated body, and generating an error message to the preset review terminal if a topological loop exists, the method further includes: finding the identification information of all abnormal prefabricated bodies related to the topological loop, and highlighting the abnormal prefabricated bodies in a preset form according to the identification information.
[0046] In some embodiments, the preset format includes: adding an anomaly indicator display, highlighting the anomaly, or adding a red-temperature tinting display.
[0047] On the other hand, the present invention also provides a hierarchical configuration device for prefabs in a 2D game scene, including a processor, a memory, and a computer program / instructions stored in the memory. The processor is used to execute the computer program / instructions, and when the computer program / instructions are executed, the device implements the steps of the above method.
[0048] On the other hand, the present invention also provides a computer-readable storage medium having a computer program / instructions stored thereon, which, when executed by a processor, implements the steps of the method described above.
[0049] On the other hand, the present invention also provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the above-described method.
[0050] The present invention will now be described with reference to a specific embodiment: This embodiment provides a method for setting the hierarchy of a 2D game scene, including the following steps: 1. Set the background to the Background layer, the ground to the Ground layer, and all items to the Item layer.
[0051] 2. Divide the different courtyards in the scene into different groups, attach a grouping script, and manually set the group number. The group number represents the overall hierarchical relationship between the courtyards.
[0052] 3. Based on the object's ground contact, set up a layer vector group for the object in the scene. Starting from the bottom left pixel of the object, create a corresponding layer vector for each object along the positive X-axis of the standard coordinate system, with the object's width as the vector length. After decomposition, the layer vector should always ensure that x is positive and y is negative. During initialization, the layer vector is automatically generated by the script for the object. This vector may not be completely accurate and may require manual adjustment. The vector itself does not contain position information; the vector stored in the prefab only has direction and length. However, the layer vector line segments drawn in the provided example image already contain position information.
[0053] 4. Among overlapping items, based on the relative positional relationship between adjacent layer vectors, items located near the observer's angle are configured with a higher display layer, and items located far from the observer's angle are configured with a lower display layer. When displaying the target scene from a 45° overhead viewpoint, the item on the right side of the adjacent layer vectors is the side near the observer's angle and has a higher display layer; the item on the left side is the side far from the observer's angle and has a lower display layer.
[0054] Then click the automatic scene setting button. Based on the execution of the above rules, you can check whether the automatically calculated scene hierarchy effect meets expectations. If an error occurs or the effect does not meet expectations, the vectors need to be rearranged in the scene. Errors do not occur frequently. The main reason for them is due to position or vector intersection.
[0055] 5. Iterate through all groups in the scene. For each item in a group, calculate all other possible overlapping items based on the item's position and size (automatically calculated by the script and stored in the prefab). This step requires adding the character's reserved width and height. Iterate through all possible overlapping items, combining the item's and its potentially overlapping item's layer vector groups with its own placement position to determine the topological order of the two items. The rule is that if the direction line segment of item A is to the right of all direction line segments of item B, then A's topological order is considered higher than B's. For example, if an item's vector is stored as (1,2), but when it is placed at position (0,0), the rectangle it represents is a vector line segment starting from (0,0) and pointing to the end point (1,2), while when placed at position (1,1), it is a vector line segment pointing from (1,1) to the end point (2,3). The method for determining the hierarchical relationship between items A and B is to traverse all the starting and ending points of item A's vector group and all the vectors of item B's vector group. If all the points of item A are on one side of the vectors of item B, then whether item A is on the right or left side determines whether item A is on a higher or lower level than item B. If there are inconsistent results, then the method is reversed: traverse all the starting and ending points of item B's vector group and all the vectors of item A's vector group, using the same method. If there are still inconsistent results, it means that the two cannot be correctly determined to form a cycle, and an error message is returned. A topology graph is constructed for each group.
[0056] 6. Check the topology graph; if a topological cycle exists, report an error.
[0057] 7. In the absence of a topological cycle, output the topological queue and perform layer calculations for each item in the topological queue in turn.
[0058] 8. When the character moves in the scene, acquire the surrounding items that overlap with the character, and set the character's level according to the topological relationship between the character and the items (the topological relationship calculation is the same as the previous topological relationship calculation rule between items, except that the character is calculated using points).
[0059] Corresponding to the above method, the present invention also provides an apparatus / system including a computer device, the computer device including a processor and a memory, the memory storing computer instructions, the processor executing the computer instructions stored in the memory, and when the computer instructions are executed by the processor, the apparatus / system performs the steps of the method as described above.
[0060] This invention also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the aforementioned edge computing server deployment method. The computer-readable storage medium can be a tangible storage medium, such as random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, floppy disks, hard disks, removable storage disks, CD-ROMs, or any other form of storage medium known in the art.
[0061] In summary, the hierarchical configuration method, apparatus, and computer program product for 2D game scenes described in this invention automatically generates hierarchical vectors based on the images of prefabs formed during the art creation stage. The relative positional relationships between these vectors reflect the relative relationships of the prefabs in the display hierarchy. Combined with the correction of the hierarchical vectors by the review process, a topology graph of the prefab hierarchy is constructed. The correctness of the hierarchical relationships is verified by checking for the existence of topological cycles in the graph. When no topological cycle exists, the topology queue is directly output, automatically generating the hierarchical configuration for each prefab. This achieves automated configuration of multiple prefab levels in complex scenes, reducing the error rate.
[0062] Furthermore, by setting the overall hierarchy of the established scene groups, it is possible to split and combine the configuration tasks of complex scene hierarchy, enabling more efficient setting of hierarchy for complex scenes.
[0063] Furthermore, for characters in the scene, by constructing character positioning points, identifying the relative positional relationship of the hierarchical vectors of the intermediate prefabs that overlap with them, and combining the already determined hierarchical configuration of the intermediate prefabs in the target scene, the display level of the character can be directly determined, which can ensure real-time dynamic updates and is more efficient.
[0064] Those skilled in the art will understand that the exemplary components, systems, and methods described in conjunction with the embodiments disclosed herein can be implemented in hardware, software, or a combination of both. Whether implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this invention. When implemented in hardware, it can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this invention are programs or code segments used to perform the desired tasks. The programs or code segments can be stored in a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried in a carrier wave.
[0065] It should be clarified that the present invention is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of the present invention.
[0066] In this invention, features described and / or illustrated for one embodiment may be used in the same or similar manner in one or more other embodiments, and / or combined with or in place of features of other embodiments.
[0067] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, various modifications and variations of the embodiments of the present invention are possible. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for configuring the hierarchy of a 2D game scene, characterized in that, The method includes the following steps: Construct a standard coordinate system. For multiple prefabs deployed in the target scene, starting from the lower left pixel of the prefab, establish a corresponding hierarchical vector along the positive X-axis of the standard coordinate system with the width of the prefab as the vector length. Obtain hierarchical relationship configuration rules, which determine the hierarchical relationship between the prefabs based on the hierarchical vector of the prefab; among the prefabs that overlap, according to the relative positional relationship between adjacent hierarchical vectors, the prefab located on the side closer to the observer's angle is configured as a higher display level, and the prefab located on the side farther from the observer's angle is configured as a lower display level; When a display hierarchy error exists, the system receives hierarchy vector correction information from a preset review end. The hierarchy vector correction information marks a hierarchy vector correction instruction that adjusts the starting point, length, direction, and / or splits each of the hierarchy vectors. The hierarchy vector correction instruction reconfigures the corresponding hierarchy vectors for prefabricated objects that display overlap and have incorrect hierarchy relationships according to the shape of the prefabricated object's landing surface. The corrected direction is either the positive X-axis or the negative Y-axis of the standard coordinate system, and the corrected hierarchy vectors do not intersect each other. The prefabs in the target scene are divided into multiple scene groups according to scene relationships; a scene group hierarchy configuration instruction is received, and hierarchy values are configured for each scene group to distinguish the display hierarchy according to the size of the hierarchy values, including: traversing each prefab in each scene group of the target scene, calculating all other possible overlapping prefabs based on the position and size of the prefab; traversing other possible overlapping prefabs, combining the hierarchy vector of the prefab and its possible overlapping prefabs with its own placement position to determine the topological order of the two prefabs; determining the hierarchy between prefab A and prefab B. When determining the hierarchical relationship, iterate through all the start and end points of the level vectors of prefab A and all the level vectors of prefab B. If all the start and end points of the level vectors of prefab A are on one side of the level vectors of prefab B, then determine whether prefab A is at a higher or lower level than prefab B based on whether it is on the right or left. If there are inconsistent results, then reverse the process and iterate through all the start and end points of the level vectors of prefab B and all the level vectors of prefab A, using the same determination method. If there are still inconsistent results, it means that the hierarchical relationship between prefab A and prefab B cannot be correctly determined, and an error message is returned. Construct a hierarchical relationship topology diagram of the prefabricated body, which is used to record the displayed hierarchical relationship between each hierarchical vector and other adjacent hierarchical vectors; Check if there is a topological cycle in the hierarchical relationship topology diagram of the prefabricated body. If the topological cycle exists, generate an error message to the preset review terminal to prompt the preset review terminal to provide new hierarchical vector correction information. If the topological cycle does not exist, output the prefabricated body topology queue and generate a hierarchical configuration for the prefabricated body according to the prefabricated body topology queue.
2. The hierarchical configuration method for a 2D game scene according to claim 1, characterized in that, In the method described above, the target scene is displayed from a 45° overhead viewpoint. In the adjacent layer vectors, the side on the right is the side closest to the observer's angle and has a higher display layer; the side on the left is the side furthest from the observer's angle and has a lower display layer.
3. The hierarchical configuration method for 2D game scenes according to claim 1, characterized in that, The method further includes: A character positioning point is set for a character moving in the target scene, and the character positioning point moves in the target scene based on the user's action command; Based on the real-time position of the character in the target scene and the size of the image displayed by the character, determine one or more intermediate prefabs in the target scene that overlap with the character; Determine the relative positional relationship between the character's positioning point and the hierarchical vector of the intermediate prefab, and determine the display level of the character according to the hierarchical relationship configuration rules and the hierarchical configuration of the intermediate prefab in the target scene.
4. The hierarchical configuration method for a 2D game scene according to claim 1, characterized in that, Before establishing a standard coordinate system and, for multiple prefabs deployed in the target scene, taking the lower left corner pixel of each prefab as the starting point and the width of the prefab as the vector length along the positive X-axis of the standard coordinate system, the method further includes: The prefabricated body is divided into a background layer, a ground layer, and an object layer. The background layer and the ground layer are configured to have a lower display level than the object layer. Subsequently, only the prefabricated body within the object layer is configured with a higher display level.
5. The hierarchical configuration method for a 2D game scene according to claim 1, characterized in that, After verifying whether the hierarchical relationship topology diagram of the prefabricated body contains a topology loop, and if the topology loop exists, generating an error message to the preset review terminal, the method further includes: Find the identification information of all relevant abnormal prefabricated bodies within the topology ring, and highlight the abnormal prefabricated bodies according to the identification information in a preset format.
6. The hierarchical configuration method for a 2D game scene according to claim 5, characterized in that, The preset formats include: adding an anomaly indicator display, highlighting the anomaly, or adding a red-temperature coloring display.
7. A hierarchical configuration device for prefabs in a 2D game scene, comprising a processor, a memory, and computer programs / instructions stored in the memory, characterized in that, The processor is configured to execute the computer program / instructions, and when the computer program / instructions are executed, the device implements the steps of the method as described in any one of claims 1 to 6.
8. A computer-readable storage medium having a computer program / instructions stored thereon, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method as described in any one of claims 1 to 6.
9. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method described in any one of claims 1 to 6.