Interaction processing method and device in game, electronic equipment and storage medium
By using virtual models in the game to record location interaction information and store it in real-time virtual maps, the problems of low efficiency and difficulty in optimizing game terrain interaction processing in the prior art are solved, and more efficient game operation and simplified processing processes are achieved.
Patent Information
- Application Number
- CN202411884334.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-02-25
AI Technical Summary
The prior art is inefficient and difficult to optimize when performing terrain interaction processing in games, especially when virtual characters jump or fly, complex blueprint operations are required, resulting in complicated processing processes.
By using virtual models in the game to record the location interaction information between virtual objects and virtual elements, and store this information in real-time virtual maps, and then convert it into the rendering target map, reducing the number of rendering target maps and improving the game running efficiency.
It reduces the difficulty of terrain interaction processing of virtual objects during jumping or flying operations, improves game operation efficiency, and solves the problems of low efficiency and high optimization difficulty in the existing technology.
Smart Images

Figure CN119499659A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for interactive processing in a game. Background Art
[0002] As the performance and graphics processing capabilities of electronic devices continue to improve, users have higher and higher requirements for the realism of game graphics, sound effects and interactions. For example, the ground in the game scene may have different materials such as swamps, snow, deserts, stone surfaces, and ice surfaces. When the game characters move on the ground with different materials, in order to improve the realism of the game, it is necessary to dynamically change the material properties of the terrain to enhance the feedback effect of terrain interaction.
[0003] However, the prior art usually captures the position information of virtual objects when performing terrain interaction processing, draws the captured position information into the Render Target map, and then performs material transformation through the Render Target map. However, this method usually requires three or more Render Target maps to ensure the accuracy of the picture, and the accuracy of each Render Target map is 2k, which will consume more bandwidth and memory, not only affecting the efficiency of the game operation, but also increasing the difficulty of optimization when optimizing the terrain interaction effect. At the same time, when the virtual character performs operations such as jumping and flying that do not touch the ground, it can only be achieved through complex blueprint operations, resulting in the problem of complicated terrain interaction processing. Summary of the invention
[0004] In view of this, the purpose of the present application is to provide a method, device, electronic device and storage medium for interactive processing in a game to solve the problems of low game operation efficiency and great difficulty in processing and optimization.
[0005] In a first aspect, an embodiment of the present application provides an interactive processing method in a game, wherein a graphical user interface is provided through a terminal device, and at least a portion of a virtual terrain scene is displayed on the graphical user interface, and a virtual element for covering the virtual terrain scene is provided on the virtual terrain scene, including:
[0006] In response to a movement control instruction for a virtual object, the virtual object is controlled to move in a virtual terrain scene, the virtual object is bound to a virtual model, and the virtual model moves with the virtual object;
[0007] During the movement of the virtual object, the position interaction information between the virtual model and the virtual element is recorded through the real-time virtual map corresponding to the virtual model;
[0008] The virtual terrain scene is rendered according to the position interaction information to present a scene picture effect of real-time interaction between virtual objects and virtual elements in a graphical user interface.
[0009] In a second aspect, an embodiment of the present application further provides an interactive processing device in a game, which provides a graphical user interface through a terminal device, and displays at least part of a virtual terrain scene on the graphical user interface, and a virtual element for covering the virtual terrain scene is provided on the virtual terrain scene, and the device includes:
[0010] A movement control module, for controlling the movement of the virtual object in the virtual terrain scene in response to a movement control instruction for the virtual object, wherein the virtual object is bound to a virtual model, and the virtual model moves with the virtual object;
[0011] An interaction information recording module is used to record the position interaction information between the virtual model and the virtual element through the real-time virtual map corresponding to the virtual model during the movement of the virtual object;
[0012] The scene rendering module is used to render the virtual terrain scene according to the position interaction information, so as to present the scene picture effect of real-time interaction between virtual objects and virtual elements in the graphical user interface.
[0013] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the interactive processing method in the game as described above are performed.
[0014] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the interaction processing method in the game as described above are executed.
[0015] The embodiments of the present application bring the following beneficial effects:
[0016] The embodiment of the present application provides an interactive processing method, device, electronic device and storage medium in a game, which can use a virtual model to obtain the position interaction information of a virtual object. The position interaction information can reflect whether the virtual object interacts with the ground, so that when the virtual object performs an operation such as jumping or flying that does not interact with the ground, the terrain is rendered using the corresponding terrain material that does not interact with the ground, which reduces the difficulty of terrain interaction processing when the virtual object performs operations such as jumping and flying. At the same time, the position interaction information is stored in a real-time virtual map, and the position interaction information is converted into a rendering target map through the real-time virtual map. There is no need to use multiple rendering target maps, which reduces the number of rendering target maps and improves the game operation efficiency. Compared with the interactive processing method in the game in the prior art, it solves the problems of low game operation efficiency and high processing and optimization difficulty.
[0017] In order to make the above-mentioned objects, features and advantages of the present application 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
[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0019] Figure 1 A flowchart showing an interactive processing method in a game provided by an embodiment of the present application is shown;
[0020] Figure 2 A flow chart showing a method for configuring terrain interaction in a game engine provided by an embodiment of the present application is shown;
[0021] Figure 3 A schematic diagram showing a rendering target mapping effect provided by an embodiment of the present application is shown;
[0022] Figure 4 The effect diagram after the virtual object and the virtual element provided in the embodiment of the present application interact with each other is shown;
[0023] Figure 5 A schematic diagram showing the structure of an interactive processing device in a game provided in an embodiment of the present application is shown;
[0024] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0025] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application usually described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, each other embodiment obtained by those skilled in the art without making creative work belongs to the scope of protection of the present application.
[0026] It is worth noting that before this application was filed, with the continuous improvement of the performance and graphics processing capabilities of electronic devices, users have higher and higher requirements for the realism of game pictures, sound effects and interactions. The ground of the game scene will have different materials such as swamps, snow, deserts, stone surfaces, ice surfaces, etc. When the game characters move on the ground of different materials, in order to improve the realism of the game, it is necessary to dynamically change the material properties of the terrain. For example: when the virtual character in the game walks on the snow, it is necessary to leave footprints or change the thickness of the snow at the location where the virtual character walks, so as to enhance the realism of the game. However, the prior art generally adopts the following two methods when performing terrain interaction processing: one is to capture the position information of the virtual object through the SceneCapture2D component, and draw the captured position information into the Render Target map, and then perform material transformation through the RenderTarget map. However, this method usually requires three or more Render Target maps under the premise of ensuring the accuracy of the picture, and the accuracy of each Render Target map is 2k. Multiple high-precision RenderTarget maps will consume more bandwidth and memory, which will not only affect the running efficiency of the game, but also increase the difficulty of optimization when optimizing the terrain interaction effect. Another method is to use the blueprint system to capture the position information of the virtual character, draw the RenderTarget map through the position change of the virtual character, and then realize the material effect. However, this method requires complex blueprint operations to achieve when the virtual character performs operations that do not touch the ground, such as jumping and flying, resulting in the problem of complicated terrain interaction processing.
[0027] The terms involved in the embodiments of the present application are explained below.
[0028] Render target map:
[0029] A render target map, also known as a Render Target map, is a special map in the Unreal Engine that allows data to be written and read dynamically and can store various types of data, such as lighting information, vertex positions, etc. The main feature of the Render Target map is its dynamic writing and reading capabilities, which enables it to be used for a variety of advanced effects and features in game development.
[0030] Real-time virtual texturing:
[0031] Render target map, also known as Runtime Virtual Texture map, is a texture technology used in Unreal Engine to optimize performance and memory usage. RVT map is mainly used to capture and store real-time rendering results of large scenes (such as terrain) to optimize performance and memory usage. It can include information such as terrain color, normal, height, etc., and is suitable for rendering large areas of terrain and environmental details.
[0032] Graphical User Interface:
[0033] It is an interface display format for communication between people and computers, allowing users to manipulate icons, logos or menu options on the screen using input devices such as a mouse or keyboard, and also allowing users to manipulate icons or menu options on the screen by performing touch operations on the touch screen of a touch terminal to select commands, start programs or perform other tasks.
[0034] Game scene:
[0035] It is a virtual scene displayed (or provided) when the application is running on a terminal device or server, that is, the scene used in the normal game process. In other words, the game scene refers to the virtual game control that carries the virtual object during the game process. The virtual object can perform actions such as movement and skill release in the virtual scene under the operation instructions issued by the user (i.e., the player) to the terminal device. Optionally, the game scene can be a simulation environment of the real world, a semi-simulation and semi-fictitious virtual environment, or a purely fictitious virtual environment. The game scene can be any one of a two-dimensional virtual scene, a 2.5-dimensional virtual scene, and a three-dimensional virtual scene. The virtual environment can be the sky, land, ocean, etc., wherein the land includes environmental elements such as deserts and cities. Among them, the game scene is a scene in which the user controls the complete game logic of the virtual object. Optionally, the game scene can also be used for a virtual environment battle between at least two virtual objects, and there are virtual resources available for at least two virtual objects in the game scene. Exemplarily, the game scene may include any one or more of the following elements: game background elements, game virtual character elements, game prop elements, etc.
[0036] In an optional implementation, the interactive processing method in the game in one embodiment of the present disclosure can be run on a local terminal device or a server. When the interactive processing method in the game is run on a server, the method can be implemented and executed based on a cloud interactive system, wherein the cloud interactive system includes a server and a client device.
[0037] In an optional implementation, various cloud applications, such as cloud games, can be run under the cloud interaction system. Taking cloud games as an example, cloud games refer to a game mode based on cloud computing. In the operation mode of cloud games, the operating body of the game program and the main body of the game screen presentation are separated. The storage and operation of the game loading method are completed on the cloud game server. The role of the client device is used for receiving and sending data and presenting the game screen. For example, the client device can be a display device with data transmission function close to the user side, such as a mobile terminal, a TV, a computer, a handheld computer, etc.; but the cloud game server in the cloud is used for information processing. When playing the game, the player operates the client device to send an operation instruction to the cloud game server. The cloud game server runs the game according to the operation instruction, encodes and compresses the game screen and other data, and returns it to the client device through the network. Finally, the client device decodes and outputs the game screen.
[0038] In an optional embodiment, taking a game as an example, a local terminal device stores a game program and is used to present a game screen. The local terminal device is used to interact with the player through a graphical user interface, that is, the game program is downloaded and installed by an electronic device and run conventionally. The local terminal device may provide the graphical user interface to the player in a variety of ways, for example, it may be rendered and displayed on a display screen of the terminal, or provided to the player through a holographic projection. For example, the local terminal device may include a display screen and a processor, the display screen is used to present a graphical user interface, the graphical user interface includes a game screen, and the processor is used to run the game, generate a graphical user interface, and control the display of the graphical user interface on the display screen.
[0039] In a possible implementation, an embodiment of the present invention provides an interaction processing method in a game, providing a graphical user interface through a terminal device, wherein the terminal device can be the local terminal device mentioned above, or can be a client device in the cloud interaction system mentioned above.
[0040] Based on this, an embodiment of the present application provides an interaction processing method in a game to improve the game operation efficiency and reduce the difficulty of terrain interaction processing and optimization.
[0041] See also Figure 1 , Figure 1 This is a flow chart of an interactive processing method in a game provided by an embodiment of the present application. Figure 1 As shown, the interactive processing method in the game provided by the embodiment of the present application includes:
[0042] Step S101, in response to a movement control instruction for a virtual object, controlling the virtual object to move in a virtual terrain scene, the virtual object being bound to a virtual model, and the virtual model moving with the virtual object;
[0043] Step S102, during the movement of the virtual object, recording the position interaction information between the virtual model and the virtual element through the real-time virtual map corresponding to the virtual model;
[0044] Step S103, rendering the virtual terrain scene according to the position interaction information, so as to present a scene picture effect of real-time interaction between virtual objects and virtual elements in the graphical user interface.
[0045] The interactive processing method in the game provided by the embodiment of the present application can use the virtual model to obtain the position interaction information of the virtual object. The position interaction information can reflect whether the virtual object interacts with the ground, so that when the virtual object performs operations such as jumping or flying that do not interact with the ground, the terrain is rendered using the corresponding terrain material that does not interact with the ground, which reduces the difficulty of terrain interaction processing when the virtual object performs operations such as jumping and flying. At the same time, the position interaction information is stored in the real-time virtual map, and the position interaction information is converted into the rendering target map through the real-time virtual map. There is no need to use multiple rendering target maps, which reduces the number of rendering target maps, improves the game operation efficiency, and solves the problems of low game operation efficiency and high processing and optimization difficulty.
[0046] To facilitate understanding of this embodiment, the following takes the interactive processing method in the game applied to the terminal device as an example to illustrate the above exemplary steps provided in the embodiment of the present application. Among them, a graphical user interface is provided by the terminal device, and at least part of the virtual terrain scene is displayed on the graphical user interface, and the virtual terrain scene is provided with virtual elements for covering the virtual terrain scene.
[0047] In step S101 , in response to a movement control instruction for a virtual object, the virtual object is controlled to move within a virtual terrain scene.
[0048] In this step, the movement control instruction may refer to an instruction for controlling the movement of the virtual object. As an example, the movement control instruction may be an instruction issued by clicking a movement control widget.
[0049] A virtual object may refer to an object that can move in a virtual terrain scene and interact with the virtual terrain scene. For example, a virtual object may be a virtual character or a virtual prop. A virtual model is bound to the virtual object, and the virtual model moves with the virtual object.
[0050] The virtual element may refer to an element used to represent the ground morphology, and for example, the virtual element may be an element such as snow, swamp, desert, etc. The virtual element may refer to a virtual element affected by the interactive behavior of the virtual object.
[0051] In an embodiment of the present application, during the running of the game, the user controls the movement of a virtual object in a virtual terrain scene through a mobile control control on a terminal device. The virtual terrain scene is covered with virtual elements such as snow or desert. When controlling the virtual object to move on virtual elements such as snow or desert, it is necessary to present corresponding landform changes in the graphical user interface. For example, when a virtual object walks in the snow, footprints can be left at the location where the virtual object passes or different snow depths can be presented to enhance the realism of the game.
[0052] In step S102, during the movement of the virtual object, the position interaction information between the virtual model and the virtual element is recorded through the real-time virtual map corresponding to the virtual model.
[0053] In this step, the virtual model is used to collect the position interaction information between the virtual object and the virtual element. The virtual model is an object created in the first blueprint corresponding to the virtual object. As an example, the virtual model can be a sphere or a footprint.
[0054] The virtual model is an object bound to the virtual object. The virtual model is bound to the intersection of the virtual object and the virtual element. For example, the virtual model is bound to the sole of the virtual object's feet. When the virtual object moves in the game scene, the virtual model will also move with the virtual object. When the virtual object jumps or flies in the game scene, the virtual model will also jump or fly with the virtual object. It should be noted that the virtual model is set to be invisible, and the user cannot see the virtual model during the game.
[0055] The position interaction information is used to represent the position where the virtual object interacts with the virtual element. When there is no interaction between the virtual object and the virtual element, the position will not be recorded in the position interaction information. For example, when the virtual object is jumping or flying, the virtual object does not interact with the ground, and the position interaction information does not include the position of the virtual object during the jump and flight.
[0056] The real-time virtual map may refer to a runtime virtual texture, namely, Runtime Virtual Texture. The real-time virtual map is set as the virtual texture of the first blueprint of the virtual object and is used to store position interaction information.
[0057] In the embodiment of the present application, although the virtual object is provided with a model collision, the virtual elements covered on the virtual terrain scene, such as snow, water or sand and mud, are only a type of terrain material, and the virtual elements actually have no collision volume. On this basis, it is difficult to determine the interaction between the virtual object and the virtual element through the above-mentioned physical operation. Therefore, the present application collects data by binding an additional virtual model to the virtual object to obtain position interaction information. At every moment during the game operation, the position interaction information between the virtual object and the virtual element is obtained in real time through the virtual model, and the obtained real-time position interaction information is stored in the real-time virtual map. In this way, when the virtual object moves on the virtual terrain scene, since the real-time virtual map can dynamically write and read data, a moving track of the virtual object can be generated in real time in the real-time virtual map, and the moving track is disconnected during the virtual object jumping or flying, that is, the real-time virtual map only records the moving track when the virtual object interacts with the ground.
[0058] In one example, the range for obtaining the position interaction information is predetermined. When the virtual object moves outside the preset range, the position interaction information cannot be obtained. To this end, when the virtual model is used to obtain the position interaction information between the virtual object and the virtual element, it is necessary to determine whether the virtual model is located in the preset real-time virtual volume corresponding to the virtual terrain scene based on the position interaction information. For example, if the virtual terrain scene is a snow scene and the range of the snow is 500×500, the real-time virtual volume corresponding to the snow scene needs to be determined in advance. The range of the real-time virtual volume can be equal to the range of the snow, or slightly larger than the range of the snow when the range of the snow is irregular. Then, it is detected in real time whether the current position of the virtual model is within the preset real-time virtual volume. If the virtual model is located within the preset real-time virtual volume, it indicates that the virtual object moves in the snow, and the position interaction information between the virtual object and the virtual element is obtained to record the moving trajectory of the virtual object in the snow in the real-time virtual map; if the virtual model is located outside the preset real-time virtual volume, it indicates that the virtual object moves outside the snow range, and the position interaction information outside the snow range cannot be obtained, and the moving trajectory outside the snow range cannot be recorded in the real-time virtual map.
[0059] In one example, the real-time virtual texture is associated with the second blueprint so that the second blueprint obtains the position interaction information of the virtual object. If the real-time virtual texture is not associated with the second blueprint, the second blueprint cannot determine which virtual object the position interaction information is. The process of associating the real-time virtual texture with the second blueprint will be described in detail in the subsequent section and will not be repeated here. The second blueprint is a blueprint corresponding to the virtual terrain scene obtained by converting the real-time virtual volume.
[0060] In step S103, the virtual terrain scene is rendered according to the position interaction information to present a scene picture effect of real-time interaction between virtual objects and virtual elements in the graphical user interface.
[0061] In this step, the position interaction information recorded in the real-time virtual map can be drawn into the rendering target map, so as to render the virtual terrain scene using the rendering target map.
[0062] The render target map is the Render Target map. The render target map is used as the basis for material selection when selecting terrain materials.
[0063] In one example, since the rendering target map may store the position interaction information recorded when the game was last run, at the beginning of the current game run, the historical position interaction information recorded in the rendering target map needs to be cleared to avoid rendering errors.
[0064] In one example, since the coordinates of each position in the virtual element are its three-dimensional world coordinates in the game, and the position coordinates in the UV space are presented on the graphical user interface, when drawing the position interaction information in the real-time virtual map to the rendering target map, it is necessary to first perform a coordinate conversion, that is, convert the global coordinates of each position in the virtual element into UV space coordinates, and then use the UV space coordinates to draw the rendering target map, so that the interactive movement trajectory of the virtual object in the UV space can be recorded in real time in the drawn rendering target map.
[0065] For example: for each pixel on the virtual element, the global coordinates of the pixel are converted to local coordinates, that is, the world coordinates are converted to the coordinates of the local block, and then the local coordinates are mapped to the UV space, that is, the local block coordinates are converted to the UV space, to obtain the initial UV space coordinates of the pixel.
[0066] Since the virtual terrain scene is composed of multiple plots, in order to eliminate the position differences between different plots, the initial UV space coordinates need to be normalized, that is, the initial UV space coordinates need to be corrected to obtain corrected UV space coordinates.
[0067] For example, the subdivision values in the X-axis direction and the Y-axis direction can be determined separately, where the subdivision value in the X-axis direction is determined by the length of the virtual terrain scene in the X-axis direction, and the subdivision value in the Y-axis direction is determined by the length of the virtual terrain scene in the Y-axis direction. Then, the X-axis component of the initial UV space coordinate is divided by the subdivision value in the X-axis direction, and the Y-axis component of the initial UV space coordinate is divided by the subdivision value in the Y-axis direction, and then the subdivision values are combined and output to the UV space to obtain the corrected UV space coordinates. Assuming that the range of the virtual terrain scene is 5000×5000, the subdivision values in the X-axis direction and the Y-axis direction are both 5000.
[0068] Finally, the corrected UV space coordinates of each pixel on the virtual element are matched with the pixel in the rendering target map, and the movement trajectory of the virtual object is drawn in the rendering target map according to the position interaction information. The converted movement trajectory can then be presented in the graphical user interface.
[0069] In step S104, the virtual terrain scene is rendered based on the position interaction information in the rendering target map, so as to present the terrain after the virtual object interacts with the virtual terrain scene in the graphical user interface.
[0070] In this step, take the case where the virtual terrain scene does not cover the virtual elements as an example, for example, the virtual object walks on a rocky road, and the location where the virtual object passes does not need to be changed. In this case, it is not necessary to switch the material of different locations in the virtual terrain scene according to the position interaction information to change the terrain material.
[0071] Take the example of covering virtual elements in a virtual terrain scene. For example, when a virtual object walks in the snow, the location where the virtual object passes needs to be changed, such as leaving footprints or changing the thickness of the snow. At this time, it is necessary to switch the material of different locations in the virtual terrain scene according to the position interaction information to change the terrain material.
[0072] In one example, when the topography of a virtual terrain scene is affected by interactive behavior, the topography materials at different positions in the virtual terrain scene can be determined based on the position interaction information in the rendering target map, and the topography materials include a first topography material for representing that the virtual object and the virtual element have not interacted, and a second topography material for representing that the virtual object and the virtual element have interacted. For example: for each position in the virtual terrain scene, determine whether the position is a position where the virtual object and the virtual element interact based on the position interaction information. If it is not a position where the virtual object and the virtual element interact, it indicates that the virtual object has not passed through this place, and the initial snow material can be used, that is, the first topography material is used to render the material at this position; if it is a position where the virtual object and the virtual element interact, it indicates that the virtual object has passed through this place, and a material different from the initial snow material can be used, that is, the second topography material is used to render the material at this position.
[0073] In one example, in order to reflect the difference between the ground where the virtual character passes through snow and where the virtual character does not pass through snow, the first landform material and the second landform material need to be distinguished. For example, the world position offset (WPO) between the first landform material and the second landform material can be set to be different, so as to form different snow thicknesses between the position where the virtual object passes through and the position where the virtual object does not pass.
[0074] In one example, in order to increase the realism of the game, the size of the difference in snow thickness between the position where the virtual object has passed and the position where it has not passed can be determined by a preset attribute in the virtual object, that is, the difference between the world position offset corresponding to the first landform material and the world position offset corresponding to the second landform material is determined by the size of the preset attribute parameter value of the virtual object. For example: the virtual object is set with a weight attribute. If the weight attribute value is larger, the world position offset corresponding to the second landform material is set smaller to increase the difference in snow thickness before and after the virtual object passes; if the weight attribute value is smaller, the world position offset corresponding to the second landform material is set larger to reduce the difference in snow thickness before and after the virtual object passes.
[0075] After determining the terrain material used at each position in the virtual terrain scene, the virtual terrain scene can be rendered using the terrain materials at different positions, so that in the rendered virtual terrain scene, obvious terrain differences are formed between the positions passed by the virtual character and the positions not passed by.
[0076] In one example, the shape of the movement trajectory of the virtual object in the virtual terrain scene is determined by the shape of the virtual model. Therefore, based on the shape information of the virtual model, the shape of the terrain material after the virtual object interacts with the virtual element is determined. For example, if the shape of the virtual model is a sphere, each time the virtual object moves forward one step, it will leave a small arc on the virtual terrain scene. This small arc is called the shape of the terrain material, and multiple arcs connected together form a movement trajectory; if the shape of the virtual model is a cube, each time the virtual object moves forward one step, it will leave a square area on the virtual terrain scene, and multiple squares connected together form a movement trajectory.
[0077] It should be noted that the movement trajectory of the virtual object is generated in real time when the game is running. The movement trajectory will be updated every time the virtual object moves. Different ground performances are formed through material drive, so as to present an interactive effect in the graphical user interface where the terrain changes continuously as the virtual object moves.
[0078] In one example, since the virtual model is used to obtain the position of the virtual object in real time and is an object used at the development level and does not need to be perceived by the user, the virtual model can be hidden in the graphical user interface, that is, the virtual model can be set invisible, and the collision and shadow rendering of the virtual model can be turned off.
[0079] In the embodiment of the present application, in order to implement the above steps, it is necessary to first configure the terrain interaction through the target game engine, and then apply it to the game to present the desired terrain interaction effect when the game is running. Here, the target game engine may refer to a game engine that supports real-time virtual mapping function and rendering target mapping function. As an example, the target game engine may be UE4 engine, that is, Unreal Engine, or Unity engine.
[0080] Refer to the following Figure 2 To introduce the development process of terrain interaction configuration method in game engine.
[0081] Figure 2 A flow chart of a terrain interaction configuration method in a game engine provided by an embodiment of the present application is shown. Figure 2 As shown, the terrain interaction configuration method in the game engine includes:
[0082] Step S201, creating a real-time virtual texture and a rendering target texture.
[0083] Taking the virtual object as a controlled virtual character as an example, you can first create a rendering target map, a real-time virtual map in the target game engine, and write a virtual model material.
[0084] Among them, the rendering target map may refer to the RenderTarget map, the real-time virtual map may refer to the runtime virtual texture, i.e., Runtime Virtual Texture. The size of the real-time virtual map is determined by the picture accuracy. Those skilled in the art can determine the size of the real-time virtual map according to actual conditions, and this application does not limit it here.
[0085] Step S202: creating a virtual model.
[0086] Create an object in the blueprint of the third-person virtual character that comes with the target game engine. The blueprint of the virtual character is called the first blueprint. The object can be a small ball or a footprint. The object is used as a virtual model, and the virtual model material written in the previous step is assigned to the virtual model. The virtual model material is also called a preset material. At the same time, set the virtual model to be hidden and turn off the collision and shadow rendering of the virtual model. Among them, the virtual model is not a function in the target game engine, but an Object in the UE4 engine. The virtual model is an object created in the blueprint of the virtual object. The shape of the virtual model is the shape of the object. For example: if the object is a sphere, the shape of the virtual model is a sphere; if the object is a cube, the shape of the virtual model is a cube.
[0087] Step S203, assigning the real-time virtual texture to the first blueprint.
[0088] Assign the previously created real-time virtual map to the virtual texture in the first blueprint, that is, set the virtual texture of the first blueprint as a real-time virtual map.
[0089] Step S204: drawing the position interaction information in the real-time virtual map into the rendering target map.
[0090] Here, a material is created for drawing the position interaction information in the real-time virtual map to the rendering target map, and the position interaction information can be converted into a color display in the rendering target map by using the material. Among them, the base color (BaseColor) of the real-time virtual map can be used as the opacity of the material, and red can be used as the self-luminous color of the material, that is, the color of the interactive movement track in the rendering target map is red. It can be understood that step S204 samples the real-time virtual map to extract the position interaction information in the virtual map, and draws the extracted position interaction information into the rendering target map.
[0091] Step S205: Create the real-time virtual volume as an editable second blueprint.
[0092] Here, real-time virtual volume may refer to runtime virtual texture volume in Unreal Engine.
[0093] A real-time virtual volume corresponding to the virtual terrain scene is created in the game scene. The real-time virtual volume corresponds to the size of the virtual terrain scene. The larger the size of the virtual terrain scene, the larger the real-time virtual volume; the smaller the size of the virtual terrain scene, the smaller the real-time virtual volume. After the real-time virtual volume is created, the real-time virtual volume is converted into an editable blueprint, which is called a second blueprint.
[0094] Step S206, refreshing the rendering target map in real time.
[0095] In the second blueprint, the rendering target map is set to be initialized before each game is run, that is, the historical position interaction information recorded in the rendering target map is cleared. For example, in the second blueprint, an "Event Starts Running" event and a "Clear Rendering Target 2D" node are created, the "Event Starts Running" event is connected to the "Clear Rendering Target 2D" node, and the "Clear Rendering Target 2D" node includes the rendering target map and Clear Color created in step S201.
[0096] At the same time, the rendering target map is refreshed in real time using the material created in step S204. For example, an "Event Tick" event and a "Draw Material to Render Target" node are created in the second blueprint, the "Event Tick" event and the "Draw Material to Render Target" node are connected, and the "Draw Material to Render Target" node includes the rendering target map created in step S201 and the material created in step S204.
[0097] Refer to the following Figure 3 To introduce the effect of real-time refresh of the rendering target map.
[0098] Figure 3 A schematic diagram showing the rendering target mapping effect provided by an embodiment of the present application is shown in FIG. Figure 3 As shown, the moving track of the virtual object is represented by curve 301. When the virtual object moves a certain distance in the snow of the game scene, the moving track of the virtual object will be recorded in the rendering target map, and curve 301 is the path that the virtual object has walked in the snow. It should be noted that in actual production, curve 301 is not a solid white line, but a curve of other colors, for example, curve 301 is a red curve.
[0099] Step S207, determining the landform materials corresponding to different positions in the virtual terrain scene.
[0100] Create the first landform material and the second landform material, set the material properties of the first landform material, such as base color, roughness, and world position offset, and set the material properties of the second landform material, such as base color, roughness, normal map, ambient occlusion, and world position offset. Taking the virtual terrain scene as snow as an example, the first landform material is used to represent the snow material when the virtual object does not pass through the location, and the second landform material is used to represent the snow material after the virtual object passes through the location.
[0101] The rendering target map refreshed in real time in step S206 is used as the material selection basis to determine the landform materials used at different positions on the virtual terrain scene. Here, it is equivalent to making a material blending judgment, that is, the material attributes of the first landform material (such as base color, roughness, world position offset), the material attributes of the second landform material (such as base color, roughness, normal map, ambient occlusion, world position offset) and texture samples are input into the BlendMatterialAttributes of the Unreal Engine for calculation to determine the material attributes of the virtual terrain scene.
[0102] Step S208, determining the real-time virtual volume range, and associating the second blueprint with the real-time virtual texture.
[0103] In the game scene provided by the target game engine, the second blueprint created in step S205 is selected, and the range of the real-time virtual volume corresponding to the second blueprint is set, that is, the terrain is picked up and the boundary is set. At the same time, a real-time virtual map is selected in the virtual texture of the second blueprint to associate the real-time virtual map with the second blueprint.
[0104] After completing the above steps, you can complete the terrain interaction configuration in the target game engine.
[0105] Refer to the following Figure 4 To introduce the changes in terrain after the interaction between virtual objects and virtual elements in the virtual terrain scene.
[0106] Figure 4 The effect diagram after the virtual object and the virtual element provided in the embodiment of the present application interact with each other is shown as follows: Figure 4 As shown, a virtual object 401 walks on the snow and leaves an interactive movement track 402 on the snow. The interactive movement track 402 is recorded in the rendering target map. The interactive movement track recorded in the rendering target map can be used to distinguish which positions in the virtual terrain scene need to be rendered using the first terrain material and which positions need to be rendered using the second terrain material. In this way, after rendering, the terrain differences between the positions where the virtual object has passed and the positions where it has not passed can be presented in real time in the graphical user interface.
[0107] Based on the same inventive concept, the embodiment of the present application also provides an interactive processing device in the game corresponding to the interactive processing method in the game. Since the principle of solving the problem by the device in the embodiment of the present application is similar to the interactive processing method in the game in the embodiment of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0108] See also Figure 5 , Figure 5 This is a schematic diagram of the structure of an interactive processing device in a game provided by an embodiment of the present application. Figure 5As shown in , a graphical user interface is provided by a terminal device, and at least a part of a virtual terrain scene is displayed on the graphical user interface. The virtual terrain scene is provided with virtual elements for covering the virtual terrain scene. The interactive processing device 500 in the game includes:
[0109] The movement control module 501 is used to control the movement of the virtual object in the virtual terrain scene in response to the movement control instruction for the virtual object, the virtual object is bound to a virtual model, and the virtual model moves with the virtual object;
[0110] The interaction information recording module 502 is used to record the position interaction information between the virtual model and the virtual element through the real-time virtual map corresponding to the virtual model during the movement of the virtual object;
[0111] The scene rendering module 503 is used to render the virtual terrain scene according to the position interaction information, so as to present a scene picture effect of real-time interaction between virtual objects and virtual elements in the graphical user interface.
[0112] In a possible implementation of the present application, the interactive processing device 500 in the game also includes a model creation module, which is used to: create a virtual model in the first blueprint corresponding to the virtual object, and bind the virtual model to the intersection of the virtual object and the virtual element; assign a preset material to the virtual model, set the virtual model to hide the display, and turn off the collision and shadow rendering of the virtual model.
[0113] In a possible implementation of the present application, the interactive processing device 500 in the game also includes a rendering target map drawing module, which is used to: draw the position interaction information recorded in the real-time virtual map into the rendering target map, so as to render the virtual terrain scene using the rendering target map.
[0114] In a possible implementation of the present application, the interactive processing device 500 in the game further includes a rendering target map initialization module, and the rendering target map initialization module is used to: clear the historical position interaction information recorded in the rendering target map when the game starts running.
[0115] In a possible implementation of the present application, the scene rendering module 503 includes a material judgment module and a material rendering module. The material judgment module is used to: determine the terrain materials at different positions in the virtual terrain scene based on the position interaction information in the rendering target map; the material rendering module is used to: use the terrain materials at different positions to render the virtual terrain scene.
[0116] In a possible implementation of the present application, the landform material includes a first landform material and a second landform material, and the material judgment module is specifically used to: for each position in the virtual terrain scene, determine whether the position is a position where a virtual object interacts with a virtual element based on the position interaction information; if it is not a position where a virtual object interacts with a virtual element, use the first landform material to render the position; if it is a position where a virtual object interacts with a virtual element, use the second landform material to render the position.
[0117] In a possible implementation of the present application, the world position offset between the first landform material and the second landform material is different.
[0118] In a possible implementation of the present application, the difference between the world position offset corresponding to the first landform material and the world position offset corresponding to the second landform material is determined by the size of the preset attribute parameter value of the virtual object.
[0119] In a possible implementation of the present application, the interaction processing device 500 in the game further includes a shape determination module, which is used to determine the shape of the terrain material after the virtual object interacts with the virtual element based on the shape of the virtual model.
[0120] In a possible implementation of the present application, the interactive processing device 500 in the game also includes a scene entry judgment module, which is used to: determine whether the virtual model is located within a preset real-time virtual volume corresponding to the virtual terrain scene; if it is located within the preset real-time virtual volume, it is determined that the virtual object enters the virtual terrain scene.
[0121] In a possible implementation of the present application, the rendering target map drawing module includes a coordinate conversion module and a map drawing module. The coordinate conversion module is used to: convert the global coordinates of each position in the virtual terrain scene into UV space coordinates; the map drawing module is used to: use the UV space coordinates to draw the rendering target map.
[0122] In a possible implementation scheme of the present application, the coordinate conversion module is specifically used to: convert the global coordinates into local coordinates, and map the local coordinates in the UV space to obtain initial UV space coordinates; correct the initial UV space coordinates to obtain corrected UV space coordinates.
[0123] In a possible implementation of the present application, the real-time virtual map is associated with the second blueprint so that the second blueprint obtains the position interaction information of the virtual object, and the second blueprint corresponds to the virtual terrain scene and is converted from the real-time virtual volume.
[0124] Through the interactive processing device in the above-mentioned game, the virtual model can be used to obtain the position interaction information of the virtual object, and the position interaction information can reflect whether the virtual object interacts with the ground. Therefore, when the virtual object performs operations such as jumping or flying that do not interact with the ground, the terrain material corresponding to the terrain that does not interact with the ground is used for terrain rendering, which reduces the difficulty of terrain interaction processing when the virtual object performs operations such as jumping and flying. At the same time, the position interaction information is stored in the real-time virtual texture, and the position interaction information is converted into the rendering target texture through the real-time virtual texture, without using multiple rendering target textures, reducing the number of rendering target textures, improving the game operation efficiency, and solving the problems of low game operation efficiency and high processing and optimization difficulties.
[0125] See also Figure 6 , Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 6 As shown in , the electronic device 600 includes a processor 610 , a memory 620 and a bus 630 .
[0126] The memory 620 stores machine-readable instructions executable by the processor 610. When the electronic device 600 is running, the processor 610 communicates with the memory 620 via the bus 630. When the machine-readable instructions are executed by the processor 610, the above-mentioned Figure 1 The steps of the interaction processing method in the game in the method embodiment shown, the specific implementation method can be found in the method embodiment, and will not be repeated here.
[0127] A graphical user interface is provided through a terminal device, and at least part of a virtual terrain scene is displayed on the graphical user interface. Virtual elements for covering the virtual terrain scene are arranged on the virtual terrain scene. In response to a movement control instruction for a virtual object, the virtual object is controlled to move in the virtual terrain scene. The virtual object is bound to a virtual model, and the virtual model moves with the virtual object. During the movement of the virtual object, position interaction information between the virtual model and the virtual element is recorded through a real-time virtual map corresponding to the virtual model. According to the position interaction information, the virtual terrain scene is rendered to present a scene picture effect of real-time interaction between the virtual object and the virtual element in the graphical user interface.
[0128] Through the above electronic device, the virtual model can be used to obtain the position interaction information of the virtual object, and the position interaction information can reflect whether the virtual object interacts with the ground. Therefore, when the virtual object performs operations such as jumping or flying that do not interact with the ground, the terrain material corresponding to the terrain that does not interact with the ground is used for terrain rendering, which reduces the difficulty of terrain interaction processing when the virtual object performs operations such as jumping and flying. At the same time, the position interaction information is stored in a real-time virtual map, and the position interaction information is converted into a rendering target map through the real-time virtual map. There is no need to use multiple rendering target maps, which reduces the number of rendering target maps, improves the game operation efficiency, and solves the problems of low game operation efficiency and high processing and optimization difficulties.
[0129] The present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the computer program can execute the above-mentioned Figure 1 The steps of the interaction processing method in the game in the method embodiment shown, the specific implementation method can be found in the method embodiment, and will not be repeated here.
[0130] A graphical user interface is provided through a terminal device, and at least part of a virtual terrain scene is displayed on the graphical user interface. Virtual elements for covering the virtual terrain scene are arranged on the virtual terrain scene. In response to a movement control instruction for a virtual object, the virtual object is controlled to move in the virtual terrain scene. The virtual object is bound to a virtual model, and the virtual model moves with the virtual object. During the movement of the virtual object, position interaction information between the virtual model and the virtual element is recorded through a real-time virtual map corresponding to the virtual model. According to the position interaction information, the virtual terrain scene is rendered to present a scene picture effect of real-time interaction between the virtual object and the virtual element in the graphical user interface.
[0131] Through the above-mentioned computer-readable storage medium, the virtual model can be used to obtain the position interaction information of the virtual object, and the position interaction information can reflect whether the virtual object interacts with the ground, so that when the virtual object performs operations such as jumping or flying that do not interact with the ground, the terrain is rendered using the corresponding terrain material that does not interact with the ground, which reduces the difficulty of terrain interaction processing when the virtual object performs operations such as jumping and flying. At the same time, the position interaction information is stored in the real-time virtual map, and the position interaction information is converted into the rendering target map through the real-time virtual map, without using multiple rendering target maps, reducing the number of rendering target maps, improving the game operation efficiency, and solving the problems of low game operation efficiency and high processing and optimization difficulties.
[0132] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0133] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0134] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0135] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0136] 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 non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application can essentially be embodied in the form of a software product, or in other words, the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including 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 application. 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.
[0137] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-mentioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-mentioned embodiments within the technical scope disclosed in the present application, 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 application, and should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A method for interactive processing in a game, characterized in that: Providing a graphical user interface through a terminal device, wherein at least a portion of a virtual terrain scene is displayed on the graphical user interface, and a virtual element for covering the virtual terrain scene is arranged on the virtual terrain scene, including: In response to a movement control instruction for a virtual object, controlling the virtual object to move within the virtual terrain scene, the virtual object being bound to a virtual model, and the virtual model moving along with the virtual object; During the movement of the virtual object, position interaction information between the virtual model and the virtual element is recorded through a real-time virtual map corresponding to the virtual model; The virtual terrain scene is rendered according to the position interaction information to present a scene picture effect of real-time interaction between the virtual object and the virtual element in the graphical user interface.
2. The method according to claim 1, characterized in that: The method further comprises: Creating the virtual model in the first blueprint corresponding to the virtual object, and binding the virtual model at the intersection of the virtual object and the virtual element; Assign a preset material to the virtual model, set the virtual model to be hidden, and turn off collision and shadow rendering of the virtual model.
3. The method according to claim 1, characterized in that The method further comprises: The position interaction information recorded in the real-time virtual map is drawn into a rendering target map, so as to render the virtual terrain scene using the rendering target map.
4. The method according to claim 3, characterized in that The method further comprises: When the game starts running, the historical position interaction information recorded in the rendering target map is cleared.
5. The method according to claim 3, characterized in that: The virtual terrain scene is rendered using the rendering target map by the following processing: Determining landform materials at different locations in the virtual terrain scene based on the position interaction information in the rendering target map; The virtual terrain scene is rendered using the terrain materials at the different positions.
6. The method according to claim 5, characterized in that The landform material includes a first landform material and a second landform material, and determining the landform materials at different positions in the virtual terrain scene based on the position interaction information in the rendering target map includes: For each position in the virtual terrain scene, determining, based on the position interaction information, whether the position is a position where the virtual object interacts with the virtual element; If it is not the location where the virtual object interacts with the virtual element, rendering the location using the first landform material; If it is the location where the virtual object interacts with the virtual element, the second landform material is used to render the location.
7. The method according to claim 6, characterized in that The first landscape material and the second landscape material have a different world position offset.
8. The method according to claim 6, characterized in that The difference between the world position offset corresponding to the first landform material and the world position offset corresponding to the second landform material is determined by the value of the preset attribute parameter of the virtual object.
9. The method according to claim 1, characterized in that: The method further comprises: Based on the shape of the virtual model, the shape of the landform material after the virtual object interacts with the virtual element is determined.
10. The method according to claim 1, characterized in that Determining whether the virtual object enters the virtual terrain scene by the following processing includes: Determining whether the virtual model is located within a preset real-time virtual volume corresponding to the virtual terrain scene; If the virtual object is located within the preset real-time virtual volume, it is determined that the virtual object enters the virtual terrain scene.
11. The method according to claim 3, characterized in that Drawing the position interaction information in the real-time virtual map into the rendering target map includes: Converting the global coordinates of each position in the virtual terrain scene into UV space coordinates; The rendering target map is drawn using the UV space coordinates.
12. The method according to claim 11, characterized in that The step of converting the global coordinates of each position in the virtual terrain scene into UV space coordinates comprises: Convert the global coordinates into local coordinates, and map the local coordinates in UV space to obtain initial UV space coordinates; The initial UV space coordinates are corrected to obtain corrected UV space coordinates.
13. The method according to claim 10, characterized in that The real-time virtual map is associated with a second blueprint so that the second blueprint obtains the position interaction information of the virtual object. The second blueprint corresponds to the virtual terrain scene and is converted from the preset real-time virtual volume.
14. An interactive processing device in a game, characterized in that: Providing a graphical user interface through a terminal device, wherein at least a portion of a virtual terrain scene is displayed on the graphical user interface, and a virtual element for covering the virtual terrain scene is arranged on the virtual terrain scene, including: A movement control module, for controlling the movement of the virtual object in the virtual terrain scene in response to a movement control instruction for the virtual object, wherein the virtual object is bound to a virtual model, and the virtual model moves with the virtual object; An interaction information recording module, used for recording the position interaction information between the virtual model and the virtual element through the real-time virtual map corresponding to the virtual model during the movement of the virtual object; A scene rendering module is used to render the virtual terrain scene according to the position interaction information, so as to present a scene picture effect of real-time interaction between the virtual object and the virtual element in the graphical user interface.
15. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and the processor executes the machine-readable instructions to perform the steps of the interactive processing method in the game as described in any one of claims 1 to 13.
16. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the interactive processing method in the game as claimed in any one of claims 1 to 13 are executed.