Two-dimensional terrain simulation method and device

By acquiring the location parameters of terrain control points, assigning terrain resistance coefficients, and using spline algorithms to generate two-dimensional terrain, monitoring trigger action signals, and adjusting the terrain resistance coefficients to coordinate with the movement of the action subject, the problem of monotonous visual effects of terrain destruction in existing technologies is solved, thereby enhancing the realism and immersion of the game.

CN122006258APending Publication Date: 2026-05-12SHENZHEN GRAVITY PARADISE TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHENZHEN GRAVITY PARADISE TECHNOLOGY CO LTD
Filing Date
2026-03-11
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

In existing 2D terrain generation and destruction technologies, the shape changes and triggering actions of the terrain when it is destroyed lack coordination, resulting in monotonous visual effects, a lack of realism and immersion, and affecting the user's gaming experience.

Method used

By acquiring the location parameters of the terrain control points, a terrain resistance coefficient is assigned to each terrain control point. A spline algorithm is then used to connect the control points to generate a two-dimensional terrain. Trigger action signals are monitored, the terrain resistance coefficient sequence is determined, and the terrain control points are adjusted to coordinate the movement of the action subject and avoid the action subject from intersecting with the terrain.

Benefits of technology

It achieves coordination between terrain changes and the movement of the main character, avoiding visual distortion and improving the user's gaming experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122006258A_ABST
    Figure CN122006258A_ABST
Patent Text Reader

Abstract

The invention relates to the field of games, in particular to a two-dimensional terrain simulation method and device.According to the method, after terrain control points are endowed with terrain resistance, the terrain can be made to move in cooperation with movement of an action main body when the action main body acts on the terrain; therefore, the situation that the action main body crosses the boundary of the two-dimensional terrain and intersects with the two-dimensional terrain is avoided, visual effect distortion is avoided, and the game experience of a user is guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of games, and in particular to a two-dimensional terrain simulation method and apparatus. Background Technology

[0002] In the gaming industry, real-time editable and destructible 2D terrain is one of the core elements for enhancing the interactive experience.

[0003] Existing 2D terrain generation and destruction technologies mainly rely on control points and spline curves to generate terrain skeletons, achieve terrain destruction through polygon clipping, and then generate meshes and collision bodies through triangulation. However, existing terrain control points only contain basic positional information such as location and angle, without being associated with terrain destruction-related attributes. This results in a lack of coordination between the shape changes produced when the terrain is destroyed and the triggering action that causes the destruction. It is easy for the action subject and the 2D terrain to intersect, resulting in a relatively monotonous visual effect that lacks realism and immersion, thus affecting the user's gaming experience. Summary of the Invention

[0004] Therefore, it is necessary to provide a two-dimensional terrain simulation method and apparatus to address the aforementioned problems.

[0005] The present invention is implemented as follows: a two-dimensional terrain simulation method is provided, the method comprising: S1: Before entering a new game view, obtain the position parameters of the terrain control points of that game view; S2: Generate terrain control points for this game view based on location parameters; S3: Assign a terrain resistance coefficient to each terrain control point; S4: After entering a new game view, the terrain control points are connected using smooth spline curves based on the spline algorithm to obtain the two-dimensional terrain; S5: Monitor action signals that trigger actions that could lead to terrain destruction; S6: For each action signal detected, the movement path of the action subject that triggered the action and the force relationship between the action subject and the two-dimensional terrain during the movement are determined based on the action signal, and then the terrain resistance coefficient sequence of each terrain control point during the entire movement process of the action subject is determined. S7: During the actual movement of the main body in the game, the terrain resistance coefficient of each terrain control point is adjusted according to the corresponding terrain resistance coefficient sequence, so that the terrain changes in the two-dimensional terrain are coordinated with the movement of the main body.

[0006] In one embodiment, the present invention provides a two-dimensional terrain simulation device, the device comprising: The first processing module is used to obtain the position parameters of the terrain control points of each new game view before entering that game view. The second processing module is used to generate terrain control points for the game view based on location parameters; The third processing module is used to assign a terrain resistance coefficient to each terrain control point; The fourth processing module is used to connect the various terrain control points with smooth spline curves based on the spline algorithm after entering a new game view to obtain two-dimensional terrain. The fifth processing module is used to monitor action signals that trigger actions that could lead to terrain destruction; The sixth processing module is used to determine the movement path of the subject that triggered the action and the force relationship between the subject and the two-dimensional terrain during the movement process based on the action signal for each detected action signal, and then determine the terrain resistance coefficient sequence of each terrain control point during the entire movement process of the subject. The seventh processing module is used to adjust the terrain resistance coefficient of each terrain control point according to the corresponding terrain resistance coefficient sequence during the actual movement of the game subject, so that the terrain changes in the two-dimensional terrain are coordinated with the movement of the action subject.

[0007] This invention provides a two-dimensional terrain simulation method and apparatus. The method includes: before entering a new game view, acquiring the position parameters of the terrain control points of that game view; generating the terrain control points of the game view based on the position parameters; assigning a terrain resistance coefficient to each terrain control point; after entering a new game view, connecting the terrain control points with smooth spline curves based on a spline algorithm to obtain two-dimensional terrain; monitoring action signals that trigger actions that would cause terrain destruction; and for each action signal detected, determining the movement path of the action subject applying the trigger action and the interaction between the action subject and the two-dimensional terrain during the movement. The force relationship between the two terrain control points is determined, and the terrain resistance coefficient sequence of each terrain control point is determined throughout the movement of the main body. During the actual movement of the main body, the terrain resistance coefficient of each terrain control point is adjusted according to the corresponding terrain resistance coefficient sequence, so that the terrain changes in the two-dimensional terrain are coordinated with the movement of the main body. In this application, after giving terrain resistance to the terrain control points, the terrain can move in coordination with the movement of the main body when it is subjected to the action of the main body, thereby avoiding the main body from crossing the boundary of the two-dimensional terrain and causing the main body to intersect with the two-dimensional terrain, avoiding visual distortion, and ensuring the user's game experience. Attached Figure Description

[0008] Figure 1 A flowchart of a two-dimensional terrain simulation method provided in one embodiment; Figure 2 This is a schematic diagram illustrating the interaction between the action subject and the two-dimensional terrain in a two-dimensional terrain simulation method provided in one embodiment; Figure 3 This is a block flowchart of a two-dimensional terrain simulation device provided in one embodiment; Figure 4 This is a block diagram of the internal structure of a computer device in one embodiment. Detailed Implementation

[0009] 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.

[0010] It is understood that the terms "first," "second," etc., used in this invention may be used to describe various elements herein, but unless specifically stated otherwise, these elements are not limited by these terms. These terms are used only to distinguish one element from another. For example, without departing from the scope of this invention, a first script may be referred to as a second script, and similarly, a second script may be referred to as a first script.

[0011] like Figure 1 As shown, in one embodiment, a two-dimensional terrain simulation method is proposed, the method comprising: S1: Before entering a new game view, obtain the position parameters of the terrain control points of that game view; S2: Generate terrain control points for this game view based on location parameters; S3: Assign a terrain resistance coefficient to each terrain control point; S4: After entering a new game view, the terrain control points are connected using smooth spline curves based on the spline algorithm to obtain the two-dimensional terrain; S5: Monitor action signals that trigger actions that could lead to terrain destruction; S6: For each action signal detected, the movement path of the action subject that triggered the action and the force relationship between the action subject and the two-dimensional terrain during the movement are determined based on the action signal, and then the terrain resistance coefficient sequence of each terrain control point during the entire movement process of the action subject is determined. S7: During the actual movement of the main body in the game, the terrain resistance coefficient of each terrain control point is adjusted according to the corresponding terrain resistance coefficient sequence, so that the terrain changes in the two-dimensional terrain are coordinated with the movement of the main body.

[0012] In this embodiment, the method is executed in a computer device, which can be an independent physical server or terminal, or a server cluster consisting of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud servers, cloud databases, cloud storage and CDN.

[0013] In this embodiment, this method is applicable to the rendering of game views in two-dimensional games (two-dimensional games with a head-up perspective, where the game screen is presented to the player in a horizontal, side view, and the player sees the side outline of the scene and character; the overall screen only has two dimensions, horizontal (left and right) and vertical (up and down), without perspective changes of distance and depth). Two-dimensional terrain refers to the virtual land in the game view of a two-dimensional game. The game view entered by the display screen is a game view that includes two-dimensional terrain. If the entered game view does not contain two-dimensional terrain, this method is not executed for that game view. Terrain control points are the reference points that represent the various positions of the terrain in the two-dimensional terrain. Each terrain control point includes a position parameter, namely the coordinates of the terrain control point. After assigning a terrain resistance coefficient to the terrain control point, the terrain control point has the physical property of terrain resistance, thereby being able to withstand force. The higher the terrain resistance coefficient, the smaller the displacement of the terrain control point under the same force. In this embodiment, the spline algorithm (such as the B-spline algorithm) is an algorithm that uses several fixed points to draw a natural, smooth, and unbroken curve. After initializing the parameters and assigning the attributes of the terrain control points, when generating two-dimensional terrain based on the spline algorithm, all terrain control points in the current game view are first arranged in an orderly manner according to their spatial positions to ensure that the control points are continuously distributed in the horizontal direction without intersections or disorder. At the same time, the control points at the boundaries are processed to ensure a smooth transition and a natural connection with the terrain of adjacent views. Subsequently, the cubic spline algorithm is used as the core curve construction method, with each terrain control point as a curve constraint node. The smooth transition curve segment between adjacent control points is automatically calculated. Through recursive solving within the algorithm, the entire terrain curve is ensured to be continuous and have uniform curvature at the nodes, avoiding sharp angles and abrupt undulations. The overall terrain outline presents a natural and smooth shape. During curve generation, the spline curve is adaptively subdivided and sampled based on the terrain roughness coefficient pre-assigned to each control point. In areas with lower terrain roughness coefficients and higher detail requirements, the number of sampling points is increased to improve curve fidelity and terrain detail. In areas with higher terrain roughness coefficients and lower detail requirements, the number of sampling points is appropriately reduced to lower computational and rendering pressure. After the sampling points are generated, all sampling points are connected sequentially to form a continuous closed two-dimensional terrain outline. Then, the corresponding terrain patch structure is generated based on this outline to complete the final two-dimensional terrain construction. This ensures that the generated terrain not only meets the visual requirements of smoothness and beauty but also dynamically adapts the detail density according to the control point attributes, providing a stable and reliable geometric basis for subsequent terrain destruction and dynamic adjustment.

[0014] In this embodiment, the action subject can be a game character, NPC, etc. The two-dimensional game software has preset interactive targets for each type of trigger action. The action signal of the trigger action that will cause terrain destruction is the action signal of the trigger action whose interactive target is two-dimensional terrain. In this embodiment, by giving the terrain control points terrain resistance, the terrain can move in coordination with the movement of the action subject when it is acted upon, thereby preventing the action subject from crossing the boundary of the two-dimensional terrain and causing the action subject to intersect with the two-dimensional terrain, thus avoiding visual distortion and ensuring the user's gaming experience.

[0015] As a preferred embodiment, the two-dimensional spatial domain of the game view is represented as follows: in, For a two-dimensional spatial domain, for The minimum x-coordinate, for The maximum x-coordinate, for The minimum ordinate, for The maximum ordinate; The location parameters of terrain control points are their coordinates. After assigning a terrain resistance coefficient to each terrain control point, the complete parameter set of any terrain control point is represented as: in, This represents the complete parameter set for the i-th terrain control point. Let x be the x-coordinate of the i-th terrain control point. Let be the ordinate of the i-th terrain control point. Let be the terrain resistance coefficient of the i-th terrain control point.

[0016] In this embodiment, a two-dimensional coordinate system is preset in the game view. The origin can be set at the lower left corner of the game view, the horizontal axis represents the horizontal direction, and the vertical axis represents the vertical direction. The terrain resistance coefficient is a normalized value, ranging from 0 to 1, which corresponds to different levels of resistance to displacement. The larger the value, the stronger the resistance to displacement.

[0017] In a preferred embodiment, the motion signal includes the motion subject, the direction of movement, and the speed of movement; Based on the action signal, the movement path of the subject that triggered the action and the force relationship between the subject and the two-dimensional terrain during the movement are determined, and then the terrain resistance coefficient sequence of each terrain control point during the entire movement process of the subject is determined, including: S61: Determine the current position of the action subject; S62: Starting from the current position, generate the movement path of the main body according to the movement direction until the boundary of the two-dimensional terrain, and determine the terrain control point that contacts the two-dimensional terrain when the main body moves to the end of the movement path as the contact point; S63: Determine the time when the subject of the action reaches the end of the movement path as the reference time; S64: Determine the impact force of the action subject on the contact point, and determine the terrain resistance coefficient of each terrain control point at the reference time based on the impact force, so that the two-dimensional terrain can move in tandem with the action subject; S65: Determine whether the reaction force on the main body of the action is higher than the preset lower limit. If not, the determination of the terrain resistance coefficient is completed. S66: If so, determine the direction and speed of movement of the subject after the reference time based on the reaction force, determine the next action time and the position of each contact point at that time based on the direction and speed of movement, take the next action time as the reference time, and execute steps S64 to S66 until the determination of the terrain resistance coefficient is completed. S67: For each terrain control point, arrange all the corresponding terrain resistance coefficients in chronological order to obtain the terrain resistance coefficient sequence of that terrain control point.

[0018] In this embodiment, the current position is the current coordinate of the action subject, and the endpoint of the generated movement path satisfies the condition that when the action subject moves to this endpoint, the edge contour of the action subject just touches the boundary of the two-dimensional terrain without intersecting it; the movement path can be determined by simulating the movement of the action subject in the background (the simulation process is not displayed in the game view), and the contact point that the action subject touches when it reaches the endpoint of the movement path (e.g., Figure 2 (As shown); the lower limit can be 1 / 10mg, where m is the nominal mass of the moving body. When the reaction force on the moving body is less than the preset lower limit, it can be considered that the force on the moving body is too small to make the moving body continue to move, so the movement of the moving body can be stopped, and the movement of the contact point can be stopped accordingly. Given the length of the path and the speed of movement, the movement time can be calculated. Adding the current time to the movement time will give you the reference time.

[0019] As a preferred embodiment, the impact force of the moving body on the contact point is determined to include: Retrieve the nominal mass of the action subject; The total impact force of the moving subject on the two-dimensional terrain is calculated based on the nominal mass and the impulse theorem. The component impact force and direction of each contact point are determined based on the moving subject's direction of movement and the relative position of the moving subject with each contact point.

[0020] The topographic resistance coefficients of various topographic control points at the reference time, determined based on the impact force, include: S641: For each contact point, adjust the terrain resistance coefficient of the contact point according to the partial impact force of the contact point, so that the direction and speed of the contact point moving under the action of the partial impact force are consistent with the main body of the action. S642: Use the contact point as the completion adjustment point; S643: Rigidify each spline curve. For each terrain control point connected to the completed adjustment point, determine the transmission force from the completed adjustment point to the terrain control point. Adjust the terrain resistance coefficient of the terrain control point according to the transmission force so that the terrain control point can move with the movement of the connected completed adjustment point under the action of the transmission force. S644: The terrain control points whose terrain resistance coefficients are to be adjusted are summarized as adjustment completion points. Steps S643 to S644 are executed until the terrain resistance coefficients of all terrain control points are adjusted.

[0021] In this embodiment, each action subject in the game has a pre-defined nominal mass, which can be retrieved at any time. When determining the impact force of an action subject on the terrain contact point, the nominal mass of that action subject is first retrieved. This nominal mass is a fixed parameter preset by the game and is stored in the game resource library in advance, along with the type of action subject (such as player character, item, skill effect). During retrieval, the unique identifier of the action subject is directly matched to quickly obtain its standard nominal mass, ensuring the uniformity and accuracy of the calculation benchmark and avoiding the impact force calculation accuracy being affected by deviations in mass parameters. Subsequently, based on the relevant principles of the impulse theorem, combined with the nominal mass of the action subject, the change in motion velocity, and the impact time, the total impact force of the action subject on the two-dimensional terrain is calculated. In the two-dimensional game scene from a head-up perspective, the initial direction of the total impact force is determined by combining the movement direction of the action subject (such as horizontal left, right, or vertical downward impact on the terrain). At the same time, all contact points between the action subject and the two-dimensional terrain are captured, and the coordinate positions of each contact point and its relative distance and angle to the center of the action subject are accurately recorded. Based on this, according to the relative positional relationship between each contact point and the action subject, combined with the magnitude and direction of the total impact force, the sub-impact force is calculated. The force weight of each contact point is determined first. The closer the contact point is to the center of the moving subject and the closer its angle is to the direction of the total impact force, the greater the distributed component impact force; conversely, the farther away, the smaller the component impact force. Simultaneously, based on the moving subject's direction of movement and the spatial location of the contact points, the specific direction of the component impact force at each contact point is determined, ensuring that the direction of the component impact force matches the terrain tangent and normal directions at the contact point, closely reflecting the actual impact effect. Finally, the calculated component impact forces and directions at each contact point are verified, outliers are eliminated, and it is ensured that the vector sum of the component impact forces at all contact points equals the total impact force, providing accurate force data support for subsequent adjustments to the terrain resistance coefficient and simulation of terrain damage effects.

[0022] In this embodiment, after the spline curve is made rigid, the spline curve can transmit force and will not bend. Since the force at the adjustment point is known, the force transmission analysis can be performed using the force analysis software built into the computer device to determine the force at the terrain control point connected to the adjustment point. The terrain resistance coefficient is adjusted by increasing / decreasing the terrain resistance coefficient of the terrain control point until the control point can achieve the effect of moving in the same direction and speed as the main body under the action of the partial impact force. In this embodiment, since each spline curve has been rigidified, it will move along with the contact point during movement. Therefore, at the initial moment (i.e. the moment when the subject just comes into contact with the contact point), the subject does not intersect with the boundary of the two-dimensional terrain, and it will not intersect with the boundary during subsequent movement. This achieves the effect of coordinated movement between the terrain change of the two-dimensional terrain and the movement of the subject.

[0023] In a preferred embodiment, determining the direction and speed of movement of the action subject after the reference moment based on the reaction force, and determining the next moment of action and the position of each contact point at that moment based on the direction and speed of movement, includes: Determine the component reaction force corresponding to each component impact force, wherein the component reaction force is the same in magnitude but opposite in direction to the corresponding component impact force; Determine the resultant force of each component reaction force, and divide the resultant force by the nominal mass to obtain the acceleration; Determine the speed and direction of movement of the subject under acceleration at the next moment of action; Based on the speed and direction of movement at the reference time and the next action time, the movement trajectory of the subject at these two times is determined, and the position of the subject at the next action time is obtained, thus obtaining the position of the contact point at the next action time.

[0024] In this embodiment, the interval between two adjacent moments can be 0.1 seconds or other times, which can be selected according to the processing power of the computer equipment; the smaller the interval, the more accurate the result. Based on the interaction between the subject and the terrain, the determination process of the reaction force and subsequent motion state is as follows: First, according to Newton's third law, the corresponding partial reaction force for each component impact force is determined, ensuring that the partial reaction force is equal in magnitude and opposite in direction to the corresponding component impact force, thereby restoring the true constraint effect of the terrain on the subject. After obtaining all the partial reaction forces, the partial reaction forces are vector-synthesized to determine the resultant force acting on the subject. Then, this resultant force is divided by the nominal mass of the subject pre-set to obtain the current instantaneous acceleration of the subject, with the acceleration direction consistent with the resultant force direction. Based on this acceleration, combined with the initial velocity and initial direction of the subject at the reference moment, the magnitude and direction of the subject's movement speed at the next moment of action are calculated using kinematic laws. The velocity change is determined by both the acceleration and the time interval between actions, and the direction is determined by the vector superposition of the acceleration and the initial velocity. Subsequently, starting from the reference time, and combining the time interval between the current action time and the next action time, as well as the corresponding movement speed and direction at the two times, a continuous movement trajectory of the subject during this time period is constructed. The trajectory generation process fully considers terrain constraints and the continuous changes in velocity and acceleration to ensure a smooth motion process that conforms to physical laws. Based on determining the subject's position at the next moment, since the contact points move synchronously with the subject and their relative positions remain unchanged, the coordinates of each contact point between the subject and the terrain are updated synchronously according to the relative positional relationship between the subject and the terrain. This yields the latest positions of each contact point at the next action time, providing continuous and accurate position and motion data for subsequent calculations of the impact force, reaction force, acceleration, and updating terrain parameters. This achieves a closed-loop iterative calculation of the subject's movement and terrain destruction.

[0025] As a preferred embodiment, determining the sequence of terrain resistance coefficients for each terrain control point throughout the entire movement of the subject includes: For each terrain control point, retrieve all terrain resistance coefficients determined for that terrain control point, and assign each terrain resistance coefficient a corresponding action time. The terrain resistance coefficients are arranged in order from first to last according to the reference time to obtain the terrain resistance coefficient sequence.

[0026] During the actual movement of the main game character, the terrain resistance coefficient of each terrain control point is adjusted according to the corresponding terrain resistance coefficient sequence, including: At each action time, for each terrain control point, the terrain resistance coefficient is adjusted to the terrain resistance coefficient corresponding to that action time.

[0027] In this embodiment, the action time refers to each moment after the moment when the action subject releases the contact point; for each terrain control point, the corresponding action time is determined in the process of determining its terrain resistance coefficient, and each terrain resistance coefficient is assigned a corresponding action time, that is, each terrain resistance coefficient is bound to the corresponding action time; during the actual movement of the action subject, when the actual time reaches each action time, the terrain resistance coefficient of each terrain control point is adjusted to the terrain resistance coefficient corresponding to that action time.

[0028] like Figure 3 As shown, in one embodiment, a two-dimensional terrain simulation device is provided, the device comprising: The first processing module is used to obtain the position parameters of the terrain control points of each new game view before entering that game view. The second processing module is used to generate terrain control points for the game view based on location parameters; The third processing module is used to assign a terrain resistance coefficient to each terrain control point; The fourth processing module is used to connect the various terrain control points with smooth spline curves based on the spline algorithm after entering a new game view to obtain two-dimensional terrain. The fifth processing module is used to monitor action signals that trigger actions that could lead to terrain destruction; The sixth processing module is used to determine the movement path of the subject that triggered the action and the force relationship between the subject and the two-dimensional terrain during the movement process based on the action signal for each detected action signal, and then determine the terrain resistance coefficient sequence of each terrain control point during the entire movement process of the subject. The seventh processing module is used to adjust the terrain resistance coefficient of each terrain control point according to the corresponding terrain resistance coefficient sequence during the actual movement of the game subject, so that the terrain changes in the two-dimensional terrain are coordinated with the movement of the action subject.

[0029] The process by which each module in the two-dimensional terrain simulation device provided in this application implements its respective function can be specifically referred to the foregoing. Figure 1 The description of the illustrated embodiment will not be repeated here.

[0030] Figure 4 An internal structural diagram of a computer device in one embodiment is shown. Figure 4As shown, the computer device includes a processor, memory, network interface, input device, and display screen connected via a system bus. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and may also store a computer program. When executed by the processor, this computer program enables the processor to implement a two-dimensional terrain simulation method provided in this embodiment of the invention. The internal memory may also store a computer program, which, when executed by the processor, enables the processor to execute the two-dimensional terrain simulation method provided in this embodiment of the invention. The display screen of the computer device can be a liquid crystal display (LCD) or an e-ink display. The input device can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse, etc.

[0031] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present invention and does not constitute a limitation on the computer device to which the present invention is applied. A specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0032] In one embodiment, the two-dimensional terrain simulation device provided by this invention can be implemented as a computer program, and the computer program can be implemented in the form of, for example... Figure 4 The computer device shown is running the simulation. The computer device's memory can store the various program modules that make up the two-dimensional terrain simulation device, for example... Figure 3 The first, second, third, fourth, and fifth processing modules are shown. The computer program comprised of these modules causes the processor to execute the steps in the two-dimensional terrain simulation methods of the various embodiments of the present invention described in this specification.

[0033] For example, Figure 4 The computer device shown can be used as follows Figure 3 The first processing module in the two-dimensional terrain simulation device shown executes step S1; the computer device can execute step S2 through the second processing module; the computer device can execute step S3 through the third processing module; the computer device can execute step S4 through the fourth processing module; the computer device can execute step S5 through the fifth processing module; the computer device can execute step S6 through the sixth processing module; and the computer device can execute step S7 through the seventh processing module.

[0034] In one embodiment, a computer device is provided, the computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, performs the following steps: S1: Before entering a new game view, obtain the position parameters of the terrain control points of that game view; S2: Generate terrain control points for this game view based on location parameters; S3: Assign a terrain resistance coefficient to each terrain control point; S4: After entering a new game view, the terrain control points are connected using smooth spline curves based on the spline algorithm to obtain the two-dimensional terrain; S5: Monitor action signals that trigger actions that could lead to terrain destruction; S6: For each action signal detected, the movement path of the action subject that triggered the action and the force relationship between the action subject and the two-dimensional terrain during the movement are determined based on the action signal, and then the terrain resistance coefficient sequence of each terrain control point during the entire movement process of the action subject is determined. S7: During the actual movement of the main body in the game, the terrain resistance coefficient of each terrain control point is adjusted according to the corresponding terrain resistance coefficient sequence, so that the terrain changes in the two-dimensional terrain are coordinated with the movement of the main body.

[0035] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, causes the processor to perform the following steps: S1: Before entering a new game view, obtain the position parameters of the terrain control points of that game view; S2: Generate terrain control points for this game view based on location parameters; S3: Assign a terrain resistance coefficient to each terrain control point; S4: After entering a new game view, the terrain control points are connected using smooth spline curves based on the spline algorithm to obtain the two-dimensional terrain; S5: Monitor action signals that trigger actions that could lead to terrain destruction; S6: For each action signal detected, the movement path of the action subject that triggered the action and the force relationship between the action subject and the two-dimensional terrain during the movement are determined based on the action signal, and then the terrain resistance coefficient sequence of each terrain control point during the entire movement process of the action subject is determined. S7: During the actual movement of the main body in the game, the terrain resistance coefficient of each terrain control point is adjusted according to the corresponding terrain resistance coefficient sequence, so that the terrain changes in the two-dimensional terrain are coordinated with the movement of the main body.

[0036] It should be understood that although the steps in the flowcharts of the various embodiments of the present invention are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the various embodiments may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least a portion of the sub-steps or stages of other steps. Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided by this invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0037] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0038] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.

Claims

1. A two-dimensional terrain simulation method, characterized in that, The method includes: S1: Before entering a new game view, obtain the position parameters of the terrain control points of that game view; S2: Generate terrain control points for this game view based on location parameters; S3: Assign a terrain resistance coefficient to each terrain control point; S4: After entering a new game view, the terrain control points are connected using smooth spline curves based on the spline algorithm to obtain the two-dimensional terrain; S5: Monitor action signals that trigger actions that could lead to terrain destruction; S6: For each action signal detected, the movement path of the action subject that triggered the action and the force relationship between the action subject and the two-dimensional terrain during the movement are determined based on the action signal, and then the terrain resistance coefficient sequence of each terrain control point during the entire movement process of the action subject is determined. S7: During the actual movement of the main body in the game, the terrain resistance coefficient of each terrain control point is adjusted according to the corresponding terrain resistance coefficient sequence, so that the terrain changes in the two-dimensional terrain are coordinated with the movement of the main body.

2. The method according to claim 1, characterized in that, The two-dimensional spatial domain of the game view is represented as: in, For a two-dimensional spatial domain, for The minimum x-coordinate, for The maximum x-coordinate, for The minimum ordinate, for The maximum ordinate; The location parameters of terrain control points are their coordinates. After assigning a terrain resistance coefficient to each terrain control point, the complete parameter set of any terrain control point is represented as: in, This represents the complete parameter set for the i-th terrain control point. Let x be the x-coordinate of the i-th terrain control point. Let be the ordinate of the i-th terrain control point. Let be the terrain resistance coefficient of the i-th terrain control point.

3. The method according to claim 2, characterized in that, Action signals include the subject of the action, the direction of movement, and the speed of movement; Based on the action signal, the movement path of the subject that triggered the action and the force relationship between the subject and the two-dimensional terrain during the movement are determined, and then the terrain resistance coefficient sequence of each terrain control point during the entire movement process of the subject is determined, including: S61: Determine the current position of the action subject; S62: Starting from the current position, generate the movement path of the main body according to the movement direction until the boundary of the two-dimensional terrain, and determine the terrain control point that contacts the two-dimensional terrain when the main body moves to the end of the movement path as the contact point; S63: Determine the time when the subject of the action reaches the end of the movement path as the reference time; S64: Determine the impact force of the action subject on the contact point, and determine the terrain resistance coefficient of each terrain control point at the reference time based on the impact force, so that the two-dimensional terrain can move in tandem with the action subject; S65: Determine whether the reaction force on the main body of the action is higher than the preset lower limit. If not, the determination of the terrain resistance coefficient is completed. S66: If so, determine the direction and speed of movement of the subject after the reference time based on the reaction force, determine the next action time and the position of each contact point at that time based on the direction and speed of movement, take the next action time as the reference time, and execute steps S64 to S66 until the determination of the terrain resistance coefficient is completed. S67: For each terrain control point, arrange all the corresponding terrain resistance coefficients in chronological order to obtain the terrain resistance coefficient sequence of that terrain control point.

4. The method according to claim 3, characterized in that, The impact force of the moving subject on the contact point includes: Retrieve the nominal mass of the action subject; The total impact force of the moving subject on the two-dimensional terrain is calculated based on the nominal mass and the impulse theorem. The component impact force and direction of each contact point are determined based on the moving subject's direction of movement and the relative position of the moving subject with each contact point.

5. The method according to claim 4, characterized in that, The topographic resistance coefficients of various topographic control points at the reference time, determined based on the impact force, include: S641: For each contact point, adjust the terrain resistance coefficient of the contact point according to the partial impact force of the contact point, so that the direction and speed of the contact point moving under the action of the partial impact force are consistent with the main body of the action. S642: Use the contact point as the completion adjustment point; S643: Rigidify each spline curve. For each terrain control point connected to the completed adjustment point, determine the transmission force from the completed adjustment point to the terrain control point. Adjust the terrain resistance coefficient of the terrain control point according to the transmission force so that the terrain control point can move with the movement of the connected completed adjustment point under the action of the transmission force. S644: The terrain control points whose terrain resistance coefficients are to be adjusted are summarized as adjustment completion points. Steps S643 to S644 are executed until the terrain resistance coefficients of all terrain control points are adjusted.

6. The method according to claim 5, characterized in that, The direction and speed of movement of the moving subject after the reference moment are determined based on the reaction force. The next moment of action and the positions of each contact point at that moment are then determined based on this direction and speed, including: Determine the component reaction force corresponding to each component impact force, wherein the component reaction force is the same in magnitude but opposite in direction to the corresponding component impact force; Determine the resultant force of each component reaction force, and divide the resultant force by the nominal mass to obtain the acceleration; Determine the speed and direction of movement of the subject under acceleration at the next moment of action; Based on the speed and direction of movement at the reference time and the next action time, the movement trajectory of the subject at these two times is determined, and the position of the subject at the next action time is obtained, thus obtaining the position of the contact point at the next action time.

7. The method according to claim 3, characterized in that, The sequence of terrain resistance coefficients for each terrain control point throughout the entire movement of the subject includes: For each terrain control point, retrieve all terrain resistance coefficients determined for that terrain control point, and assign each terrain resistance coefficient a corresponding action time. The terrain resistance coefficients are arranged in order of their application time from earliest to latest to obtain the terrain resistance coefficient sequence.

8. The method according to claim 7, characterized in that, During the actual movement of the main game character, the terrain resistance coefficient of each terrain control point is adjusted according to the corresponding terrain resistance coefficient sequence, including: At each action time, for each terrain control point, the terrain resistance coefficient is adjusted to the terrain resistance coefficient corresponding to that action time.

9. A two-dimensional terrain simulation device, characterized in that, The device includes: The first processing module is used to obtain the position parameters of the terrain control points of each new game view before entering that game view. The second processing module is used to generate terrain control points for the game view based on location parameters; The third processing module is used to assign a terrain resistance coefficient to each terrain control point; The fourth processing module is used to connect the various terrain control points with smooth spline curves based on the spline algorithm after entering a new game view to obtain two-dimensional terrain. The fifth processing module is used to monitor action signals that trigger actions that could lead to terrain destruction; The sixth processing module is used to determine the movement path of the subject that triggered the action and the force relationship between the subject and the two-dimensional terrain during the movement process based on the action signal for each detected action signal, and then determine the terrain resistance coefficient sequence of each terrain control point during the entire movement process of the subject. The seventh processing module is used to adjust the terrain resistance coefficient of each terrain control point according to the corresponding terrain resistance coefficient sequence during the actual movement of the game subject, so that the terrain changes in the two-dimensional terrain are coordinated with the movement of the action subject.