Search

CN-122006258-A - Two-dimensional terrain simulation method and device

CN122006258ACN 122006258 ACN122006258 ACN 122006258ACN-122006258-A

Abstract

The invention relates to the field of games, in particular to a two-dimensional terrain simulation method and a two-dimensional terrain simulation device, wherein after terrain resistance is given to a terrain control point, the method can enable the terrain to move cooperatively with the movement of an action main body when the action main body acts, so that the action main body is prevented from crossing the boundary of the two-dimensional terrain to cause the intersection of the action main body and the two-dimensional terrain, the distortion of visual effect is avoided, and the game experience of a user is ensured.

Inventors

  • ZENG JIE

Assignees

  • 深圳市引力乐园科技有限公司

Dates

Publication Date
20260512
Application Date
20260311

Claims (9)

  1. 1. A method of two-dimensional terrain simulation, the method comprising: s1, before entering a new game view, acquiring position parameters of a terrain control point of the game view; s2, generating a terrain control point of the game view based on the position parameter; S3, giving a terrain resistance coefficient to each terrain control point; s4, after entering a new game view, connecting all terrain control points by using a smooth spline curve based on a spline algorithm to obtain a two-dimensional terrain; S5, monitoring an action signal of a triggering action which can cause the damage of the terrain; S6, determining a moving path of an action main body applying trigger action and a stress relation between the action main body and two-dimensional terrains in the moving process according to the action signal when an action signal is monitored, and further determining a terrain resistance coefficient sequence of each terrain control point in the whole moving process of the action main body; And S7, in the actual movement process of the game main body, adjusting the terrain resistance coefficient of each terrain control point according to the corresponding terrain resistance coefficient sequence so as to enable the terrain change on the two-dimensional terrain to be cooperated with the movement of the action main body.
  2. 2. The method of claim 1, wherein the two-dimensional spatial domain of the game view is represented as: Wherein, the In the two-dimensional space domain of the device, Is that Is defined by the minimum abscissa of the (c), Is that Is defined by the maximum abscissa of the (c), Is that Is defined by the minimum ordinate of (c), Is that Is defined by the maximum ordinate of (2); The position parameters of the terrain control points are coordinates of the terrain control points; after assigning each terrain control point a terrain resistance coefficient, the complete set of parameters for any terrain control point is expressed as: Wherein, the For the complete set of parameters for the ith terrain control point, Is the abscissa of the ith terrain control point, Is the ordinate of the ith terrain control point, Is the terrain resistance coefficient of the ith terrain control point.
  3. 3. The method of claim 2, wherein the motion signal comprises a motion body, a direction of movement, and a speed of movement; Determining a moving path of an action main body applying trigger action and a stress relation between the action main body and two-dimensional terrains in the moving process according to the action signal, and further determining a terrain resistance coefficient sequence of each terrain control point in the whole moving process of the action main body comprises the following steps: S61, determining the current position of the action body; s62, generating a moving path of the action body from the current position according to the moving direction until reaching a two-dimensional terrain boundary, and determining a terrain control point which is in contact with the two-dimensional terrain when the action body moves to the end point of the moving path as a contact point; s63, determining the moment that the action body reaches the end point of the moving path as a reference moment; S64, determining the impact force of the contact with the action body, and determining the terrain resistance coefficient of each terrain control point at the reference moment according to the impact force, so that the two-dimensional terrain can move in cooperation with the action body; s65, judging whether the reaction force born by the action main body is higher than a preset lower limit value, if not, finishing the determination of the terrain resistance coefficient; S66, if so, determining the moving direction and the moving speed of the action body after the reference moment according to the received reaction force, determining the next action moment and the positions of the contact points at the moment according to the moving direction and the moving speed, taking the next action moment as the reference moment, and executing the steps S64 to S66 until the determination of the terrain resistance coefficient is completed; S67, aiming at each terrain control point, arranging all corresponding terrain resistance coefficients according to the time sequence to obtain a terrain resistance coefficient sequence of the terrain control point.
  4. 4. A method according to claim 3, wherein determining the impact force on the contact at the action body comprises: the nominal mass of the action main body is called; And calculating the total impact force of the action body on the two-dimensional terrain according to the nominal mass and impulse theorem, and determining the sub-impact force and the direction received by each contact point according to the moving direction of the action body and the relative positions of the action body and each contact point.
  5. 5. The method of claim 4, wherein determining the terrain resistance coefficients for each terrain control point at the reference time based on the impact force comprises: s641, for each contact point, adjusting the terrain resistance coefficient of the contact point according to the sub-impact force of the contact point to ensure that the moving direction and speed of the contact point under the action of the sub-impact force are consistent with those of the action main body; s642, taking the contact point as a completion adjusting point; S643, rigidizing each sample curve, determining the conduction acting force of the finishing adjusting point to the terrain control point for each terrain control point connected with the finishing adjusting point, and adjusting the terrain resistance coefficient of the terrain control point according to the conduction acting force so that the terrain control point can move along with the movement of the finishing adjusting point; And S644, summarizing the terrain control points with the terrain resistance coefficients adjusted as finishing adjustment points, and executing steps S643 to S644 until the terrain resistance coefficients of all the terrain control points are finished being adjusted.
  6. 6. The method of claim 5, wherein determining the direction and speed of movement of the moving body after the reference time based on the reaction force applied, and determining the next time of action and the location of each contact point at that time based on the direction and speed of movement comprises: determining a corresponding sub-reaction force of each sub-impact force, wherein the sub-reaction force is the same as the corresponding sub-impact force in size and opposite in direction; determining the resultant force of the reaction forces of all the components, and dividing the resultant force by the nominal mass to obtain acceleration; determining the moving speed and the moving direction of the action body at the next action moment under the action of acceleration; and determining the moving track of the action body at the reference moment and the next action moment according to the moving speed and the moving direction of the action body at the reference moment and the next action moment to obtain the position of the action body at the next action moment, thereby obtaining the position of the contact point at the next action moment.
  7. 7. A method according to claim 3, wherein determining a sequence of terrain resistance coefficients for each terrain control point throughout the course of movement of the moving body comprises: for each terrain control point, calling all terrain resistance coefficients determined for the terrain control point, and endowing each terrain resistance coefficient with corresponding action time; And arranging the terrain resistance coefficients according to the sequence from the beginning to the end of the action time to obtain a terrain resistance coefficient sequence.
  8. 8. The method of claim 7, wherein adjusting the terrain resistance coefficient of each terrain control point in accordance with the corresponding sequence of terrain resistance coefficients during actual movement of the game body comprises: and for each action moment, for each terrain control point, adjusting the terrain resistance coefficient to the terrain resistance coefficient corresponding to the action moment.
  9. 9. A two-dimensional terrain simulation apparatus, the apparatus comprising: the first processing module is used for acquiring the position parameters of the terrain control points of the game view before entering a new game view; A second processing module for generating a terrain control point for the game view based on the location parameter; a third processing module for imparting a terrain resistance coefficient to each terrain control point; the fourth processing module is used for connecting all terrain control points by using a smooth spline curve based on a spline algorithm after entering a new game view to obtain a two-dimensional terrain; the fifth processing module is used for monitoring an action signal of a triggering action which can cause the damage of the terrain; The sixth processing module is used for determining a moving path of an action main body applying trigger action and a stress relation between the action main body and two-dimensional terrains in the moving process according to the action signal when detecting an action signal, so as to determine a terrain resistance coefficient sequence of each terrain control point in the whole moving process of the action main body; and the seventh processing module is used for adjusting the terrain resistance coefficient of each terrain control point according to the corresponding terrain resistance coefficient sequence in the actual movement process of the game main body so as to enable the terrain change in the two-dimensional terrain to be cooperated with the movement of the action main body.

Description

Two-dimensional terrain simulation method and device Technical Field The invention relates to the field of games, in particular to a two-dimensional terrain simulation method and device. Background In the field of games, real-time editable, destructible two-dimensional terrain is one of the core elements that enhance the interactive experience. However, the existing terrain control points only comprise basic position information such as positions, angles and the like, and related attributes of the terrain damage are not associated, so that shape change generated when the terrain is damaged is lack of cooperation with triggering actions which cause the damage, a motion main body and the two-dimensional terrain are easy to mutually cross, the visual effect is relatively single, authenticity and immersion are lacked, and the user game experience is affected. Disclosure of Invention In view of the above, it is necessary to provide a two-dimensional terrain simulation method and apparatus. The embodiment of the invention is realized in such a way that a two-dimensional terrain simulation method is provided, and the method comprises the following steps: s1, before entering a new game view, acquiring position parameters of a terrain control point of the game view; s2, generating a terrain control point of the game view based on the position parameter; S3, giving a terrain resistance coefficient to each terrain control point; s4, after entering a new game view, connecting all terrain control points by using a smooth spline curve based on a spline algorithm to obtain a two-dimensional terrain; S5, monitoring an action signal of a triggering action which can cause the damage of the terrain; S6, determining a moving path of an action main body applying trigger action and a stress relation between the action main body and two-dimensional terrains in the moving process according to the action signal when an action signal is monitored, and further determining a terrain resistance coefficient sequence of each terrain control point in the whole moving process of the action main body; And S7, in the actual movement process of the game main body, adjusting the terrain resistance coefficient of each terrain control point according to the corresponding terrain resistance coefficient sequence so as to enable the terrain change on the two-dimensional terrain to be cooperated with the movement of the action main body. In one embodiment, the present invention provides a two-dimensional terrain simulation apparatus, the apparatus comprising: the first processing module is used for acquiring the position parameters of the terrain control points of the game view before entering a new game view; A second processing module for generating a terrain control point for the game view based on the location parameter; a third processing module for imparting a terrain resistance coefficient to each terrain control point; the fourth processing module is used for connecting all terrain control points by using a smooth spline curve based on a spline algorithm after entering a new game view to obtain a two-dimensional terrain; the fifth processing module is used for monitoring an action signal of a triggering action which can cause the damage of the terrain; The sixth processing module is used for determining a moving path of an action main body applying trigger action and a stress relation between the action main body and two-dimensional terrains in the moving process according to the action signal when detecting an action signal, so as to determine a terrain resistance coefficient sequence of each terrain control point in the whole moving process of the action main body; and the seventh processing module is used for adjusting the terrain resistance coefficient of each terrain control point according to the corresponding terrain resistance coefficient sequence in the actual movement process of the game main body so as to enable the terrain change in the two-dimensional terrain to be cooperated with the movement of the action main body. The application provides a two-dimensional terrain simulation method and device, wherein the method comprises the steps of obtaining position parameters of terrain control points of a game view before entering a new game view, generating the terrain control points of the game view based on the position parameters, endowing each terrain control point with a terrain resistance coefficient, connecting the terrain control points with a smooth spline curve based on a spline algorithm after entering the new game view to obtain two-dimensional terrain, monitoring an action signal which can cause terrain destruction to trigger action, determining a moving path of an action main body applying trigger action and a stress relation between the action main body and the two-dimensional terrain during moving according to the action signal, further determining a terrain resistance coefficient sequence of each terrain control point