A mechanism generation system based on a three-dimensional coordinate system
By using a 3D coordinate system generation system based on the cocos2djs engine, the problem of low configuration efficiency in map game development is solved, and the visualization configuration and efficient management of map scenes and exploration mechanisms are realized.
Patent Information
- Application Number
- CN202211066139.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-31
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2042-08-31
AI Technical Summary
Existing technologies are inefficient and error-prone in configuring map scenes and exploration mechanisms during map game development, and cannot perform visual operations.
A 3D coordinate system generation system based on the cocos2djs engine is adopted. Through basic data acquisition, building entity generation, mapping module and relation network export module, the system realizes the visualization configuration of the map and the automatic export of mechanism relations.
It improves the efficiency of map exploration mechanism configuration, reduces the probability of configuration errors, and achieves intuitive operation and efficient data management.
Smart Images

Figure CN115409967B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of game software technology, and in particular to a mechanism generation system based on a three-dimensional coordinate system. Background Technology
[0002] Map-based games are a common game genre. During map game development, designers need to create various map scenarios and exploration mechanisms to ensure gameplay diversity and increase game enjoyment. A common approach is to configure map elements and exploration mechanisms in an Excel spreadsheet. However, this method lacks visual and intuitive operation on the map, is prone to errors during configuration, and becomes extremely labor-intensive and inefficient when dealing with a large number of maps. Summary of the Invention
[0003] To address the aforementioned problems, this invention provides a mechanism generation system based on a three-dimensional coordinate system.
[0004] The present invention adopts the following technical solution:
[0005] A mechanism generation system based on a three-dimensional coordinate system is provided. The mechanism generation system is implemented based on the cocos2djs engine and includes a basic data acquisition module, a building entity generation module, a mapping module, a mechanism module, and a relationship network export module.
[0006] The basic data acquisition module is used to collect building type, building skin and event type, and assign a unique corresponding building type code, building skin code and event code to each;
[0007] The building entity generation module constructs building entities based on the data collected by the basic data acquisition module and assigns them unique entity codes. The data structure of the building entity includes the building type and building skin. The entity code uses the map's x-axis coordinates, y-axis coordinates, and z-axis coordinates as generation parameters.
[0008] The mapping module loads the building entity into the corresponding map grid and binds the grid coordinates with the entity code to form a mapping relationship;
[0009] The mechanism module is used to build mechanism entities and assign unique mechanism entity codes. The mechanism entity is the correspondence between conditions and results. The data structure of the mechanism entity includes the building entity code of the condition, the event code of the condition, the building entity code of the result, and the event code of the result. The building entity code of the condition corresponds to at least one building entity code of the result.
[0010] The relationship network export module traverses each cell of the map, uses the building entity corresponding to the map cell as the building entity of the condition, and finds the building entity of the corresponding result according to the mechanism entity in the mechanism module, so as to generate and export the relationship queue of conditions and results.
[0011] Furthermore, the building type and building type code are stored in a building type pool.
[0012] Furthermore, the building skin and building skin code are stored in the building skin pool.
[0013] Furthermore, the event type and the event type are stored in the event type pool.
[0014] Furthermore, the x-axis and y-axis coordinates are used to represent the planar position of the building entity on the map, and the z-axis coordinate is used to represent the floor where the building entity is located.
[0015] Furthermore, the data from the building entity generation module, the mapping module, and the mechanism module are all written to a local storage device.
[0016] Furthermore, the data in the relation queue is organized into corresponding format strings and written to an external storage device.
[0017] By adopting the above technical solution, the present invention has the following advantages compared with the prior art:
[0018] The mechanism generation system of this invention is based on the cocos2djs engine to achieve visual operation, which allows planners to intuitively operate and configure the map on the cocos2djs development interface, reducing the probability of errors when configuring map exploration mechanisms. In addition, the system can automatically export the relationship network of the mechanism into a relationship queue, which greatly improves the configuration efficiency. Attached Figure Description
[0019] Figure 1 This is a structural diagram of the mechanism generation system of the present invention. Detailed Implementation
[0020] 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 accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0021] Example
[0022] like Figure 1As shown, a mechanism generation system based on a three-dimensional coordinate system is disclosed. The mechanism generation system includes a basic data acquisition module, a building entity generation module, a mapping module, a mechanism module, and a relationship network export module. The mechanism generation system is implemented based on the cocos2djs engine.
[0023] The basic data acquisition module is used to collect building type, building skin and event type, and assign a unique corresponding building type code, building skin code and event code to each; wherein, the building type and building type code are stored in the building type pool, the building skin and building skin code are stored in the building skin pool, and the event type and event type are stored in the event type pool.
[0024] The basic data acquisition module achieves its functions through the following steps:
[0025] S1. Construct the basic data acquisition module, specifically:
[0026] S11. Classify the buildings on the map and assign a unique building type code to each building type. The building types can be divided into several major categories according to actual needs, such as: monster type, switch type, etc. These types will be collected into the building type pool, and each building type corresponds to a unique building type code.
[0027] S12. Separate the skins used for architectural display, assign a unique architectural skin code to each skin, and collect and store the architectural skins and architectural skin codes in the architectural skin pool;
[0028] S13. Classify the events in the mechanism and assign a unique event code to each event type. Based on the actual situation of the game, divide the events in the mechanism into several major categories, such as: combat type, activation type, display type, disappearance type, etc. These types will be collected into the event type pool, and each event type has a unique event code.
[0029] The building entity generation module constructs building entities based on the data collected by the basic data acquisition module and assigns them unique entity codes. The data structure of the building entity includes the building type and building skin. The entity code uses the map's x-axis, y-axis, and z-axis coordinates as generation parameters.
[0030] The functionality of the building entity generation module is achieved through the following steps:
[0031] S2. Construct the building entity generation module, specifically:
[0032] S21. A data structure for a newly constructed building entity, wherein the data structure includes the building type and skin;
[0033] S22. Input the building type code and building skin code to obtain a new building entity;
[0034] S23. Generate a unique entity code for the new building entity, wherein the entity code uses the x-axis coordinate, y-axis coordinate and z-axis coordinate of the map as generation parameters;
[0035] S24. Place the completed building entities into the building entity library;
[0036] S25. Traverse each building entity in the building entity library and write the data to the local storage device.
[0037] Since multiple buildings can be placed on a single grid cell in a map, the uniqueness of the entity code cannot be guaranteed if only the two-dimensional coordinates of the map grid cells are used as the generation parameters. This embodiment introduces a third-dimensional coordinate, namely the z-axis, on the map. The z-axis is perpendicular to the map plane, which is equivalent to having a building on each grid cell, with each building entity corresponding to one floor. In this way, the uniqueness of the entity code can be guaranteed by using the two-dimensional coordinates of the map grid cells and the z-axis coordinates as the generation parameters.
[0038] The mapping module loads the building entity into the corresponding map grid and binds the grid coordinates with the entity code to form a mapping relationship;
[0039] The mapping module functions through the following steps:
[0040] S3. Construct a mapping module between coordinates and entities, specifically:
[0041] S31. Mark each grid cell on the map with unique grid coordinates;
[0042] S32. Find the corresponding building entity from the building entity library, load the building entity into the corresponding map grid, and bind the grid coordinates with the entity code;
[0043] S33. Traverse each cell of the map and write the mapping relationship between the cell coordinates and entity codes into the local storage device.
[0044] The mechanism module is used to build mechanism entities and assign unique mechanism entity codes. The mechanism entity is the correspondence between conditions and results. The data structure of the mechanism entity includes the building entity code of the condition, the event code of the condition, the building entity code of the result, and the event code of the result. The building entity code of the condition corresponds to at least one building entity code of the result.
[0045] In fact, in a mechanism, activating building A will cause building B to change. Therefore, we break down a mechanism into a correspondence between [condition] and [result]. For example, the condition corresponds to building A, and the result corresponds to building B. In this way, the mechanism can be projected to a specific location.
[0046] The functionality of the mechanism module is achieved through the following steps:
[0047] S4, the construction mechanism module, is as follows:
[0048] S41. Create a new data structure for a mechanism entity. This data structure contains four pieces of information: the building entity code of the condition, the event type of the condition, the building entity code of the result, and the event type of the result.
[0049] S42. Input the corresponding values from step S41 into the mechanism data structure to generate a new mechanism entity;
[0050] S43. Assign a unique mechanism entity code to the new mechanism entity and store it in the mechanism entity library;
[0051] S44. Traverse each mechanism entity in the mechanism entity library and write the data to the local storage device.
[0052] The relationship network export module traverses each cell of the map, uses the building entity corresponding to the map cell as the building entity of the condition, and finds the building entity of the corresponding result according to the mechanism entity in the mechanism module, so as to generate and export the relationship queue of conditions and results.
[0053] Since a single cell in a map may be involved in multiple mechanisms simultaneously, and a building entity may serve as a condition in mechanism X and a result in mechanism Y, a relationship network is formed between cells when multiple mechanisms are overlaid on the map. To facilitate the export of mechanism data, this relationship network is integrated into a relation queue where a condition corresponds to multiple results. The specific algorithm is as follows:
[0054] S5. The steps for exporting the relation queue using the relation network export module are as follows:
[0055] S51. Traverse each cell in the map, and according to the mapping relationship between cell coordinates and entity codes (e.g., entity code A), read the corresponding building entity in the cell, obtain the entity code, and use the building entity as a condition.
[0056] S52. Based on the above entity codes, find the corresponding building entity codes and event codes for the conditions, and then find the corresponding building entity codes and event codes for the results based on the mechanism entities.
[0057] S53. Store the building entity codes and event codes of the results found above into the result information queue (e.g., result information queue B) until all the results corresponding to the entity codes are found and included in the result information queue, forming a mapping relationship between entity codes and result information queues, and import this mapping relationship (i.e., the mapping relationship between A and B) into the relationship queue.
[0058] S54. Repeat steps S51-S53 until the mechanisms corresponding to all building entities in all grids on the map are exported. Then, organize the data in the exported relation queue into the corresponding format strings and write them to the external storage device.
[0059] The above description is merely a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A mechanism generation system based on a three-dimensional coordinate system, characterized in that: The mechanism generation system is implemented based on the cocos2djs engine and includes a basic data acquisition module, a building entity generation module, a mapping module, a mechanism module, and a relationship network export module. The basic data acquisition module is used to collect building type, building skin and event type, and assign a unique corresponding building type code, building skin code and event code to each; The building entity generation module constructs building entities based on the data collected by the basic data acquisition module and assigns them unique entity codes. The data structure of the building entity includes the building type and building skin. The entity code uses the map's x-axis coordinates, y-axis coordinates, and z-axis coordinates as generation parameters. The mapping module loads the building entity into the corresponding map grid and binds the grid coordinates with the entity code to form a mapping relationship; The mechanism module is used to build mechanism entities and assign unique mechanism entity codes. The mechanism entity is the correspondence between conditions and results. The data structure of the mechanism entity includes the building entity code of the condition, the event code of the condition, the building entity code of the result, and the event code of the result. The building entity code of the condition corresponds to at least one building entity code of the result. The relationship network export module traverses each cell of the map, uses the building entity corresponding to the map cell as the building entity of the condition, and finds the building entity of the corresponding result according to the mechanism entity in the mechanism module, so as to generate and export the relationship queue of conditions and results.
2. The mechanism generation system based on a three-dimensional coordinate system as described in claim 1, characterized in that: The building type and building type code are stored in the building type pool.
3. The mechanism generation system based on a three-dimensional coordinate system as described in claim 2, characterized in that: The building skin and building skin code are stored in the building skin pool.
4. The mechanism generation system based on a three-dimensional coordinate system as described in claim 3, characterized in that: The event type and event type are stored in the event type pool.
5. The mechanism generation system based on a three-dimensional coordinate system as described in claim 1, characterized in that: The x-axis and y-axis coordinates are used to represent the planar position of the building entity on the map, and the z-axis coordinate is used to represent the floor where the building entity is located.
6. The mechanism generation system based on a three-dimensional coordinate system as described in claim 5, characterized in that: The data from the building entity generation module, the mapping module, and the mechanism module are all written to the local storage device.
7. The mechanism generation system based on a three-dimensional coordinate system as described in claim 6, characterized in that: The data in the relation queue is organized into corresponding format strings and written to an external storage device.
Citation Information
Patent Citations
Game image processing system and program
CN108601976A
Game map generation method and device, equipment and storage medium
CN112604289A