Method, storage medium and electronic device for declarative game terrain change
Patent Information
- Application Number
- CN202611198355.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-07
- Publication Date
- 2026-10-30
AI Technical Summary
由于声明式游戏展现在人们面前的场景是由规则推导出来的而非代码生成的,以往传统游戏过程中利用控制台输入一句作弊码即可强制改变某一场景数据的方式已无法适用于声明式游戏中
[0016]本申请应用于无运行时代码生成的声明式游戏中,基于本申请技术方案,使得声明式游戏中地形高度场可在运行期以单行声明式动作当场形变,地形可被声明式孔洞掩码镂空成洞穴/隧道/门洞;世界点处的地面高度、地表法线、地表材质档位可被暴露为可读值,供放置、贴合、分支逻辑直接读取,无需任何射线脚本;形变或被规则派生的区域,地表权重以规则派生或同管线笔刷方式保持连贯,无需人工绘制。
Smart Images

Figure CN122998744A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of declarative game technology, and in particular relates to a declarative game terrain modification method, storage medium, and electronic device. Background Technology
[0002] Artificial intelligence (AI) is a key direction for future game development. For example, patent CN122265549A, "An AI-Driven Modular Generation and Multi-Platform Intelligent Adaptation Method and System for Game 3D Assets," generates 3D game models using generative AI and adapts them to various games. Another patent, CN121648569A, "A Game Map Generation Method and System Based on Artificial Intelligence Simulation," generates game maps using generative AI. The applicant also has multiple patents in the field of AI-generated 3D assets. Declarative games, on the other hand, generate the entire game using generative AI. Developers only need to input the desired scene and game rules. Declarative games represent one of the emerging research directions for generative AI in game development. Current generative AI technologies such as Deepseek, Grok, and GPT, in their latest updates, all possess game generation capabilities.
[0003] Currently, mainstream declarative games are primarily generated through the collaboration of artificial intelligence and mainstream game engines (such as Unreal Engine and Unity Engine). Artificial intelligence compiles models, logic, and code within the game engine framework to generate 3D games. In these generative games, developers describe the game's state and gameplay to the artificial intelligence, which then translates these descriptions into instructions that the game engine can recognize and execute, and the game engine then generates the game. This application proposes a generation method in a prior patent application, which includes mapping declarations in a configuration file set to corresponding primitive execution function pointers based on a pre-compiled primitive registry. The pre-compiled primitive registry includes multiple primitive execution functions statically linked during application construction. During game execution, based on the mapping relationship between declarations and corresponding primitive execution function pointers, the interpreter calls the corresponding primitive execution function pointers to execute the game logic described in the configuration file set.
[0004] In traditional games, the game engine maps player commands to code, and then interacts with the game environment according to the code's specifications. In declarative games, however, player actions alter the game environment as pure data actions. The interaction between the player and the game environment in a declarative game primarily involves the player adding data to the current scene (data). Based on this data, the game scans all declared rules, identifies those that satisfy the data condition, and then executes the effect declared by those rules. Compared to traditional games, player actions in declarative games are no longer mapped to code and are no longer limited to the results of coded interactions. Because the scene presented in a declarative game is derived from rules rather than generated by code, the traditional method of forcibly changing scene data by entering a cheat code in the console is no longer applicable. Therefore, current generative AI-generated 3D games have significant limitations in player-terrain interaction during gameplay. The generated 3D games involve cumbersome terrain interaction steps during gameplay, so most generative AI does not allow for terrain changes during gameplay. As a result, the playability of AI-generated 3D games in terms of terrain changes is currently not comparable to that of traditionally produced games. Summary of the Invention
[0005] To address the problems existing in declarative games regarding terrain changes during gameplay, this invention provides a declarative game terrain change method, storage medium, and electronic device to realize or simplify the process of changing the game scene terrain during declarative game runtime.
[0006] The method and technical solution include: a declarative game terrain modification method, the method steps of which include: The game engine performs coordinate and dimension conversion, constructs corresponding terrain change elements based on the conversion results, and constructs corresponding terrain interaction primitives based on the terrain change elements. During the game loading phase, the terrain interaction primitives are packaged into a configuration file set that describes the game logic; During the game's runtime, based on the mapping relationship between the declaration and the corresponding terrain interaction primitives, the game engine implements corresponding terrain changes according to the primitive data.
[0007] Furthermore, the terrain interaction primitives include terrain deformation primitives, terrain hole primitives, surface query primitives, and surface weight primitives.
[0008] Furthermore, the terrain modification process using the terrain deformation primitives includes: converting the declared terrain area to be modified into an active canvas; converting the coordinates of the active canvas into UV coordinates; obtaining the terrain area from the UV coordinates and using UV coordinate values to represent the deformation modification radius, using grayscale values to represent the deformation modification height, and accumulating floppy disk clamps on the area to be deformed according to the declaration content, thereby obtaining terrain deformation parameters; and re-rendering the declared terrain area to be modified using the game engine in conjunction with the terrain deformation parameters to achieve terrain deformation.
[0009] Furthermore, the terrain modification process using the terrain hole primitive includes: converting the declared terrain area to be modified into an active canvas; converting the coordinates of the active canvas into UV coordinates; obtaining the terrain area from the UV coordinates and providing the hole position in the UV coordinates through a mask and setting a mask threshold, with pixels whose brightness is higher than the threshold being recorded as holes; and re-rendering the declared terrain area to be modified according to the hole parameters and the game engine to achieve terrain opening.
[0010] Furthermore, the process of obtaining surface parameters through the surface query primitives includes converting the surface of the target terrain area into values that can be directly read by the game logic.
[0011] Furthermore, the aforementioned surface weight primitives are used to maintain the coherence of the material of the modified area; wherein, the surface weight of the modified area is derived from the terrain shape according to semantic level rules, and the level boundary is realized by a smooth step with noise perturbation.
[0012] Furthermore, the active canvas carries height field data.
[0013] Furthermore, the configuration file set is a closed set, and during the loading phase, pre-checks are performed on the active canvas height source, parameter range, mask threshold / region, layer name resolvability, mutual exclusion between derivation and direct input, dependency of derivation on height source, and rendering-collision consistency in the primitives.
[0014] Another aspect of this application discloses a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method as described in any one of the above statements.
[0015] Another aspect of this application discloses an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform any of the methods described above.
[0016] This application is applied to declarative games without runtime code generation. Based on the technical solution of this application, the terrain height field in the declarative game can be deformed on the spot at runtime with a single-line declarative action. The terrain can be hollowed out into caves / tunnels / doorways by declarative hole masks. The ground height, surface normal, and surface material weight at the world point can be exposed as readable values, which can be directly read by placement, fitting, and branching logic without any raycasting scripts. In deformed or rule-derived areas, the surface weight is kept consistent by rule derivation or the same pipeline brush method, without the need for manual drawing. Attached Figure Description
[0017] The above and other objects, features and advantages of this disclosure will become more apparent from the accompanying drawings, in which like reference numerals generally denote like parts.
[0018] Figure 1 A flowchart of a declarative game execution method without runtime code generation provided in this application embodiment; Figure 2 This is a schematic diagram of an embodiment of the electronic device of this application. Detailed Implementation
[0019] The embodiments of this disclosure will now be described in detail with reference to the accompanying drawings.
[0020] It should be understood that the following specific examples illustrate the implementation of this disclosure, and those skilled in the art can easily understand other advantages and effects of this disclosure from the content disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. This disclosure can also be implemented or applied through other different specific implementation methods, and the details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this disclosure. It should be noted that, in the absence of conflict, the following embodiments and features in the embodiments can be combined with each other. Based on the embodiments in this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.
[0021] It should be noted that the aspects described herein can be embodied in a wide variety of forms, and any particular structure and / or function described herein is merely illustrative. Based on this disclosure, those skilled in the art will understand that one aspect described herein can be implemented independently of any other aspect, and two or more of these aspects can be combined in various ways. For example, any number of aspects set forth herein can be used to implement the device and / or practice method. Furthermore, this device and / or practice method can be implemented using other structures and / or functionalities besides one or more of the aspects set forth herein.
[0022] It should also be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of this disclosure. The illustrations only show the components related to this disclosure and are not drawn according to the number, shape and size of the components in actual implementation. In actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.
[0023] Furthermore, specific details are provided in the following description to facilitate a thorough understanding of the examples. However, those skilled in the art will understand that the described aspects can be practiced without these specific details.
[0024] This application primarily addresses improvements to declarative games. A key characteristic of declarative games is the absence of code execution during gameplay. This is achieved by replacing the arduous manual coding and data configuration of traditional development with a highly intelligent AI system. The core principle is to digitize game logic as much as possible, and then use a game engine to understand and drive this data. The user's natural language commands are ultimately translated by the AI agent into operations that the game engine can understand. However, in existing game architectures, modifying terrain at runtime still requires writing mesh / height field / collision scripts within the game engine, which involves executing new instruction streams at runtime and directly conflicts with the no-code execution architecture. For example, in games, interactive events such as shells creating craters, footprints in snow, and players digging slopes all require runtime modifications to the terrain height field (a field that assigns a height value to each point on a plane) and synchronized ground and collider depression. The traditional approach involves running a script at runtime: reading the terrain region, calculating the conversion from world coordinates to UV (texture coordinates), converting the metric depth, and rewriting the mesh vertices and collision shapes. This conflicts with the prior patent's no-code architecture; and in the code calculation process, each step of the conversion is very prone to error, such as if the sign of the decimal part of the world coordinate is wrong when it is negative, the crater will fall on the other side of the map; if the division by the fluctuation range is not calculated, the two-meter-deep crater will either disappear or penetrate the floor, etc.
[0025] Based on this, the applicant further developed interactive technology for terrain changes during gameplay in declarative games. In the process of developing declarative games, the applicant improved the interaction of terrain scenes during gameplay, categorizing terrain changes into data rules such as undulating deformation, holes dug, readable surface data queries, and automatic surface weighting after changes. During the runtime of a declarative game using this solution, player events involving terrain changes will trigger one or more of the above rules, updating the game's terrain scene based on the declarative effects of these data rules.
[0026] This application proposes a declarative terrain modification method in a game environment. The method includes the following steps: performing coordinate and dimension conversion through a game engine; constructing corresponding terrain change elements based on the conversion results; and constructing corresponding terrain interaction primitives based on the terrain change elements. During the game loading phase, the terrain interaction primitives are packaged into a configuration file set describing the game logic. During the game runtime phase, based on the mapping relationship between the declarations and the corresponding terrain interaction primitives, the game engine implements the corresponding terrain modification according to the primitive data. In this embodiment, the primitives describe the changes that should be made to the terrain to the game engine, and the game engine performs relevant operations based on the primitive description after recognizing the primitives. Through the method of this embodiment, there is no conversion from string to instruction or configuration to code from player events to the final rendered surface and collision surface. The terrain modification in this application is a pure primitive data action, the hole is a pure data declaration, and the surface query is a pure data readable value; all conversions fall in the statically compiled conversion layer during packaging, and only the compiled formulas are executed during runtime. Refer to the following flow code executed in this embodiment.
[0027] flowchart TDclassDef default fill:none,stroke:#000,color:#000;LOGIC["Game Logic / Player Events"] Shell hit / Finger brush / Placement request"] DEFORM["Runtime deformation action"] Target + World Point + Radius + Depth"]HOLE["Hole Excavation Declaration"] Mask + Brightness Threshold"]QUERY["Surface query readable value"] Height / Normal / Material Level"]CONV["Coordinate and Dimension Conversion Layer" World→UV decimal rounding Metric system → Grayscale / Radius → UV Accumulated floppy disk clamping"]CANVAS[("Active canvas height source"] [Revision number is raised by brush stroke] REFILL["Height field refill and hole annotation"] Render displacement + collision height Write a non-numerical culling triangle at the hole"]GRID[("CPU height grid"] Automatic surface weighting (without rendering sampling) Rule Derivation / Same Pipeline Brush Completion"]OUT["Rendering Surface + Collision Surface" Same formula for pixel-by-pixel alignment"] LOGIC --> DEFORM --> CONV --> CANVAS --> REFILL --> OUTLOGIC --> HOLE --> REFILLLOGIC --> QUERY --> GRIDREFILL --> GRIDREFILL --> SPLAT --> OUTlinkStyle default stroke:#000,color:#000,fill:none Based on the method of this embodiment, the terrain height field can be deformed on the spot during runtime using a single-line declarative action (such as craters / excavation / uplift); the terrain can be hollowed out into caves / tunnels / doorways using declarative hole masks; the ground height, surface normal, and surface material level at the world point can be exposed as readable values, which can be directly read by placement, fitting, and branching logic without any raycasting scripts; the surface weight of deformed or rule-derived areas remains consistent through rule derivation or the same pipeline brush method, without the need for manual drawing.
[0028] Based on the above embodiment, the terrain interaction primitives include terrain deformation primitives, terrain hole primitives, surface query primitives, and surface weight primitives.
[0029] Based on the above embodiment, this application further improves upon the above. The terrain deformation process executed through the terrain deformation primitive includes: converting the declared terrain area to be modified into an active canvas; converting the active canvas coordinates into UV coordinates; obtaining the terrain area from the UV coordinates and representing the deformation modification radius with UV coordinate values, and the deformation modification height with grayscale values, and accumulating floppy disk clamps on the area to be deformed according to the declaration content, thereby obtaining terrain deformation parameters; and re-rendering the declared terrain area to be modified using a game engine in conjunction with the terrain deformation parameters to achieve terrain deformation. This invention abstracts terrain changes, such as "changing the ground undulations at a certain point in the world," into a runtime action primitive (denoted as deform). When an operator writes "Deform a certain terrain, at a certain world anchor point (at), radius R meters, (uplift / sinking) depth D meters," that is, changing the terrain of a certain location, the above change is executed through the primitive. Specifically, operations such as creating craters and hills are performed. The deformation is determined based on the operator's input, indicating whether the depth is positive (sinking, crater) or negative (rising, hill). If the deformation is repeated at the same location, it is accumulated. In this step, the target of the deformation is a terrain whose height source is a live canvas (a dynamic height source that can be rewritten by brush strokes at runtime). During the action execution, the engine performs three load calculations on behalf of the author (invisible to the operator and impossible to write incorrectly), converting world coordinates to UV coordinates. Specifically, the conversion uses the same decimal rounding formula as the rendering shader and collision refill, replacing world XZ with canvas UV, ensuring strict consistency between brush landing points and collision reading points, and correct sign at negative world coordinates. The deformation radius is also converted during the conversion, expressed in meters to UV coordinates, while depth is represented in grayscale. The UV radius is obtained by dividing the radius by the terrain area span, and the grayscale increment is obtained by dividing the depth by the undulation amplitude. When deformation is repeatedly accumulated, the deformation is clamped to the surrounding environment by accumulating the floppy disk. That is, the grayscale increment is accumulated into the canvas with a softly decaying circular brush and clamped within the legal undulation zone. Repeated deformations are naturally superimposed without overflowing.
[0030] Based on the above embodiment, this application further improves upon the above. The terrain hole primitive is used to perform the terrain hole-making process, which includes: converting the declared terrain area to be modified into an active canvas; converting the active canvas coordinates into UV coordinates; obtaining the terrain area from the UV coordinates and providing the hole position in the UV coordinates using a mask, setting a mask threshold, and marking pixels with brightness higher than the threshold as holes; and re-rendering the declared terrain area to be modified according to the hole parameters and the game engine to achieve terrain hole-making. This embodiment provides a mask (PNG asset or active canvas) and marks pixels with brightness higher than the threshold as "holes (no ground here)". Holes and deformation undulations can be superimposed (digging holes in undulations) or independent (creating vertical shafts on flat ground); if no hole sub-block is specified, the ground remains continuous and unchanged byte-by-byte. Both the mask and world coordinates are converted to UV coordinates and rounded to the nearest integer, simultaneously driving two deletions and strictly aligning the same footprint. During the hole-making process, the terrain shader samples the hole mask at the fragment stage. Fragments with brightness ≥ the threshold are discarded. Shared subdivided tile meshes are not reconstructed, and there is no per-tile regeneration, resulting in a low-cost fragment effect. The entire height field collider of the terrain writes a non-number (NaN) height value at the hole grid. The physics backend removes any triangles that touch the NaN corner points from the collision shape. Vertical rays pass through the hole grid, and the falling object falls into the geometry below from this point, while solid grids are supported as usual. In this embodiment, the physics backend throughout treats NaN heights as holes and removes adjacent triangles, without adding new node types or collision shapes. As a fallback, if the backend is changed, a triangular mesh collision that removes the hole triangles is used instead. To ensure that the finite bounding box of the collider is not contaminated, the outermost corner grid is forced to be solid (holes at the outermost corners of the terrain are meaningless in practice). What lies below the hole (cave, tunnel, basement) is carried out by ordinary declarative geometry and is not within the scope of the declarations and primitives of this application. The primitives of this application are only responsible for creating holes. Collision culling and mask determination of holes can be performed without rendering tests, and clean visual edges are determined by the visual language model.
[0031] Based on the above embodiment, this application further improves upon the previous one by obtaining surface parameters through the surface query primitives, including converting the surface of the target terrain area into values that can be directly read by the game logic. In this embodiment, during the interaction between objects and the ground in the game, such as placement and fitting, the runtime is required to read the "ground conditions of a certain world point". This invention exposes the terrain surface as several readable values / conditions for direct reading by the logic, without ever using physical rays. In this embodiment, the terrain height field is exposed as a readable scalar field by name. The ground height at a certain world XZ is obtained by the CPU directly sampling the height raster (the raster is inherently persistent and can be sampled without rendering) for object interaction with the ground, such as placement. The surface normal is calculated from the center difference gradient of the height raster to determine the surface orientation (normal) to provide interaction in scenes such as tilting the ground. In this embodiment, the game's surface material weight is responded to by a Boolean function (denoted as on_surface, "on a certain surface layer") to indicate whether the dominant surface layer of this world point is a certain layer (e.g., on_surface(grass), on_surface(sand, event.tap)). The author wrote the surface layer name instead of the channel subscript, thus eliminating the pitfall of channel → layer name mapping; this determination is a pure CPU operation that takes the maximum value (argmax) of each channel of the surface weight, and can be tested without rendering.
[0032] All the above embodiments share the same world coordinate → UV decimal rounding convention as the rendering shader, the sampling point is consistent with the display pixel, and it is correct at negative world coordinates. When there is no terrain or no surface weight, a safe default is returned (height is based on the ground reference, on_surface is always false), and there is no crash; when there is a tie (equal weight), the lowest layer index is used to ensure no jitter. Thus, logic such as "place the turret on the slope and fit it to the slope normal" and "slow down when the ground is sand, and recover when it is grass" becomes a single readable line of code, without the need for any raycasting scripts.
[0033] Based on the above embodiment, this application further improves upon it by using a surface weight primitive to maintain the consistency of the material in the modified area. The surface weight of the modified area is derived from the terrain shape according to semantic level rules, and the level boundaries are implemented with smooth steps with noise perturbation. After the terrain changes, the modified area must maintain consistent surface material. This embodiment proposes to achieve the above-mentioned material consistency requirement using two complementary paths. The two complementary paths produce the same surface weight map and share the entire rendering and query pipeline. In this embodiment, the surface weight can be automatically derived from the terrain shape according to semantic rules. Game creators only need to declare the altitude level (low / medium / high) and slope level (flat / gentle / steep) for each of the 2 to 4 surface layers, and can assign snow lines, water lines, and realism levels. The derivator calculates the weight grid by grid based on slope, height, curvature (and available erosion byproducts), and the level boundaries are implemented with smooth steps with noise perturbation, resulting in a natural transition without sharp edges; the author does not need any images. In this embodiment, the deformation action can write the surface weights into a specific channel of the weight map along the same canvas brush pipeline (e.g., pushing the weights to the "soil / gravel" layer for craters). It shares the same world coordinates → UV conversion and the same refill chain as the height deformation. Thus, the material at the bottom of the crater changes seamlessly as it is created. In the above process, rule-based derivation and direct map input are mutually exclusive (with mutual exclusion diagnostics), and derivation depends on the existence of the height source (with dependency diagnostics). The derived product has the same shape as the hand-drawn weight map product, directly reusing the existing surface blending shader and on_surface query without adding a new rendering path. Using these two complementary paths for mutual verification further improves the coherence of the surface material after terrain changes.
[0034] Based on the above embodiment, this application further improves the application by adding that the active canvas carries height field data.
[0035] Based on the above embodiment, this application further improves upon it by making the configuration file set a closed set. During the loading phase, pre-checks are performed on the active canvas height source, parameter range, mask threshold / region, layer name resolvability, mutual exclusion between derivation and direct assignment, dependency of derivation on the height source, and rendering-collision consistency in the primitives. In this application, deformation actions, hole sub-blocks, surface query value functions, and automatic surface weight rules are all statically compiled closed sets during packaging, with zero additions at runtime. The primitive configuration in this embodiment is pure data. During the loading phase, a full check is performed on the following items (each with a stable diagnostic code): the deformation target must carry the height field state and its source must be the active canvas (otherwise, an alarm will be printed and an empty operation will occur, but it will never crash); the radius / depth / anchor point parameters must exist and the radius must be positive; the hole source must exist, the threshold must be within the legal range, and the region must be a binary sequence; the layer name of the surface query must be resolvable within the declared surface layer set (an alarm will be reported upon loading if the layer name is unknown); automatic surface derivation and direct assignment are mutually exclusive, and the derivation depends on the height source. Any inconsistent runtime interaction description is rejected at load time and does not enter runtime.
[0036] This embodiment further illustrates the surface shaping process during gameplay with an example. This example uses the firing of a cannon during gameplay. The cannon is positioned on undulating slopes, tilting towards the slope, and will create craters on the ground from cannonballs. In this application, the author only needs to output the corresponding declarations regarding the cannonball creating craters, the turret placement on the ground, and the interaction between the turret and the surrounding area. When a cannonball hits the ground, a deformation action is triggered, deforming the "ground." The deformation center is taken as the world position of the cannonball's impact point, with a deformation radius of 4 meters and a depth of 2 meters. After inputting the above declaration, the game engine calculates the world coordinates → UV (including negative coordinates) for the author, converts the 2-meter depth into a grayscale increment, and accumulates it into the active canvas using a disc brush. When accumulation is needed, the canvas revision number is increased, and the refill chain synchronizes the sunken rendered ground with its collider, causing objects falling into craters to stop lower. When the turret is placed, a surface read query is performed; the ground height raises the turret base to the ground surface, and the ground normal aligns the turret's orientation with the slope. As the crater is created, deformation pushes the surface weights at the bottom of the crater towards the "rubble" layer along the same brush path. The material at the bottom of the crater changes seamlessly with the shape; the grass outside the crater is still covered by rule-derived weights. All of the above processes are pure data actions and readable values. During the loading period, the target is verified to carry an active canvas, the parameters are valid, and the layer names are resolvable. This process involves approximately dozens of words, replacing the runtime script of traditional solutions that involves modifying the entire height map, reconstructing collisions, checking the ground using emission lines, and supplementing the weight map.
[0037] This application also discloses an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method as described in any of the above embodiments.
[0038] This application also discloses a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any of the above embodiments.
[0039] The electronic device disclosed in this embodiment includes a memory and a processor. The memory is used to store non-transitory computer-readable instructions. Specifically, the memory may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may, for example, include random access memory (RAM) and / or cache memory. The non-volatile memory may, for example, include read-only memory (ROM), hard disk, flash memory, etc. The processor may be a central processing unit (CPU) or other forms of processing unit with data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device to perform desired functions. In one embodiment of this disclosure, the processor is used to run the computer-readable instructions stored in the memory, causing the electronic device to execute all or part of the steps of the declarative game running method without runtime code generation described in the foregoing embodiments of this disclosure. Those skilled in the art should understand that, in order to solve the technical problem of how to obtain a good user experience, this embodiment may also include known structures such as communication buses and interfaces, and these known structures should also be included within the protection scope of this disclosure. Figure 2 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. It illustrates a structural schematic diagram suitable for implementing the electronic device in the embodiment of the present disclosure. Figure 2 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0040] like Figure 2 As shown, an electronic device may include a processing unit (such as a central processing unit, graphics processing unit, etc.) that can perform various appropriate actions and processes based on a program stored in read-only memory (ROM) or a program loaded from a storage device into random access memory (RAM). The RAM also stores various programs and data required for the operation of the electronic device. The processing unit, ROM, and RAM are interconnected via a bus. Input / output (I / O) interfaces are also connected to the bus.
[0041] Typically, the following devices can be connected to the I / O interface: input devices, such as sensors or visual information acquisition devices; output devices, such as displays; storage devices, such as magnetic tapes or hard drives; and communication devices. Communication devices allow electronic devices to exchange data wirelessly or via wired communication with other devices, such as edge computing devices. Although Figure 2 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have alternatively.
[0042] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from a storage device, or installed from a ROM. When the computer program is executed by a processing device, all or part of the steps of the declarative game running method without runtime code generation according to embodiments of this disclosure are performed.
[0043] For a detailed description of this embodiment, please refer to the corresponding descriptions in the foregoing embodiments, which will not be repeated here.
[0044] A computer-readable storage medium according to embodiments of the present disclosure stores non-transitory computer-readable instructions. When these non-transitory computer-readable instructions are executed by a processor, all or part of the steps of the declarative game execution method without runtime code generation described in the foregoing embodiments of the present disclosure are performed.
[0045] The aforementioned computer-readable storage media include, but are not limited to: optical storage media (e.g., CD-ROM and DVD), magneto-optical storage media (e.g., MO), magnetic storage media (e.g., magnetic tape or portable hard drive), media with built-in rewritable non-volatile memory (e.g., memory card), and media with built-in ROM (e.g., ROM cartridge).
[0046] For a detailed description of this embodiment, please refer to the corresponding descriptions in the foregoing embodiments, which will not be repeated here.
[0047] The basic principles of this disclosure have been described above with reference to specific embodiments. However, it should be noted that the advantages, benefits, and effects mentioned in this disclosure are merely examples and not limitations, and should not be considered as essential features of each embodiment of this disclosure. Furthermore, the specific details disclosed above are for illustrative and facilitative purposes only, and are not limitations. These details do not limit the scope of this disclosure to the necessity of employing the aforementioned specific details for implementation.
[0048] In this disclosure, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. The block diagrams of devices, apparatuses, devices, and systems involved in this disclosure are merely illustrative examples and are not intended to require or imply that they must be connected, arranged, or configured in the manner shown in the block diagrams. As those skilled in the art will recognize, these devices, apparatuses, devices, and systems can be connected, arranged, and configured in any manner. Words such as "comprising," "including," "having," etc., are open-ended terms meaning "including but not limited to," and are used interchangeably with them. The terms "or" and "and" as used herein refer to the terms "and / or," and are used interchangeably with them unless the context clearly indicates otherwise. The term "such as" as used herein refers to the phrase "such as but not limited to," and is used interchangeably with it.
[0049] Additionally, as used herein, the "or" used in a list of items beginning with "at least one" indicates a separate list, such that a list of, for example, "at least one of A, B, or C" means A or B or C, or AB or AC or BC, or ABC (i.e., A and B and C). Furthermore, the word "exemplary" does not imply that the described example is preferred or better than other examples.
[0050] It should also be noted that in the systems and methods of this disclosure, the components or steps can be decomposed and / or recombined. These decompositions and / or recombinations should be considered as equivalent solutions to this disclosure.
[0051] Various changes, substitutions, and modifications can be made to the techniques described herein without departing from the teachings defined in this embodiment. Furthermore, the scope of this embodiment is not limited to the specific aspects of the processes, machines, manufacturing processes, events, means, methods, and actions described above. Currently existing or later-developed processes, machines, manufacturing processes, events, means, methods, or actions that perform substantially the same functions or achieve substantially the same results as the corresponding aspects described herein can be utilized. Therefore, this embodiment includes such processes, machines, manufacturing processes, events, means, methods, or actions within its scope.
[0052] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use this disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of this disclosure. Therefore, this disclosure is not intended to be limited to the aspects shown herein, but rather to be carried out within the widest scope consistent with the principles and novel features disclosed herein.
[0053] The above description has been given for purposes of illustration and description. Furthermore, this description is not intended to limit the embodiments of this disclosure to the forms disclosed herein. Although numerous exemplary aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, alterations, additions, and sub-combinations thereof.
Claims
1. A declarative method for changing game terrain, characterized in that, The method steps include: The game engine performs coordinate and dimension conversion, constructs corresponding terrain change elements based on the conversion results, and constructs corresponding terrain interaction primitives based on the terrain change elements. During the game loading phase, the terrain interaction primitives are packaged into a configuration file set that describes the game logic; During the game's runtime, based on the mapping relationship between the declaration and the corresponding terrain interaction primitives, the game engine implements corresponding terrain changes according to the primitive data.
2. The method according to claim 1, characterized in that, The terrain interaction primitives include terrain deformation primitives, terrain hole primitives, surface query primitives, and surface weight primitives.
3. The method according to claim 2, characterized in that, The process of altering terrain using the terrain deformation primitives includes: converting the declared terrain area to be modified into an active canvas; converting the coordinates of the active canvas into UV coordinates; obtaining the terrain area from the UV coordinates and representing the deformation modification radius with UV coordinate values, representing the deformation modification height with grayscale values, and accumulating floppy disk clamps on the area to be deformed according to the declaration content, thereby obtaining terrain deformation parameters; and re-rendering the declared terrain area to be modified using the game engine in combination with the terrain deformation parameters to achieve terrain deformation.
4. The method according to claim 2, characterized in that, The terrain modification process using the terrain hole primitive includes: converting the declared terrain area to be modified into an active canvas; converting the coordinates of the active canvas into UV coordinates; obtaining the terrain area from the UV coordinates and providing the hole positions in the UV coordinates using a mask method and setting a mask threshold, with pixels whose brightness is higher than the threshold being recorded as holes; and re-rendering the declared terrain area to be modified based on the hole parameters and the game engine to achieve terrain hole creation.
5. The method according to claim 2, characterized in that, The process of obtaining surface parameters through the surface query primitives includes converting the surface of the target terrain area into values that can be directly read by the game logic.
6. The method according to claim 2, characterized in that, The surface weight primitive is used to maintain the coherence of the material of the modified area; wherein, the surface weight of the modified area is derived from the terrain shape according to the semantic level rules, and the level boundary is realized by a smooth step with noise perturbation.
7. The method according to claim 3 and / or 4, characterized in that, The active canvas carries height field data.
8. The method according to claim 1, characterized in that, The configuration file set is a closed set. During the loading phase, pre-checks are performed on the active canvas height source, parameter range, mask threshold / region, layer name resolvability, mutual exclusion between derivation and direct input, dependency of derivation on height source, and rendering-collision consistency in the primitives.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 8.
10. An electronic device, characterized in that, The electronic device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1-8.
Citation Information
Patent Citations
Game map generation method and system based on artificial intelligence simulation
CN121648569A
AI-driven game 3D asset modular generation and multi-terminal intelligent adaptation method and system
CN122265549A
