Methods, devices, and electronic devices for controlling the height of game terrain
By saving and updating the height information of the game terrain and dynamically changing the terrain, the problem of players not being able to change the terrain during gameplay is solved, improving the game interaction and experience, and avoiding resource waste.
Patent Information
- Application Number
- CN202311568511.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-22
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2043-11-22
AI Technical Summary
In existing technologies, players cannot change the game terrain during gameplay, resulting in limited interaction methods, insufficient game content, poor player experience, and even potential waste of game server resources.
A method for controlling the height of game terrain is provided, which saves pre-configured height information, updates the height of the game terrain in response to player operation commands, and dynamically changes the terrain using initial height information and alternative height information.
It enables the terrain to change during gameplay, enriching player interaction methods, improving the gaming experience, and avoiding waste of game server resources.
Smart Images

Figure CN120022585B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to a method, apparatus, and electronic device for controlling the height of game terrain. Background Technology
[0002] In existing technologies, developers typically create and edit game terrain in advance in a terrain editor, or edit game terrain in the game's editing scene. However, during actual gameplay, the game audio cannot provide the function of changing game terrain in real time. Therefore, players cannot change the game terrain in the game scene, resulting in players being limited to interacting with game characters. The interaction methods are relatively simple, the game content is not rich enough, and the novelty and interest brought to players are low. This leads to a poor gaming experience and may even cause game users to leave, resulting in a waste of game server resources. Summary of the Invention
[0003] In view of this, the purpose of this disclosure is to provide a method, device, and electronic device for controlling the height of game terrain. During game operation, players can change the terrain height of the initial game terrain. Specifically, the terrain height of the initial game terrain is updated based on pre-configured initial height information and alternative height information of the parts of the game terrain that have undergone terrain updates during the initial game terrain. This achieves the effect of changing the terrain during game operation, enriches the player's interaction methods, improves the player's gaming experience, and avoids the waste of game server resources.
[0004] In a first aspect, embodiments of this disclosure provide a method for controlling the height of game terrain. The method includes: saving pre-configured height information; the height information includes: initial height information of an initial game terrain, and candidate height information of a portion of the game terrain in the initial game terrain that has undergone terrain updates; in response to a game start target command, obtaining the pre-saved initial height information of the initial game terrain and displaying the initial game terrain; in response to a height control operation on the initial game terrain, determining that the game terrain controlled by the height control operation is a specified game terrain, and obtaining target height information matching the specified game terrain from the pre-saved candidate height information; wherein, the specified game terrain is at least a portion of the game terrain in the initial game terrain; updating the initial height information of the specified game terrain according to the target height information; and updating the terrain height of the initial game terrain based on the updated initial height information of the specified game terrain.
[0005] Secondly, embodiments of this disclosure provide a height control device for game terrain. The device includes: a first storage module for storing pre-configured height information; the height information includes: initial height information of an initial game terrain, and candidate height information of a portion of the initial game terrain that has undergone terrain updates; a first acquisition module for acquiring the pre-saved initial height information of the initial game terrain in response to a game start target command, and displaying the initial game terrain; a second acquisition module for determining, in response to a height control operation on the initial game terrain, that the game terrain controlled by the height control operation is a specified game terrain, and acquiring target height information matching the specified game terrain from the pre-saved candidate height information; wherein the specified game terrain is at least a portion of the initial game terrain; a first update module for updating the initial height information of the specified game terrain according to the target height information; and a second update module for updating the terrain height of the initial game terrain based on the updated initial height information of the specified game terrain.
[0006] Thirdly, embodiments of this disclosure provide an electronic device including a processor and a memory, the memory storing computer-executable instructions executable by the processor, the processor executing the computer-executable instructions to implement the height control method for game terrain according to any one of the first aspects.
[0007] Fourthly, embodiments of this disclosure provide a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are invoked and executed by a processor, the computer-executable instructions cause the processor to implement the game terrain height control method of any one of the first aspects.
[0008] The embodiments disclosed herein bring the following beneficial effects:
[0009] This disclosure provides a method, apparatus, and electronic device for controlling the height of game terrain. The method includes: storing pre-configured height information; responding to a game launch target command, acquiring pre-saved initial height information of the initial game terrain and displaying the initial game terrain; responding to a height control operation on the initial game terrain, determining the game terrain controlled by the height control operation as a specified game terrain, acquiring target height information matching the specified game terrain from pre-saved candidate height information; updating the initial height information of the specified game terrain according to the target height information; and updating the terrain height of the initial game terrain based on the updated initial height information of the specified game terrain. In this method, during game execution, players can update the height of the initial game terrain based on the pre-configured initial height information and candidate height information of the game terrain that has undergone terrain updates. This achieves the effect of changing the terrain during game execution, enriching the player's interaction methods, improving the player's gaming experience, and avoiding resource waste on the game server.
[0010] Other features and advantages of this disclosure will be set forth in the following description and will be apparent in part from the description or may be learned by practicing the disclosure. The objects and other advantages of this disclosure are realized and obtained through the structures particularly pointed out in the description, claims and drawings.
[0011] To make the above-mentioned objects, features and advantages of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0012] To more clearly illustrate the technical solutions in the specific embodiments of this disclosure or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0013] Figure 1 A flowchart illustrating a method for controlling the height of game terrain provided in this embodiment of the disclosure;
[0014] Figure 2 A schematic diagram of a terrain editor provided for embodiments of this disclosure;
[0015] Figure 3 A schematic diagram of a terrain component provided for an embodiment of this disclosure;
[0016] Figure 4 A flowchart illustrating a specific method for controlling the height of game terrain provided in this embodiment of the disclosure;
[0017] Figure 5 This is a schematic diagram of the structure of a game terrain height control device provided in an embodiment of the present disclosure;
[0018] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.
[0020] In existing technologies, developers typically create and edit game terrain in advance within a terrain editor, or within the game's editing scene. However, during actual gameplay, players cannot modify the game terrain, limiting their interaction to limited interactions with the game character. This results in a simplistic interaction method, insufficient game content, low novelty and interest for players, a poor gaming experience, and potentially user churn, leading to wasted game server resources. Therefore, this disclosure provides a method, apparatus, and electronic device for controlling the height of game terrain, applicable to devices such as mobile phones, tablets, and computers.
[0021] In one possible implementation, embodiments of this disclosure provide a method for controlling the height of game terrain, such as... Figure 1 As shown, the method for controlling the height of the game terrain includes the following steps:
[0022] Step S102: Save the pre-configured height information; the height information includes: the initial height information of the initial game terrain, and the alternative height information of the game terrain in the initial game terrain that has undergone terrain updates;
[0023] The pre-configured height information mentioned above is typically customized by players through the game engine's terrain editor. This pre-configured height information can include multiple height identifiers, each corresponding to different alternative height information. Optionally, the pre-configured height information is a JSON file. The initial game terrain mentioned above can include different types, such as land terrain, lake terrain, and mountain terrain. The initial height information mentioned above can include initial height data and initial mipmap data for the initial game terrain. Game terrain generated using mipmap data can avoid jagged edges, improving the player's gaming experience; it can also include a height map or vertex data, where height... Figure 1 Vertex data is generally used for rendering on computers, while vertex data is generally used for rendering on mobile devices.
[0024] Step S104: In response to the game start target command, obtain the initial height information of the pre-saved initial game terrain and display the initial game terrain;
[0025] The aforementioned activation command can be a voice command, a text command, or a touch command generated by the player's touch operation on the graphical user interface. The touch command can be generated by the player's operation on icons, buttons, etc. on the graphical user interface.
[0026] Optionally, after the player starts the game, in response to a display command for a specified game scene, the specified game scene is displayed. This specified game scene includes the initial game terrain. Simultaneously, the initial height information of the initial game terrain is retrieved from pre-saved height information, and the initial game terrain is displayed based on this initial height information. Specifically, the model of the initial game terrain is determined using the initial height data in the initial height information, and the presentation effect of the initial game terrain is also determined based on the initial mipmap data.
[0027] Step S106: In response to the height control operation for the initial game terrain, determine that the game terrain controlled by the height control operation is the specified game terrain, and obtain the target height information that matches the specified game terrain from the pre-saved candidate height information; wherein, the specified game terrain is at least a part of the game terrain in the initial game terrain;
[0028] The aforementioned target height information includes target height data for a specified game terrain. This target height data is the updated height data of the specified game terrain after a height update occurs in the initial game terrain. The height control operation can be performed by the player on the terrain in the game. Optionally, an edit button can be displayed, allowing the player to enter edit mode and adjust parameters to set the terrain height; alternatively, the player can use touch controls on the graphical user interface to enter edit mode and drag the initial game terrain to adjust its height; or a spinning wheel can be displayed on the interface, allowing the player to adjust the initial game terrain height.
[0029] Step S108: Update the initial height information of the specified game terrain according to the target height information;
[0030] The aforementioned technique of updating the initial height information of a specified game terrain is to change the height information of the specified game terrain within the initial game terrain. Target height information can include one or more. Optionally, when there is only one target height information, the initial height information of the specified game terrain can be updated based on that target height information; when there are multiple target height information, relevant calculations (such as interpolation calculations, averaging calculations, etc.) can be performed on the multiple target height information to determine the calculated target height information, and the initial height information of the specified game terrain can be updated based on this calculated target height information.
[0031] Step S110: Update the terrain height of the initial game terrain based on the updated initial height information of the specified game terrain.
[0032] The aforementioned update of the initial game terrain height based on the initial height information of the specified game terrain can be done automatically after the player performs a height control operation, or before the next height control operation, or the system can pre-set the game terrain height to be updated at regular intervals.
[0033] Optionally, based on the updated initial height information of the specified game terrain, update the terrain height of the specified game terrain in the initial game terrain.
[0034] Optionally, the game system will automatically update the terrain height of the specified game terrain in the initial game terrain based on the updated initial height information of the specified game terrain.
[0035] This disclosure provides a method for controlling the height of game terrain. The method includes: saving pre-configured height information; responding to a game launch target command, acquiring pre-saved initial height information of the initial game terrain and displaying the initial game terrain; responding to a height control operation on the initial game terrain, determining the game terrain controlled by the height control operation as a specified game terrain, acquiring target height information matching the specified game terrain from pre-saved candidate height information; updating the initial height information of the specified game terrain according to the target height information; and updating the terrain height of the initial game terrain based on the updated initial height information of the specified game terrain. In this method, during game execution, players can update the height of the initial game terrain based on the pre-configured initial height information and candidate height information of the game terrain that has undergone terrain updates. This achieves the effect of changing the terrain during game execution, enriching the player's interaction methods, improving the player's gaming experience, and avoiding resource waste on the game server.
[0036] The aforementioned pre-configured height information is determined in the following manner:
[0037] The system uses a terrain editor to create initial game terrain and save its height information. It then responds to editing operations on the initial game terrain by updating it. By comparing the initial game terrain with the updated initial game terrain, it identifies the parts of the game terrain that have undergone height updates and saves the alternative height information of these updated parts of the game terrain, thus obtaining the pre-configured height information.
[0038] The terrain editor described above can include multiple display areas, each displaying different information and having different functions. These areas can be adjacent to each other or not. One display area can show one or more tools for editing the game terrain, as well as the real-time style of the game terrain and one or more parameter settings related to the game terrain. The editing operations can include operations such as adjusting the terrain height. The portion of the game terrain whose height has been updated can be determined by calculating the height information of the initial game terrain and the updated initial game terrain. This height information can be stored in one or more JSON files.
[0039] The following describes how to render game terrain. The initial game terrain mentioned above consists of multiple terrain components. These components are Unreal Engine's basic rendering units, visibility calculation units, and collision units. The entire game terrain is rendered by rendering each terrain component. A terrain component is typically a square containing n*n (n is an integer) small squares, which in turn contain multiple basic units for terrain LOD calculation (sections). Each basic unit contains multiple smallest constituent units of the ground surface (quards), which are small squares. The default value is usually 1 meter, and the value of the quard can be modified by changing the scale. All terrain components remain connected, and the vertex positions of adjacent edges of each adjacent component are the same.
[0040] For example, such as Figure 2 As shown, the right-hand area represents the rendered terrain after its creation, composed of multiple terrain components. Each terrain component represents a terrain tile, and the size of the terrain tile can be adjusted by changing the parameters within the white rectangle on the left. For example... Figure 3 As shown, the terrain component consists of four sections (the areas with black diagonal lines in the figure), and each section consists of nine quards (the gray areas in the figure).
[0041] Furthermore, the created terrain is rendered. Optionally, the rendering operations for desktop and mobile devices are different. When rendering the terrain on the desktop, the entire terrain is rendered by rendering each terrain component. A vertex buffer (VertexBuffer) of a flat mesh can be built for each terrain component. Then, the vertices are sampled from the height map (HeightMap) in the VertexBuffer to obtain the corresponding height and normals, and finally, a corresponding terrain is output. The terrain data is stored through each channel of the texture: the RG channel stores the height data, and the AB channel stores the normal data. The R channel is used to store the high eight bits of the height data, and the G channel is used to store the low eight bits of the height data.
[0042] For example, the rendering process involves the terrain component ULandscapeComponent creating a corresponding FPrimitiveSceneProxy using the CreateSceneProxy() method to handle the rendering. The SceneProxy created in the CreateSceneProxy() function is responsible for pushing data from the logic thread into the rendering pipeline on the rendering thread side, including vertex buffers, index buffers, etc. The terrain also has corresponding vertex data, defined through FLandscapeVertexFactory.
[0043] When rendering on mobile devices, there is no need to consider editing the terrain in edit mode. Furthermore, the SceneProxy for mobile devices is FLandscapeComponentSceneProxyMobile. Mobile devices do not have HeightmapTexture, so vertex data can be passed from PlatformData. The first data in MobileWeightmapTextures is the normal map.
[0044] Furthermore, the shape and size of terrain areas can be defined using brushes, which can have different shapes, sizes, and attenuations. Brush attenuation determines the hardness of the brush edges. In UE4, terrain brushes have three modes: Manage, Sculpt, and Paint. In Manage mode, you can create new terrain, modify existing terrain components using component tools, and perform operations such as selecting, deleting, and moving components. In Sculpt mode, you can modify the shape of the terrain, change its height, etc. In Paint mode, you can selectively apply material layers to different parts of the terrain actor, such as for brushing grass.
[0045] The process of changing terrain height in brush sculpting mode might be as follows: First, obtain the brush range data, which can be calculated using `FLandscapeBrushData BrushInfo = Brush->ApplyBrush(InteractorPositions)`. The sculpting range can also be calculated, along with the sculpting depth of each point. This depth is related to the distance from the center; for example, a brush at the center of a circle will have a greater sculpting depth the closer it is to the center. Next, obtain the height data within the brush range. This range can be the range calculated in the previous step or a filtered brush range. Then, iterate through the points within the range, change the height values, and save these values to an array. Finally, apply the new height values to the terrain.
[0046] For example, selecting the brush in the panel and dragging the cursor on the terrain object by clicking can adjust the terrain's height. The height data at this point can be the target height. This target height data can be cached, and the corresponding cache can be used to retrieve the height data, which is then saved to a JSON file. Each time the terrain editor is used, a new JSON file is saved. Since each game terrain contains multiple terrain components, data on changes to these components can be saved in the JSON file.
[0047] In some optional embodiments, the pre-configured height information includes multiple height identifiers; different height identifiers correspond to different candidate height information; in response to a height control operation on the initial game terrain, determining that the game terrain controlled by the height control operation is the specified game terrain, and obtaining target height information matching the specified game terrain from the pre-saved candidate height information, one possible implementation is as follows:
[0048] In response to a height control operation on the initial game terrain, determine the target height identifier after the specified game terrain has been updated; determine at least one height identifier that matches the target height identifier from multiple height identifiers, and determine the candidate height information corresponding to at least one height identifier as the target height information that matches the specified game terrain.
[0049] The aforementioned height control operation can be an operation where the player controls the initial game terrain to change its height. Optionally, a turntable control can be displayed in the game interface, allowing the player to change the initial game terrain height by spinning the turntable. Spinning stops when the initial game terrain is adjusted to a suitable position. For example, if the player wants to change the current lake, spinning the turntable will gradually make the lake shallower. When the lake is adjusted to a suitable position, the player stops spinning the turntable, saves the current state, and exits. The aforementioned height identifier has corresponding alternative height information, allowing the player to determine one or more height identifiers that match the target height identifier from multiple height identifiers. The pre-configured height information includes the height identifier of the height data; for example, the height identifier for the first height information is the first height identifier (e.g., "1").
[0050] Optionally, the pre-configured height information includes multiple height identifiers for different plots in the initial height terrain; different height identifiers for the same plot correspond to different alternative height information. Alternatively, a target plot matching the specified game terrain can be determined from multiple plots, and then at least one height identifier matching the target height identifier can be determined from the multiple height identifiers of the target plot. The alternative height information corresponding to this at least one height identifier is then determined as the target height information matching the specified game terrain.
[0051] In some optional embodiments, the initial height information includes initial height data of the initial game terrain; the initial height data includes a height map or vertex data; the target height information includes target height data of the specified game terrain; the target height data is the updated height data of the specified game terrain in the initial game terrain where a height update has occurred; one possible implementation of the step of updating the initial height information of the specified game terrain according to the target height information is: updating the initial height data of the specified game terrain in the initial height data to the target height data.
[0052] One possible implementation of the above step of updating the terrain height of the initial game terrain based on the updated initial height information of the specified game terrain is as follows: update the terrain height of the specified game terrain in the initial game terrain based on the updated initial height data of the specified game terrain.
[0053] In some optional embodiments, the initial height information mentioned above further includes initial mipmap data of the initial game terrain; one possible implementation of the step of updating the initial height information of the specified game terrain according to the target height information is as follows:
[0054] Calculate the target mipmap data for the specified game terrain based on the target height data; update the initial mipmap data of the specified game terrain in the initial mipmap data to the target mipmap data to obtain the updated initial height information of the specified game terrain.
[0055] The aforementioned mipmap data can be used when importing textures for game terrain editing. The combination of mipmap technology and material mapping technology allows for the representation of planar textures at different resolutions using a single material map, with the largest image placed prominently in the foreground, based on varying visual distances. Each different size level defines a mipmap level, with higher levels resulting in clearer images. When target height information is updated, target mipmap data can be calculated from the target height data. Updating the initial height data and initial mipmap data of the specified game terrain to the target height data and target mipmap data yields the updated initial height information for the specified game terrain. This method uses mipmap data to avoid jagged edges in the image, improving the player's gaming experience.
[0056] One possible implementation of the above step of updating the terrain height of the initial game terrain based on the updated initial height information of the specified game terrain is as follows: based on the updated initial height data of the specified game terrain and the updated initial Mipmap data of the specified game terrain, update the terrain height of the specified game terrain in the initial game terrain.
[0057] The updated initial height information of the specified game terrain includes the updated initial height data and the updated initial mipmap data. When the terrain height changes, the terrain texture also needs to be changed accordingly. Therefore, it is necessary to update the initial height data and initial mipmap data of the specified game terrain at the same time to achieve the realism and consistency of terrain rendering.
[0058] In some optional embodiments, the target height information includes multiple targets; one possible implementation of the step of updating the initial height information of the specified game terrain based on the target height information is: interpolating the multiple targets to obtain interpolated height information; and updating the initial height information of the specified game terrain based on the interpolated height information.
[0059] If the user adjusts the initial height of the game terrain, placing it between the first and second height markers, the target height information obtained will be the first height information corresponding to the first height marker and the second height information corresponding to the second height marker. Optionally, interpolated height information can be obtained by interpolating the first and second height information; or, the average of the first and second height information can be calculated to obtain the aforementioned difference height information. Finally, the initial height information of the specified game terrain is updated based on the interpolated height information.
[0060] One possible implementation of the above step of obtaining target height information matching the specified game terrain from pre-saved candidate height information is as follows: based on a task concurrency mechanism, load the target height information matching the specified game terrain from pre-saved candidate height information.
[0061] The concurrency mechanism described above can be either thread-based parallel programming or task-based parallel programming. Optionally, loading the target height information mentioned above refers to loading the corresponding JSON file. TaskGraph is a task-based parallel programming tool that is easy to use and can be used to load JSON files.
[0062] For example, a task can be defined where the `GetDesiredThread()` method returns the thread the task is expected to run on. A common approach is to obtain a suitable thread using a `FAutoConosoleTaskPriority` object, or to specify a particular thread, such as `ENamedThreads::GameThread` or `ENamedThreads::AnyHiPriThreadHiPriTask`. The `GetSubsequentsMode()` method determines the subsequent execution mode; optionally, it returns `TrackSubsequents` if a subsequent task exists, and `FireAndForget` if no subsequent task exists. The `DoTask()` method contains the actual code for the task.
[0063] Furthermore, create a task using TGraphTask, such as TGraphTask<FTask_LoadFileToString> `::CreateTask(nullptr,ENamedThreads::GameThread).ConstructAndDispatchWhenReady(FilePath,Key,TaskDelegate);` Finally, a callback needs to be bound. The JSON data is processed in the callback function, and after parsing, a `TArray Data` height array is obtained. This method uses concurrency to handle multiple requests simultaneously, resulting in faster response times and improved player experience.
[0064] The above method also includes: determining the collider of the updated initial game terrain based on the initial height information of the updated initial game terrain.
[0065] The colliders of the updated initial game terrain described above are the physical data for determining the updated initial game terrain. Optionally, a physics engine can be used to simulate physical effects. All physical motion and collisions are managed by PhysX, and the colliders of the initial game terrain are updated by updating the corresponding HeightField data.
[0066] For example, first find the corresponding ULandscapeHeightfieldCollisionComponent, then modify the corresponding PxHeightField height data, and then refresh it using the FPhysicsInterface::SetGeometry(PShapes[0],LandscapeComponentGeom) method to obtain the updated initial game terrain collider.
[0067] This embodiment provides a flowchart illustrating a specific method for controlling the height of game terrain, as shown below. Figure 4As shown, ALandscape is the method for editing game terrain. By calling this method, operations such as creating and rendering the terrain can be performed. Save saves the height information (corresponding to the initial height information of the initial game terrain mentioned above). By editing the game terrain, the height array is obtained and saved to the corresponding JSON file (corresponding to the alternative height information mentioned above). Load loads the data in the initial JSON file and performs caching operations. The JSON file stores one or more height information, and the game terrain can be changed according to the height information in the JSON file. Component is Unreal Engine's basic rendering unit, visibility calculation unit, and collision unit. The game terrain is composed of multiple components. The entire game terrain is rendered by rendering each terrain component. It includes multiple basic units for terrain LOD calculation (i.e., sections). Each basic unit includes multiple smallest constituent units (i.e., quards) that make up the ground surface. The terrain components are kept connected, and the vertex positions of the adjacent edges of each adjacent component are the same. The SetHeightData and SetMobileHeightData methods change the terrain height on the computer and mobile devices, respectively.
[0068] In the above method, the initial game terrain is first created in the game terrain editor, and its height information is obtained and saved in a JSON file. Then, in response to the game's start command, the game begins to run. After a period of time, the configuration list is initialized, the file is read from it, and the data for each configuration is cached. The first configuration is retrieved to initialize the terrain, i.e., the pre-configured height information is obtained, and then this data is loaded. At this point, all terrain components in the terrain are traversed to check if the current height information is in the cache. If not, the data in the JSON is read and cached in the cache; if it exists, the current information can be directly read to set the game terrain.
[0069] Players can change the terrain by selecting different configurations to control the height. Optionally, if the player is operating on a computer, they can use the SetHeightData method to change the height information; if the player is operating on a mobile device, they can use the SetMobileHeightData method to change the height information.
[0070] Corresponding to the above method embodiments, this disclosure provides a height control device for game terrain, such as... Figure 5 As shown, the device includes:
[0071] The first storage module 501 is used to store pre-configured height information; the height information includes: the initial height information of the initial game terrain, and the alternative height information of the game terrain in the initial game terrain that has undergone terrain updates;
[0072] The first acquisition module 502 is used to acquire the initial height information of the pre-saved initial game terrain in response to the game start target command and display the initial game terrain;
[0073] The second acquisition module 503 is used to respond to a height control operation on the initial game terrain, determine that the game terrain controlled by the height control operation is a specified game terrain, and acquire target height information that matches the specified game terrain from pre-saved candidate height information; wherein, the specified game terrain is at least a portion of the game terrain in the initial game terrain;
[0074] The first update module 504 is used to update the initial height information of the specified game terrain based on the target height information;
[0075] The second update module 505 is used to update the terrain height of the initial game terrain based on the updated initial height information of the specified game terrain.
[0076] This disclosure provides a device for controlling the height of game terrain. It stores pre-configured height information; in response to a game launch command, it retrieves pre-saved initial height information of the initial game terrain and displays the initial game terrain; in response to a height control operation on the initial game terrain, it determines the game terrain controlled by the height control operation as a specified game terrain, retrieves target height information matching the specified game terrain from pre-saved candidate height information; updates the initial height information of the specified game terrain according to the target height information; and updates the terrain height of the initial game terrain based on the updated initial height information of the specified game terrain. In this method, during game execution, players can update the height of the initial game terrain based on the pre-configured initial height information and candidate height information of the game terrain that has undergone terrain updates. This achieves the effect of changing the terrain during game execution, enriching the player's interaction methods, improving the player's gaming experience, and avoiding resource waste on the game server.
[0077] The aforementioned first storage module is also used to: create initial game terrain through the terrain editor and save the initial height information of the initial game terrain; update the initial game terrain in response to editing operations on the initial game terrain; compare the initial game terrain and the updated initial game terrain to determine the parts of the game terrain that have undergone height updates, and save the alternative height information of the updated parts of the game terrain to obtain the pre-configured height information.
[0078] The pre-configured height information includes multiple height identifiers; different height identifiers correspond to different alternative height information; the second acquisition module is further configured to: respond to height control operations for the initial game terrain, determine the target height identifier after the specified game terrain has been updated; determine at least one height identifier that matches the target height identifier from the multiple height identifiers, and determine the alternative height information corresponding to at least one height identifier as the target height information that matches the specified game terrain.
[0079] The aforementioned initial height information includes the initial height data of the initial game terrain; the target height information includes the target height data of the specified game terrain; the aforementioned initial height data includes a height map or vertex data; the target height data is the updated height data of the specified game terrain in the initial game terrain where a height update has occurred; the aforementioned first update module is further used to: update the initial height data of the specified game terrain in the initial height data to the target height data;
[0080] The aforementioned initial height information also includes the initial mipmap data of the initial game terrain; the aforementioned first update module is further used to: calculate the target mipmap data of the specified game terrain based on the target height data, update the initial mipmap data of the specified game terrain in the initial mipmap data to the target mipmap data, and obtain the updated initial height information of the specified game terrain.
[0081] The aforementioned target height information includes multiple targets; the first update module is also used to: perform interpolation calculations on the multiple target height information to obtain interpolated height information; and update the initial height information of the specified game terrain based on the interpolated height information.
[0082] The pre-configured height information is a JSON file.
[0083] The aforementioned device also includes a data loading module for: loading target height information that matches the specified game terrain from pre-saved height information using a task-based concurrency mechanism.
[0084] The aforementioned device further includes a first determining module, used to: determine the collider of the updated initial game terrain based on the updated initial height terrain initial height information.
[0085] The game terrain height control device provided in this embodiment has the same technical features as the game terrain height control method provided in the above embodiments, so it can also solve the same technical problems and achieve the same technical effects.
[0086] This embodiment also provides an electronic device, including a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor. The processor executes the machine-executable instructions to implement the above-described method for controlling the height of game terrain. This electronic device can be a server or a terminal device.
[0087] See Figure 6 As shown, the electronic device includes a processor 100 and a memory 101. The memory 101 stores machine-executable instructions that can be executed by the processor 100. The processor 100 executes the machine-executable instructions to implement the above-described method for controlling the height of the game terrain.
[0088] Furthermore, Figure 6 The electronic device shown also includes a bus 102 and a communication interface 103, with the processor 100, the communication interface 103 and the memory 101 connected via the bus 102.
[0089] The memory 101 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 103 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc. The bus 102 may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 6 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0090] The processor 100 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the processor 100 or by instructions in software form. The processor 100 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this disclosure. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this disclosure can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a readily available storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 101, and the processor 100 reads the information from memory 101 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiments.
[0091] The processor in the aforementioned electronic device, by executing machine-executable instructions, can perform the following operations in the aforementioned method for controlling the height of the game terrain:
[0092] The system saves pre-configured height information; in response to a game launch target command, it retrieves the pre-saved initial height information of the initial game terrain and displays the initial game terrain; in response to height control operations on the initial game terrain, it determines the game terrain controlled by the height control operation as the specified game terrain, retrieves the target height information matching the specified game terrain from the pre-saved candidate height information; updates the initial height information of the specified game terrain according to the target height information; and updates the terrain height of the initial game terrain based on the updated initial height information of the specified game terrain. In this method, during game runtime, players can update the height of the initial game terrain based on the pre-configured initial height information and the candidate height information of the game terrain that has undergone terrain updates. This achieves the effect of changing the terrain during game runtime, enriches the player's interaction methods, improves the player's gaming experience, and avoids wasting game server resources.
[0093] The pre-configured height information is determined as follows: an initial game terrain is created using the terrain editor, and the initial height information of the initial game terrain is saved; in response to editing operations on the initial game terrain, the initial game terrain is updated; the initial game terrain and the updated initial game terrain are compared, the game terrain that has undergone height updates is determined, and the alternative height information of the updated game terrain is saved to obtain the pre-configured height information.
[0094] The aforementioned pre-configured height information includes multiple height identifiers; different height identifiers correspond to different alternative height information; the step of responding to a height control operation on the initial game terrain, determining the game terrain controlled by the height control operation as the specified game terrain, and obtaining target height information matching the specified game terrain from the pre-saved alternative height information includes: responding to a height control operation on the initial game terrain, determining the target height identifier after the specified game terrain has been updated; determining at least one height identifier matching the target height identifier from multiple height identifiers, and determining the alternative height information corresponding to the at least one height identifier as the target height information matching the specified game terrain.
[0095] The aforementioned initial height information includes the initial height data of the initial game terrain; the target height information includes the target height data of the specified game terrain; the initial height data includes a height map or vertex data; the target height data is the updated height data of the specified game terrain in the initial game terrain where a height update has occurred; the step of updating the initial height information of the specified game terrain according to the target height information includes: updating the initial height data of the specified game terrain in the initial height data to the target height data.
[0096] The aforementioned initial height information includes the initial game terrain and initial mipmap data. The step of updating the initial height information of the specified game terrain based on the target height information further includes: calculating the target mipmap data of the specified game terrain based on the target height information; updating the initial mipmap data of the specified game terrain in the initial mipmap data to the target mipmap data, thus obtaining the updated initial height information of the specified game terrain. In this method, using mipmap data avoids jagged edges appearing in the image, improving the player's gaming experience.
[0097] The aforementioned target height information includes multiple targets; the step of updating the initial height information of the specified game terrain based on the target height information includes: performing interpolation calculations on the multiple target height information to obtain interpolated height information; and updating the initial height information of the specified game terrain based on the interpolated height information.
[0098] The pre-configured height information is a JSON file.
[0099] The steps described above for obtaining target height information matching the specified game terrain from pre-saved candidate height information include: using a task-based concurrency mechanism to load the target height information matching the specified game terrain from the pre-saved candidate height information. This method utilizes a concurrency mechanism to handle multiple requests simultaneously, resulting in faster response times and improved player experience.
[0100] The above method also includes: determining the collider of the updated initial game terrain based on the initial height information of the updated initial game terrain.
[0101] This embodiment also provides a machine-readable storage medium storing machine-executable instructions. When the machine-executable instructions are called and executed by the processor, the machine-executable instructions cause the processor to implement the above-described method for controlling the height of the game terrain.
[0102] The machine-executable instructions stored in the aforementioned machine-readable storage medium can be executed to perform the following operations in the aforementioned method for controlling the height of the game terrain:
[0103] The system saves pre-configured height information; in response to a game launch target command, it retrieves the pre-saved initial height information of the initial game terrain and displays the initial game terrain; in response to height control operations on the initial game terrain, it determines the game terrain controlled by the height control operation as the specified game terrain, retrieves the target height information matching the specified game terrain from the pre-saved candidate height information; updates the initial height information of the specified game terrain according to the target height information; and updates the terrain height of the initial game terrain based on the updated initial height information of the specified game terrain. In this method, during game runtime, players can update the height of the initial game terrain based on the pre-configured initial height information and the candidate height information of the game terrain that has undergone terrain updates. This achieves the effect of changing the terrain during game runtime, enriches the player's interaction methods, improves the player's gaming experience, and avoids wasting game server resources.
[0104] The pre-configured height information is determined as follows: an initial game terrain is created using the terrain editor, and the initial height information of the initial game terrain is saved; in response to editing operations on the initial game terrain, the initial game terrain is updated; the initial game terrain and the updated initial game terrain are compared, the game terrain that has undergone height updates is determined, and the alternative height information of the updated game terrain is saved to obtain the pre-configured height information.
[0105] The aforementioned pre-configured height information includes multiple height identifiers; different height identifiers correspond to different alternative height information; the step of responding to a height control operation on the initial game terrain, determining the game terrain controlled by the height control operation as the specified game terrain, and obtaining target height information matching the specified game terrain from the pre-saved alternative height information includes: responding to a height control operation on the initial game terrain, determining the target height identifier after the specified game terrain has been updated; determining at least one height identifier matching the target height identifier from multiple height identifiers, and determining the alternative height information corresponding to the at least one height identifier as the target height information matching the specified game terrain.
[0106] The aforementioned initial height information includes the initial height data of the initial game terrain; the target height information includes the target height data of the specified game terrain; the initial height data includes a height map or vertex data; the target height data is the updated height data of the specified game terrain in the initial game terrain where a height update has occurred; the step of updating the initial height information of the specified game terrain according to the target height information includes: updating the initial height data of the specified game terrain in the initial height data to the target height data.
[0107] The aforementioned initial height information includes the initial game terrain and initial mipmap data. The step of updating the initial height information of the specified game terrain based on the target height information further includes: calculating the target mipmap data of the specified game terrain based on the target height information; updating the initial mipmap data of the specified game terrain in the initial mipmap data to the target mipmap data, thus obtaining the updated initial height information of the specified game terrain. In this method, using mipmap data avoids jagged edges appearing in the image, improving the player's gaming experience.
[0108] The aforementioned target height information includes multiple targets; the step of updating the initial height information of the specified game terrain based on the target height information includes: performing interpolation calculations on the multiple target height information to obtain interpolated height information; and updating the initial height information of the specified game terrain based on the interpolated height information.
[0109] The pre-configured height information is a JSON file.
[0110] The steps described above for obtaining target height information matching the specified game terrain from pre-saved candidate height information include: using a task-based concurrency mechanism to load the target height information matching the specified game terrain from the pre-saved candidate height information. This method utilizes a concurrency mechanism to handle multiple requests simultaneously, resulting in faster response times and improved player experience.
[0111] The above method also includes: determining the collider of the updated initial game terrain based on the initial height information of the updated initial game terrain.
[0112] The computer program product of the game terrain height control method, device and system provided in this disclosure includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.
[0113] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and apparatus described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0114] Furthermore, in the description of the embodiments of this disclosure, unless otherwise expressly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this disclosure based on the specific circumstances.
[0115] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0116] In the description of this disclosure, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, and are only for the convenience of describing this disclosure and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this disclosure. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0117] Finally, it should be noted that the above embodiments are merely specific implementations of this disclosure, used to illustrate the technical solutions of this disclosure, and not to limit it. The protection scope of this disclosure is not limited thereto. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this disclosure. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure, and should all be covered within the protection scope of this disclosure. Therefore, the protection scope of this disclosure should be determined by the protection scope of the claims.
Claims
1. A method for controlling the height of game terrain, characterized in that, The method includes: Save pre-configured height information; the height information includes: initial height information of the initial game terrain, and alternative height information of the game terrain in the initial game terrain that has undergone terrain updates; the pre-configured height information includes multiple height identifiers; different height identifiers correspond to different alternative height information; In response to the game start target command, the system retrieves the pre-saved initial height information of the initial game terrain and displays the initial game terrain; In response to a height control operation on the initial game terrain, the game terrain controlled by the height control operation is determined to be a specified game terrain, and a target height identifier is determined after the specified game terrain undergoes a terrain update; wherein, the specified game terrain is at least a portion of the game terrain in the initial game terrain; From the plurality of height markers, at least one height marker that matches the target height marker is determined, and the candidate height information corresponding to the at least one height marker is determined as the target height information that matches the specified game terrain; Update the initial height information of the specified game terrain based on the target height information; Based on the updated initial height information of the specified game terrain, update the terrain height of the initial game terrain.
2. The method according to claim 1, characterized in that, The pre-configured height information is determined in the following manner: The initial game terrain is created using the terrain editor, and its initial height information is saved. In response to an edit operation on the initial game terrain, update the initial game terrain; By comparing the initial game terrain with the updated initial game terrain, the parts of the game terrain that have undergone height updates are identified, and the alternative height information of the updated parts of the game terrain is saved to obtain the pre-configured height information.
3. The method according to claim 1, characterized in that, The initial height information includes the initial height data of the initial game terrain; the initial height data includes a height map or vertex data; the target height information includes the target height data of the specified game terrain, wherein the target height data is the updated height data of the specified game terrain after a height update occurs in the initial game terrain; The step of updating the initial height information of the specified game terrain based on the target height information includes: Update the initial height data of the specified game terrain in the initial height data to the target height data.
4. The method according to claim 3, characterized in that, The initial height information also includes the initial Mipmap data of the initial game terrain; The step of updating the initial height information of the specified game terrain based on the target height information further includes: Calculate the target mipmap data of the specified game terrain based on the target height data; The initial mipmap data of the specified game terrain in the initial mipmap data is updated to the target mipmap data to obtain the updated initial height information of the specified game terrain.
5. The method according to claim 1, characterized in that, The target height information includes multiple components; The step of updating the initial height information of the specified game terrain based on the target height information includes: Interpolation calculations are performed on the height information of the multiple targets to obtain interpolated height information; The initial height information of the specified game terrain is updated based on the interpolated height information.
6. The method according to claim 1, characterized in that, The pre-configured height information is a JSON file.
7. The method according to claim 1, characterized in that, The step of determining at least one height identifier from the plurality of height identifiers that matches the target height identifier, and determining the candidate height information corresponding to the at least one height identifier as the target height information that matches the specified game terrain, includes: Based on the task concurrency mechanism, at least one height identifier that matches the target height identifier is determined from the plurality of height identifiers, and target height information that matches the specified game terrain is loaded from the candidate height information corresponding to the at least one height identifier.
8. The method according to claim 1, characterized in that, The method further includes: Based on the updated initial height information of the initial game terrain, the collider of the updated initial game terrain is determined.
9. A height control device for game terrain, characterized in that, The device includes: The first storage module is used to store pre-configured height information; the height information includes: initial height information of the initial game terrain, and alternative height information of the game terrain in the initial game terrain that has undergone terrain updates; the pre-configured height information includes multiple height identifiers; different height identifiers correspond to different alternative height information; The first acquisition module is used to acquire the pre-saved initial height information of the initial game terrain in response to the game start target command, and display the initial game terrain; The second acquisition module is configured to respond to a height control operation on the initial game terrain, determine that the game terrain controlled by the height control operation is a specified game terrain, and determine a target height identifier after the specified game terrain undergoes a terrain update; wherein, the specified game terrain is at least a portion of the game terrain in the initial game terrain; determine at least one height identifier that matches the target height identifier from the plurality of height identifiers, and determine the candidate height information corresponding to the at least one height identifier as the target height information that matches the specified game terrain; The first update module is used to update the initial height information of the specified game terrain according to the target height information; The second update module is used to update the terrain height of the initial game terrain based on the updated initial height information of the specified game terrain.
10. An electronic device, characterized in that, The system includes a processor and a memory, the memory storing computer-executable instructions that can be executed by the processor, the processor executing the computer-executable instructions to implement the game terrain height control method according to any one of claims 1-8.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the height control method for game terrain according to any one of claims 1-8.
Citation Information
Patent Citations
Game scene rendering method and device, and equipment
CN112169324A
Virtual road processing method and device, electronic equipment and storage medium
CN115671729A