Game terrain height control method and device and electronic equipment
By real-time update of the game's terrain height in the game, the problem that players cannot change the terrain when the game is running is solved, the game's interactivity and experience is improved, and resource waste is avoided.
Patent Information
- Application Number
- CN202311568511.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-22
- Publication Date
- 2025-05-23
- Estimated Expiration
- 2043-11-22
AI Technical Summary
In the prior art, players cannot change the game terrain when the game is running, resulting in a single interaction mode and insufficient game content, which affects players' freshness and interest, which leads to poor game experience and user loss.
It provides a height control method for game terrain. By saving pre-configured height information, responding to player's height control operations, updating the terrain height of the initial game terrain, and achieving the effect of changing the terrain during game running.
It enriches the interaction methods of players, improves the gaming experience of players, and avoids waste of resources on the game server.
Smart Images

Figure CN120022585A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a method, device and electronic device for controlling the height of a game terrain. Background Art
[0002] In the prior art, developers usually create and edit game terrain in a terrain editor in advance, or can edit the game terrain in the game editing scene of the game. However, in the actual operation of the game, the called game audio cannot provide the function of changing the 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 in the game. The interaction method is relatively simple, the game content is not rich enough, and the sense of freshness and interest brought to players is low. The player's gaming experience is not good, and it may even lead to the loss of game users, thereby resulting in a waste of game server resources. Summary of the invention
[0003] In view of this, the purpose of the present disclosure is to provide a method, device and electronic device for controlling the height of a game terrain. When a game is running, a player can change the terrain height of an initial game terrain. Specifically, the terrain height of the initial game terrain is updated according to pre-configured initial height information about the initial game terrain and alternative height information of a part of the game terrain where terrain updates occur in the initial game terrain, so as to achieve the effect of changing the terrain when the game is running, enrich the player's interaction method, improve the player's gaming experience, and avoid wasting resources of the game server.
[0004] In a first aspect, an embodiment of the present disclosure provides a method for controlling the height of a game terrain, the method comprising: saving pre-configured height information; the height information comprising: initial height information of an initial game terrain, and alternative height information of a portion of the game terrain where terrain update occurs in the initial game terrain; in response to a game start target instruction, 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 designated game terrain, and obtaining target height information matching the designated game terrain from the pre-saved alternative height information; wherein the designated game terrain is at least a portion of the game terrain in the initial game terrain; updating the initial height information of the designated 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 designated game terrain.
[0005] In a second aspect, an embodiment of the present disclosure provides a device for controlling the height of a game terrain, the device comprising: a first storage module for storing pre-configured height information; the height information comprising: initial height information of an initial game terrain, and alternative height information of a portion of the game terrain where terrain update occurs in the initial game terrain; a first acquisition module for responding to a game start target instruction, acquiring the pre-saved initial height information of the initial game terrain, and displaying the initial game terrain; a second acquisition module for responding to a height control operation on the initial game terrain, determining that the game terrain controlled by the height control operation is a designated game terrain, and acquiring target height information matching the designated game terrain from the pre-saved alternative height information; wherein the designated game terrain is at least a portion of the game terrain in the initial game terrain; a first update module for updating the initial height information of the designated 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 designated game terrain.
[0006] In a third aspect, the embodiments of the present disclosure provide an electronic device including a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the method for controlling the height of the game terrain of any one of the first aspects.
[0007] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the method for controlling the height of the game terrain of any one of the first aspects.
[0008] The embodiments of the present disclosure bring the following beneficial effects:
[0009] The present disclosure provides a method, device and electronic device for controlling the height of a game terrain, which save pre-configured height information; in response to a game start target instruction, obtain the pre-saved initial height information of the initial game terrain, and display the initial game terrain; in response to a height control operation for the initial game terrain, determine that the game terrain controlled by the height control operation is a designated game terrain, and obtain target height information matching the designated game terrain from pre-saved alternative height information; update the initial height information of the designated game terrain according to the target height information; and update the terrain height of the initial game terrain based on the updated initial height information of the designated game terrain. In this method, when the game is running, the player can update the height of the initial game terrain according to the pre-configured initial height information of the initial game terrain and the alternative height information of the part of the game terrain where the terrain update occurs in the initial game terrain, thereby achieving the effect of changing the terrain when the game is running, enriching the player's interaction method, improving the player's game experience, and avoiding the waste of resources of the game server.
[0010] Other features and advantages of the present disclosure will be described in the following description, and partly become apparent from the description, or understood by practicing the present disclosure. The purpose and other advantages of the present disclosure are realized and obtained by the structures particularly pointed out in the description, claims and drawings.
[0011] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the specific embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.
[0013] Figure 1 A flowchart of a method for controlling the height of a game terrain provided by an embodiment of the present disclosure;
[0014] Figure 2 A schematic diagram of a terrain editor provided for an embodiment of the present disclosure;
[0015] Figure 3 A schematic diagram of a terrain component provided for an embodiment of the present disclosure;
[0016] Figure 4 A flowchart of a specific method for controlling the height of a game terrain provided by an embodiment of the present disclosure;
[0017] Figure 5 A schematic diagram of the structure of a height control device for a game terrain provided by an embodiment of the present disclosure;
[0018] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0019] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0020] In the existing technology, developers usually create and edit game terrain in the terrain editor in advance, or can edit the game terrain in the game editing scene of the game. However, in the actual operation of the game, players cannot change the game terrain in the game scene, resulting in players being limited to interacting with game characters in the game. The interaction method is relatively simple, the game content is not rich enough, and the players have low sense of freshness and interest. The player's gaming experience is not good, and it may even cause the loss of game users, thereby resulting in a waste of game server resources. Based on this, the embodiments of the present disclosure provide a method, device and electronic device for controlling the height of game terrain, which can be applied to mobile phones, tablet computers, computers and other devices.
[0021] In a possible implementation, the present disclosure provides a method for controlling the height of a game terrain, such as Figure 1 As shown, the height control method of the game terrain includes the following steps:
[0022] Step S102, saving pre-configured height information; the height information includes: initial height information of the initial game terrain, and candidate height information of a portion of the game terrain where terrain update occurs in the initial game terrain;
[0023] The above-mentioned pre-configured height information is usually customized by the player through the terrain editor of the game engine. The pre-configured height information may include multiple height identifiers, where different height identifiers may correspond to different alternative height information. Optionally, the pre-configured height information is a file in json format. The above-mentioned initial game terrain may include different types, such as land terrain, lake terrain, mountain terrain, etc. The above-mentioned initial height information may include initial height data and initial Mipmap data of the initial game terrain, where the game terrain generated by Mipmap data can avoid jagged edges and improve the player's gaming experience; it may also include height maps or vertex data, where the height Figure 1 Generally used for computer rendering, vertex data is generally used for mobile rendering.
[0024] Step S104, in response to the game start target instruction, obtaining the pre-saved initial height information of the initial game terrain, and displaying the initial game terrain;
[0025] The above-mentioned target opening instruction can be a voice instruction, a text instruction or a touch instruction generated by the player's touch operation on the graphical user interface, wherein the touch instruction 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 instruction of a specified game scene, the specified game scene is displayed, the specified game scene includes the initial game terrain, and the initial height information of the initial game terrain is obtained from the pre-saved height information, and the initial game terrain is displayed according to the initial height information. Specifically, the model of the initial game terrain is determined by the initial height data in the initial height information, and the performance effect of the initial game terrain is determined according to the initial Mipmap data.
[0027] Step S106, in response to the height control operation on the initial game terrain, determining that the game terrain controlled by the height control operation is the designated game terrain, and obtaining target height information matching the designated game terrain from pre-stored candidate height information; wherein the designated game terrain is at least part of the game terrain in the initial game terrain;
[0028] The target height information includes target height data of the specified game terrain, wherein the target height data is the height data after the specified game terrain is updated in the initial game terrain. The height control operation may be a corresponding operation performed by the player on the terrain in the game. Optionally, an edit button may be displayed, and the player enters the edit mode by clicking the button and sets the height of the terrain by adjusting the parameters. Alternatively, the player may perform a touch operation on the graphical user interface to enter the editable mode, and the player may drag the initial game terrain to adjust the height. Alternatively, a turntable may be displayed in the interface, and the player may adjust the height of the initial game terrain by turning the turntable.
[0029] Step S108, updating the initial height information of the designated game terrain according to the target height information;
[0030] The above-mentioned updating of the initial height information of the designated game terrain is a technique for changing the height information of the designated game terrain in the initial game terrain. The target height information may include one or more. Optionally, when there is only one target height information, the initial height information of the designated game terrain may be updated according to the target height information; when there are multiple target height information, relevant calculations (such as interpolation calculations, average calculations, etc.) may be performed on the multiple target height information to determine the calculated target height information, and the initial height information of the designated game terrain may be updated according to the calculated target height information.
[0031] Step S110, updating the terrain height of the initial game terrain based on the updated initial height information of the designated game terrain.
[0032] The above-mentioned updating of the terrain height of the initial game terrain based on the initial height information of the specified game terrain can be automatically updated after the player performs a height control operation, or can be updated before the next height control operation, or the system can preset the terrain height of the game terrain to update at regular intervals.
[0033] Optionally, based on the updated initial height information of the specified game terrain, the terrain height of the specified game terrain in the initial game terrain is updated.
[0034] Optionally, the game system will automatically update the terrain height of the specified game terrain in the initial game terrain directly according to the updated initial height information of the specified game terrain.
[0035] The disclosed embodiment provides a method for controlling the height of a game terrain, which saves pre-configured height information; in response to a game start target instruction, obtains the pre-saved initial height information of the initial game terrain, and displays the initial game terrain; in response to a height control operation for the initial game terrain, determines that the game terrain controlled by the height control operation is a designated game terrain, and obtains target height information matching the designated game terrain from pre-saved alternative height information; updates the initial height information of the designated 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 designated game terrain. In this method, when the game is running, the player can update the height of the initial game terrain according to the pre-configured initial height information of the initial game terrain and the alternative height information of the part of the game terrain in the initial game terrain where the terrain update occurs, thereby achieving the effect of changing the terrain when the game is running, enriching the player's interaction method, improving the player's gaming experience, and avoiding the waste of game server resources.
[0036] The above pre-configured altitude information is determined in the following way:
[0037] Through the terrain editor, the initial game terrain is created and the height information of the initial game terrain is saved; in response to the editing operation on the initial game terrain, the initial game terrain is updated; the initial game terrain and the updated initial game terrain are compared to determine the part of the game terrain that has undergone height update, and the alternative height information after the update of the part of the game terrain is saved to obtain the pre-configured height information.
[0038] The terrain editor may include multiple display areas, each display area corresponding to displaying different information and having different functions, and may be adjacent or non-adjacent to each other. One of the display areas may display one or more tools for editing the game terrain, may also display the style of the game terrain in real time, and may also display one or more parameter settings related to the game terrain. The editing operations may include operations such as adjusting the height of the terrain. The part of the game terrain determined to have undergone a height update may be obtained by calculating the height information of the initial game terrain and the updated initial game terrain. The height information may be saved in one or more json files.
[0039] The following describes how to render the game terrain. The above initial game terrain includes multiple terrain components (i.e., components), which are the basic rendering units, visibility calculation units, and collision units of Unreal. The entire game terrain is rendered by rendering each terrain component. The terrain component is usually a square containing n*n (n is an integer) small squares, which includes multiple basic units (i.e., sections) for terrain LOD calculation. The basic unit also includes multiple minimum components (i.e., quards) that constitute the surface, which is a small square. The default value is generally 1 meter, and the value of quard can be modified by modifying the scale. Each terrain component remains connected, and the vertex positions of the adjacent edges of each adjacent component are the same.
[0040] For example, Figure 2 As shown in the figure, the area on the right is a terrain rendering body after the terrain is created. It is composed of multiple terrain components. A terrain component represents a terrain block. The size of the terrain block can be adjusted by changing the parameters in the white rectangular box on the left. Figure 3 As shown, the terrain component component includes four sections (the areas with black diagonal lines in the figure), and each section includes nine quards (the gray areas in the figure).
[0041] Furthermore, the created terrain is rendered. Optionally, the rendering operations are different for the PC and mobile terminals. When rendering the terrain on the PC, the entire terrain is rendered by rendering each terrain component. A vertex buffer VertexBuffer of a flat mesh can be constructed for each terrain component. Then, the vertices in the VertexBuffer sample the height map HeightMap to obtain the corresponding height and normal, and finally output a corresponding terrain. The terrain data is saved through each channel of the texture. The RG channel saves the height data, and the AB channel saves the normal data. The R channel is used to save the high eight-bit data of the height, and the G channel is used to save the low eight-bit data of the height.
[0042] For example, the rendering process is that the terrain component ULandscapeComponent creates the corresponding FPrimitiveSceneProxy through the method CreateSceneProxy() to be responsible for rendering. Among them, the SceneProxy created in the CreateScenceProxy() function is responsible for pushing the data on the logical thread side into the rendering pipeline on the rendering thread side, including the vertex buffer VertexBuffer, the index buffer IndexBuffer, etc. The terrain also corresponds to the corresponding vertex data, which is defined by FLandscapeVertexFactory.
[0043] When rendering for mobile devices, there is no need to consider editing the terrain in the edit state, and the SceneProxy of the mobile device is FLandscapeComponentSceneProxyMobile. There is no HeightmapTexture in the mobile device. The vertex data can be passed from PlatformData, and the first data of MobileWeightmapTextures is the normal map.
[0044] Furthermore, the shape and size of the terrain area can be defined by a brush, which can have different shapes, sizes and attenuation. The brush attenuation can determine the hardness of the brush edge. In UE4, the terrain brush is divided into three modes: Manage mode, Sculpt mode and Paint mode. In Manage mode, you can create a new terrain, modify existing terrain components using component tools, select, delete and move components; in Sculpt mode, you can make different modeling modifications to the terrain, change the terrain height, etc.; in Paint mode, you can selectively apply material layers to various parts of the terrain Actor, such as brushing grass.
[0045] Among them, the process of changing the terrain height in the brush carving mode may be: first, obtain the brush range data, which can be based on FLandscapeBrushData BrushInfo = Brush->ApplyBrush (InteractorPositions); calculate the carving range, and also calculate the carving depth of each point. The value of the carving depth is related to the distance from the center. For example, the closer the brush is to the center, the greater the carving depth; further, obtain the height data within the brush range, and the brush range can be the range calculated in the previous step, or the brush range after screening; further, traverse the points within the range, change the height values, and save these values in an array; finally, apply the new height value to the terrain.
[0046] For example, select a brush in the panel, and drag the cursor on the terrain object by clicking to adjust the height of the terrain. The height data at this time may be the target height data. The target height data may be cached by Cache, and the height data may be further obtained by the corresponding cache, and then saved in a json file. Each time the terrain editor is used, a json file is saved. Since each game terrain includes multiple terrain components, the data of the changed terrain components may be saved in a json file.
[0047] In some optional embodiments, the above-mentioned pre-configured height information includes multiple height identifiers; different height identifiers correspond to different candidate height information; in response to the height control operation on the initial game terrain, the game terrain controlled by the height control operation is determined to be the specified game terrain, and the step of obtaining the target height information matching the specified game terrain from the pre-saved candidate height information is a possible implementation method:
[0048] In response to the height control operation for the initial game terrain, a target height identifier after the terrain update of the specified game terrain is determined; at least one height identifier matching the target height identifier is determined from multiple height identifiers, and alternative height information corresponding to the at least one height identifier is determined as the target height information matching the specified game terrain.
[0049] The above-mentioned height control operation can be an operation in which the player controls the initial game terrain to change the height of the terrain. Optionally, a turntable control can be displayed in the game interface. The player changes the height of the initial game terrain by turning the turntable control, and stops turning when the initial game terrain is adjusted to a suitable position. For example, the player wants to change the current lake, turn the turntable, the lake will slowly become shallower, when the lake is adjusted to a suitable position, the player stops turning the turntable, and then saves and exits the current state. The above-mentioned height identifier has corresponding alternative height information, and one or more height identifiers that match the target height identifier can be determined from multiple height identifiers. The pre-configured height information includes the height identifier of the height data, for example, the height identifier of the first height information is the first height identifier (such as "1").
[0050] Optionally, the pre-configured height information includes multiple height identifiers of different plots in the initial height terrain; different height identifiers of the same plot correspond to different candidate height information. Optionally, a target plot matching the specified game terrain is first determined from multiple plots, and then at least one height identifier matching the target height identifier is determined from multiple height identifiers of the target plot, and the candidate height information corresponding to the at least one height identifier is determined as the target height information matching the specified game terrain.
[0051] In some optional embodiments, in some optional embodiments, the above-mentioned 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 whose height is updated in the initial game terrain; the step of updating the initial height information of the specified game terrain according to the target height information, a possible implementation method is: updating the initial height data of the specified game terrain in the initial height data to the target height data.
[0052] A 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 designated game terrain is as follows: updating the terrain height of the designated game terrain in the initial game terrain based on the updated initial height data of the designated game terrain.
[0053] In some optional embodiments, the initial height information further includes initial Mipmap data of the initial game terrain; a step of updating the initial height information of the specified game terrain according to the target height information, a possible implementation method is:
[0054] Calculate the target Mipmap data of the specified game terrain according to 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.
[0055] The above Mipmap data can be used when editing game terrain and importing textures. The combination of Mipmap technology and material mapping technology can represent plane textures in the form of multiple images with different resolutions using a single material map according to different visual distances, with the largest image placed in the front and most prominent position. Each different size level is defined as a Mipmap level, and the higher the level, the clearer the image. When the target height information is updated, the target Mipmap data can be obtained by calculation based on the target height data, and the initial height data and initial Mipmap data of the specified game terrain can be updated to the target height data and target Mipmap data to obtain the updated initial height information of the specified game terrain. In this way, the use of Mipmap data avoids the appearance of jagged edges in the image and improves the player's gaming experience.
[0056] A 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, the terrain height of the specified game terrain in the initial game terrain is updated.
[0057] The above-mentioned updated initial height information of the specified game terrain includes the updated initial height data of the specified game terrain and the updated initial Mipmap data of the specified game terrain. When the terrain height changes, the texture of the terrain 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 authenticity and coordination of terrain rendering.
[0058] In some optional embodiments, the above-mentioned target height information includes multiple steps; a step of updating the initial height information of the specified game terrain according to the target height information, a possible implementation method: interpolating multiple target height information to obtain interpolated height information; updating the initial height information of the specified game terrain according to the interpolated height information.
[0059] If the user adjusts the height of the initial game terrain, the adjustment is between the first height mark and the second height mark. At this time, the target height information obtained is the first height information corresponding to the first height mark and the second height information corresponding to the second height mark. Optionally, the interpolation height information is obtained by interpolating the first height information and the second height information; or, the average data of the first height information and the second height information is calculated to obtain the above-mentioned difference height information. Finally, the initial height information of the specified game terrain is updated according to the interpolation height information.
[0060] A possible implementation of the above step of obtaining target height information matching the specified game terrain from pre-saved alternative height information is as follows: based on a task concurrency mechanism, target height information matching the specified game terrain is loaded from pre-saved alternative height information.
[0061] The above concurrency mechanism can be thread-based parallel programming or task-based parallel programming. Optionally, the above loading target height information is to load the corresponding json file. TaskGraph is task-based parallel programming and is easy to use. TaskGraph can be used to load the json file.
[0062] For example, a task can be defined, in which the method GetDesiredThread() is used to return the thread that the task wants to run. The common writing method can be to obtain a current suitable thread through a classFAutoConosoleTaskPriority object, or to specify a thread, such as ENamedThreads::GameThread; ENamedThreads::AnyHiPriThreadHiPriTask, etc. The subsequent execution mode can be determined by the method GetSubsequentsMode(). Optionally, if there is a subsequent task, the value is TrackSubsequents; if there is no subsequent task, the value is FireAndForget. The method DoTask() contains the actual working code of the task.
[0063] Furthermore, create a task through TGraphTask, such as TGraphTask<FTask_LoadFileToString> ::CreateTask(nullptr,ENamedThreads::GameThread).ConstructAndDispatchWhenReady(FilePath,Key,TaskDelegate);Finally, you need to bind the callback, process the json data in the callback function, and get the TArray Data height array after parsing. In this way, the concurrent mechanism can process multiple requests at the same time, the response will be faster, and the player's gaming experience will also be improved.
[0064] The above method also includes: determining a collision body of the updated initial game terrain based on the initial height information of the updated initial game terrain.
[0065] The above determination of the collision body of the updated initial game terrain is to determine the physical data of the initial game terrain of the updated initial game terrain. Optionally, a physics engine can be used to simulate physical effects. All physical movements and collisions are managed by PhysX, and the collision body of the initial game terrain is updated by updating the corresponding HeightField data.
[0066] Exemplarily, first find the corresponding ULandscapeHeightfieldCollisionComponent, then modify the corresponding PxHeightField height data, and then refresh it through the FPhysicsInterface::SetGeometry(PShapes[0],LandscapeComponentGeom); method to obtain the updated collision body of the initial game terrain.
[0067] This embodiment provides a flow chart of a specific method for controlling the height of a game terrain. Figure 4As shown, ALandscape is a method for editing game terrain. By calling this method, you can create, render, and perform other operations on the terrain; Save is to save 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 above-mentioned alternative height information); Load is to load the data in the initial json file and cache it. 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; componet is Unreal's basic rendering unit, visibility calculation unit, and collision unit. The game terrain is composed of multiple componet. The entire game terrain is rendered by rendering each terrain component, which includes multiple basic units (i.e., sections) for terrain LOD calculation. The basic unit includes multiple minimum components (i.e., quards) that constitute the surface. Each terrain component remains connected, and the vertex positions of the adjacent edges of each adjacent component are the same; SetHeightData and SetMobileHeightData methods are used to change the terrain height on the computer and mobile terminals respectively.
[0068] In the above method, first create the initial game terrain in the game terrain editor, obtain the height information, and save the height information in the json file, then respond to the game start command to start the game, initialize the configuration list for a period of time, read the file and cache the data of each configuration, take out the first configuration to initialize the terrain, that is, obtain the pre-configured height information, and then load this data. At this time, traverse all terrain components in the terrain to check whether the current height information is in the cache. If not, read the data in json and cache it in the cache. If it exists, you can directly read the current information to set the game terrain.
[0069] Players can change the terrain by selecting different configurations to perform height control operations. Optionally, if the player is operating on a computer, use the SetHeightData method to change the height information; if the player is operating on a mobile device, use the SetMobileHeightData method to change the height information.
[0070] Corresponding to the above method embodiment, the present disclosure provides a device for controlling the height of a game terrain, such as Figure 5 As shown, the device comprises:
[0071] The first storage module 501 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 a part of the game terrain where terrain update occurs in the initial game terrain;
[0072] The first acquisition module 502 is used to respond to the game start target instruction, obtain the pre-saved initial height information of the initial game terrain, and display the initial game terrain;
[0073] The second acquisition module 503 is used to respond to the height control operation on the initial game terrain, determine that the game terrain controlled by the height control operation is the designated game terrain, and obtain target height information matching the designated game terrain from the pre-stored candidate height information; wherein the designated game terrain is at least part of the game terrain in the initial game terrain;
[0074] A first updating module 504, used to update the initial height information of the designated game terrain according to the target height information;
[0075] The second updating module 505 is used to update the terrain height of the initial game terrain based on the updated initial height information of the designated game terrain.
[0076] The disclosed embodiment provides a height control device for game terrain, which saves pre-configured height information; in response to a game start target instruction, obtains the pre-saved initial height information of the initial game terrain, and displays the initial game terrain; in response to a height control operation for the initial game terrain, determines that the game terrain controlled by the height control operation is a designated game terrain, and obtains target height information matching the designated game terrain from pre-saved alternative height information; updates the initial height information of the designated 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 designated game terrain. In this way, when the game is running, the player can update the height of the initial game terrain according to the pre-configured initial height information of the initial game terrain and the alternative height information of the part of the game terrain where the terrain update occurs in the initial game terrain, thereby achieving the effect of changing the terrain when the game is running, enriching the player's interaction method, improving the player's gaming experience, and avoiding the waste of game server resources.
[0077] The above-mentioned first storage module is also used to: create an initial game terrain through a 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 with the updated initial game terrain, determine the part of the game terrain that has undergone height update, and save the alternative height information after the part of the game terrain is updated to obtain pre-configured height information.
[0078] The above-mentioned pre-configured height information includes multiple height identifiers; different height identifiers correspond to different alternative height information; the above-mentioned second acquisition module is also used to: respond to the height control operation for the initial game terrain, and determine the target height identifier after the terrain of the specified game terrain is updated; determine at least one height identifier matching the target height identifier from multiple height identifiers, and determine the alternative height information corresponding to the at least one height identifier as the target height information matching the specified game terrain.
[0079] The 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 that has undergone a height update; the 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 above-mentioned initial height information also includes the initial Mipmap data of the initial game terrain; the above-mentioned first update module is also used to: calculate the target Mipmap data of the specified game terrain according to the target height data, and 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.
[0081] The target height information includes multiple ones; the first updating module is also used for: performing interpolation calculation on the multiple target height information to obtain interpolation height information; and updating the initial height information of the designated game terrain according to the interpolation height information.
[0082] The above pre-configured height information is a file in json format.
[0083] The above-mentioned device also includes a data loading module, which is used to: load target height information matching the specified game terrain from pre-saved height information based on the concurrent mechanism of tasks.
[0084] The above-mentioned device also includes a first determination module, which is used to determine the collision body of the updated initial game terrain based on the initial height information of the updated initial height terrain.
[0085] The height control device for the game terrain provided in the embodiment of the present disclosure has the same technical features as the height control method for the game terrain provided in the above-mentioned embodiment, and therefore can 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, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned game terrain height control method. The electronic device can be a server or a terminal device.
[0087] See also 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-mentioned game terrain height control method.
[0088] Further, Figure 6 The electronic device shown further includes a bus 102 and a communication interface 103 , and the processor 100 , the communication interface 103 and the memory 101 are connected via the bus 102 .
[0089] Among them, the memory 101 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 103 (which can be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. can be used. The bus 102 can 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 an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0090] The processor 100 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 100. The above processor 100 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can 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 gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present disclosure can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present disclosure can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 101, and the processor 100 reads the information in the memory 101 and completes the steps of the method of the above embodiment in combination with its hardware.
[0091] The processor in the electronic device can implement the following operations in the height control method of the game terrain by executing the machine executable instructions:
[0092] Pre-configured height information is saved; in response to a game start target instruction, the pre-saved initial height information of the initial game terrain is obtained, and the initial game terrain is displayed; in response to a height control operation for the initial game terrain, the game terrain controlled by the height control operation is determined to be a designated game terrain, and the target height information matching the designated game terrain is obtained from the pre-saved alternative height information; the initial height information of the designated game terrain is updated according to the target height information; based on the updated initial height information of the designated game terrain, the terrain height of the initial game terrain is updated. In this method, when the game is running, the player can update the height of the initial game terrain according to the pre-configured initial height information of the initial game terrain and the alternative height information of the part of the game terrain where the terrain update occurs in the initial game terrain, thereby achieving the effect of changing the terrain when the game is running, enriching the player's interaction method, improving the player's game experience, and avoiding the waste of game server resources.
[0093] The above-mentioned pre-configured height information is determined in the following manner: by using a terrain editor, an initial game terrain is created 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 is compared with the updated initial game terrain to determine the portion of the game terrain where a height update has occurred, and the alternative height information after the portion of the game terrain has been updated is saved to obtain the pre-configured height information.
[0094] The above-mentioned pre-configured height information includes multiple height identifiers; different height identifiers correspond to different alternative height information; in response to the height control operation on the initial game terrain, the game terrain controlled by the height control operation is determined to be the specified game terrain, and the step of obtaining the target height information matching the specified game terrain from the pre-saved alternative height information includes: in response to the height control operation on the initial game terrain, the target height identifier after the terrain of the specified game terrain is updated is determined; at least one height identifier matching the target height identifier is determined from multiple height identifiers, and the alternative height information corresponding to the at least one height identifier is determined as the target height information matching the specified game terrain.
[0095] The above-mentioned 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 whose height has been updated in the initial game terrain; 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 above-mentioned initial height information includes the initial game terrain and initial Mipmap data; the step of updating the initial height information of the designated game terrain according to the target height information also includes: calculating the target Mipmap data of the designated game terrain according to the target height information; updating the initial Mipmap data of the designated game terrain in the initial Mipmap data to the target Mipmap data, and obtaining the updated initial height information of the designated game terrain. In this method, using Mipmap data avoids the appearance of jagged edges in the image, thereby improving the game experience of the player.
[0097] The target height information includes multiple; the step of updating the specified game terrain initial height information according to the target height information includes: interpolating the multiple target height information to obtain interpolated height information; updating the specified game terrain initial height information according to the interpolated height information.
[0098] The above pre-configured height information is a file in json format.
[0099] The step of obtaining the target height information matching the specified game terrain from the pre-saved candidate height information includes: based on the task concurrency mechanism, loading the target height information matching the specified game terrain from the pre-saved candidate height information. In this way, using the concurrency mechanism can process multiple requests at the same time, the response will be faster, and the player's gaming experience will also be improved.
[0100] The above method also includes: determining a collision body 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, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the above-mentioned game terrain height control method.
[0102] The machine executable instructions stored in the machine readable storage medium can implement the following operations in the height control method of the game terrain by executing the machine executable instructions:
[0103] Pre-configured height information is saved; in response to a game start target instruction, the pre-saved initial height information of the initial game terrain is obtained, and the initial game terrain is displayed; in response to a height control operation for the initial game terrain, the game terrain controlled by the height control operation is determined to be a designated game terrain, and the target height information matching the designated game terrain is obtained from the pre-saved alternative height information; the initial height information of the designated game terrain is updated according to the target height information; based on the updated initial height information of the designated game terrain, the terrain height of the initial game terrain is updated. In this method, when the game is running, the player can update the height of the initial game terrain according to the pre-configured initial height information of the initial game terrain and the alternative height information of the part of the game terrain where the terrain update occurs in the initial game terrain, thereby achieving the effect of changing the terrain when the game is running, enriching the player's interaction method, improving the player's game experience, and avoiding the waste of game server resources.
[0104] The above-mentioned pre-configured height information is determined in the following manner: by using a terrain editor, an initial game terrain is created 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 is compared with the updated initial game terrain to determine the portion of the game terrain where a height update has occurred, and the alternative height information after the portion of the game terrain has been updated is saved to obtain the pre-configured height information.
[0105] The above-mentioned pre-configured height information includes multiple height identifiers; different height identifiers correspond to different alternative height information; in response to the height control operation on the initial game terrain, the game terrain controlled by the height control operation is determined to be the specified game terrain, and the step of obtaining the target height information matching the specified game terrain from the pre-saved alternative height information includes: in response to the height control operation on the initial game terrain, the target height identifier after the terrain of the specified game terrain is updated is determined; at least one height identifier matching the target height identifier is determined from multiple height identifiers, and the alternative height information corresponding to the at least one height identifier is determined as the target height information matching the specified game terrain.
[0106] The above-mentioned 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 whose height has been updated in the initial game terrain; 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 above-mentioned initial height information includes the initial game terrain and initial Mipmap data; the step of updating the initial height information of the designated game terrain according to the target height information also includes: calculating the target Mipmap data of the designated game terrain according to the target height information; updating the initial Mipmap data of the designated game terrain in the initial Mipmap data to the target Mipmap data, and obtaining the updated initial height information of the designated game terrain. In this method, using Mipmap data avoids the appearance of jagged edges in the image, thereby improving the game experience of the player.
[0108] The target height information includes multiple; the step of updating the specified game terrain initial height information according to the target height information includes: interpolating the multiple target height information to obtain interpolated height information; updating the specified game terrain initial height information according to the interpolated height information.
[0109] The above pre-configured height information is a file in json format.
[0110] The step of obtaining the target height information matching the specified game terrain from the pre-saved candidate height information includes: based on the task concurrency mechanism, loading the target height information matching the specified game terrain from the pre-saved candidate height information. In this way, using the concurrency mechanism can process multiple requests at the same time, the response will be faster, and the player's gaming experience will also be improved.
[0111] The above method also includes: determining a collision body 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 method, device and system for controlling the height of game terrain provided in the embodiments of the present 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 previous method embodiments. The specific implementation can be found in the method embodiments, which will not be repeated here.
[0113] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0114] In addition, in the description of the embodiments of the present disclosure, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present disclosure can be understood according to specific circumstances.
[0115] If the functions are implemented in the form of 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 the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0116] In the description of the present disclosure, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present disclosure and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present disclosure. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0117] Finally, it should be noted that the above embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above embodiments, those skilled in the art should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A method for controlling the height of game terrain, It is characterized in that The method comprises: Pre-configured height information is saved; the height information includes: initial height information of the initial game terrain, and candidate height information of a portion of the game terrain where terrain update occurs in the initial game terrain; In response to a game start target instruction, obtaining pre-saved initial height information of the initial game terrain, and displaying the initial game terrain; In response to the height control operation for the initial game terrain, determining that the game terrain controlled by the height control operation is a designated game terrain, and acquiring target height information matching the designated game terrain from the pre-saved candidate height information; wherein the designated game terrain is at least a portion of the game terrain in the initial game terrain; Updating the initial height information of the designated game terrain according to the target height information; Based on the updated initial height information of the designated game terrain, the terrain height of the initial game terrain is updated.
2. The method according to claim 1, It is characterized in that The pre-configured height information is determined in the following manner: Using a terrain editor, create the initial game terrain and save initial height information of the initial game terrain; In response to an editing operation on the initial game terrain, updating the initial game terrain; The initial game terrain is compared with the updated initial game terrain to determine a portion of the game terrain where a height update occurs, and candidate height information of the portion of the game terrain after the update is saved to obtain the pre-configured height information.
3. The method according to claim 1, It is characterized in that The pre-configured height information includes a plurality of height identifiers; different height identifiers correspond to different candidate height information; In response to the height control operation for the initial game terrain, determining that the game terrain controlled by the height control operation is a designated game terrain, and acquiring target height information matching the designated game terrain from the pre-saved candidate height information, comprises: In response to the height control operation for the initial game terrain, determining a target height identifier after the designated game terrain undergoes terrain update; At least one height identifier matching the target height identifier is determined from the multiple height identifiers, and candidate height information corresponding to the at least one height identifier is determined as target height information matching the designated game terrain.
4. The method according to claim 1, It is characterized in that 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 designated game terrain, and the target height data is the updated height data of the designated game terrain that has undergone a height update in the initial game terrain; The step of updating the initial height information of the designated game terrain according to the target height information comprises: The initial height data of the designated game terrain in the initial height data is updated to the target height data.
5. The method according to claim 4, It is characterized in that The initial height information also includes initial Mipmap data of the initial game terrain; The step of updating the initial height information of the designated game terrain according to the target height information also includes: Calculate the target Mipmap data of the specified game terrain according to the target height data; The initial Mipmap data of the designated game terrain in the initial Mipmap data is updated to the target Mipmap data to obtain the updated initial height information of the designated game terrain.
6. The method according to claim 1, It is characterized in that The target height information includes multiple; The step of updating the initial height information of the designated game terrain according to the target height information comprises: Performing interpolation calculation on the plurality of target height information to obtain interpolation height information; The initial height information of the designated game terrain is updated according to the interpolated height information.
7. The method according to claim 1, It is characterized in that The pre-configured height information is a file in json format.
8. The method according to claim 1, It is characterized in that The step of acquiring target height information matching the specified game terrain from the pre-saved candidate height information comprises: Based on the concurrent mechanism of tasks, target height information matching the specified game terrain is loaded from the pre-saved candidate height information.
9. The method according to claim 1, It is characterized in that The method further comprises: Based on the updated initial height information of the initial game terrain, a collision body of the updated initial game terrain is determined.
10. A height control device for game terrain, It is characterized in that The device comprises: 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 a part of the game terrain where terrain update occurs in the initial game terrain; A first acquisition module, configured to respond to a game start target instruction, acquire pre-saved initial height information of the initial game terrain, and display the initial game terrain; A second acquisition module is used to respond to the height control operation on the initial game terrain, determine that the game terrain controlled by the height control operation is a designated game terrain, and acquire target height information matching the designated game terrain from the pre-saved candidate height information; wherein the designated game terrain is at least a part of the game terrain in the initial game terrain; A first updating module, used for updating the initial height information of the designated game terrain according to the target height information; The second updating module is used to update the terrain height of the initial game terrain based on the updated initial height information of the designated game terrain.
11. An electronic device, It is characterized in that It comprises a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the height control method of the game terrain described in any one of claims 1-9.
12. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called and executed by the processor, the computer-executable instructions prompt the processor to implement the method for controlling the height of the game terrain as described in any one of claims 1-9.
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
Game terrain conversion method, electronic equipment and storage medium
CN115957508A
Apparatus, system, and method for automated generation of a virtual environment for software applications
US20060030405A1