Data processing method, device and computer-readable storage medium
By obtaining the target toolkit of the Unreal Engine Mobile game, rendering and caching the target shader list file scene by scene, the slow rendering speed and lag issues when starting the Unreal Engine Mobile game are solved, pre-rendering of resource data is achieved, and data processing efficiency and game smoothness are improved.
Patent Information
- Application Number
- CN202011374067.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-30
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2040-11-30
AI Technical Summary
When launching Unreal Engine mobile games, the rendering speed is slow due to centralized processing of resource data, causing the game screen to freeze and easily crash, affecting data processing efficiency.
Pre-rendering of resource data is achieved by obtaining the target toolkit, rendering resource data scene by scene, caching the target shader list file and compiling it into the main project.
This avoids the centralized loading of large amounts of resource data when the game starts, significantly improves data processing efficiency and game smoothness, and reduces lag.
Smart Images

Figure CN113384893B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data processing method, device, and computer-readable storage medium. Background Art
[0002] Unreal Engine (UE) is currently the world's most well-known and widely licensed top-tier game engine, holding 80% of the global commercial game engine market share. Through continuous development, Unreal Engine has become the most widely used, most widely adopted, and most advanced next-generation graphics engine in the gaming industry.
[0003] Currently, when an Unreal Engine mobile game is launched, the game project is not pre-rendered in advance, but is rendered only when the game screen is played for the first time. However, when a large amount of resource data is rendered at one time, the rendering speed will be slow, which will cause the game screen to be stuck, greatly affecting user experience. In addition, due to the centralized processing of processing resources, it is easy to cause the game to crash, resulting in low data processing efficiency. Summary of the Invention
[0004] The embodiments of the present application provide a data processing method, device, and computer-readable storage medium, which can improve the efficiency of data processing.
[0005] To solve the above technical problems, the embodiments of the present application provide the following technical solutions:
[0006] A data processing method, comprising:
[0007] Obtaining a target toolkit, wherein the target toolkit includes resource data for each scenario;
[0008] Execute the target toolkit to render the resource data in each scene in turn;
[0009] Cache the target shader generated by rendering the resource data in each scene every other frame to obtain the target shader list file;
[0010] Compile the target shader list file to build a main project to achieve pre-rendering of resource data.
[0011] Accordingly, an embodiment of the present application further provides a data processing device, including:
[0012] an acquisition unit, configured to acquire a target toolkit, wherein the target toolkit includes resource data for each scenario;
[0013] A rendering unit, configured to execute the target toolkit and render the resource data of each scene in sequence;
[0014] A cache unit is used to cache target shaders generated by rendering resource data in each scene every other frame, and obtain a target shader list file;
[0015] The compiling unit is used to compile the target shader list file to construct a main project to achieve pre-rendering of resource data.
[0016] A computer device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of any one of the data processing methods provided in the embodiments of the present application are implemented.
[0017] A computer-readable storage medium stores a plurality of instructions, wherein the instructions are suitable for being loaded by a processor to execute the steps in the above-mentioned data processing method.
[0018] A computer program product or computer program includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps of any data processing method provided in the embodiments of the present application.
[0019] The embodiment of the present application obtains a target toolkit; executes the target toolkit, renders the resource data in each scene in sequence; caches the target shader generated by rendering the resource data in each scene to obtain a target shader list file; and compiles the target shader list file to construct a main project to achieve pre-rendering of the resource data. In this way, by pre-rendering the resource data in each scene in the target toolkit, caching the target shader generated by rendering the resource data in each scene to obtain a target shader list file, and compiling the target shader list file to construct a main project, pre-rendering of the resource data is achieved, avoiding the loading of a large amount of resource data at the same time when the main project is started, causing lag, and greatly improving the efficiency of data processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0021] Figure 1 This is a schematic diagram of a data processing system according to an embodiment of the present application;
[0022] Figure 2 Schematic diagram of the data processing method provided in the embodiment of the present application;
[0023] Figure 3 is another flow chart of the data processing method provided in an embodiment of the present application;
[0024] Figure 4 A product diagram of the data processing method provided in an embodiment of the present application;
[0025] Figure 5 is a structural diagram of a data processing device provided in an embodiment of the present application;
[0026] Figure 6 It is a schematic diagram of the structure of the terminal provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without making creative efforts are within the scope of protection of this application.
[0028] Embodiments of the present application provide a data processing method, apparatus, and computer-readable storage medium.
[0029] See also Figure 1 , Figure 1 The scenario diagram of the data processing system provided in the embodiment of the present application includes: terminal A, and a server (the data processing system may also include other terminals in addition to terminal A, and the specific number of terminals is not limited here). Terminal A and the server can be connected through a communication network. The communication network may include a wireless network and a wired network, wherein the wireless network includes a combination of one or more of a wireless wide area network, a wireless local area network, a wireless metropolitan area network, and a wireless personal network. The network includes network entities such as routers and gateways, which are not shown in the figure. Terminal A can exchange information with the server through the communication network. For example, the server can send a target toolkit to the server.
[0030] The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. Figure 1As shown, the server can send a target toolkit including resource data in each scenario to terminal A. In one embodiment, the server can be a development terminal, which can obtain resource data in each scenario, form a target engineering project, set the loading attribute of the resource data of the target engineering project to load the resource data in each scenario, and generate the target toolkit.
[0031] The data processing system may include a data processing device, which may be specifically integrated into a terminal. The terminal A may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a smart payment terminal, etc., but is not limited thereto. The terminal and the server may be directly or indirectly connected via wired or wireless communication, which is not limited in this application. The terminal A may install various applications required by the user, such as game applications, etc. The terminal may obtain a target toolkit, which includes resource data for each scene; execute the target toolkit, and render the resource data for each scene in turn; cache the target shader generated by rendering the resource data for each scene to obtain a target shader list file; compile the target shader list file to construct a main project to achieve pre-rendering of resource data.
[0032] It should be noted that Figure 1 The scenario diagram of the data processing system shown is only an example. The data processing system and scenario described in the embodiment of the present application are intended to more clearly illustrate the technical solution of the embodiment of the present application, and do not constitute a limitation on the technical solution provided by the embodiment of the present application. Ordinary technicians in this field can know that with the evolution of data processing systems and the emergence of new business scenarios, the technical solution provided by the embodiment of the present application is also applicable to similar technical problems.
[0033] The following are detailed descriptions of each.
[0034] In this embodiment, the description will be made from the perspective of a data processing device, which can be specifically integrated into a terminal having a storage unit and a microprocessor installed therein so as to have computing capabilities.
[0035] See also Figure 2 , Figure 2 : is a flow chart of a data processing method provided in an embodiment of the present application. The data processing method includes:
[0036] In step 101, a target toolkit is obtained.
[0037] With the continuous development and popularization of the Unreal Engine, terminal game applications are essentially developed using it. As game scenes become richer, the number of in-game assets (materials) increases, requiring an increasing amount of rendering computation. Currently, game projects do not perform rendering in advance, but only when the first rendering is played. However, due to the diversity of assets, a large amount of resource data is being rendered simultaneously, which can cause game lag. The conditions that cause lag can be determined by the time it takes to execute each frame and the frames per second (FPS). FPS is a definition in the graphics field that refers to the number of frames per second transmitted, generally speaking, the number of frames in an animation or video. FPS measures the amount of information used to store and display dynamic video. The higher the number of frames per second, the smoother the displayed action. Generally, the minimum frame rate to avoid lag is 30, and a frame time exceeding 33.9ms (milliseconds) is considered lag.
[0038] In actual tests, when current game applications control a virtual character to release a skill for the first time without pre-rendering, the fps will drop to 12.98, and the execution time of each frame will reach 47.15ms, resulting in an unsmooth picture and severe lag.
[0039] While testers can manually run game application projects and cache the shaders corresponding to the assets used in the project, these shaders are editable programs used to implement image rendering, replacing the fixed rendering pipeline. They can be understood as program instructions corresponding to assets (i.e., resource information), specifically, the program instructions used to display the assets on the display interface. These shaders include four sub-shaders: the vertex shader, the pixel shader, the geometry shader, the compute shader, and the tessellation or hull shader. When objects are drawn or displayed on the screen, they appear as primitives or meshes. For example, a geometric character or a textured character attached to a mesh in a game. For example, when creating shadow effects, the mesh is drawn before the shadows are calculated. For example, a projectile requires drawing its outer mesh before launching. These objects can all be considered meshes, which can be broken down into primitives, the basic units of a mesh. Primitives include triangles, lines, and points, and shaders can be used to describe any element, such as map resource information and character (Actor) resource information, through four sub-shaders to achieve game special effects. The cached shaders are then compiled into the Pipeline State Object (PSO) caching tool using the Unreal Engine command line and loaded into the main project. This allows the game application to pre-render the resource information in the cached shaders at startup, speeding up the loading of manually tested resource information and minimally reducing lag.
[0040] However, the above methods all require manual shader caching, which is time-consuming and very easy to miss resource information, and has little practical effect. In addition, due to the tight time during game development, it is not realistic to collect shader cache by manually playing the game.
[0041] Based on this, the embodiment of the present application can obtain all the resource data of the game application in each scene in advance, and form a test project, load the resource data in each scene into the target project, and set the resource data loading attribute of the target project to the resource data in each scene, so that the test project can load all the resource data in each scene and generate a target toolkit. The target toolkit can also be understood as a running test package and can be used only to load resource data in the game scene. In one embodiment, when the terminal operating system is an Android operating system, the target toolkit can also be an Android package, and the format can be APK format, that is, the game application of the terminal can be directly launched and executed.
[0042] In step 102, the target toolkit is executed to render the resource data in each scene in sequence.
[0043] Computer vision (CV) is the science of making machines "see." Specifically, it refers to machine vision, where cameras and computers replace the human eye in identifying and measuring objects, performing further image processing to create images more suitable for human observation or transmission to instruments. As a scientific discipline, computer vision studies related theories and technologies, attempting to build artificial intelligence systems capable of extracting information from images or multidimensional data. Computer vision technologies typically include image processing, image recognition, image semantic understanding, image retrieval, optical character recognition (OCR), video processing, video semantic understanding, video content / behavior recognition, three-dimensional object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous localization and mapping, and common biometric recognition technologies such as facial recognition and fingerprint recognition.
[0044] This application is based on artificial intelligence computer vision technology, and can be specifically applied to the following shader rendering process for illustration:
[0045] To obtain the shader generated by sequentially rendering the resource data for each scene, the target toolkit needs to be executed by the terminal game application. The resource data for each scene is sequentially rendered. The resource data can be map resources, character resources, skill effect resources, etc. In this way, a target shader can be generated by sequentially rendering the resource data for each scene. Subsequent rendering can be performed using this cached target shader to quickly obtain the corresponding resource data without causing processor load.
[0046] In one embodiment, the step of executing the target toolkit to sequentially render the resource data in each scene may include:
[0047] (1) Start the target toolkit and obtain resource data for each scenario;
[0048] (2) The resource data of each scene is loaded in sequence at preset frame intervals, and the resource data of each scene is rendered in sequence.
[0049] Among them, the target toolkit can be directly started through the game application of the terminal to obtain the resource data in each scene. In order to avoid the loading of resource data causing lag that affects the normal use of the terminal or crashes, the resource data in each scene can be loaded in sequence at intervals of preset frames. The preset frame can be 1 frame or 2 frames, etc., which is not specifically limited here. The resource data in each scene can be loaded intermittently in sequence, that is, the resource data in each scene can be rendered in sequence without causing lag in the terminal, which is suitable for background operation.
[0050] In some implementations, the number of preset frames can be intelligently set based on the current busyness of the terminal processor. The smaller the number of preset frames, the more frequently the processor needs to process resource data, which leads to insufficient processor resources. The larger the number of preset frames, the less frequently the processor needs to process resource data, and the less processor resources are occupied. Therefore, before the step of sequentially loading resource data for each scenario at intervals of preset frames, the following steps may be further included:
[0051] (1.1) Get the current usage of the processor;
[0052] (1.2) Determine a corresponding preset frame according to the threshold range within which the usage rate falls.
[0053] The threshold range can be divided into three threshold ranges: low, medium, and high. The current usage rate of the processor is obtained. When the usage rate is in the low threshold range, for example, when the usage rate is between [1, 35], it means that the current processor is in an idle state. The preset frame can be set to a smaller value, such as 1 or 2, to increase the rendering speed. When the usage rate is in the medium threshold range, for example, when the usage rate is between [36, 70], it means that the current processor is in a normal working state. The preset frame can be set to a moderate value, such as 4 or 5, to try not to affect the operation of the terminal during the rendering process. When the usage rate is in the high threshold range, for example, when the usage rate is between [71, 95], it means that the current processor is busy. The preset frame can be set to a larger value, such as 10 or 11, to perform rendering at a very slow speed, so as not to affect the operation of the processor and avoid processing jams.
[0054] In one embodiment, when it is detected that the usage rate is greater than 95%, it indicates that the processor is already under a very high load, and the process of loading resource data in each scenario is suspended to avoid the processor from being stuck.
[0055] In some embodiments, the steps of sequentially loading resource data for each scene at preset intervals and sequentially rendering each scene may include:
[0056] (2.1) When the preset frame is one frame, the resource data of each scene is sequentially instantiated and loaded in odd-numbered frames at intervals of the preset frame;
[0057] (2.2) Unload the resource data instantiated and loaded in the previous frame in the even-numbered frames until the resource data instantiation and loading in each scene is completed;
[0058] (2.2) Collect the target shader generated after instantiating and loading the resource data in each scene.
[0059] Among them, in order to avoid the situation where resource data overlaps on the display interface and causes resource loading failure, the resource data under each scene can be instantiated and loaded in sequence in the odd frames of the playback screen, such as in the 1st frame, the 3rd frame, and so on. The resource data under each scene is instantiated and loaded in the odd frames at intervals of one frame, and the resource data instantiated and loaded in the odd frames of the previous frame is unloaded in the even frames of the playback screen to ensure that there is no interference in the display screen when the odd frames instantiate and load the resource data. In this way, until the instantiation and loading of the resource data under each scene is completed, the target shader generated by the instantiation and loading of the resource data under each scene is obtained.
[0060] In step 103, target shaders generated by rendering resource data in each scene are cached to obtain a target shader list file.
[0061] Among them, in order to realize the pre-rendering of subsequent resource data, it is necessary to cache the target shader generated by rendering the resource data in each scene, and generate the corresponding target shader list file for local storage. In one embodiment, in order to find the target shader list file faster, the target shader list file can be named according to a certain naming rule or the target shader list file can be stored in a preset file location to realize subsequent quick search.
[0062] In some embodiments, the step of caching the target shader generated by rendering the resource data in each scene to obtain the target shader list file may include:
[0063] (1) Obtain the target shader generated by rendering the resource data in each scene every other frame;
[0064] (2) comparing every two target shaders in the target shader, and deleting duplicate target shaders in the same target shader;
[0065] (3) Cache the target shader after the deletion operation and generate a target shader list file.
[0066] Among them, in actual scenarios, different scenes may contain the same resource data, such as the same virtual character A. In this way, the target shader generated by rendering the resource data in each scene every other frame can be obtained, the rendering data between each target shader can be compared two by two, the repeated target shaders in the same target shader can be deleted, and the redundant target shaders can be removed. Furthermore, the target shader after the deletion operation is cached to generate a target shader list file.
[0067] In some embodiments, after the step of generating the target shader list file, the step may further include: naming the target shader list file according to a preset naming rule.
[0068] After the target shader list file is generated, in order for subsequent terminals to quickly find the target shader list, the target shader list file can be named according to a preset naming rule, for example, the target shader list is named rec.upipelinecache.
[0069] In step 104 , the target shader list file is compiled to construct a main project to implement pre-rendering of resource data.
[0070] Among them, after obtaining the target shader list file corresponding to all resource information that can be rendered quickly, the target shader list file can be compiled using the Unreal Engine command line on the terminal, and the build can be loaded into the main project. After the main project is started, all resource data can be pre-rendered through each target shader in the target shader list file. When controlling the virtual character to release a skill for the first time, there is no need to concentrate on rendering the corresponding resource data to cause a jam, so that the execution time of each frame is reduced to 13.96ms, and the FPS can be maintained at 74, which greatly improves the efficiency of data processing and the smoothness of the game application.
[0071] In some implementations, the step of compiling the target shader list file to build the main project may include:
[0072] (1) Search the file storage space by the preset field to find the target shader list file that matches the preset field;
[0073] (2) Compile the target shader list file and add the compiled target shader list file to the main project.
[0074] Among them, the file storage space is a storage space used by the terminal to store files. In one embodiment, all files can be stored in a main folder to form a file storage space. In this way, the preset field rec.upipelinecache can be used to search in the file storage space, and the target shader list file named with the preset field rec.upipelinecache can be directly found. Each target shader in the target shader list file is directly compiled, and each target shader in the compiled target shader list is added to the installation package corresponding to the game application of the terminal, so as to realize pre-caching of all target shaders corresponding to all resource data, avoid scenes of concentrated rendering causing freezes during the game, and avoid the situation of missing shaders.
[0075] In one embodiment, the step of compiling the target shader list file and adding the compiled target shader list file to the main project includes:
[0076] (1) Compile the target shader list file into the pipeline state object cache tool through the Unreal Engine command line;
[0077] (2) Load the pipeline state object cache tool into the main project to achieve pre-rendering of resource data.
[0078] Among them, the target shader list file can be compiled into the pipeline state object cache tool through the Unreal Engine command line, and then the pipeline state object tool can be placed in the main project of the game application. It can also be understood as being placed in the installation package for loading to achieve pre-rendering of resource data and prepare all target shaders corresponding to all resource data. After the actual game application is started, the screen no longer needs to temporarily load the corresponding target shader to avoid lag.
[0079] As can be seen from the above, the embodiment of the present application obtains a target toolkit; executes the target toolkit, renders the resource data in each scene in sequence; caches the target shader generated by rendering the resource data in each scene to obtain a target shader list file; compiles the target shader list file to build a main project to achieve pre-rendering of resource data. In this way, by pre-rendering the resource data in each scene in the target toolkit, caching the target shader generated by rendering the resource data in each scene to obtain a target shader list file, and compiling the target shader list file to build a main project, pre-rendering of resource data is achieved, avoiding the lag caused by loading a large amount of resource data at the same time when the main project is started, and greatly improving the efficiency of data processing.
[0080] In this embodiment, the data processing device is specifically integrated into a terminal as an example for description, and the details are described below.
[0081] See also Figure 3 , Figure 3 This is another flow chart of the data processing method provided in the embodiment of the present application. The method flow may include:
[0082] To better describe the embodiments of this application, please refer to Figure 4 As shown, Figure 4 A product diagram of the data processing method provided in an embodiment of the present application.
[0083] In step 201, the terminal obtains resource data in each scenario.
[0084] The terminal may obtain in advance all resource data of the game application in each scene, and the resource data includes map resource data and virtual character resource data.
[0085] In step 202 , the terminal constructs a target project, loads resource data in each scenario into the target project, sets a loading attribute of the resource data of the target project to load the resource data in each scenario, and generates a target toolkit.
[0086] Please combine Figure 4 For reference, the BlueShield pipeline is a terminal device. Because the resource data in the game application is constantly updated, it needs to be executed regularly to obtain the resource data for each scene. The terminal then builds a target project, loads the resource data for each scene into the target project, and sets the target project's resource data loading attribute to load the resource data for each scene. This replaces the main scene in the target project with the resource data for all scenes. Generate a target toolkit. Assuming the terminal in this application is an Android device, an Android package is generated.
[0087] In step 203, the terminal starts the target toolkit and obtains resource data for each scene. When the preset frame is one frame, the resource data for each scene is sequentially instantiated and loaded in odd-numbered frames at intervals of the preset frame.
[0088] Please combine Figure 4 With reference to steps 24 and 25 in the game, the target project of the target toolkit is started in the terminal through ADB (Android Debug Bridge) control, the resource data of each scene is obtained, and the resource data of each scene is instantiated and loaded in sequence at odd frames every other frame. The object corresponding to the resource data of each scene in the game screen is rendered, that is, all the resource information in the target project is loaded and the target shader corresponding to each resource data is generated.
[0089] In step 204, the terminal unloads the resource data instantiated and loaded in the previous frame in the even-numbered frames until the instantiation and loading of the resource data in each scene is completed, and collects the target shader generated after the instantiation and loading of the resource data in each scene.
[0090] In order to avoid resource data overlapping on the display interface and causing resource loading failure, the terminal can unload the resource data instantiated and loaded in the previous frame in the even frame to ensure that there is no task interference in the display screen when the resource data is instantiated and loaded in each odd frame. Figure 4 Refer to step 26 in the example, until the instantiation and loading of the resource data in each scene is completed, notify the terminal device that all instances have been loaded, collect the resource data in each scene, instantiate and load, and generate a subsequent target shader that can be quickly rendered.
[0091] In step 205, the terminal obtains the target shader generated by rendering the resource data in each scene every other frame, compares every two target shaders in the target shader, deletes the repeated target shaders in the same target shader, caches the target shader after the deletion operation, generates a target shader list file, and names the target shader list file according to a preset naming rule.
[0092] Among them, in actual scenarios, different scenes may contain the same resource data. For example, different scenes may include the same virtual character B. In this way, the target shader generated by rendering the resource data in each scene every other frame can be obtained, the rendering data between each target shader can be compared pairwise, the repeated target shaders in the same target shader are deleted, and the redundant target shaders are removed. Furthermore, the target shader after the cache deletion operation is generated to generate a target shader list file, and the target shader list file is named according to the preset naming rule rec.upipelinecache.
[0093] In step 206, the terminal searches the file storage space using the preset fields to find a target shader list file that matches the preset fields, and compiles the target shader list file into the pipeline state object cache tool through the Unreal Engine command line.
[0094] Please combine Figure 4For reference, the terminal can search the preset field rec.upipelinecache in the file storage space, quickly find the target shader list file named with the preset field rec.upipelinecache and put it into the installation package corresponding to the main project, and compile the target shader list file into the Tubular State Object Cache (PSO) through the Unreal Engine command line to implement target shader file caching.
[0095] In step 207 , the terminal loads the pipeline state object cache tool into the main project.
[0096] Among them, the terminal loads the pipeline state object cache tool into the installation package corresponding to the game application, so that the game application can quickly obtain the target shader corresponding to each resource information after rendering. Through the target shader, each resource information can be quickly rendered and pre-rendered, so that after the actual game application is started, the screen no longer needs to temporarily load the corresponding target shader to avoid lag.
[0097] As can be seen from the above, the embodiment of the present application obtains a target toolkit; executes the target toolkit, renders the resource data in each scene in sequence; caches the target shader generated by rendering the resource data in each scene to obtain a target shader list file; compiles the target shader list file to build a main project to achieve pre-rendering of resource data. In this way, by pre-rendering the resource data in each scene in the target toolkit, caching the target shader generated by rendering the resource data in each scene to obtain a target shader list file, and compiling the target shader list file to build a main project, pre-rendering of resource data is achieved, avoiding the lag caused by loading a large amount of resource data at the same time when the main project is started, and greatly improving the efficiency of data processing.
[0098] Furthermore, the embodiments of the present application implement an automated processing flow, reduce the occurrence of manual intervention, and avoid resource information omission.
[0099] To facilitate better implementation of the data processing method provided in the embodiment of the present application, the embodiment of the present application also provides a device based on the above data processing method. The meanings of the terms are the same as those in the above data processing method, and the specific implementation details can be referred to the description in the method embodiment.
[0100] See also Figure 5 , Figure 5 This is a structural diagram of a data processing device provided in an embodiment of the present application, wherein the data processing device may include an acquisition unit 301, a rendering unit 302, a cache unit 303, and a compilation unit 304, etc.
[0101] The acquisition unit 301 is configured to acquire a target toolkit, which includes resource data for each scenario.
[0102] The acquisition unit 301 can obtain all resource data of the game application in each scenario in advance and form a test project. The resource data in each scenario is loaded into the target project, and the resource data loading attribute of the target project is set to the resource data in each scenario. This allows the test project to load all resource data in each scenario and generate a target toolkit. The target toolkit can also be understood as a running test package and can be used only to load resource data in the game scenario. In one embodiment, when the terminal operating system is an Android operating system, the target toolkit can also be an Android package in the APK format, that is, the game application of the terminal can be directly launched and executed.
[0103] In some embodiments, the acquisition unit 301 is used to: acquire resource data in each scenario; construct a target engineering project, and load the resource data in each scenario into the target engineering project; set the loading attribute of the resource data of the target engineering project to load the resource data in each scenario, and generate a target toolkit.
[0104] The rendering unit 302 is used to execute the target toolkit and render the resource data in each scene in sequence.
[0105] In order to obtain the shader generated by sequentially rendering the resource data in each scene, the target toolkit needs to be executed by the rendering unit 302 to sequentially render the resource data in each scene. The resource data can be map resources, character resources, skill effect resources, etc. In this way, a target shader can be generated by sequentially rendering the resource data in each scene. Subsequent rendering can be performed using this cached target shader to quickly obtain the corresponding resource data without causing processor load.
[0106] In some embodiments, the rendering unit 302 includes:
[0107] A startup subunit, used to start the target toolkit and obtain resource data in each scenario;
[0108] The rendering subunit is used to load the resource data of each scene in sequence at preset frame intervals, and render the resource data of each scene in sequence.
[0109] In some embodiments, the rendering sub-unit is used to: when the preset frame is one frame, sequentially instantiate and load the resource data under each scene in the odd frames at intervals of the preset frames; unload the resource data instantiated and loaded in the previous frame in the even frames until the instantiation and loading of the resource data under each scene are completed; and collect the target shader generated after the resource data under each scene is instantiated and loaded.
[0110] The cache unit 303 is used to cache the target shader generated by rendering the resource data in each scene, and obtain a target shader list file.
[0111] Among them, in order to realize the pre-rendering of subsequent resource data, the cache unit 303 needs to cache the target shader generated by rendering the resource data in each scene, and generate a corresponding target shader list file for local storage. In one embodiment, in order to find the target shader list file faster, the target shader list file can be named according to a certain naming rule or the target shader list file can be stored in a preset file location to realize subsequent quick search.
[0112] In some implementations, the cache unit 303 includes:
[0113] The acquisition subunit is used to obtain the target shader generated by rendering the resource data in each scene every other frame;
[0114] A comparison subunit, used for comparing every two target shaders in the target shader, and deleting duplicate target shaders in the same target shader;
[0115] The cache subunit is used to cache the target shader after the deletion operation and generate the target shader list file;
[0116] The naming subunit is used to name the target shader list file according to a preset naming rule.
[0117] The compiling unit 304 is configured to compile the target shader list file to construct a main project to implement pre-rendering of resource data.
[0118] Among them, after obtaining the target shader list file corresponding to all resource information that can be rendered quickly, the compilation unit 304 can use the Unreal Engine command line to compile the target shader list file and build it into the main project, so that after the main project is started, all resource data can be pre-rendered through each target shader in the target shader list file, which greatly improves the efficiency of data processing and greatly improves the fluency of game applications.
[0119] In some implementations, the compilation unit includes:
[0120] A search subunit is used to search the file storage space by a preset field to find a target shader list file that matches the preset field;
[0121] The compilation subunit is used to compile the target shader list file and add the compiled target shader list file to the main project.
[0122] In some embodiments, the compilation subunit is used to: compile the target shader list file into the pipeline state object cache tool through the Unreal Engine command line; load the pipeline state object cache tool into the main project to achieve pre-rendering of resource data.
[0123] The specific implementation of each of the above units can be found in the previous embodiments and will not be described again here.
[0124] As can be seen from the above, the embodiment of the present application obtains the target toolkit through the acquisition unit 301; the rendering unit 302 executes the target toolkit and renders the resource data under each scene in sequence; the cache unit 303 caches the target shader generated by rendering the resource data under each scene to obtain a target shader list file; the compilation unit 304 compiles the target shader list file to construct the main project to achieve pre-rendering of the resource data. In this way, by pre-rendering the resource data under each scene in the target toolkit, caching the target shader generated by rendering the resource data under each scene, obtaining a target shader list file, compiling the target shader list file to construct the main project, achieving pre-rendering of the resource data, avoiding the jamming caused by loading a large amount of resource data at the same time when the main project is started, and greatly improving the efficiency of data processing.
[0125] The embodiment of the present application also provides a computer device, which may be a terminal, such as Figure 6 As shown, it shows a schematic diagram of the structure of the terminal involved in the embodiment of the present application, specifically:
[0126] The embodiment of the present application also provides a terminal, such as Figure 6 As shown, the terminal may include components such as a radio frequency (RF) circuit 601, a memory 602 including one or more computer-readable storage media, an input unit 603, a display unit 604, a sensor 605, an audio circuit 606, a wireless fidelity (WiFi) module 607, a processor 608 including one or more processing cores, and a power supply 609. It will be understood by those skilled in the art that Figure 6The terminal structure shown in the figure does not constitute a limitation on the terminal, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0127] The RF circuit 601 can be used to receive and send signals during information transmission or calls. In particular, after receiving downlink information from the base station, it is handed over to one or more processors 608 for processing; in addition, uplink data is sent to the base station. Generally, the RF circuit 601 includes but is not limited to an antenna, at least one amplifier, a tuner, one or more oscillators, a subscriber identity module (SIM) card, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, etc. In addition, the RF circuit 601 can also communicate with the network and other devices via wireless communication. Wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), etc.
[0128] The memory 602 can be used to store software programs and modules. The processor 608 executes various functional applications and information processing by running the software programs and modules stored in the memory 602. The memory 602 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, at least one application required for a function (such as a sound playback function, an image playback function, etc.); the data storage area may store data created according to the use of the terminal (such as audio data, a phone book, etc.). In addition, the memory 602 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device. Accordingly, the memory 602 may also include a memory controller to provide the processor 608 and the input unit 603 with access to the memory 602.
[0129] The input unit 603 can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical, or trackball signal input related to user settings and function control. Specifically, in one embodiment, the input unit 603 may include a touch-sensitive surface and other input devices. A touch-sensitive surface, also known as a touch display or touchpad, can detect user touch operations on or near it (for example, operations performed by a user using a finger, stylus, or any other suitable object or accessory on or near the touch-sensitive surface) and drive corresponding connected devices according to a pre-set program. Optionally, the touch-sensitive surface may include a touch detection device and a touch controller. The touch detection device detects the user's touch direction and detects signals generated by the touch operation, transmitting the signals to the touch controller. The touch controller receives the touch information from the touch detection device, converts it into touch point coordinates, and then sends it to the processor 608. It can also receive and execute commands from the processor 608. In addition, touch-sensitive surfaces can be implemented using various types, such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch-sensitive surface, the input unit 603 may also include other input devices. Specifically, other input devices may include, but are not limited to, one or more of a physical keyboard, function keys (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, and the like.
[0130] The display unit 604 can be used to display information input by the user or information provided to the user and various graphical user interfaces of the terminal, which can be composed of graphics, text, icons, videos and any combination thereof. The display unit 604 may include a display panel. Optionally, the display panel can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. Further, the touch-sensitive surface can cover the display panel. When the touch-sensitive surface detects a touch operation on or near it, it is transmitted to the processor 608 to determine the type of touch event. The processor 608 then provides corresponding visual output on the display panel according to the type of touch event. Although in Figure 6 In the embodiment, the touch-sensitive surface and the display panel are used as two independent components to realize input and output functions, but in some embodiments, the touch-sensitive surface and the display panel can be integrated to realize input and output functions.
[0131] The terminal may also include at least one sensor 605, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel according to the brightness of the ambient light, and the proximity sensor may turn off the display panel and / or backlight when the terminal is moved to the ear. As a type of motion sensor, the gravity acceleration sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors that can be configured in the terminal, such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be described here.
[0132] Audio circuit 606, a speaker, and a microphone provide an audio interface between the user and the terminal. Audio circuit 606 converts received audio data into electrical signals and transmits them to the speaker, which then converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuit 606 and converted into audio data. The audio data is then processed by output processor 608 and transmitted via RF circuit 601 to, for example, another terminal. Alternatively, the audio data is output to memory 602 for further processing. Audio circuit 606 may also include an earphone jack to allow communication between an external headset and the terminal.
[0133] WiFi is a short-range wireless transmission technology. The terminal can help users send and receive emails, browse web pages and access streaming media through the WiFi module 607. It provides users with wireless broadband Internet access. Figure 6 A WiFi module 607 is shown, but it is understandable that it is not an essential component of the terminal and can be omitted as needed without changing the essence of the invention.
[0134] Processor 608 is the terminal's control center, connecting all components of the phone using various interfaces and circuits. By running or executing software programs and / or modules stored in memory 602 and accessing data stored in memory 602, it executes various terminal functions and processes data, thereby performing overall phone testing. Optionally, processor 608 may include one or more processing cores; preferably, processor 608 may integrate an application processor and a modem processor, with the application processor primarily handling the operating system, user interface, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into processor 608.
[0135] The terminal also includes a power supply 609 (e.g., a battery) for supplying power to various components. Preferably, the power supply can be logically connected to the processor 608 via a power management system, thereby enabling the power management system to manage charging, discharging, and power consumption. The power supply 609 can also include one or more DC or AC power supplies, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and other arbitrary components.
[0136] Although not shown, the terminal may also include a camera, a Bluetooth module, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 608 in the terminal will load the executable files corresponding to the processes of one or more applications into the memory 602 according to the following instructions, and the processor 608 will run the applications stored in the memory 602 to implement various functions:
[0137] Obtain a target toolkit, which includes resource data for each scene; execute the target toolkit to render the resource data for each scene in sequence; cache the target shader generated by rendering the resource data for each scene to obtain a target shader list file; compile the target shader list file to build a main project to achieve pre-rendering of resource data.
[0138] It should be noted that the terminal provided in the embodiment of the present application and the data processing method applicable to the terminal in the above embodiment belong to the same concept, and its specific implementation process is detailed in the above method embodiment and will not be repeated here.
[0139] As can be seen from the above, the computer device of the embodiment of the present application can obtain a target toolkit; execute the target toolkit to render the resource data in each scene in sequence; cache the target shader generated by rendering the resource data in each scene to obtain a target shader list file; compile the target shader list file to build a main project to achieve pre-rendering of resource data. In this way, by pre-rendering the resource data in each scene in the target toolkit, caching the target shader generated by rendering the resource data in each scene to obtain a target shader list file, compiling the target shader list file to build a main project, and achieving pre-rendering of resource data, it is possible to avoid loading a large amount of resource data at the same time when the main project is started, thereby greatly improving the efficiency of data processing.
[0140] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be accomplished by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0141] To this end, an embodiment of the present application provides a computer-readable storage medium storing a plurality of instructions that can be loaded by a processor to execute the steps of any data processing method provided in an embodiment of the present application. For example, the instructions can execute the following steps:
[0142] Obtain a target toolkit, which includes resource data for each scene; execute the target toolkit to render the resource data for each scene in sequence; cache the target shader generated by rendering the resource data for each scene to obtain a target shader list file; compile the target shader list file to build a main project to achieve pre-rendering of resource data.
[0143] According to one aspect of the present application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various optional implementations provided in the above embodiments.
[0144] The specific implementation of the above operations can be found in the previous embodiments and will not be repeated here.
[0145] The computer-readable storage medium may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0146] Since the instructions stored in the computer-readable storage medium can execute the steps in any data processing method provided in the embodiments of the present application, the beneficial effects that can be achieved by any data processing method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0147] The above is a detailed introduction to a data processing method, device and computer-readable storage medium provided in the embodiments of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, based on the ideas of the present application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A data processing method, characterized in that: include: Acquiring a target toolkit, including: acquiring resource data for each scenario; forming a target engineering project, and loading the resource data for each scenario into the target engineering project; setting a loading attribute of the resource data of the target engineering project to load the resource data for each scenario, thereby generating a target toolkit; the target toolkit including the resource data for each scenario; Execute the target toolkit to render the resource data in each scene in turn; Cache the target shader generated by rendering the resource data in each scene to obtain the target shader list file; Compile the target shader list file to build a main project to achieve pre-rendering of resource data.
2. The data processing method according to claim 1, wherein: The executing the target toolkit and rendering the resource data in each scene in sequence include: Starting the target toolkit to obtain resource data in each scenario; The resource data of each scene is loaded in sequence at preset frame intervals, and the resource data of each scene is rendered in sequence.
3. The data processing method according to claim 2, characterized in that: The resource data of each scene is loaded in sequence at the preset interval frame, and the resource data of each scene is rendered in sequence, including: When the preset frame is one frame, the resource data of each scene is sequentially instantiated and loaded in odd-numbered frames at intervals of the preset frame; Unload the resource data instantiated and loaded in the previous frame in the even-numbered frames until the resource data instantiation and loading in each scene is completed; Collect the target shader generated after instantiating and loading the resource data in each scene.
4. The data processing method according to claim 1, wherein: The cache generates target shaders by rendering resource data in each scene, and obtains a target shader list file, including: Obtain the target shader generated by rendering the resource data in each scene every other frame; Comparing every two target shaders in the target shaders, and deleting duplicate target shaders in the same target shaders; Cache the target shader after the deletion operation and generate the target shader list file; The target shader list file is named according to a preset naming rule.
5. The data processing method according to claim 4, characterized in that: Compiling the target shader list file to build a main project includes: Search the file storage space by the preset field to find the target shader list file that matches the preset field; Compile the target shader list file, and add the compiled target shader list file to the main project.
6. The data processing method according to claim 5, characterized in that: Compiling the target shader list file and adding the compiled target shader list file to the main project includes: Compile the target shader list file into the pipeline state object cache tool through the Unreal Engine command line; The pipeline state object cache tool is loaded into the main project to achieve pre-rendering of resource data.
7. A data processing device, characterized in that: include: An acquisition unit, configured to acquire a target toolkit, comprising: acquiring resource data for each scenario; forming a target engineering project, and loading the resource data for each scenario into the target engineering project; setting a loading attribute of the resource data for the target engineering project to load the resource data for each scenario, thereby generating a target toolkit; the target toolkit including the resource data for each scenario; A rendering unit, configured to execute the target toolkit and render the resource data of each scene in sequence; A cache unit is used to cache the target shader generated by rendering the resource data in each scene, and obtain a target shader list file; The compiling unit is used to compile the target shader list file to construct a main project to achieve pre-rendering of resource data.
8. The data processing device according to claim 7, characterized in that The rendering unit includes: A startup subunit, configured to start the target toolkit and obtain resource data for each scenario; The rendering subunit is used to load the resource data of each scene in sequence at preset frame intervals, and render the resource data of each scene in sequence.
9. The data processing device according to claim 8, characterized in that The rendering subunit is used to: When the preset frame is one frame, the resource data of each scene is sequentially instantiated and loaded in odd-numbered frames at intervals of the preset frame; Unload the resource data instantiated and loaded in the previous frame in the even-numbered frames until the resource data instantiation and loading in each scene is completed; Collect the target shader generated after instantiating and loading the resource data in each scene.
10. The data processing device according to claim 7, wherein: The cache unit includes: The acquisition subunit is used to obtain the target shader generated by rendering the resource data in each scene every other frame; a comparison subunit, configured to compare every two target shaders in the target shaders and delete duplicate target shaders in the same target shaders; The cache subunit is used to cache the target shader after the deletion operation and generate the target shader list file; The naming subunit is used to name the target shader list file according to a preset naming rule.
11. The data processing device according to claim 10, characterized in that The compilation unit includes: A search subunit is used to search the file storage space by a preset field to find a target shader list file that matches the preset field; The compiling subunit is used to compile the target shader list file and add the compiled target shader list file to the main project.
12. The data processing device according to claim 11, characterized in that The compilation subunit is used to: Compile the target shader list file into the pipeline state object cache tool through the Unreal Engine command line; The pipeline state object cache tool is loaded into the main project to achieve pre-rendering of resource data.
13. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the data processing method according to any one of claims 1 to 6.
14. A computer device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the data processing method according to any one of claims 1 to 6 when executing the computer program.
15. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in the data processing method described in any one of claims 1 to 6.
Citation Information
Patent Citations
Coloring data processing method and device based on game engine and electronic equipment
CN111813380A