Method, device and medium for quickly splitting resources without reference relationship

By adjusting the resource identification bits and dynamic identification in Unity 3D games, determining the number of resource non-reference relationships, and using multi-threaded packaging, the problem of slow packaging speed and excessive package size in Unity 3D games is solved, and the game operation efficiency and packaging are improved speed.

CN112732268BActive Publication Date: 2025-02-11ZHUHAI KINGSOFT ONLINE GAME TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110033986.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-11
Publication Date
2025-02-11
Estimated Expiration
2041-01-11

AI Technical Summary

Technical Problem

Unity 3D games are slow to package, which makes it take a long time to package projects. Due to the strong reference relationship between resources, the package body increases after packaging, and the memory usage during runtime is high, which affects the game efficiency.

Method used

By obtaining the Unity 3D project resource list, setting the identification bits and creating a dynamic identifier, generating a list of recursive reference resources, traversing the list to adjust the identification bits according to the reference relationship until all resources are marked, and then determining the number of resource-free reference relationships based on the number of identification bits. Use multithreading for packaging.

Benefits of technology

Reduces redundancy of bundle dependency chains, reduces memory usage and loading time, improves game running efficiency, and speeds up packaging speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112732268B_ABST
    Figure CN112732268B_ABST
Patent Text Reader

Abstract

The present invention relates to a technical solution of a method, device and medium for quickly splitting resources without reference relationship, including: obtaining a project resource list based on Unity 3D, setting an identification bit in each resource, and creating a dynamic identification at the same time; each time a resource is taken out from the project, generating a recursive reference resource list of the corresponding resource, and writing the corresponding resource flag bit into the recursive reference resource list; traversing the recursive reference resource list, modifying the resource identification bit according to the reference relationship of the resource, and dynamically adjusting the dynamic identification; repeating until all resources in the resource list are marked; determining the number of resources without reference relationship according to the number of identification bits of all resources, and packaging the project resources using corresponding multiple threads according to the number of resources without reference relationship. The beneficial effects of the present invention are: in the case of increasing bundle redundancy, the speed of Bundle packaging is accelerated, and the project is convenient for rapid package verification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computers, and in particular to a method, device and medium for quickly splitting resources without reference relationships. Background Art

[0002] In Unity 3D games, packaging is very slow. If you want to verify the effect of modifying bugs, if the project is large, packaging will take a long time, usually 2 hours is very common. Speeding up the packaging speed is a key issue. Because when Unity 3D is packaging, only one process can be used to build a bundle for a project. If all resources can be quickly split into several parts that have no reference relationship with each other, and multiple processes can build the bundle, the packaging speed can be greatly improved. However, there is a strong reference relationship between resources. If it is not handled properly, it will cause a lot of redundancy, resulting in an increase in the package size and high memory usage during runtime. Summary of the invention

[0003] The purpose of the present invention is to solve at least one of the technical problems existing in the prior art, and to provide a method, device and medium for reducing the redundancy of bundle dependency chains, thereby reducing the redundancy of bundle dependency chains, reducing memory usage and loading time, and improving game operation efficiency.

[0004] The technical solution of the present invention includes a method for quickly splitting resources without reference relationships, characterized in that the method includes: S100, obtaining a project resource list based on Unity 3D, setting an identification bit in each resource, and creating a dynamic identification at the same time; S200, generating a recursive reference resource list of the corresponding resource each time a resource is taken out from the project, and writing the corresponding resource flag bit into the recursive reference resource list; S300, traversing the recursive reference resource list, modifying the resource identification bit according to the reference relationship of the resource, and dynamically adjusting the dynamic identification; S400, repeating steps S200 to S300 until the resource in the resource list is marked; S500, determining the number of resources with no reference relationship to each other according to the number of identification bits of all resources, and packaging the project resources using corresponding multiple threads according to the number of resources with no reference relationship to each other.

[0005] According to the method for quickly splitting resources without reference relationships, S100 includes: traversing all resources in the project, obtaining a list of all resources, setting an identification bit for each resource, the identification bit defaults to 0, and setting a dynamic identification bit, the dynamic identification bit defaults to 1.

[0006] According to the method for quickly splitting resources without reference relationships, S300 includes: S310, taking out resources, searching for a list of all recursive reference resources of the resources, and adding the resource's own information to the list of recursive reference resources; S320, for each taken out resource in the recursive reference resource list processed by S310, judging whether the identification bit is 0, if the identification bit of the resource is 0, directly setting the resource identification bit to the value of the current dynamic identification; if the identification bit of the resource is not 0, searching for the resource corresponding to the resource list according to the identification bit value of the resource, and modifying the identification bit of the searched resource to the value of the dynamic identification, and then self-incrementing the dynamic identification.

[0007] According to the method for quickly splitting resources without reference relationships, the method from the project resource list is: sequentially reading according to the project resource list.

[0008] According to the method for quickly splitting resources with no reference relationships, S500 includes: obtaining the flag bits of all resources obtained through S400, determining the number of mutual no-reference relationships based on the value of the resource's flag bit and the value of the dynamic identifier, and using a corresponding number of threads to package and process the corresponding resources.

[0009] The technical solution of the present invention also includes a device for quickly splitting resources without reference relationships, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and is characterized in that the processor implements any of the method steps described when executing the computer program.

[0010] The technical solution of the present invention also includes a computer-readable storage medium, which stores a computer program, and is characterized in that when the computer program is executed by a processor, any of the method steps described above is implemented.

[0011] The beneficial effects of the present invention are: while increasing bundle redundancy, the speed of Bundle packaging is accelerated, and the project is facilitated to quickly produce a package to verify the effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The present invention is further described below in conjunction with the accompanying drawings and embodiments;

[0013] Figure 1 Shown is an overall flow chart according to an embodiment of the present invention;

[0014] Figure 2 It is a schematic diagram of the process of splitting resources without reference relationship according to an embodiment of the present invention;

[0015] Figure 3 Shown is a diagram of an apparatus according to an embodiment of the present invention. DETAILED DESCRIPTION

[0016] This section will describe in detail the specific embodiments of the present invention. The preferred embodiments of the present invention are shown in the accompanying drawings. The purpose of the accompanying drawings is to supplement the description of the text part of the specification with graphics, so that people can intuitively and vividly understand each technical feature and the overall technical solution of the present invention, but it cannot be understood as a limitation on the scope of protection of the present invention.

[0017] In the description of the present invention, “several” means one or more, “more” means more than two, “greater than”, “less than”, “exceed”, etc. are understood as not including the number itself, and “above”, “below”, “within”, etc. are understood as including the number itself.

[0018] In the description of the present invention, the consecutive numbering of the method steps is for the convenience of review and understanding. Combined with the overall technical scheme of the present invention and the logical relationship between the various steps, adjusting the implementation order between the steps will not affect the technical effect achieved by the technical scheme of the present invention.

[0019] In the description of the present invention, unless otherwise clearly defined, words such as "setting" should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meaning of the above words in the present invention in combination with the specific content of the technical solution.

[0020] Figure 1 The figure shows an overall flow chart according to an embodiment of the present invention, which includes: S100, obtaining a project resource list based on Unity3D, setting an identification bit in each resource, and creating a dynamic identification at the same time; S200, generating a recursive reference resource list of the corresponding resource each time a resource is taken out from the project, and writing the corresponding resource flag bit into the recursive reference resource list; S300, traversing the recursive reference resource list, modifying the resource identification bit according to the reference relationship of the resource, and dynamically adjusting the dynamic identification; S400, repeating steps S200 to S300 until all resources in the resource list are marked; S500, determining the number of resources with no reference relationship to each other according to the number of identification bits of all resources, and packaging the project resources using corresponding multiple threads according to the number of resources with no reference relationship to each other.

[0021] Figure 2 The figure is a schematic diagram of a process of splitting resources without reference relationships according to an embodiment of the present invention, including:

[0022] (1) First, traverse all resources in the project and obtain a list of all resources. Set an identification bit AssetFlag for each resource, and mark it as 0 by default. Then set a dynamic flag BundleFlag (default is 1);

[0023] (2) Traverse the list one by one and take out a resource Itor_Asset_A in the order of the list;

[0024] (3) After taking out a resource, called Itor_Asset_A, first search for all recursive reference resource lists of Itor_Aaset_A, Asset_A_DependecnList, and add Itor_Asset_A to the recursive reference resource list of Itor_Asset_A, Asset_A_DependecnList, which contains all recursive reference resources of Asset_A including itself;

[0025] (4) Traverse Asset_A_DependecnListt again, and for each resource Itor_Asset_DependecnList_x, first determine whether the identification bit AssetFlag of Itor_Asset_DependecnList_x is 0. If it is 0, it means that it is not referenced by other resources for the time being, then directly set the identification bit of the resource to the current BundleFlag. If the identification bit AssetFlag is not 0, the resource has been referenced by other resources, so these resources need to be divided as well. Assuming that the identification bit AssetFlag of Itor_Asset_DependecnList_x is N, then it is necessary to find all the resource lists NAssetlist with the identification bit N, and set the identification bits of all resources in NAssetlist to BundleFlag, and then increment BundleFlag once (BundleFlag = BundleFlag + 1);

[0026] (5) Sequentially take out the second resource and repeat steps (3) to (4) above until all resources are marked;

[0027] (6) Get the flag bits of all resources. There are as many types as there are, which can be divided into as many parts that have no reference relationship with each other, and then packaged in several processes. For example, if there are only three types, 0, 2, and 55, they can be divided into three parts and packaged in three processes.

[0028] Figure 3The device diagram according to an embodiment of the present invention is shown. The device includes a memory 100 and a processor 200, wherein the processor 200 stores a computer program, and the computer program is used to execute: obtain a project resource list based on Unity 3D, set an identification bit in each resource, and create a dynamic identification at the same time; each time a resource is taken out from the project, generate a recursive reference resource list of the corresponding resource, and write the corresponding resource flag bit into the recursive reference resource list; traverse the recursive reference resource list, modify the resource identification bit according to the reference relationship of the resource, and dynamically adjust the dynamic identification; repeat until all resources in the resource list are marked; determine the number of resources with no reference relationship with each other according to the number of identification bits of all resources, and use corresponding multiple threads to package the project resources according to the number of resources with no reference relationship with each other. Among them, the memory 100 is used to store data.

[0029] The embodiments of the present invention are described in detail above in conjunction with the accompanying drawings, but the present invention is not limited to the above embodiments, and various changes can be made within the knowledge scope of ordinary technicians in the technical field without departing from the purpose of the present invention.

Claims

1. A method for quickly splitting resources without reference relationships, characterized in that: The method includes: S100, obtaining a list of engineering resources based on Unity 3D, setting an identification bit in each resource, and creating a dynamic identification; S200, each time a resource is taken out from the project, a recursive reference resource list of the corresponding resource is generated, and the corresponding resource flag is written into the recursive reference resource list; S300, traversing the recursive reference resource list, modifying the resource identification bit according to the reference relationship of the resource, and dynamically adjusting the dynamic identification; S400, repeating steps S200 to S300 until all resources in the resource list are marked; S500, determining the number of resources that have no reference relationship to each other according to the number of identification bits of all resources, and packaging the project resources using corresponding multiple threads according to the number of resources that have no reference relationship to each other; The S300 includes: S310, taking out the resource, searching for all recursive reference resource lists of the resource, and adding the resource information itself to the recursive reference resource list; S320, recursively reference the resource list processed by S310, and for each resource taken out, determine whether the identification bit is 0. If the identification bit of the resource is 0, directly set the resource identification bit to the value of the current dynamic identification; if the identification bit of the resource is not 0, search for the resource corresponding to the resource list according to the identification bit value of the resource, and modify the identification bit of the searched resource to the value of the dynamic identification, and then the dynamic identification is self-incremented.

2. The method for quickly splitting resources without reference relationships according to claim 1, characterized in that: The S100 includes: Traverse all resources in the project and obtain a list of all resources. Set an identification bit for each resource, which defaults to 0. At the same time, set a dynamic identification bit, which defaults to 1.

3. The method for quickly splitting resources without reference relationships according to claim 1, characterized in that: The method from the project resource list is to read sequentially according to the project resource list.

4. The method for quickly splitting resources without reference relationships according to claim 1, characterized in that: The S500 includes: obtaining the flag bits of all resources obtained through the S400, determining the number of resources with no reference relationship to each other according to the value of the resource flag bit and the value of the dynamic flag, and using the corresponding number of threads to package the corresponding resources.

5. A device for quickly splitting resources without reference relationships, the device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method steps described in any one of claims 1 to 4 are implemented.

6. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method steps according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Resource information determination method and device, electronic equipment and storage medium

    CN110287723A

  • Project resource processing method and device

    CN111062638A