Resource data processing method and device, storage medium and electronic equipment
By processing Unreal Engine resource data in parallel, the resource collection is divided into subsets and processed in parallel, solving the problem of the long baking time of Unreal Engine resource data and improving processing efficiency.
Patent Information
- Application Number
- CN202410178251.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-08
- Publication Date
- 2025-08-08
AI Technical Summary
In the prior art, the baking process of Unreal Engine resource data is too long due to serial execution dependencies, and there is a lack of effective solutions.
By running multiple resource processing processes in parallel, the resource collection is divided into subsets according to the type and dependencies of the object resources, and each subset is processed in parallel to convert it into the target platform data format to generate target resource data.
Improve the efficiency of resource baking, reduce processing time, and realize efficient generation of resource data.
Smart Images

Figure CN120437592A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a method and device for processing resource data, a storage medium, and an electronic device. Background Art
[0002] Unreal Engine stores content assets in a specific format for internal use. However, this content needs to be converted to a different format for each platform because the platform uses a proprietary format, the platform does not support the format Unreal Engine uses to store assets, or there are more memory-efficient or better performance formats. Therefore, when deploying Unreal packages to platforms, a process called cooking is required to convert the content from the internal format to the platform-specific format.
[0003] In related technologies, the "CookOnTheFly" command is used to launch the cooker in server mode. CookOnTheFly uses a serial execution process based on data dependencies. After executing one resource package, it pulls down the dependent resource packages based on its dependencies to continue processing. This means that the entire cooking process requires waiting for the current resource to execute before pulling down the remaining resources based on their dependencies, resulting in a technical issue of long resource data processing times.
[0004] To address the above-mentioned problems, no effective solutions have been proposed so far. Summary of the Invention
[0005] Embodiments of the present application provide a method and apparatus for processing resource data, a storage medium, and an electronic device to at least address the technical problem of long resource data processing time in resource baking methods provided in related technologies.
[0006] According to one aspect of an embodiment of the present application, a method for processing resource data is provided, comprising: obtaining an object resource set corresponding to a target virtual scene, and a resource relationship set matching the object resource set, wherein the object resource set includes multiple object resources, the object resources are used to indicate scene elements in the target virtual scene, and the resource relationship set is used to indicate resource dependency relationships between the multiple object resources; determining multiple object resource subsets from the object resource set based on the resource types corresponding to each of the multiple object resources and the resource dependency relationships, wherein resource processing parameters of the object resource subsets meet target conditions, and the resource processing parameters are used to indicate a reference processing time for resource processing on the object resource subsets; performing resource processing on the multiple object resource subsets respectively through multiple resource processing processes running in parallel, wherein the resource processing process is used to perform resource processing on one of the object resource subsets, and the resource processing is used to convert the object resources in the object resource subset into a data format corresponding to a target platform; and determining the resource processing results of each of the multiple object resource subsets as target resource data, wherein the target resource data is used to render and generate the target virtual scene on the target platform.
[0007] According to another aspect of an embodiment of the present application, a resource data processing device is also provided, including: an acquisition unit, used to acquire an object resource set corresponding to a target virtual scene, and a resource relationship set matching the above object resource set, wherein the above object resource set includes multiple object resources, the above object resources are used to indicate scene elements in the above target virtual scene, and the above resource relationship set is used to indicate resource dependency relationships between the multiple object resources; a first determination unit, used to determine multiple object resource subsets from the above object resource set according to the resource types corresponding to the multiple object resources and the above resource dependency relationships, wherein the resources of the above object resource subsets are The processing parameters meet the target conditions, and the above-mentioned resource processing parameters are used to indicate the reference processing time for resource processing of the above-mentioned object resource subsets; the resource processing unit is used to perform resource processing on the multiple above-mentioned object resource subsets respectively through multiple resource processing processes running in parallel, wherein the above-mentioned resource processing process is used to perform resource processing on one of the above-mentioned object resource subsets, and the above-mentioned resource processing is used to convert the object resources in the above-mentioned object resource subset into a data format corresponding to the target platform; the second determination unit is used to determine the resource processing results of each of the multiple above-mentioned object resource subsets as target resource data, wherein the above-mentioned target resource data is used to render and generate the above-mentioned target virtual scene on the above-mentioned target platform.
[0008] Optionally, the resource processing unit includes: a first determination module, used to determine multiple resource operation sets from the current object resource subset through the current resource processing process, wherein the resource operation set includes multiple object resources obtained from the current object resource subset, the object resource subset includes the current object resource subset, and the current resource processing process is the resource processing process used to perform resource processing on the current object resource subset; a second determination module, used to determine multiple resource operation sets as the current operation set in turn, and repeat the following steps until multiple resource operation sets are traversed: batch loading multiple object resources in the current operation set into a memory area matching the current resource processing process; batch caching multiple object resources in the memory area to obtain reference resource data; a serialization module, used to serialize the reference resource data corresponding to the multiple resource operation sets respectively to obtain the resource processing results corresponding to the current object resource subset.
[0009] Optionally, the above-mentioned second determination module is also used to: obtain the sorting results of the multiple resource operation sets according to the dependency parameters corresponding to each of the multiple resource operation sets, wherein the above-mentioned dependency parameters are used to indicate the number of reference object resources associated with the above-mentioned resource operation sets, and the above-mentioned reference object resources are object resources that have the above-mentioned resource dependency relationship with the above-mentioned object resources in the above-mentioned resource operation sets, and the first dependency parameter corresponding to the above-mentioned resource operation sets that are sorted in front in the above-mentioned sorting results is lower than the second dependency parameter corresponding to the above-mentioned resource operation sets that are sorted in the back; according to the above-mentioned sorting results, the multiple resource operation sets are sequentially determined as the above-mentioned current operation sets, wherein the above-mentioned resource operation sets that are sorted in front in the above-mentioned sorting results.
[0010] Optionally, the above-mentioned first determination module is also used to: determine multiple resource operation sets from the above-mentioned current object resource subset according to the resource type of the above-mentioned object resource; determine multiple resource operation sets from the above-mentioned current object resource subset according to the number of reference object resources associated with the above-mentioned object resource, wherein the above-mentioned reference object resource is an object resource having the above-mentioned resource dependency relationship with the above-mentioned object resource; determine multiple resource operation sets from the above-mentioned current object resource subset according to the resource data volume of the above-mentioned object resource, wherein the resource data volume corresponding to the above-mentioned resource operation set is greater than the target data volume.
[0011] Optionally, the serialization module is further used to: call multiple resource processing threads through the current resource processing process; serialize the multiple reference resource data respectively according to the multiple resource processing threads running in parallel to obtain the resource processing results corresponding to the current object resource subset.
[0012] Optionally, the above-mentioned first determination module is also used to: when the number of processes of the current processing sub-process currently in running state is less than the target number, obtain the above-mentioned current operation set from multiple above-mentioned resource operation sets, wherein the above-mentioned current resource processing process is used to pull up the above-mentioned current processing sub-process to perform resource processing on the above-mentioned resource operation set; pull up the target processing sub-process through the above-mentioned current resource processing process; batch load the multiple above-mentioned object resources in the above-mentioned current operation set into the memory area matching the above-mentioned current resource processing process through the above-mentioned target processing sub-process; batch cache the multiple above-mentioned object resources in the above-mentioned memory area to obtain reference resource data.
[0013] Optionally, the above-mentioned first determination module is also used to: obtain the core number of the processing core of the current terminal, wherein the above-mentioned processing core is used to run the resource processing sub-process; determine the above-mentioned target number based on the above-mentioned core number and the subset number of the above-mentioned object resource subset, wherein the above-mentioned target number is the process number of resource processing sub-processes allowed to be pulled up by each of the above-mentioned resource processing processes.
[0014] Optionally, the above-mentioned first determination module is also used to: obtain a process priority parameter, wherein the above-mentioned process priority parameter is used to indicate that the process priority of the resource processing sub-process pulled up by the above-mentioned resource processing process is the first priority, and the above-mentioned resource processing sub-process includes the above-mentioned target processing sub-process and the above-mentioned current processing sub-process; update the above-mentioned process priority parameter, wherein the updated process priority parameter is used to indicate that the process priority of the resource processing sub-process pulled up by the above-mentioned resource processing process is the second priority, and the above-mentioned second priority is higher than the above-mentioned first priority.
[0015] Optionally, the above-mentioned first determination module is also used to: batch load the multiple object resources in the above-mentioned current operation set into the memory area matching the above-mentioned current resource processing process in a target order, wherein the above-mentioned target order is the resource loading order determined according to the above-mentioned resource dependency relationship; when the reference object resource on which the current object resource depends is not included in the above-mentioned current object resource subset, the above-mentioned reference object resource is not loaded into the memory area matching the above-mentioned current resource processing process, wherein the multiple object resources in the above-mentioned current operation set include the above-mentioned current object resource.
[0016] Optionally, the above-mentioned resource processing unit includes: a disabling module, used to disable multiple above-mentioned resource processing processes from creating data storage space under the target path respectively; a first creation module, used to create corresponding data storage space for multiple above-mentioned resource processing processes respectively, wherein the above-mentioned data storage space is used to store the intermediate resource data generated by the above-mentioned resource processing process during the resource processing process and the above-mentioned resource processing results.
[0017] Optionally, the resource processing unit includes: a second creation module for creating a target management process, wherein the target management process is used to read a process configuration file, and the process configuration file includes process configuration information corresponding to each of the multiple resource processing processes; a pull-up module for pulling up the multiple resource processing processes according to the process configuration file; and a maintenance module for maintaining the operating status of each of the multiple resource processing processes through the target management process.
[0018] Optionally, the above-mentioned first determination unit also includes: an acquisition module for acquiring resource processing parameters, wherein the above-mentioned resource processing parameters are used to indicate the number of subsets of the above-mentioned object resource subsets; a third determination module for determining the multiple above-mentioned object resource subsets indicated by the above-mentioned resource processing parameters from the above-mentioned object resource set based on the above-mentioned resource types corresponding to each of the multiple above-mentioned object resources and the above-mentioned resource dependencies.
[0019] Optionally, the above-mentioned acquisition unit includes: a fourth determination module, used to obtain resource processing configuration information, and determine the above-mentioned resource dependency relationship of each of the multiple above-mentioned object resources according to the resource path indicated by the above-mentioned resource processing configuration information, wherein the above-mentioned resource processing configuration information includes the resource path of each of the above-mentioned object resources; a loading module, used to load the above-mentioned object resources, and obtain the above-mentioned resource dependency relationship of the above-mentioned object resources according to the resource loading result.
[0020] Optionally, the above-mentioned loading module is also used to: when the above-mentioned object resource collection includes a first object resource of a first reference type, run the resource constructor for loading the above-mentioned first object resource, and obtain the above-mentioned resource dependency relationship associated with the above-mentioned first object resource indicated during the running of the above-mentioned constructor; when the above-mentioned object resource collection includes a second object resource of a second reference type, load the above-mentioned second object resource to obtain a resource information list corresponding to the above-mentioned second object resource, and obtain the above-mentioned resource dependency relationship associated with the above-mentioned second object resource based on the above-mentioned resource information list.
[0021] Optionally, the above-mentioned loading module is also used to: configure a target resource tag for the above-mentioned object resource, wherein the above-mentioned target resource tag is used to indicate disabling of resource processing operations triggered after loading the above-mentioned object resource; and disable post-loading instructions associated with the above-mentioned object resource, wherein the above-mentioned post-loading instructions are used to trigger resource processing operations associated with the above-mentioned object resource when the above-mentioned object resource is loaded.
[0022] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is configured to execute the above-mentioned resource data processing method when running.
[0023] According to another aspect of an embodiment of the present application, a computer program product is provided, comprising a computer program / instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer program / instructions from the computer-readable storage medium and executes the computer program / instructions, causing the computer device to perform the resource data processing method described above.
[0024] According to another aspect of the embodiments of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the resource data processing method through the computer program.
[0025] In an embodiment of the present application, a set of object resources corresponding to a target virtual scene and a set of resource relationships matching the set of object resources are obtained; multiple object resource subsets are determined from the set of object resources based on the resource types and resource dependencies corresponding to the multiple object resources; resource processing is performed on the multiple object resource subsets through multiple resource processing processes running in parallel; and the resource processing results of the multiple object resource subsets are determined as target resource data. This achieves efficient generation of target resource data.
[0026] In an embodiment of the present application, a collection of object resources is divided according to the resource types corresponding to each of the multiple object resources and the resource dependencies, and multiple object resource subsets whose resource processing parameters meet the target conditions are determined. Multiple resource processing processes running in parallel perform resource processing on the multiple object resource subsets to obtain target resource data. This allows the collection of object resources that need to be executed serially to be divided into multiple object resource subsets whose processing parameters meet the requirements according to the resource types and resource dependencies, and the multiple object resource subsets are processed in parallel. This solves the technical problem of long resource data processing time in the resource baking method provided by the related art, thereby improving the efficiency of resource baking. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0028] Figure 1 is a schematic diagram of a hardware environment of an optional resource data processing method according to an embodiment of the present application;
[0029] Figure 2 is a flowchart of an optional resource data processing method according to an embodiment of the present application;
[0030] Figure 3 is a schematic diagram of an optional resource data processing method according to an embodiment of the present application;
[0031] Figure 4 is a schematic diagram of another optional resource data processing method according to an embodiment of the present application;
[0032] Figure 5 is a schematic diagram of another optional resource data processing method according to an embodiment of the present application;
[0033] Figure 6 is a schematic diagram of another optional resource data processing method according to an embodiment of the present application;
[0034] Figure 7 is a result diagram of an optional resource data processing method according to an embodiment of the present application;
[0035] Figure 8 is a flowchart of another optional resource data processing method according to an embodiment of the present application;
[0036] Figure 9 is a result diagram of another optional resource data processing method according to an embodiment of the present application;
[0037] Figure 10 is a schematic structural diagram of an optional resource data processing device according to an embodiment of the present application;
[0038] Figure 11 It is a schematic structural diagram of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0039] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.
[0040] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in a sequence other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0041] According to one aspect of the embodiment of the present application, a method for processing resource data is provided. As an optional implementation, the above-mentioned method for processing resource data can be applied to, but is not limited to, Figure 1 The resource data processing system in the hardware environment shown in FIG. 1 may include but is not limited to a terminal device 102, a network 110, a server 112, a database 114, and a terminal device 118. The terminal device 102 runs a target client (e.g., Figure 1 As shown, taking the target client as a game application client that can display a virtual scene as an example, a configuration client for configuring object resources in the virtual scene is running in the terminal device 118. The above-mentioned terminal device 102 includes a human-computer interaction screen (display 108), a processor 106 and a memory 104. The human-computer interaction screen (display 108) can be used to display the virtual scene, and is also used to provide a human-computer interaction interface to receive human-computer interaction operations for controlling a controlled virtual character in the virtual scene, and the virtual character will complete the game tasks set in the virtual scene. The processor is used to generate an interaction instruction in response to the above-mentioned human-computer interaction operation, and send the interaction instruction to the server to obtain an object resource set corresponding to the target virtual scene and a resource relationship set matching the above-mentioned object resource set. The memory is used to store relevant resource data, such as the obtained target resource data and unprocessed object resources, etc. The resource data here can include but is not limited to data for indicating scene elements or virtual characters in the target virtual scene. Among them, a game client that controls a virtual character can be running in the terminal device 102.
[0042] In addition, the server 112 includes a processing engine 116, which is configured to perform storage or reading operations on the database 114. Specifically, the processing engine 116 reads each object resource and a resource relationship set matching the object resource from the database 114.
[0043] Assumptions Figure 1The terminal device 102 in the embodiment runs a client for displaying virtual scenes and virtual characters, and the terminal device 118 runs a configuration client for configuring object resources in the virtual scene. The specific process of this embodiment is as follows: as in step S102, the terminal device 118 sends object resources to the server 112 via the network 110, wherein the object resources are used to indicate scene elements in the virtual scene, and the terminal device 118 may be one or more devices; after the server 112 receives the object resources sent by the terminal device 118 in step S102, the object resources are stored in the database 114; after the terminal device 102 sends the interaction instruction to the server 116, the server 116 executes step S104, and sends the required object resource set for indicating the scene elements in the target virtual scene and the resource relationship set matching the object resource set to the terminal device 102 via the network 110.
[0044] Then, steps S106 to S112 are executed in the terminal device 102 to obtain an object resource set corresponding to the target virtual scene and a resource relationship set matching the object resource set, wherein the object resource set includes multiple object resources, the object resources are used to indicate scene elements in the target virtual scene, and the resource relationship set is used to indicate resource dependency relationships between the multiple object resources; multiple object resource subsets are determined from the object resource set according to the resource types corresponding to the multiple object resources and the resource dependency relationships, wherein the resource processing parameters of the object resource subsets meet the target conditions, and the resource processing parameters are used to indicate a reference processing time for resource processing of the object resource subsets; resource processing is performed on the multiple object resource subsets respectively through multiple resource processing processes running in parallel, wherein the resource processing process is used to perform resource processing on one of the object resource subsets, and the resource processing is used to convert the object resources in the object resource subset into a data format corresponding to the target platform; the resource processing results of each of the multiple object resource subsets are determined as target resource data, wherein the target resource data is used to render and generate the target virtual scene on the target platform.
[0045] Optionally, in this embodiment, the terminal device 102 may be a terminal device configured with a target client, which may include but is not limited to at least one of the following: a mobile phone (such as an Android phone, an iOS phone, etc.), a laptop, a tablet computer, a PDA, an MID (Mobile Internet Device), a PAD, a desktop computer, a smart TV, etc. The target client may be a video client, an instant messaging client, a browser client, an educational client, or the like that supports providing object resource baking tasks. The network may include but is not limited to: a wired network, a wireless network, wherein the wired network includes: a local area network, a metropolitan area network, and a wide area network, and the wireless network includes: Bluetooth, WIFI, and other networks that implement wireless communication. The server may be a single server, or a server cluster consisting of multiple servers, or a cloud server. The above is only an example and is not limited to this in this embodiment.
[0046] Optionally, in this embodiment, the resource data processing method described above can be applied, but is not limited to, to a gaming terminal application (Application, APP) that completes a predetermined social gaming task in a virtual scene, such as a virtual competitive gaming application in a Multiplayer Online Battle Arena (MOBA) game application. The social gaming task described above can be, but is not limited to, a gaming task completed by a current player through virtual social interaction between a virtual character in a virtual scene and virtual characters controlled by other players, through processing human-computer interaction resource data. The resource data processing method described above can also be applied to a massively multiplayer online role-playing game (MMORPG) terminal application, in which the current player can complete social gaming tasks in the game through role-playing from the first-person perspective of a virtual character, for example, completing gaming tasks together with other virtual characters. The social gaming tasks herein can be, but are not limited to, running in an application (such as a non-standalone gaming app) in the form of a plug-in or mini-program, or running in an application (such as a standalone gaming app) within a game engine. The types of the above-mentioned game applications may include but are not limited to at least one of the following: two-dimensional (2D) game applications, three-dimensional (3D) game applications, virtual reality (VR) game applications, augmented reality (AR) game applications, and mixed reality (MR) game applications.
[0047] Optionally, in this embodiment, the resource data processing method described above can be applied, but is not limited to, to film and television production. Film and television production can include, but is not limited to, animation, movies, and television series, and film and television production can include, but is not limited to, creating virtual scenes and special effects between frames. Unreal Engine can simulate the motion and lighting effects of actual cameras during film and television production, allowing for real-time preview of the effects during production. After production is complete, the resource data can be transmitted to a server. When needed by a terminal device, the resource data can be retrieved from the server and the target resource data can be obtained using the resource data processing method described above.
[0048] Optionally, in this embodiment, the resource data processing method described above can be applied to, but is not limited to, the fields of architecture and visualization. Architects and interior designers can use Unreal Engine to create virtual building models and, when needed, retrieve resource data from a server to achieve real-time rendering and interactive roaming.
[0049] The above usage scenarios are merely examples. The resource data processing method can also be applied to professional scenarios such as design software integration and medical training, for example, by constructing visualized medical images for viewing on terminal devices. In other words, any scenario related to the baking process of a virtual engine can utilize the solution of this application. This embodiment does not impose any limitations on this.
[0050] In an embodiment of the present application, a set of object resources corresponding to a target virtual scene and a set of resource relationships matching the set of object resources are obtained; multiple object resource subsets are determined from the set of object resources based on the resource types and resource dependencies corresponding to the multiple object resources; resource processing is performed on the multiple object resource subsets through multiple resource processing processes running in parallel; and the resource processing results of the multiple object resource subsets are determined as target resource data. This achieves efficient generation of target resource data.
[0051] In an embodiment of the present application, a collection of object resources is divided according to the resource types corresponding to each of the multiple object resources and the resource dependencies, and multiple object resource subsets whose resource processing parameters meet the target conditions are determined. Multiple resource processing processes running in parallel perform resource processing on the multiple object resource subsets to obtain target resource data. This allows the collection of object resources that need to be executed serially to be divided into multiple object resource subsets whose processing parameters meet the requirements according to the resource types and resource dependencies, and the multiple object resource subsets are processed in parallel. This solves the technical problem of long resource data processing time in the resource baking method provided by the related art, thereby improving the efficiency of resource baking.
[0052] As an optional implementation, Figure 2 As shown, the resource data processing method includes the following steps:
[0053] S202, obtaining an object resource set corresponding to a target virtual scene, and a resource relationship set matching the object resource set, wherein the object resource set includes a plurality of object resources, the object resources are used to indicate scene elements in the target virtual scene, and the resource relationship set is used to indicate resource dependency relationships between the plurality of object resources;
[0054] S204: determining a plurality of object resource subsets from the object resource set based on resource types corresponding to the plurality of object resources and resource dependencies, wherein resource processing parameters of the object resource subsets satisfy target conditions, and the resource processing parameters are used to indicate reference processing times for resource processing on the object resource subsets;
[0055] S206, performing resource processing on the multiple object resource subsets respectively by using multiple resource processing processes running in parallel, wherein the resource processing process is used to perform resource processing on one object resource subset, and the resource processing is used to convert the object resources in the object resource subset into a data format corresponding to the target platform;
[0056] S208 : Determine the resource processing results of each of the plurality of object resource subsets as target resource data, wherein the target resource data is used to render and generate a target virtual scene on a target platform.
[0057] It should be noted that the above method can be used in scenarios including, but not limited to, rendering a target virtual scene on a target platform by baking resource data. For example, in a game rendering scenario, a predetermined set of object resources can be loaded into a PS4 for baking to obtain resource data that can be used to render a virtual scene corresponding to the game on the PS4 platform. In this embodiment, the specific application scenario of the above embodiment is not limited. In a specific scenario, the above resource data processing method can be specifically applied to a technical application scenario of rendering a virtual scene using the Unreal Engine.
[0058] It should be noted that the object resource in step S202 can be data in formats such as .uasset and .umap. These object resources can be stored on a hard disk in these formats and loaded from the hard disk to serialize and load scene elements into memory to produce the target virtual scene. These object resources can be used to store information such as blueprints, textures, skeletons, sounds, and special effects.
[0059] In an optional implementation, when the object resource collection needs to be deployed to the corresponding platform, the default packaging configuration in the object resource collection can be scanned first to obtain the resource path of each object resource, thereby obtaining the object resource collection corresponding to the target virtual scene.
[0060] Optionally, the resource relationship set matched by the object resource set in the above step S202 can indicate the resource dependency between multiple object resources. The above resource relationship set indicates the resource dependency between multiple object resources. The dependency can be regarded as a reference relationship between object resources. If object resource A is referenced by object resource B, then object resource B can be regarded as dependent on object resource A. When obtaining the object resource set, a configuration file is usually obtained, which carries the dependency of most object resources. For example, the above resource relationship set can be obtained in the form of AssetRegistry (resource registry). AssetRegistry can be used to scan the specified target and then load the information of the object resource. When the object resource changes (for example, renaming, moving to other directories, deletion, etc.), AssetRegistry can monitor it.
[0061] Sometimes, the dependency relationships between object resources may not be fully obtained using the Asset Registry. In this case, it is possible to check whether other object resources are loaded when the object resource is loaded. If object resource C also loads object resource D when it is loaded, then object resource C depends on object resource D. Optionally, the resource relationship set that matches the object resource set in step S202 can also be obtained in the form of an Import Table. The Import Table can record the dependency relationships when resources are loaded. By querying the Import Table, it is possible to query the dependency relationships that cannot be obtained. The Import Table stores information about other object resources referenced by the object resource (such as path name, type, etc.).
[0062] In an optional implementation, after determining the object resource collection, you can perform a substantive dependency analysis on it, use the Asset Registry to obtain the dependency relationships of the object resource collection, store them in a rough resource list, and then monitor the creation process of the object resources. Add resources that are not in the Asset Registry to the resource list to determine the resource relationship set that matches the object resource collection.
[0063] In an optional implementation, after determining the object resource set, you can access the Import Table to directly obtain the resource relationship set that matches all object resources. Because obtaining the resource relationship set through the Import Table requires loading resources, when the amount of resources is large, it may consume hardware resources and time. Therefore, the loading process of object resources can be prohibited when obtaining the resource relationship set.
[0064] It should be noted that the object resource subset in the above step S204 can be determined based on different classification methods of the object resource collection. In one example, the object resources can be divided into multiple object resource subsets according to the resource category of the object resources, such as dividing the object resource data of the same resource type into an object resource subset, or the object resource data of the same resource type can be divided into each object resource subset as evenly as possible.
[0065] In one example, step S204 can further divide the object resource set according to the dependency relationship of the object resources. For example, object resource sets with dependencies between each other can be divided into an object resource subset, or object resource sets without dependencies can be divided into an object resource subset.
[0066] In one example, the above step S204 can also divide the object resource collection according to the items of the object resources. For example, the object resources in the same scene are divided into an object resource subset, such as dividing the object resources in the plain scene into an object resource subset, or dividing a specific virtual scene (such as a copy scene or a box garden scene in the game) into an object resource subset. The object resources corresponding to the same virtual character can also be divided into an object resource subset, such as dividing the hero character in the MOBA game into an object resource subset, or dividing the interactive character (NPC) in the MMORPG into an object subset. The object resources corresponding to the same virtual prop can be divided into an object resource subset, such as dividing all the manifestations of the virtual weapons in the FPS game into an object resource subset.
[0067] It should be noted that the resource processing parameters in the above step S204 can indicate the reference processing time for resource processing of the object resource subset, that is, the resource processing time can be controlled by the resource processing parameters. The reference processing time can be set according to the specific task. For example, the reference processing time can be set by pre-determining the number of object resource subsets and the estimated total processing time. The above resource processing parameters can also indicate the reference data volume of the object resource subset, that is, the size of the object resource subset can be limited by the resource processing parameters, thereby increasing the efficiency of task processing.
[0068] The following section will describe in detail how to determine multiple object resource subsets from an object resource collection, and will not go into detail here.
[0069] It should be noted that the target platform in step S206 is the platform specified for baking. Platforms can include Windows Server, Linux Server, PS4, Xbox, iOS, and Android. A resource processing process can process a subset of object resources. Resource processing involves converting the object resources in the currently processed subset of object resources into the data format corresponding to the target platform. A resource processing process can process a subset of object resources serially or in parallel, meaning that a subset of object resources can be processed in parallel within a single resource processing process.
[0070] Optionally, the resource processing process in step S206 may correspond to a complete task, and the resource processing process may include resource loading, cache data generation, and serialization to obtain target resource data. The operation mode of each stage in the entire resource process is not limited. For example, in the cache data generation stage, cache data may be generated in parallel within a resource processing process.
[0071] In an embodiment of the present application, a set of object resources corresponding to a target virtual scene and a set of resource relationships matching the set of object resources are obtained; multiple object resource subsets are determined from the set of object resources based on the resource types and resource dependencies corresponding to the multiple object resources; resource processing is performed on the multiple object resource subsets through multiple resource processing processes running in parallel; and the resource processing results of the multiple object resource subsets are determined as target resource data. This achieves efficient generation of target resource data.
[0072] In an embodiment of the present application, a collection of object resources is divided according to the resource types corresponding to each of the multiple object resources and the resource dependencies, and multiple object resource subsets whose resource processing parameters meet the target conditions are determined. Multiple resource processing processes running in parallel perform resource processing on the multiple object resource subsets to obtain target resource data. This allows the collection of object resources that need to be executed serially to be divided into multiple object resource subsets whose processing parameters meet the requirements according to the resource types and resource dependencies, and the multiple object resource subsets are processed in parallel. This solves the technical problem of long resource data processing time in the resource baking method provided by the related art, thereby improving the efficiency of resource baking.
[0073] In an optional implementation, the resource processing of the plurality of object resource subsets respectively by the plurality of resource processing processes running in parallel includes:
[0074] S1, determining, by a current resource processing process, multiple resource operation sets from a current object resource subset, wherein the resource operation sets include multiple object resources obtained from the current object resource subset, the object resource subset includes the current object resource subset, and the current resource processing process is a resource processing process for performing resource processing on the current object resource subset;
[0075] S2, sequentially determining multiple resource operation sets as current operation sets, and repeating the following steps until multiple resource operation sets are traversed: batch loading multiple object resources in the current operation set into a memory area that matches the current resource processing process; batch caching the multiple object resources in the memory area to obtain reference resource data;
[0076] S3, serializing the reference resource data corresponding to the multiple resource operation sets to obtain a resource processing result corresponding to the current object resource subset.
[0077] In a possible implementation, an object resource subset may be split to facilitate subsequent parallel processing. The object resource subset processed by the current resource processing process may be divided into multiple resource operation sets, and the multiple resource operation sets are processed in sequence.
[0078] Optionally, the above-mentioned resource operation set can be divided according to the type of object resources, or according to the dependency relationship of object resources. In one possible implementation, when performing resource processing on the current object resource subset, object resources of the same type can be placed in a resource operation set according to the type of object resources contained therein, and the obtained resource operation set can be processed accordingly.
[0079] Figure 3 This is a schematic diagram of an optional resource data processing method according to an embodiment of the present application. Figure 3 The object resource 1.1 in the example represents the first object resource of the first type. Figure 3 As shown in Figure (a), when processing a collection of object resources, a resource processing process serially executes resource processing operations on each object resource. Specifically, during the resource processing process, object resource 1.1 is first loaded, cached, and serialized to obtain the resource processing result corresponding to object resource 1.1. Object resource 1.2 is then obtained, loaded, cached, and serialized to obtain the resource processing result corresponding to object resource 1.2. These three phases are repeated for all object resources one by one until all object resources are processed and the resource processing result corresponding to the collection of object resources is obtained.
[0080] In one possible implementation, Figure 3As shown in Figure (b), when performing resource processing on the current object resource subset, multiple resource operation sets can be determined. Figure 3 Figure (b) shows how resources are divided according to object resource type to generate multiple resource operation sets. After obtaining these resource operation sets, instead of processing each object resource individually, multiple resource operation sets are batch loaded into a memory area that matches the current resource processing process. This completes the batch loading of object resources. The cache is then generated in batches according to a specific order. The specific number of object resources to be batch loaded can be affected by processor performance. Once the reference resource data for multiple resource operation sets is obtained, serialization processing can be performed. Similarly, batch processing can also be performed during the serialization phase.
[0081] In an optional implementation, when processing multiple resource operation sets, the multiple resource operation sets can be placed in the memory area of the resource processing process, so that after processing one object resource is completed, the next object resource can be processed immediately without waiting for the processing interval between two object resources.
[0082] Through the above-mentioned implementation mode of the present application, by dividing the object resource subset into multiple resource operation sets, and batch loading, batch caching and serializing the multiple resource operation sets to obtain resource processing results, the processing interval time between two object resources can be reduced, the utilization efficiency of the processor can be improved, and faster resource processing can be achieved.
[0083] In an optional implementation, the step of sequentially determining the plurality of resource operation sets as the current operation set includes:
[0084] S1. Obtaining sorting results of multiple resource operation sets based on dependency parameters corresponding to each of the multiple resource operation sets, wherein the dependency parameters are used to indicate the number of reference object resources associated with the resource operation sets, and the reference object resources are object resources having resource dependency relationships with object resources in the resource operation sets. In the sorting results, the first dependency parameter corresponding to the resource operation set ranked first is lower than the second dependency parameter corresponding to the resource operation set ranked later.
[0085] S2. Determine multiple resource operation sets as current operation sets in sequence according to the sorting results, wherein the resource operation set that comes first in the sorting results.
[0086] In one possible implementation, multiple resource operation sets can be obtained by dividing object resource subsets according to their types. Because object resources of the same type often depend on similar resource types, after obtaining multiple resource operation sets, the dependencies between the resource operation sets can be determined using the dependency set. Based on the dependencies between the different resource operation sets, the object resources in each resource operation set with which they have resource dependencies can be determined, thereby determining dependency parameters. The resource operation sets are then sorted according to the dependency parameters, with resource processing performed first on the resource operation sets that appear earlier in the sorting results.
[0087] In one possible implementation, object resources can be divided into subsets based on their dependencies. Specifically, the dependencies between object resources are pre-determined, and object resources with the same dependency parameters are placed into a resource operation set. Similarly, after multiple resource operation sets are determined, resource processing can be performed on the resource operation sets in order.
[0088] Optionally, in this embodiment, the type of object resources can be but is not limited to blueprints, textures, bones, sounds, special effects, maps, materials, etc. For example, the dependency of mesh-type object resources is usually lower, and the dependency of map-type object resources is usually higher. Therefore, mesh-type object resources can be processed first, and then map-type object resources can be processed.
[0089] In one possible implementation, in the process of processing resources, for each object resource, it is necessary to cache and process reference resource data. The reference resource data may be derived data. After obtaining the derived data, it is retained in the derived data cache (DDC). In the process of processing the object resource, the configuration of the DDC is read and parsed. When the DDC is read, the DDC resource is read into the memory. In the case where the DDC cannot be read, it is necessary to generate derived data and cache the derived data for subsequent resource reading. Therefore, when the resource operation set is processed sequentially according to the dependency relationship, when processing the resource operation set with low dependency, reference resource data (DDC) for it can be generated. When processing the resource operation set with high dependency subsequently, the reference resource data generated above can be reused, that is, the reference resource data is directly read and read directly into the memory without the need for repeated generation, thereby reducing the time wasted due to repeated generation of reference resource data.
[0090] Figure 4 FIG is a schematic diagram of an optional resource data processing method according to an embodiment of the present application. Figure 4As shown, after obtaining the current object resource subset, the object resource subset can be divided according to the type of the object resources in the object resource subset to obtain multiple resource operation sets. Object resource 1.1 represents the first object resource in the first type of object resources, and resource operation set 1 represents the resource operation set that is sorted first. Figure 4 As shown, after obtaining multiple resource operation sets according to the type of object resources, the dependency parameters of each resource operation set can be determined, and the resource operation sets can be sorted according to the dependency parameters of each resource operation set. Resource operation sets with lower dependency parameters are processed first, that is, resource operation set 1 with no dependency is processed first, and resource operation set n with high dependency is processed last. In the process of resource processing of resource operation set 1, corresponding reference resource data can be generated for resource operation set 1, and when resource processing is performed on resource operation set n, the reference resource data generated by the object resource data with dependency relationship can be directly read without repeated generation.
[0091] Through the above-mentioned implementation of the present application, multiple resource operation sets are sorted and processed according to dependency parameters. After the processing of resource operation sets with no or low dependencies is completed, the corresponding reference resource data can be generated. When the high-dependency resource operation sets are subsequently processed, the reference resource data can be directly read without the need for repeated generation, thereby improving the efficiency of resource processing.
[0092] In an optional embodiment, multiple resource operation sets are determined from the current object resource subset by the current resource processing process, including at least one of the following:
[0093] Method 1: Determine multiple resource operation sets from the current object resource subset based on the resource type of the object resource;
[0094] Method 2: determining multiple resource operation sets from the current object resource subset based on the number of reference object resources associated with the object resource, wherein the reference object resources are object resources having a resource dependency relationship with the object resource;
[0095] Method three: according to the resource data volume of the object resource, multiple resource operation sets are determined from the current object resource subset, wherein the resource data volume corresponding to the resource operation sets is greater than the target data volume.
[0096] In one possible implementation, an object resource subset can determine multiple resource operation sets from the current object resource subset based on the type of the object resource, and the type of the object resource data can be determined based on different projects. Object resource data of the same type can be determined as one resource operation set, or the object resource data of the same type can be divided into multiple resource operation sets. Determining the resource operation set based on the type of the object resource allows the commonality of the resource type to be utilized in subsequent resource processing. For example, in the caching stage, the caching order can be determined directly based on the type of the object resource, such as giving priority to processing grid-type object resources and then processing map-type object resources.
[0097] In an optional implementation, an object resource subset can determine multiple resource operation sets from the current object resource subset based on the number of reference object resources associated with the object resource, and the number of reference object resources associated with the object resource data can be determined by the dependency relationship of the object resource data. After determining the number of reference object resource data associated with the object resource data, the same or similar number of object resource data can be determined as a resource operation set. Determining the resource operation set according to the number of object resources associated with the object resource data can give priority to processing resource operation sets with low dependency numbers in subsequent stages, and then process resource operation sets with high dependency data, so that object resource data with high dependency can reuse the reference resource data in the cache. For example, some object resource data of mesh type and material type can be determined as a resource operation set. After completing the cache processing to obtain the reference resource data, the object resource of map type can be processed so that it can reuse the existing reference resource data.
[0098] In an optional implementation, a subset of object resources can determine multiple resource operation sets based on the data volume of the object resources, and when processing the object resources, the object resources can be processed in batches. The data volume of each resource operation set is set to be larger than the target data volume, so that the resource operation set can make full use of the processor's resources. Instead of simply dividing the number of resource operation sets, the processor needs to wait more times for subsequent resource operation sets after completing the processing of the current resource operation set. For example, for material compilation, after completing a SCW (material compilation) task, it is necessary to wait again for the processor to perform the next task. Therefore, setting the data volume contained in the resource operation set to be larger can reduce the intermediate waiting time of material compilation, thereby improving the efficiency of the processor.
[0099] Through the above-mentioned implementation mode of the present application, multiple resource operation sets are determined from the current object resource subset according to the type of object resource, the number of reference object resources associated with the object resource, the data volume of the object resource, etc., which can reduce the repeated generation of reference resource data by object resource data with dependencies, reduce the time for the processor to load tasks, make full use of the processor, and thus improve the efficiency of resource processing.
[0100] In an optional embodiment, the serialization processing of the reference resource data corresponding to the plurality of resource operation sets to obtain the resource processing result corresponding to the current object resource subset includes:
[0101] S1, calling multiple resource processing threads through the current resource processing process;
[0102] S2, serializing the multiple reference resource data respectively according to the multiple resource processing threads running in parallel, and obtaining the resource processing results corresponding to the current object resource subset.
[0103] In an optional implementation, after the current resource processing process completes loading and caching the current object resource subset, the obtained reference resource data can be serialized. In this case, the resource processing process can launch multiple resource processing threads, that is, multiple resource processing processes can run in parallel within a resource processing process to serialize multiple reference resource data.
[0104] In an optional implementation, after the resource processing process completes the loading and caching of multiple object resource subsets, the reference resource data corresponding to the object resource collection can be serialized, and the reference resource data corresponding to the object resource collection can be processed in parallel to obtain the resource processing results corresponding to the object resource collection.
[0105] Through the above-mentioned implementation of the present application, in a resource processing process, the reference resource data corresponding to an object resource subset is processed in parallel by multi-threading, or the reference resource data corresponding to multiple object resource subsets are processed in parallel by multi-threading to obtain the resource processing result, thereby saving the processing time of the serialization execution stage and improving the resource processing efficiency.
[0106] In an optional implementation manner, after the multiple resource operation sets are determined from the current object resource subset by the current resource processing process, the following steps are included:
[0107] S1, when the number of processes of the current processing sub-process currently in the running state is less than the target number, obtaining the current operation set from multiple resource operation sets, wherein the current resource processing process is used to pull up the current processing sub-process to perform resource processing on the resource operation set;
[0108] S2, pull up the target processing sub-process through the current resource processing process;
[0109] S3, through the target processing sub-process, batch loads multiple object resources in the current operation set into the memory area that matches the current resource processing process;
[0110] S4, batch caching is performed on multiple object resources in the memory area to obtain reference resource data.
[0111] Optionally, after determining the target number of processing sub-processes, the number of processes of the current processing sub-processes in running state can be compared with the target number. If the current number of processing sub-processes is less than the target number, a resource operation set can be obtained, and the corresponding target processing sub-process can be pulled up according to the resource operation set to obtain reference resource data.
[0112] When the object resource type is a material, it is necessary to compile the object resource using a shader. Shaders can be divided into vertex shaders, pixel shaders, geometry shaders, convex hull shaders, domain shaders, compute shaders, etc. When processing object resources, the number of shader compilations is very large, sometimes reaching tens of thousands of shaders. Therefore, in the following examples, the shader compilation part is described in detail in conjunction with the solution of this application.
[0113] Figure 5 FIG is a schematic diagram of an optional resource data processing method according to an embodiment of the present application. Figure 5 As shown in Figure (a), when performing Shader compilation in the related technology, for one processing task, the processor starts multiple processes, namely, the program that executes Shader compilation (Shader Compile Worker, SCW). Figure 5 Figure (b) shows a schematic diagram of shader compilation in a multithreaded environment. Processing tasks 1-p can be viewed as multiple resource processing processes. Processes 1-m within each processing task are the SCWs (subprocesses) launched for that processing task, where p and m are both integers greater than 1. The number of processing tasks p can be the same as the number of resource processing processes. Process m within each processing task is the preset target subprocess, determined by the value of p and the number of processor cores.
[0114] Through the above-mentioned implementation mode of the present application, multiple processing sub-processes can be pulled up in the resource processing process. When the resource processing process is used to process the object resource subset, the object resource subset can be divided into multiple resource operation sets, so that the resource operation sets can be processed in parallel using the processing sub-processes, that is, the resource processing process can also perform parallel processing when processing the object resource subset, thereby improving the efficiency of resource processing.
[0115] In an optional embodiment, before launching the target processing sub-process through the current resource processing process, the method further includes:
[0116] S1, obtaining the number of processing cores of the current terminal, wherein the processing core is used to run the resource processing sub-process;
[0117] S2: Determine a target number based on the number of cores and the number of subsets of the object resource subset, wherein the target number is the number of resource processing sub-processes that each resource processing process is allowed to start.
[0118] It should be noted that a processing subprocess can be launched by a resource processing process for a resource operation set. The target number of processing subprocesses can be determined based on the number of object resource subsets and the number of processor cores. For example, if the number of object resource subsets is large but the number of processor cores is small, the number of processing subprocesses launched by a resource processing process can be reduced to avoid resource competition caused by too many processes. The number of processing subprocesses should also be small to avoid inefficiency caused by too few processes.
[0119] Through the above-mentioned implementation mode of the present application, the number of processing sub-processes that a resource processing process can pull up is limited, and the number of processing sub-processes is determined based on the number of object resource subsets or the number of resource processing processes and the number of processor cores to avoid competition for processor resources caused by an excessive number of processing sub-processes, thereby improving the efficiency of the processing sub-processes.
[0120] In an optional implementation manner, before launching the target processing sub-process through the current resource processing process, the method further includes:
[0121] S1, obtaining a process priority parameter, wherein the process priority parameter is used to indicate that the process priority of the resource processing sub-process started by the resource processing process is the first priority, and the resource processing sub-process includes a target processing sub-process and a current processing sub-process;
[0122] S2. Update the process priority parameter, wherein the updated process priority parameter is used to indicate that the process priority of the resource processing sub-process started by the resource processing process is the second priority, and the second priority is higher than the first priority.
[0123] In an optional implementation, after obtaining the file, the priority-changing parameters (process priority parameters) are added during the initialization phase of the configuration system, overwriting the corresponding priority portion of the original configuration file. Because configuration files are loaded in order, the newly added parameters can overwrite the previous values. Then, during startup, the configuration file is loaded by default, the modified configuration information is read, and the priority of the child process is changed.
[0124] In one example, by changing the priority of a process at different stages, the priority is dynamically changed, the priority of the processing sub-process is increased, and the processing sub-process can be preferentially allocated processor resources. In the PostConfigInit stage (i.e., loading after the configuration system is initialized), the process priority parameter is added, and the original parameter is overwritten according to the configuration file acquisition method. In the Default stage (i.e., the loading stage), the corresponding process priority parameter is dynamically changed by reading the configuration file, thereby changing the priority of the process.
[0125] Through the above-mentioned implementation mode of the present application, by setting the process priority parameter, the priority of the process can be dynamically improved, allowing the processor to give priority to processing resources for sub-processes, thereby improving the efficiency of processing sub-processes.
[0126] In an optional embodiment, the batch loading of multiple object resources in the current operation set into a memory area matching the current resource processing process through the target processing sub-process includes:
[0127] S1, batch loading multiple object resources in the current operation set into the memory area matching the current resource processing process according to the target order, where the target order is the resource loading order determined according to the resource dependency relationship;
[0128] S2. When the current object resource subset does not include the reference object resource on which the current object resource depends, the reference object resource is not loaded into the memory area that matches the current resource processing process, wherein the multiple object resources in the current operation set include the current object resource.
[0129] In an optional implementation, when processing object resource data, object resources that the object resource depends on may also be loaded into the memory. Therefore, when batch loading multiple object resources in an operation set into a memory area that matches the resource processing process, object resources that the current object resource depends on may also be loaded into the memory. In the case that the current object resource subset does not include the reference object resource that the current object resource depends on, the reference object resource needs to be removed and only the object resources in the current object resource subset need to be processed. That is, it can be object resources in other operation sets in the same object resource subset, or it can be object resources in the same operation set, but it cannot be object resources in other object resource subsets.
[0130] In one example, when a resource processing process processes an object resource of a material type, it will automatically compile the shader of the object resource that the current object resource depends on and generate derived data. This may cause the shader to be compiled multiple times for the same object resource in different resource processing processes. Therefore, it is necessary to eliminate the object resources that are not in this resource processing process and prohibit compilation in the current resource processing process.
[0131] Through the above-described implementation of the present application, when object resources in an operation set are loaded into the memory area of a resource processing process, object resources not included in the current object resource subset are prohibited from being loaded and cached. This can thereby avoid duplicate loading between different resource processing processes and improve the overall processing efficiency of the object resource set.
[0132] In an optional implementation manner, the resource processing of the plurality of object resource subsets is performed by the plurality of resource processing processes running in parallel, including:
[0133] S1, disable multiple resource processing processes to create data storage space under the target path;
[0134] S2, creating corresponding data storage spaces for the multiple resource processing processes respectively, wherein the data storage spaces are used to store the intermediate resource data and resource processing results generated by the resource processing processes during the resource processing process.
[0135] In an optional implementation, when running multiple resource processing processes in parallel, it is necessary to disable each resource processing process from creating data storage space under the target path. That is, the output of each resource processing process can be controlled by setting the target path. Usually, the common outputs in each resource processing process can be disabled, such as Boot DDC (a startup file loaded into memory to improve startup time), Asset Registry (the above-mentioned resource registry) and Global Shader (global shader). A specific target path is, for example: ProjectDir (project name) / DerivedDataCache / Boot.ddc (the above-mentioned startup file). This directory can be disabled, that is, the creation of Boot.ddc data storage space under ProjectDir / DerivedDataCache is prohibited.
[0136] In one possible implementation, each resource processing process needs to create its own corresponding data storage space. Specifically, different resource processing processes need to have different working directories. When a resource processing process generates intermediate resource data, the intermediate resource data can be stored in the corresponding data storage space. This prevents data generated by different resource processing processes from being stored in the same directory, preventing them from interfering with each other.
[0137] Through the above-mentioned implementation of the present application, multiple resource processing processes are prohibited from creating data storage space under the target path, so that each resource processing process does not generate redundant common outputs or unnecessary outputs, thereby improving the efficiency of resource processing. By creating corresponding data storage spaces for multiple resource processing processes, they are isolated from each other, thereby improving the stability of parallel resource processing.
[0138] In an optional embodiment, before the resource processing is performed on the plurality of object resource subsets respectively by the plurality of resource processing processes running in parallel, the method further includes:
[0139] S1, creating a target management process, wherein the target management process is used to read a process configuration file, wherein the process configuration file includes process configuration information corresponding to multiple resource processing processes;
[0140] S2, launches multiple resource processing processes based on the process configuration file;
[0141] S3, maintains the operating status of multiple resource processing processes through the target management process.
[0142] In an optional implementation method, when creating multiple resource processing processes, a main process (target management process) can be created. The process configuration file can be read through the target management process. The process configuration file can record the object resources and related configurations that each resource processing process should process, and can record the startup time or conditions of each resource processing process, so as to realize orderly control of multiple resource processing processes through the process configuration file.
[0143] After the target management process starts multiple resource processing processes, it can maintain them. Specifically, it can start the corresponding resource processing process based on the conditions for starting each resource processing process, and it can also record the running status of each resource processing process after its completion. If a resource processing process fails, the target management process needs to re-start the resource processing process.
[0144] Through the above-mentioned implementation mode of the present application, multiple resource processing processes are automatically configured, started and maintained through the target management process and configuration file, thereby realizing automatic scheduling among multiple processes.
[0145] In an optional embodiment, the above-mentioned determination of multiple object resource subsets from the object resource set based on the resource types corresponding to the multiple object resources and the resource dependencies includes:
[0146] S1, obtaining a resource processing parameter, wherein the resource processing parameter is used to indicate the number of subsets of the object resource subset;
[0147] S2: Determine, from the object resource set, a plurality of object resource subsets indicated by the resource processing parameters according to resource types corresponding to the plurality of object resources and resource dependencies.
[0148] In one possible implementation, after determining the object resource set and dependency relationships, the object resource set can be split into multiple object resource subsets. When dividing the object resource subsets, they can be allocated based on the number of object resource subsets, that is, the object resource set can be divided almost evenly into a corresponding number of shares according to the number of object resource subsets.
[0149] In one possible implementation, after determining the number of object resource subsets, multiple object resource subsets may be determined based on the resource types and dependencies corresponding to the object resources. For example, resources of each type may be distributed approximately evenly across the object resource subsets based on resource type, resulting in multiple object resource subsets. Alternatively, based on dependency relationships, highly dependent object resources may be evenly distributed across the object resource subsets, and then dependent object resources may be placed into corresponding object resource subsets based on the dependency relationships. The determination of object resource subsets may be customized based on actual needs, and the specific determination method is not limited to the implementation described above.
[0150] Figure 6 FIG is a schematic diagram of an optional resource data processing method according to an embodiment of the present application. Figure 6 As shown, the resource processing parameter can be 14, and object resource 1.2 represents the second object resource in the first type of object resource. The object resource set is evenly divided into each object resource subset according to resource type, to obtain object resource subsets 1-14. Each object resource subset contains object resources of various types. Figure 7 FIG is a result diagram of an optional resource data processing method according to an embodiment of the present application. Figure 7 As shown, the horizontal axis is the corresponding object resource subset, and the vertical axis is the time consumed to process the object resource subset. It can be seen that the resource processing time of each object resource subset 1-14 is similar, and no object resource subset will affect the overall resource processing time.
[0151] Through the above implementation of the present application, the object resource collection is divided into multiple object resource subsets, the single-process execution method is converted into a multi-process execution method, and the processing resources are run in parallel, thereby improving the efficiency of resource processing.
[0152] In an optional embodiment, the acquisition of the object resource set corresponding to the target virtual scene and the resource relationship set matching the object resource set include at least one of the following:
[0153] S1, obtaining resource processing configuration information, and determining resource dependencies among a plurality of object resources according to resource paths indicated by the resource processing configuration information, wherein the resource processing configuration information includes resource paths of the object resources;
[0154] S2, load the object resource, and obtain the resource dependency of the object resource according to the resource loading result.
[0155] In one optional implementation, when resource processing is required, a collection of object resources is obtained, along with the corresponding resource processing configuration information. The path (storage directory) of the object resources is obtained based on the resource processing configuration information. The path of the object resources is scanned based on the AssetRegistry to determine the resource dependencies of the object resources. The object resources and their dependencies are stored to implement subsequent resource processing methods.
[0156] Through the above implementation of the present application, the resource dependency of multiple object resources is determined by indicating the resource path through resource processing configuration information, thereby clarifying the resource dependency before resource processing, providing a guarantee for subsequent parallel subset division.
[0157] In an optional embodiment, the loading of the object resource and obtaining the resource dependency of the object resource according to the resource loading result includes:
[0158] S1, when the object resource collection includes a first object resource of a first reference type, executing a resource constructor for loading the first object resource, and obtaining a resource dependency relationship associated with the first object resource indicated during the execution of the constructor;
[0159] S2: When the object resource collection includes a second object resource of a second reference type, load the second object resource to obtain a resource information list corresponding to the second object resource, and obtain a resource dependency relationship associated with the second object resource according to the resource information list.
[0160] In an optional implementation, the first object resource may be an object resource loaded in a constructor for which no dependency relationship has been analyzed. The second object resource may be an object resource not in the resource registry, such as Bone Compression Settings and Curve Compression Settings.
[0161] When the dependency relationship between the first object resource and the second object resource cannot be obtained using the asset registry, the dependency relationship can be obtained through the resource information list (Import Table). In one example, the resource dependency relationship can be obtained through the AssetRegistry and stored in a rough resource list. Then, after the first object resource and the second object resource are loaded at runtime, the dependency relationship can be obtained from the Import Table.
[0162] Through the above-mentioned implementation of the present application, the dependency relationship between the first object resource and the second object resource whose dependency relationship cannot be identified is determined, and resource processing is changed from a black box event to a deterministic data processing. Object resources that are not in the resource registry but are actually dependent can be analyzed, thereby improving the accuracy of resource analysis.
[0163] In an optional embodiment, before loading the object resource, at least one of the following is further included:
[0164] 1) configuring a target resource tag for the object resource, wherein the target resource tag is used to indicate disabling a resource processing operation triggered after loading the object resource;
[0165] 2) disabling a post-load instruction associated with the object resource, wherein the post-load instruction is used to trigger a resource processing operation associated with the object resource when the object resource is loaded.
[0166] In an alternative implementation, when analyzing object resources' dependencies using the Asset Registry, there's no need to load the object resources into memory. However, when using the Import Table, the object resources must actually be loaded into memory. During the loading process, PostLoad instructions are automatically executed, triggering the generation of derived data. Therefore, during the dependency analysis phase, the target resource tag is configured for the object resource so that it doesn't trigger PostLoad instructions.
[0167] Through the above-mentioned implementation of the present application, by configuring the target resource tag and disabling the post-loading instructions associated with the object resource, derived data will not be generated in the dependency analysis phase, which reduces the time consumption of generating derived data and thereby reduces the time consumption of the dependency analysis phase.
[0168] Figure 8 This is a schematic diagram of an optional resource data processing method according to an embodiment of the present application. Figure 8 A specific method for determining target resource data in this application is described.
[0169] Step S802: Obtaining an object resource set. When the terminal device needs to process resources, it needs to first obtain an object resource set. The source of the object resource set may be a cloud server, a local memory, etc. Object resources are used to indicate scene elements in the target virtual scene.
[0170] Step S804: configure the process priority by adding a process priority parameter to the configuration file. The process priority parameter is used to indicate the process priority of the resource processing sub-process started by the resource processing process.
[0171] Step S806, configure the target resource tag and disable the post-loading instruction. Before performing dependency analysis on the object resource collection, it is necessary to first configure the target resource tag for the object resource and disable the post-loading instruction associated with the object resource. In this way, when the dependency relationship is subsequently analyzed, derived data will not be automatically generated.
[0172] Step S808, reading the process priority. In this step, a configuration file is obtained, and the overwritten process priority is read from the configuration file. The process priority is updated so that the priority of the subsequent resource processing sub-process is increased.
[0173] Step S810 obtains a resource relationship set. This may involve obtaining resource paths from the resource processing configuration information, analyzing the rough resource dependencies of the object resources, and then using the resource information list to obtain the dependencies for the unidentified first and second object resources. Because the generation of derived data was disabled in step S806 above, no derived data is generated in this step.
[0174] Step S812: determine multiple object resource subsets, obtain resource processing parameters (used to indicate the number of subsets of the object resource subsets), and divide the object resource set into multiple object resource subsets according to the resource types corresponding to the object resources and resource dependencies.
[0175] Step S814: Isolate data storage space, set a corresponding data storage space for each resource processing process, and prohibit resource processing processes from generating common data, thereby reducing duplication of output and protecting the stability of the resource processing process.
[0176] Step S816: Pull multiple resource processing processes according to the process configuration file of the target management process and start resource processing. The running status of the multiple resource processing processes is recorded and maintained in case of failure.
[0177] Steps S818-S822 determine the resource operation set based on different parameters. Each resource processing process processes a subset of object resources at the same time, dividing the object resource subset into multiple resource operation sets, so that resources are also processed in parallel within the resource processing process.
[0178] Step S824, determine the sorting result of the resource operation set, and sort the resource operation set according to the dependency parameters corresponding to the resource operation set, so that the object data with low dependency can be processed first, and when the object data with high dependency is processed subsequently, the existing reference resource data can be used directly without generating it again.
[0179] Step S826, determining the target number of processing sub-processes. When processing a resource set of a material type, the target number of processing sub-processes can be determined based on the number of processing cores of the terminal and the number of subsets of the object resource subset.
[0180] Step S828: After the target number is determined, the number of processes of the processing sub-processes currently in operation is compared with the target number.
[0181] Step S830: When the number of processes of the current processing sub-process is less than the target number, a new operation set is obtained and a target processing sub-process is started for it.
[0182] Step S832, judging whether it belongs to the current object resource subset, when loading the object resources in the resource operation set into the memory area, loading them according to the dependency relationship, and judging whether the loaded object resources belong to the current object resource subset.
[0183] Step S834: If the loaded object resource does not belong to the current object resource subset, the object resource is removed, thereby prohibiting repeated loading of object resources that do not belong to the current process.
[0184] Step S836 , when the loaded object resource belongs to the object resource subset, reference resource data is generated, and batch caching processing is performed on multiple object resources in the memory area to obtain reference resource data.
[0185] Step S838, parallel serialization, calls multiple resource processing threads through the current resource processing process, and performs serialization processing on multiple reference resource data distributions according to the resource processing threads running in parallel, thereby achieving parallel serialization.
[0186] Through the above-mentioned implementation of the present application, during the resource processing process, a pre-dependency analysis is performed on the object resource collection, and tasks are assigned to the object resource collection to obtain multiple object resource subsets. The processing order of the processes is determined based on the object resource dependencies, achieving parallel serialization, and providing an overall configuration and maintenance plan for the resource processing process through the process configuration file. This achieves parallel resource processing and reduces the processing time at each stage of the resource processing process, thereby resolving the technical problem of long resource data processing time in the resource baking method provided by related technologies.
[0187] Figure 9 FIG is a result diagram of an optional resource data processing method according to an embodiment of the present application. Figure 9As shown, 27,550 texture map resources are processed using the resource data processing methods of the related technology and the embodiment of the present application. The horizontal axis is the time consumed for processing resources, and the vertical axis is the corresponding method. It can be seen that the processing time of the resource data processing solutions provided by the related technology and the embodiment of the present application for the same object resource set is quite different. The related technology takes 1,464 seconds to process the object resource set, while the method of the present application only takes 271 seconds, reducing the processing time by 80%. It can be seen that the embodiment of the present application solves the technical problem of the long resource data processing time existing in the resource baking method provided by the related technology.
[0188] It should be noted that for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.
[0189] According to another aspect of the embodiment of the present application, a resource data processing device for implementing the above resource data processing method is also provided. Figure 10 As shown, the device includes:
[0190] An acquisition unit 1002 is configured to acquire an object resource set corresponding to a target virtual scene, and a resource relationship set matching the object resource set, wherein the object resource set includes multiple object resources, the object resources are used to indicate scene elements in the target virtual scene, and the resource relationship set is used to indicate resource dependency relationships between the multiple object resources;
[0191] A first determining unit 1004 is configured to determine, from the object resource set, a plurality of object resource subsets based on resource types corresponding to the plurality of object resources and resource dependencies, wherein resource processing parameters of the object resource subsets meet a target condition, and the resource processing parameters are used to indicate a reference processing time for resource processing on the object resource subsets;
[0192] The resource processing unit 1006 is configured to perform resource processing on each of the plurality of object resource subsets through a plurality of resource processing processes running in parallel, wherein a resource processing process is configured to perform resource processing on one object resource subset, and the resource processing is configured to convert the object resources in the object resource subset into a data format corresponding to the target platform;
[0193] The second determining unit 1008 is configured to determine the resource processing results of each of the plurality of object resource subsets as target resource data, wherein the target resource data is used to render and generate a target virtual scene on a target platform.
[0194] Optionally, the resource processing unit 1006 includes:
[0195] a first determining module configured to determine, by a current resource processing process, a plurality of resource operation sets from a current object resource subset, wherein the resource operation sets include a plurality of object resources obtained from the current object resource subset, the object resource subset includes the current object resource subset, and the current resource processing process is a resource processing process for performing resource processing on the current object resource subset;
[0196] The second determination module is configured to sequentially determine the multiple resource operation sets as the current operation set and repeat the following steps until the multiple resource operation sets are traversed: batch loading the multiple object resources in the current operation set into a memory area that matches the current resource processing process; batch caching the multiple object resources in the memory area to obtain reference resource data;
[0197] The serialization module is used to serialize the reference resource data corresponding to multiple resource operation sets to obtain the resource processing result corresponding to the current object resource subset.
[0198] Optionally, the above-mentioned second determination module is also used to: obtain the sorting results of multiple resource operation sets according to the dependency parameters corresponding to each of the multiple resource operation sets, wherein the dependency parameters are used to indicate the number of reference object resources associated with the resource operation set, the reference object resources are object resources that have a resource dependency relationship with the object resources in the resource operation set, and the first dependency parameter corresponding to the resource operation set sorted earlier in the sorting result is lower than the second dependency parameter corresponding to the resource operation set sorted later; according to the sorting results, the multiple resource operation sets are sequentially determined as the current operation sets, wherein the resource operation set that comes earlier in the sorting result.
[0199] Optionally, the above-mentioned first determination module is also used to: determine multiple resource operation sets from the current object resource subset based on the resource type of the object resource; determine multiple resource operation sets from the current object resource subset based on the number of reference object resources associated with the object resource, wherein the reference object resource is an object resource that has a resource dependency relationship with the object resource; determine multiple resource operation sets from the current object resource subset based on the resource data volume of the object resource, wherein the resource data volume corresponding to the resource operation set is greater than the target data volume.
[0200] Optionally, the serialization module is further used to: call multiple resource processing threads through the current resource processing process; serialize multiple reference resource data respectively according to the multiple resource processing threads running in parallel to obtain resource processing results corresponding to the current object resource subset.
[0201] Optionally, the above-mentioned first determination module is also used to: when the number of processes of the current processing sub-process currently in running state is less than the target number, obtain the current operation set from multiple resource operation sets, wherein the current resource processing process is used to pull up the current processing sub-process to perform resource processing on the resource operation set; pull up the target processing sub-process through the current resource processing process; batch load multiple object resources in the current operation set into a memory area matching the current resource processing process through the target processing sub-process; batch cache multiple object resources in the memory area to obtain reference resource data.
[0202] Optionally, the above-mentioned first determination module is also used to: obtain the core number of the processing core of the current terminal, wherein the processing core is used to run the resource processing sub-process; determine the target number based on the core number and the subset number of the object resource subset, wherein the target number is the process number of resource processing sub-processes allowed to be pulled up by each resource processing process.
[0203] Optionally, the above-mentioned first determination module is also used to: obtain a process priority parameter, wherein the process priority parameter is used to indicate that the process priority of the resource processing sub-process pulled up by the resource processing process is a first priority, and the resource processing sub-process includes a target processing sub-process and a current processing sub-process; update the process priority parameter, wherein the updated process priority parameter is used to indicate that the process priority of the resource processing sub-process pulled up by the resource processing process is a second priority, and the second priority is higher than the first priority.
[0204] Optionally, the above-mentioned first determination module is also used to: batch load multiple object resources in the current operation set into a memory area matching the current resource processing process in a target order, wherein the target order is a resource loading order determined according to resource dependencies; when the current object resource subset does not include a reference object resource on which the current object resource depends, the reference object resource is not loaded into the memory area matching the current resource processing process, wherein the multiple object resources in the current operation set include the current object resource.
[0205] Optionally, the resource processing unit 1006 includes:
[0206] The disabling module is used to disable multiple resource processing processes from creating data storage space under the target path;
[0207] The first creation module is used to create data storage spaces corresponding to the plurality of resource processing processes respectively, wherein the data storage spaces are used to store intermediate resource data and resource processing results generated by the resource processing processes during the resource processing process.
[0208] Optionally, the resource processing unit 1006 includes:
[0209] A second creation module is used to create a target management process, wherein the target management process is used to read a process configuration file, wherein the process configuration file includes process configuration information corresponding to each of a plurality of resource processing processes;
[0210] The startup module is used to start multiple resource processing processes according to the process configuration file; the maintenance module is used to maintain the operating status of each of the multiple resource processing processes through the target management process.
[0211] Optionally, the first determining unit 1004 further includes:
[0212] An acquisition module, configured to acquire a resource processing parameter, wherein the resource processing parameter is used to indicate the number of subsets of the object resource subset;
[0213] The third determining module is configured to determine, from the object resource set, a plurality of object resource subsets indicated by the resource processing parameter according to resource types corresponding to the plurality of object resources and resource dependencies.
[0214] Optionally, the acquisition unit 1002 includes:
[0215] a fourth determining module, configured to obtain resource processing configuration information, and determine resource dependencies among the plurality of object resources according to resource paths indicated by the resource processing configuration information, wherein the resource processing configuration information includes resource paths of the respective object resources;
[0216] The loading module is used to load object resources and obtain the resource dependencies of the object resources based on the resource loading results.
[0217] Optionally, the above-mentioned loading module is also used to: when the object resource collection includes a first object resource of a first reference type, run the resource constructor for loading the first object resource, and obtain the resource dependency relationship associated with the first object resource indicated during the execution of the constructor; when the object resource collection includes a second object resource of a second reference type, load the second object resource to obtain a resource information list corresponding to the second object resource, and obtain the resource dependency relationship associated with the second object resource based on the resource information list.
[0218] Optionally, the above-mentioned loading module is also used to: configure a target resource tag for the object resource, wherein the target resource tag is used to indicate disabling of resource processing operations triggered after loading the object resource; and disable post-loading instructions associated with the object resource, wherein the post-loading instructions are used to trigger resource processing operations associated with the object resource when the object resource is loaded.
[0219] Optionally, in this embodiment, the embodiments to be implemented by the above-mentioned various unit modules can refer to the above-mentioned various method embodiments, which will not be repeated here.
[0220] According to another aspect of the embodiment of the present application, an electronic device for implementing the above-mentioned resource data processing method is also provided. The electronic device may be Figure 11 The terminal device or server shown in FIG. This embodiment is described by taking the electronic device as a terminal device as an example. Figure 11 As shown, the electronic device includes a memory 1102 and a processor 1104. The memory 1102 stores a computer program, and the processor 1104 is configured to execute the steps in any of the above method embodiments through the computer program.
[0221] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0222] Optionally, in this embodiment, the processor may be configured to execute the following steps through a computer program:
[0223] S1, obtaining an object resource set corresponding to a target virtual scene, and a resource relationship set matching the object resource set, wherein the object resource set includes multiple object resources, the object resources are used to indicate scene elements in the target virtual scene, and the resource relationship set is used to indicate resource dependency relationships between the multiple object resources;
[0224] S2, determining a plurality of object resource subsets from the object resource set based on resource types corresponding to the plurality of object resources and resource dependencies, wherein resource processing parameters of the object resource subsets meet target conditions, and the resource processing parameters are used to indicate a reference processing time for resource processing on the object resource subsets;
[0225] S3, performing resource processing on multiple object resource subsets respectively through multiple resource processing processes running in parallel, wherein a resource processing process is used to perform resource processing on one object resource subset, and the resource processing is used to convert the object resources in the object resource subset into a data format corresponding to the target platform;
[0226] S4, determining the resource processing results of each of the plurality of object resource subsets as target resource data, wherein the target resource data is used to render and generate a target virtual scene on a target platform.
[0227] Alternatively, those skilled in the art will appreciate that Figure 11The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (MID), a PAD, or other terminal devices. Figure 11 It does not limit the structure of the electronic device. For example, the electronic device may also include Figure 11 More or fewer components (such as network interfaces, etc.) as shown in, or with Figure 11 Different configurations shown.
[0228] Among them, the memory 1102 can be used to store software programs and modules, such as the program instructions / modules corresponding to the resource data processing method and device in the embodiment of the present application. The processor 1104 executes various functional applications and data processing by running the software programs and modules stored in the memory 1102, that is, realizes the above-mentioned resource data processing method. The memory 1102 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 1102 may further include a memory remotely located relative to the processor 1104, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include but are not limited to the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 1102 can be used specifically, but not limited to, to store information such as various elements in the scene screen, processing information of resource data, and so on. As an example, such as Figure 11 As shown, the memory 1102 may include, but is not limited to, the acquisition unit 1002, the first determination unit 1004, the resource processing unit 1006, and the second determination unit 1008 in the resource data processing device. In addition, it may also include, but is not limited to, other module units in the resource data processing device, which will not be repeated in this example.
[0229] Optionally, the transmission device 1106 is configured to receive or send data via a network. Specific examples of the network may include a wired network and a wireless network. In one embodiment, the transmission device 1106 includes a network interface controller (NIC), which can be connected to other network devices and a router via a network cable to communicate with the Internet or a local area network. In one embodiment, the transmission device 1106 is a radio frequency (RF) module, which is configured to communicate with the Internet wirelessly.
[0230] In addition, the electronic device further includes: a display 1108 for displaying a virtual scene in an interface; and a connection bus 1110 for connecting various module components in the electronic device.
[0231] In other embodiments, the terminal device or server may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting multiple nodes through network communication. The nodes may form a peer-to-peer (P2P) network, and any computing device, such as a server, terminal, or other electronic device, may become a node in the blockchain system by joining the peer-to-peer network.
[0232] According to one aspect of the present application, a computer program product is provided, comprising a computer program / instructions containing program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via a communication component and / or installed from a removable medium. When the computer program is executed by a central processing unit, the various functions provided in the embodiments of the present application are performed.
[0233] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0234] According to one aspect of the present application, a computer-readable storage medium is provided, and 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 executes the above-mentioned resource data processing method.
[0235] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0236] S1, obtaining an object resource set corresponding to a target virtual scene, and a resource relationship set matching the object resource set, wherein the object resource set includes multiple object resources, the object resources are used to indicate scene elements in the target virtual scene, and the resource relationship set is used to indicate resource dependency relationships between the multiple object resources;
[0237] S2, determining a plurality of object resource subsets from the object resource set based on resource types corresponding to the plurality of object resources and resource dependencies, wherein resource processing parameters of the object resource subsets meet target conditions, and the resource processing parameters are used to indicate a reference processing time for resource processing on the object resource subsets;
[0238] S3, performing resource processing on multiple object resource subsets respectively through multiple resource processing processes running in parallel, wherein a resource processing process is used to perform resource processing on one object resource subset, and the resource processing is used to convert the object resources in the object resource subset into a data format corresponding to the target platform;
[0239] S4, determining the resource processing results of each of the plurality of object resource subsets as target resource data, wherein the target resource data is used to render and generate a target virtual scene on a target platform.
[0240] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing the hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0241] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above-mentioned computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which can be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the above-mentioned methods in each embodiment of the present application.
[0242] In the above embodiments of the present application, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0243] In the several embodiments provided in this application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are merely illustrative. For example, the division of the above-mentioned units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0244] The units described above as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0245] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0246] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for processing resource data, characterized in that: include: Acquire an object resource set corresponding to a target virtual scene, and a resource relationship set matching the object resource set, wherein the object resource set includes a plurality of object resources, the object resources are used to indicate scene elements in the target virtual scene, and the resource relationship set is used to indicate resource dependency relationships between the plurality of object resources; Determining a plurality of object resource subsets from the object resource set according to resource types corresponding to the plurality of object resources and the resource dependencies, wherein resource processing parameters of the object resource subsets meet target conditions, and the resource processing parameters are used to indicate a reference processing duration for performing resource processing on the object resource subsets; Performing resource processing on each of the plurality of object resource subsets through a plurality of resource processing processes running in parallel, wherein the resource processing process is used to perform resource processing on one of the object resource subsets, and the resource processing is used to convert the object resources in the object resource subset into a data format corresponding to a target platform; The resource processing results of each of the plurality of object resource subsets are determined as target resource data, wherein the target resource data is used to render and generate the target virtual scene on the target platform.
2. The method according to claim 1, characterized in that Performing resource processing on the plurality of object resource subsets respectively by using the plurality of resource processing processes running in parallel includes: Determining, by a current resource processing process, a plurality of resource operation sets from a current object resource subset, wherein the resource operation sets include a plurality of the object resources obtained from the current object resource subset, the object resource subset includes the current object resource subset, and the current resource processing process is the resource processing process for performing resource processing on the current object resource subset; The plurality of resource operation sets are sequentially determined as current operation sets, and the following steps are repeated until the plurality of resource operation sets are traversed: the plurality of object resources in the current operation set are batch loaded into a memory area matching the current resource processing process; the plurality of object resources are batch cached in the memory area to obtain reference resource data; The reference resource data corresponding to the plurality of resource operation sets are serialized to obtain the resource processing result corresponding to the current object resource subset.
3. The method according to claim 2, characterized in that Determining the plurality of resource operation sets in sequence as a current operation set includes: Obtaining a sorting result of the plurality of resource operation sets according to dependency parameters corresponding to each of the plurality of resource operation sets, wherein the dependency parameters are used to indicate the number of reference object resources associated with the resource operation sets, the reference object resources being object resources having the resource dependency relationship with the object resources in the resource operation sets, and a first dependency parameter corresponding to the resource operation set ranked earlier in the sorting result is lower than a second dependency parameter corresponding to the resource operation set ranked later; According to the sorting result, the plurality of resource operation sets are sequentially determined as the current operation set, wherein the resource operation set that comes first in the sorting result is determined.
4. The method according to claim 2, characterized in that Determining, through the current resource processing process, a plurality of resource operation sets from the current object resource subset, including at least one of the following: Determining a plurality of resource operation sets from the current object resource subset according to the resource type of the object resource; Determining a plurality of resource operation sets from the current object resource subset according to the number of reference object resources associated with the object resource, wherein the reference object resources are object resources having the resource dependency relationship with the object resource; According to the resource data volume of the object resource, a plurality of resource operation sets are determined from the current object resource subset, wherein the resource data volume corresponding to the resource operation sets is greater than the target data volume.
5. The method according to claim 2, characterized in that The serializing process of the reference resource data corresponding to the plurality of resource operation sets to obtain the resource processing result corresponding to the current object resource subset includes: Calling multiple resource processing threads through the current resource processing process; The plurality of reference resource data are serialized and processed respectively according to the plurality of resource processing threads running in parallel, so as to obtain the resource processing result corresponding to the current object resource subset.
6. The method according to claim 2, characterized in that After determining multiple resource operation sets from the current object resource subset through the current resource processing process, the method includes: When the number of processes of the current processing sub-process currently in operation is less than the target number, obtaining the current operation set from the plurality of resource operation sets, wherein the current resource processing process is used to pull up the current processing sub-process to perform resource processing on the resource operation set; Launch a target processing sub-process through the current resource processing process; Batch loading the plurality of object resources in the current operation set into a memory area matching the current resource processing process through the target processing sub-process; Batch caching is performed on the plurality of object resources in the memory area to obtain reference resource data.
7. The method according to claim 6, characterized in that Before launching the target processing sub-process through the current resource processing process, the method further includes: Obtaining the number of processing cores of the current terminal, wherein the processing cores are used to run the resource processing subprocess; The target number is determined according to the number of cores and the number of subsets of the object resource subset, wherein the target number is the number of resource processing sub-processes that each resource processing process is allowed to start.
8. The method according to claim 6, characterized in that Before launching the target processing sub-process through the current resource processing process, the method further includes: Obtaining a process priority parameter, wherein the process priority parameter is used to indicate that the process priority of the resource processing sub-process started by the resource processing process is the first priority, and the resource processing sub-process includes the target processing sub-process and the current processing sub-process; The process priority parameter is updated, wherein the updated process priority parameter is used to indicate that the process priority of the resource processing sub-process started by the resource processing process is the second priority, and the second priority is higher than the first priority.
9. The method according to claim 6, characterized in that The step of batch loading the plurality of object resources in the current operation set into a memory area matching the current resource processing process through the target processing sub-process includes: Batch loading the plurality of object resources in the current operation set into a memory area matching the current resource processing process according to a target order, wherein the target order is a resource loading order determined according to the resource dependency relationship; When the current object resource subset does not include the reference object resource on which the current object resource depends, the reference object resource is not loaded in the memory area that matches the current resource processing process, wherein the multiple object resources in the current operation set include the current object resource.
10. The method according to claim 1, characterized in that Resource processing is performed on the plurality of object resource subsets respectively by using a plurality of resource processing processes running in parallel, including: disabling the plurality of resource processing processes from creating data storage space under the target path; A corresponding data storage space is created for each of the plurality of resource processing processes, wherein the data storage space is used to store the intermediate resource data generated by the resource processing process during the resource processing and the resource processing result.
11. The method according to claim 1, wherein Before performing resource processing on the plurality of object resource subsets respectively through the plurality of resource processing processes running in parallel, the method further includes: Creating a target management process, wherein the target management process is used to read a process configuration file, wherein the process configuration file includes process configuration information corresponding to each of the plurality of resource processing processes; Launching a plurality of resource processing processes according to the process configuration file; The target management process maintains the respective running states of the plurality of resource processing processes.
12. The method according to claim 1, characterized in that Determining a plurality of object resource subsets from the object resource set according to the resource types corresponding to the plurality of object resources and the resource dependency relationship includes: Acquire a resource processing parameter, wherein the resource processing parameter is used to indicate the number of subsets of the object resource subset; A plurality of object resource subsets indicated by the resource processing parameter are determined from the object resource set according to the resource types corresponding to the plurality of object resources and the resource dependency relationship.
13. The method according to claim 1, wherein Acquiring an object resource set corresponding to a target virtual scene, and a resource relationship set matching the object resource set includes at least one of the following: Obtaining resource processing configuration information, and determining the resource dependency relationships of the plurality of object resources according to the resource paths indicated by the resource processing configuration information, wherein the resource processing configuration information includes the resource paths of the object resources; The object resource is loaded, and the resource dependency of the object resource is obtained according to the resource loading result.
14. The method according to claim 13, characterized in that The loading of the object resource and obtaining the resource dependency of the object resource according to the resource loading result includes: In a case where the object resource collection includes a first object resource of a first reference type, executing a resource constructor for loading the first object resource, and obtaining the resource dependency relationship associated with the first object resource indicated during the execution of the constructor; When the object resource collection includes a second object resource of a second reference type, the second object resource is loaded to obtain a resource information list corresponding to the second object resource, and the resource dependency associated with the second object resource is obtained according to the resource information list.
15. The method according to claim 13, characterized in that Before loading the object resource, at least one of the following is also included: Configuring a target resource tag for the object resource, wherein the target resource tag is used to indicate disabling a resource processing operation triggered after loading the object resource; A post-load instruction associated with the object resource is disabled, wherein the post-load instruction is used to trigger a resource processing operation associated with the object resource when the object resource is loaded.
16. A resource data processing device, characterized in that: include: an acquisition unit, configured to acquire an object resource set corresponding to a target virtual scene, and a resource relationship set matching the object resource set, wherein the object resource set includes a plurality of object resources, the object resources being used to indicate scene elements in the target virtual scene, and the resource relationship set being used to indicate resource dependency relationships between the plurality of object resources; a first determining unit, configured to determine, from the object resource set, a plurality of object resource subsets based on resource types corresponding to the plurality of object resources and the resource dependency, wherein resource processing parameters of the object resource subsets satisfy a target condition, and the resource processing parameters are used to indicate a reference processing duration for performing resource processing on the object resource subsets; a resource processing unit, configured to perform resource processing on each of the plurality of object resource subsets through a plurality of resource processing processes running in parallel, wherein the resource processing process is configured to perform resource processing on one of the object resource subsets, and the resource processing is configured to convert the object resources in the object resource subset into a data format corresponding to a target platform; The second determining unit is configured to determine resource processing results of each of the plurality of object resource subsets as target resource data, wherein the target resource data is used to render and generate the target virtual scene on the target platform.
17. A computer-readable storage medium, characterized in that The computer-readable storage medium includes a stored program, wherein the method according to any one of claims 1 to 15 is executed when the program is executed.
18. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 15 are implemented.
19. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 15 through the computer program.