Methods, devices, equipment, and storage media for setting the position and height of game characters
By using two-dimensional sampling and height value lookup of the target terrain, the problem of large game size and low smoothness caused by setting the height of game character positions was solved. This method achieves better integration of game characters with the terrain, reduces dependence on the physics system, and improves the smoothness of game operation and development convenience.
Patent Information
- Application Number
- CN202211555987.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-06
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2042-12-06
AI Technical Summary
The existing technology that uses physical components to set the position and height of game characters results in a large game package size and low running smoothness.
By acquiring the target terrain file and performing two-dimensional sampling, a two-dimensional array is generated and saved to the target data file. During game runtime, the planar position coordinates of the game character in the target terrain are obtained in real time, the corresponding terrain height value is found, and the current height of the game character is set.
Reduce the game package size, improve game smoothness, and facilitate development.
Smart Images

Figure CN116212390B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of network information technology, and in particular to a method, apparatus, device, and storage medium for setting the position and height of a game character. Background Technology
[0002] Currently, in order to improve game performance and increase game playability, many game worlds feature undulating terrain such as mountains, arched bridges, and slopes, rather than just simple flat surfaces. Game characters can walk on mountains, bridges, slopes, and so on.
[0003] In game development, existing methods to make game characters move along the terrain surface and change their position and height according to the terrain's elevation are generally achieved through a physics system. This involves adding physics components to both the terrain and the game character, with the physics system simulating real-world physical interactions. However, relying on physics components requires introducing a bloated and large physics system library, which increases the game's size, reduces game smoothness, and makes development inconvenient.
[0004] The above content is only used to help understand the technical solution of the present invention and does not represent an admission that the above content is prior art. Summary of the Invention
[0005] The main objective of this invention is to provide a method, apparatus, device, and storage medium for setting the position and height of game characters, aiming to solve the technical problem in the prior art where setting the position and height of game characters through physical components results in a large game package size and low running smoothness.
[0006] To achieve the above objectives, the present invention provides a method for setting the position and height of a game character, the method comprising the following steps:
[0007] Obtain the target terrain file and perform two-dimensional sampling on the target terrain in the target terrain file;
[0008] A two-dimensional array is generated based on the sampling results, and the two-dimensional array is saved to the target data file;
[0009] During game runtime, the planar position coordinates of the game character in the target terrain are acquired in real time;
[0010] Based on the planar position coordinates, the corresponding terrain height value is found in the target data file;
[0011] The game character's current height in the target terrain is set based on the terrain height value.
[0012] Optionally, the step of acquiring the target terrain file and performing two-dimensional sampling of the target terrain in the target terrain file includes:
[0013] Obtain the target terrain file and determine the coordinates of the sampling points of the target terrain in the target terrain file;
[0014] Based on the target terrain, determine the terrain height value corresponding to the coordinates of the sampling point, and use the terrain height value as the sampling data;
[0015] The coordinates of the sampling points and the corresponding sampling data are used as the sampling results.
[0016] Optionally, the step of generating a two-dimensional array based on the sampling results and saving the two-dimensional array to the target data file includes:
[0017] A two-dimensional array is generated based on the sampling results, and the two-dimensional array is saved to the target image file;
[0018] Generate a target data file based on the target image file.
[0019] Optionally, the step of generating a two-dimensional array based on the sampling results and saving the two-dimensional array to the target image file includes:
[0020] A two-dimensional array is generated based on the sampling results, and the initial image file is obtained;
[0021] The target pixels in the initial image file are determined based on the coordinates of the sampling points in the two-dimensional array.
[0022] The sampled data in the two-dimensional array is saved to the channel of the target pixel, and the saved initial image file is used as the target image file.
[0023] Optionally, after the steps of obtaining the target terrain file and determining the coordinates of the sampling points of the target terrain in the target terrain file, the method further includes:
[0024] Based on the target terrain, determine the slope value and slope attenuation coefficient corresponding to the coordinates of the sampling point;
[0025] Accordingly, after the step of setting the current height value of the game character in the target terrain based on the terrain height value, the method further includes:
[0026] Determine whether the slope value corresponding to the plane position coordinates exceeds a preset slope value;
[0027] If so, the current movement speed of the game character is adjusted based on the slope attenuation coefficient.
[0028] Optionally, after the step of saving the sampled data in the two-dimensional array to the channel of the target pixel, the method further includes:
[0029] The slope value and the slope attenuation coefficient are saved to the channel of the target pixel.
[0030] Optionally, before the step of adjusting the current movement speed of the game character based on the slope attenuation coefficient, the method further includes:
[0031] Get the current movement speed of the game character;
[0032] Accordingly, the step of adjusting the current movement speed of the game character based on the slope attenuation coefficient includes:
[0033] Multiply the current moving speed by the slope attenuation coefficient to obtain the target moving speed corresponding to the planar position coordinates;
[0034] The game character's current movement speed is adjusted based on the target movement speed.
[0035] Furthermore, to achieve the above objectives, the present invention also proposes a device for setting the position and height of a game character, the device comprising:
[0036] A two-dimensional sampling module is used to acquire a target terrain file and perform two-dimensional sampling on the target terrain in the target terrain file;
[0037] An array generation module is used to generate a two-dimensional array based on the sampling results and save the two-dimensional array to a target data file;
[0038] The coordinate acquisition module is used to acquire the planar position coordinates of the game character in the target terrain in real time during game runtime;
[0039] The height value lookup module is used to find the corresponding terrain height value in the target data file based on the planar position coordinates.
[0040] The height setting module is used to set the current height value of the game character in the target terrain according to the terrain height value.
[0041] Furthermore, to achieve the above objectives, the present invention also proposes a game character position and height setting device, the device comprising: a memory, a processor, and a game character position and height setting program stored in the memory and executable on the processor, the game character position and height setting program being configured to implement the steps of the game character position and height setting method described above.
[0042] Furthermore, to achieve the above objectives, the present invention also proposes a storage medium storing a game character position and height setting program, wherein when the game character position and height setting program is executed by a processor, it implements the steps of the game character position and height setting method described above.
[0043] This invention involves acquiring a target terrain file and performing two-dimensional sampling on the target terrain within the file; generating a two-dimensional array based on the sampling results and saving the array to a target data file; during game execution, acquiring the planar coordinates of the game character within the target terrain in real time; searching for the corresponding terrain height value in the target data file based on the planar coordinates; and setting the game character's current height within the target terrain based on the terrain height value. Because this invention first samples the target terrain to obtain the height values corresponding to each planar coordinate within the terrain, and then searches for the corresponding height value based on the game character's planar coordinates during game execution and sets the game character's current height accordingly, compared to existing methods that set the game character's current height through a material system library, this invention effectively reduces the game package size, improves game smoothness, and facilitates development. Attached Figure Description
[0044] Figure 1 This is a schematic diagram of the device structure for setting the position and height of a game character in the hardware operating environment involved in the embodiments of the present invention.
[0045] Figure 2 This is a flowchart illustrating the first embodiment of the game character position and height setting method of the present invention;
[0046] Figure 3 This is a flowchart illustrating the second embodiment of the game character position and height setting method of the present invention;
[0047] Figure 4 This is a flowchart illustrating the third embodiment of the game character position height setting method of the present invention;
[0048] Figure 5 This is a structural block diagram of the first embodiment of the game character position and height setting device of the present invention.
[0049] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0050] It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the invention.
[0051] Reference Figure 1 , Figure 1 This is a schematic diagram of the device structure for setting the position and height of game characters in the hardware operating environment involved in the embodiments of the present invention.
[0052] like Figure 1As shown, the game character position height setting device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen or an input unit such as a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wireless-Fidelity (Wi-Fi) interface). The memory 1005 may be high-speed random access memory (RAM) or stable non-volatile memory (NVM), such as a disk storage device. The memory 1005 may also optionally be a storage device independent of the aforementioned processor 1001.
[0053] Those skilled in the art will understand that Figure 1 The structure shown does not constitute a limitation on the device for setting the position and height of game characters. It may include more or fewer parts than shown, or combine certain parts, or have different arrangements of parts.
[0054] like Figure 1 As shown, the memory 1005, which serves as a storage medium, may include an operating system, a network communication module, a user interface module, and a program for setting the position and height of game characters.
[0055] exist Figure 1 In the game character position and height setting device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the game character position and height setting device of the present invention can be set in the game character position and height setting device, and the game character position and height setting device calls the game character position and height setting program stored in the memory 1005 through the processor 1001 and executes the game character position and height setting method provided in the embodiment of the present invention.
[0056] This invention provides a method for setting the position and height of a game character, see reference. Figure 2 , Figure 2 This is a flowchart illustrating the first embodiment of the game character position and height setting method of the present invention.
[0057] In this embodiment, the method for setting the height of the game character's position includes the following steps:
[0058] Step S10: Obtain the target terrain file and perform two-dimensional sampling on the target terrain in the target terrain file.
[0059] It should be noted that the method in this embodiment can be applied to scenarios involving setting the height of game characters. The executing entity in this embodiment can be a game character position and height setting device with data processing, network communication, and program execution functions, such as a computer, or other devices capable of performing similar or identical functions. This embodiment and the following embodiments will be specifically described using the aforementioned game character position and height setting device (hereinafter referred to as the device).
[0060] It is understood that the aforementioned target terrain file may store one or more different target terrains. The aforementioned target terrains can be used for game characters to move. The aforementioned target terrains may include, but are not limited to, undulating terrains such as mountains, arched bridges, and slopes. The specific terrain can be set according to the actual situation, and this embodiment does not impose any restrictions.
[0061] It should be understood that the aforementioned target terrain can be drawn and generated by the user in the engine or editing tools, or it can be automatically generated by the aforementioned device according to the user's needs.
[0062] Furthermore, in order to collect comprehensive data on the entire target terrain, in this embodiment, step S10 includes:
[0063] Step S11: Obtain the target terrain file and determine the coordinates of the sampling points of the target terrain in the target terrain file.
[0064] It should be noted that the above sampling point coordinates can be the planar coordinates corresponding to each coordinate point in the target terrain. For ease of understanding, the coordinate axes corresponding to the planar coordinates in the target terrain can be set as the X-axis and Z-axis, and the coordinate axis representing the height can be set as the Y-axis.
[0065] Understandably, the sampling points mentioned above can be points on the target terrain. The specific number of each sampling point can be set according to the actual situation. The more sampling points there are, the denser the sampling will be, and the more accurate the scanning results of the target terrain will be. The above device can perform two-dimensional scanning of the target terrain and determine the X-axis coordinates and Z-axis coordinates of each sampling point in the target terrain.
[0066] Step S12: Determine the terrain height value corresponding to the coordinates of the sampling point based on the target terrain, and use the terrain height value as the sampling data.
[0067] It should be understood that when the target terrain is generated, the X-axis, Y-axis and Z-axis coordinates of each point on the target terrain are saved in the target terrain file. Therefore, when the above-mentioned device scans, it can determine the area to be scanned according to the user's needs. The area to be scanned can be the entire target terrain or a part of it, and the points in the area to be scanned can be used as sampling points.
[0068] It should be explained that the height value of the terrain mentioned above can be the Y-axis coordinate value of the corresponding sampling point, and the device can use the obtained Y-axis coordinate value as sampling data.
[0069] Step S13: Use the coordinates of the sampling points and the corresponding sampling data as the sampling results.
[0070] Understandably, the aforementioned device can use the X-axis, Y-axis, and Z-axis coordinates of the obtained sampling points as sampling results.
[0071] In a specific implementation, the device can acquire a target terrain file containing a pre-drawn target terrain, determine the coordinates of sampling points in the target terrain, determine the corresponding terrain height value based on the sampling point coordinates, use the terrain height value as sampling data, and use the sampling points and the corresponding sampling data as sampling results.
[0072] Step S20: Generate a two-dimensional array based on the sampling results, and save the two-dimensional array to the target data file.
[0073] It should be noted that the above two-dimensional array may include the X-axis coordinate value, Y-axis coordinate value and Z-axis coordinate value corresponding to the above sampling point, and the above target data file may be a file used to store the above two-dimensional array. The specific file type is not limited in this embodiment.
[0074] Step S30: During game execution, obtain the planar position coordinates of the game character in the target terrain in real time.
[0075] In the specific implementation, since the position of the game character can change in real time during game operation, the above-mentioned device can obtain the current planar position coordinates of the game character in the above-mentioned target terrain in real time, that is, the X-axis coordinate value and the Z-axis coordinate value.
[0076] Step S40: Based on the planar position coordinates, find the corresponding terrain height value in the target data file.
[0077] Understandably, since the target data file stores the Y-axis coordinate values corresponding to each sampling point, the aforementioned device can traverse the target data file according to the planar position coordinates to obtain the height value corresponding to the planar position coordinates, that is, the Y-axis coordinate value.
[0078] Step S50: Set the current height value of the game character in the target terrain according to the terrain height value.
[0079] In practice, the aforementioned device can set the height of the game character based on the obtained terrain height value, thereby enabling the game character to be at the same height as its current position on the target terrain, thus achieving a fit with the target terrain.
[0080] In this embodiment, the device acquires and stores a target terrain file containing pre-drawn target terrain, determines the coordinates of sampling points in the target terrain, determines the corresponding terrain height value based on the sampling point coordinates, uses the terrain height value as sampling data, and uses the sampling points and corresponding sampling data as sampling results. A two-dimensional array is generated based on the sampling results and saved to the target data file. Since the position of the game character can change in real time during game operation, the device can acquire the current planar position coordinates of the game character in the target terrain in real time, and then search in the target data file based on the planar position coordinates to obtain the corresponding terrain height value. Finally, the current height of the game character is set according to the terrain height value, thereby achieving a close fit with the target terrain. Compared with existing methods, this method can eliminate the dependence on the physics system, reduce the game package size, and avoid introducing other unnecessary functions from the physics system, improving the smoothness of game operation and facilitating development.
[0081] refer to Figure 3 , Figure 3 This is a flowchart illustrating the second embodiment of the game character position height setting method of the present invention.
[0082] Considering that there are various types of target data files, but for ease of user observation, based on the first embodiment described above, in this embodiment, as follows... Figure 3 As shown, step S20 above includes:
[0083] Step S21: Generate a two-dimensional array based on the sampling results, and save the two-dimensional array to the target image file.
[0084] It should be noted that the size of the target image file can be the same as the target terrain, or it can be other sizes; this embodiment does not impose any restrictions.
[0085] Understandably, to facilitate user observation, the aforementioned two-dimensional array can be saved to the channel of the target image file. The specific process is as follows: generate a two-dimensional array based on the sampling results and obtain an initial image file; determine the target pixel in the initial image file based on the coordinates of the sampling points in the two-dimensional array; save the sampling data in the two-dimensional array to the channel of the target pixel, and use the saved initial image file as the target image file.
[0086] It should be emphasized that the initial image file can be a single-channel image file or a three-channel image file. In this embodiment, a three-channel image file is used in order to store more information. Therefore, since the initial image file does not have a two-dimensional array, the brightness of the initial image file can be set to the lowest level.
[0087] It should be understood that in the initial image file mentioned above, one pixel can represent a sampling point, and the position of the pixel in the initial image file can represent the X-axis coordinate value and Z-axis coordinate value of the sampling point. The pixel channel can store the height value, and the larger the height value, the brighter the corresponding pixel brightness. Specifically, the height value can be stored in the R channel of the pixel, or it can be other channels. This embodiment does not limit it.
[0088] Step S22: Generate a target data file based on the target image file.
[0089] This real-time device can generate a two-dimensional array based on the sampling results and obtain an initial image file. It determines the pixel position in the initial image file based on the coordinates of the sampling points in the two-dimensional array and uses the pixel as the target pixel. At the same time, it saves the height value corresponding to the sampling point to the R channel of the target pixel. Finally, it uses the saved initial image file as the target image file and generates a target data file based on the target image file. Users can accurately observe the height of the target terrain based on the brightness of the target image file.
[0090] refer to Figure 4 , Figure 4 This is a flowchart illustrating the third embodiment of the game character position height setting method of the present invention.
[0091] Furthermore, considering that the game character's movement speed is slow when the target terrain has a large slope, making it inconvenient to set the movement speed, and based on the above embodiments, in this embodiment, as follows... Figure 4 As shown, after step S11 above, the following steps are also included:
[0092] Step S111: Determine the slope value and slope attenuation coefficient corresponding to the coordinates of the sampling point based on the target terrain.
[0093] It should be noted that the slope values corresponding to the above sampling point coordinates can also be obtained from the target terrain file. The slope attenuation coefficient can be determined by combining the height values corresponding to each sampling point. It is easy to understand that the greater the difference in height values between two sampling points, the greater the slope value and the smaller the slope attenuation coefficient.
[0094] Accordingly, after step S50 above, the following steps are also included:
[0095] Step S60: Determine whether the slope value corresponding to the plane position coordinates exceeds the preset slope value.
[0096] It is understood that the above-mentioned preset slope value can be set according to the actual situation, and this embodiment does not impose any restrictions on it.
[0097] It should be understood that the slope value and slope attenuation coefficient mentioned above can be saved to the channel of the target pixel. Specifically, the slope value can be saved to the A channel of the target pixel, and the slope attenuation coefficient can be saved to the G channel of the target pixel.
[0098] Step S70: If so, adjust the current movement speed of the game character based on the slope attenuation coefficient.
[0099] It should be explained that, before step S70 above, the method further includes: obtaining the current movement speed of the game character; correspondingly, step S70 above includes: multiplying the current movement speed by the slope attenuation coefficient to obtain the target movement speed corresponding to the planar position coordinates; and adjusting the current movement speed of the game character according to the target movement speed.
[0100] In this embodiment, the device can determine the slope value and slope attenuation coefficient corresponding to the sampling point coordinates based on the target terrain, and save the slope value and slope attenuation coefficient to the channel of the target pixel. Then, it can obtain the current movement speed of the game character, determine whether the slope value corresponding to the planar position coordinates exceeds the preset slope value, and if so, multiply the current movement speed by the slope attenuation coefficient to obtain the target movement speed. Finally, it can adjust the current movement speed according to the target movement speed, thereby accurately setting the current movement speed of the game character.
[0101] Furthermore, this embodiment of the invention also proposes a storage medium storing a game character position and height setting program, which, when executed by a processor, implements the steps of the game character position and height setting method described above.
[0102] In addition, refer to Figure 5 , Figure 5 This is a structural block diagram of a first embodiment of the game character position and height setting device of the present invention. The present invention also proposes a game character position and height setting device, which includes:
[0103] The two-dimensional sampling module 501 is used to acquire the target terrain file and perform two-dimensional sampling on the target terrain in the target terrain file;
[0104] The array generation module 502 is used to generate a two-dimensional array based on the sampling results and save the two-dimensional array to the target data file;
[0105] The coordinate acquisition module 503 is used to acquire the planar position coordinates of the game character in the target terrain in real time during game operation;
[0106] The height value lookup module 504 is used to look up the corresponding terrain height value in the target data file based on the planar position coordinates.
[0107] The height value setting module 505 is used to set the current height value of the game character in the target terrain according to the terrain height value.
[0108] In this embodiment, the device acquires and stores a target terrain file containing pre-drawn target terrain, determines the coordinates of sampling points in the target terrain, determines the corresponding terrain height value based on the sampling point coordinates, uses the terrain height value as sampling data, and uses the sampling points and corresponding sampling data as sampling results. A two-dimensional array is generated based on the sampling results and saved to the target data file. Since the position of the game character can change in real time during game operation, the device can acquire the current planar position coordinates of the game character in the target terrain in real time, and then search in the target data file based on the planar position coordinates to obtain the corresponding terrain height value. Finally, the current height of the game character is set according to the terrain height value, thereby achieving a close fit with the target terrain. Compared with existing methods, this method can eliminate the dependence on the physics system, reduce the game package size, and avoid introducing other unnecessary functions from the physics system, improving the smoothness of game operation and facilitating development.
[0109] Other embodiments or specific implementations of the game character position height setting device of the present invention can be found in the above-described method embodiments, and will not be repeated here.
[0110] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0111] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0112] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as read-only memory / random access memory, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0113] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.
Claims
1. A method for setting the position and height of a game character, characterized in that, The method includes the following steps: Obtain the target terrain file and determine the coordinates of the sampling points of the target terrain in the target terrain file, wherein the coordinates of the sampling points are the planar coordinates corresponding to each coordinate point in the target terrain; Based on the target terrain, determine the terrain height value corresponding to the coordinates of the sampling point, and use the terrain height value as the sampling data; The coordinates of the sampling points and the corresponding sampling data are used as the sampling results; A two-dimensional array is generated based on the sampling results, and the two-dimensional array is saved to the target data file. The two-dimensional array includes the X-axis coordinate value, Y-axis coordinate value and Z-axis coordinate value corresponding to the coordinates of the sampling point. During game runtime, the planar position coordinates of the game character in the target terrain are acquired in real time; Based on the planar position coordinates, the corresponding terrain height value is found in the target data file; The game character's current height in the target terrain is set based on the terrain height value.
2. The method for setting the position and height of a game character as described in claim 1, characterized in that, The step of generating a two-dimensional array based on the sampling results and saving the two-dimensional array to the target data file includes: A two-dimensional array is generated based on the sampling results, and the two-dimensional array is saved to the target image file; Generate a target data file based on the target image file.
3. The method for setting the position and height of a game character as described in claim 2, characterized in that, The step of generating a two-dimensional array based on the sampling results and saving the two-dimensional array to the target image file includes: A two-dimensional array is generated based on the sampling results, and the initial image file is obtained; The target pixels in the initial image file are determined based on the coordinates of the sampling points in the two-dimensional array. The sampled data in the two-dimensional array is saved to the channel of the target pixel, and the saved initial image file is used as the target image file.
4. The method for setting the position and height of a game character as described in claim 3, characterized in that, After the steps of obtaining the target terrain file and determining the coordinates of the sampling points of the target terrain in the target terrain file, the method further includes: Based on the target terrain, determine the slope value and slope attenuation coefficient corresponding to the coordinates of the sampling point; Accordingly, after the step of setting the current height value of the game character in the target terrain based on the terrain height value, the method further includes: Determine whether the slope value corresponding to the plane position coordinates exceeds a preset slope value; If so, the current movement speed of the game character is adjusted based on the slope attenuation coefficient.
5. The method for setting the position and height of a game character as described in claim 4, characterized in that, After the step of saving the sampled data in the two-dimensional array to the channel of the target pixel, the method further includes: The slope value and the slope attenuation coefficient are saved to the channel of the target pixel.
6. The method for setting the position and height of a game character as described in claim 4, characterized in that, Before the step of adjusting the current movement speed of the game character based on the slope attenuation coefficient, the method further includes: Get the current movement speed of the game character; Accordingly, the step of adjusting the current movement speed of the game character based on the slope attenuation coefficient includes: Multiply the current moving speed by the slope attenuation coefficient to obtain the target moving speed corresponding to the planar position coordinates; The game character's current movement speed is adjusted based on the target movement speed.
7. A device for setting the position and height of a game character, characterized in that, The device includes: A two-dimensional sampling module is used to acquire a target terrain file and determine the coordinates of sampling points in the target terrain file, wherein the coordinates of the sampling points are the planar coordinates corresponding to each coordinate point in the target terrain; based on the target terrain, the module determines the terrain height value corresponding to the coordinates of the sampling points and uses the terrain height value as sampling data; and uses the coordinates of the sampling points and the corresponding sampling data as the sampling result. An array generation module is used to generate a two-dimensional array based on the sampling results and save the two-dimensional array to a target data file. The two-dimensional array includes the X-axis coordinate values, Y-axis coordinate values and Z-axis coordinate values corresponding to the above sampling points. The coordinate acquisition module is used to acquire the planar position coordinates of the game character in the target terrain in real time during game runtime; The height value lookup module is used to find the corresponding terrain height value in the target data file based on the planar position coordinates. The height setting module is used to set the current height value of the game character in the target terrain according to the terrain height value.
8. A device for setting the position and height of a game character, characterized in that, The device includes: a memory, a processor, and a game character position and height setting program stored in the memory and executable on the processor, the game character position and height setting program being configured to implement the steps of the game character position and height setting method as described in any one of claims 1 to 6.
9. A storage medium, characterized in that, The storage medium stores a game character position and height setting program, which, when executed by a processor, implements the steps of the game character position and height setting method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Weather particle rendering method and device
CN110706324A