Method, device and medium for reducing bundle dependency chain redundancy

By generating relationship dependency tables and dependency files in Unity3D games, the problem of redundant dependencies in AssetBundle system is solved, memory usage and loading time are reduced, and game running efficiency is improved.

CN112732267BActive Publication Date: 2025-01-07ZHUHAI KINGSOFT ONLINE GAME TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In Unity3D games, the AssetBundle system has caused memory waste and increased loading time due to redundant bundle dependencies. The existing technology is difficult to effectively reduce redundancy, which affects the game's running efficiency.

Method used

By generating relationship dependency tables on the server, traversing the resource information of each bundle package, generating resource relationship dependencies and depended bundle package lists, writing dependencies to dependencies, and updating the client synchronously when the bundle package is packaged, reducing redundancy rely.

Benefits of technology

It significantly reduces the redundancy of the bundle dependency chain, reduces memory usage and loading time, and improves game operation efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112732267B_ABST
    Figure CN112732267B_ABST
Patent Text Reader

Abstract

The present invention relates to a technical solution of a method, device and medium for reducing redundancy of bundle dependency chain, including: system dependency generation, when bundling resources through a server, traversing resource information in each bundle package, generating a relationship dependency table of the corresponding bundle package; dependency chain traversal, according to the relationship dependency table, traversing resources of multiple bundle packages, obtaining resource dependencies of each bundle package and the bundle package where the resources are located, generating a relationship dependency list corresponding to the resources and the dependent bundle package list, and writing a dependency file; update synchronization, when a new bundle package is packaged, the dependency file is synchronously sent to the client. The beneficial effects of the present invention are: reducing memory usage, loading time, improving game running efficiency; and reducing the redundancy of the bundle dependency chain.
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 reducing bundle dependency chain redundancy. Background Art

[0002] In Unity3D games, the general approach to resource loading in the AssetBundle system is to first find out which bundle the Asset resource (A.prefab) is in based on the Asset2Bundle table recorded during packaging, and then find out which bundle IDs the bundle ID depends on based on the dependency relationship between bundles recorded in the AssetBundleManifest (bundle dependency table) automatically generated by the system during packaging, and recursively search the dependency bundle list of each dependent bundle, and then load all bundles into memory before loading the Asset resource. Only then can the Asset resource be loaded correctly. However, the AssetBundleManifest usually contains a large amount of bundle redundancy, which causes memory waste and loads a lot of unnecessary bundles.

[0003] The reason for the redundancy is that the AssetBundleManifest provided by the system records all dependent bundles of all files in a single bundle, but we only need all the bundles that a single file in a single bundle depends on. Removing the dependencies of other files can reduce the redundancy of the bundle dependency chain. The existing technical solution reduces the redundancy of resources in the bundle by reducing the same resources being repeatedly packaged into different bundles. Summary of the invention

[0004] 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.

[0005] The technical solution of the present invention includes a method for reducing bundle dependency chain redundancy, characterized in that the method includes: relationship dependency generation, when bundling resources through a server, traversing resource information in each bundle package to generate a relationship dependency table corresponding to the bundle package; dependency chain traversal, according to the relationship dependency table, traversing resources for multiple bundle packages, obtaining resource dependencies of each bundle package and the bundle package where the resources are located, generating a relationship dependency corresponding to the resource and a list of dependent bundle packages, and writing a dependency file; update synchronization, when packaging a new bundle package, synchronously sending the dependency file to the client.

[0006] According to the method for reducing redundancy of bundle dependency chains, the relationship dependency generation includes: storing the dependency relationship between the bundle package and the resource in a json table through the allocation relationship of the Asset2Bundle table.

[0007] According to the method for reducing bundle dependency chain redundancy, the dependency chain traversal includes: traversing all resources in the dependency chain of each bundle package, finding all dependent resources of each resource, and finding all bundle IDs of all dependent resources of the resource through the Asset2Bundle table, and then determining the relationship dependency table of the bundle package, recording the Asset-level dependency relationship and the Asset-level dependent bundle list, and writing them into a local file.

[0008] According to the method for reducing bundle dependency chain redundancy, the dependency file is a localized unreadable binary file.

[0009] According to the method for reducing bundle dependency chain redundancy, the update synchronization includes: when a new bundle is packaged, when a change in the relationship dependency table of the bundle is detected, the relationship dependency generation and dependency chain traversal processing are re-executed, and the dependency file is regenerated.

[0010] According to the method for reducing bundle dependency chain redundancy, the dependency file is used to determine whether the bundle package dependency relationship has changed.

[0011] The technical solution of the present invention also includes a device for reducing bundle dependency chain redundancy, 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.

[0012] 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.

[0013] The beneficial effects of the present invention are as follows: the resource-level Bundle dependency table has only a few or at most dozens of bundles, while the bundle-level dependency table may reach dozens to hundreds of bundles, which greatly reduces bundle redundancy, reduces memory usage, loading time, and improves game running efficiency; at the same time, it reduces the redundancy of the bundle dependency chain. BRIEF DESCRIPTION OF THE DRAWINGS

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

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

[0016] Figure 2 It is a schematic diagram of a process of reducing a bundle dependency chain according to an embodiment of the present invention;

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

[0018] 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.

[0019] 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.

[0020] 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.

[0021] 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.

[0022] Terminology explanation:

[0023] Figure 1The figure shows an overall flow chart according to an embodiment of the present invention, which includes: relationship dependency generation, when bundling resources through the server, traversing the resource information in each bundle package and generating a relationship dependency table of the corresponding bundle package; dependency chain traversal, according to the relationship dependency table, traversing resources for multiple bundle packages, obtaining the resource dependencies of each bundle package and the bundle package where the resources are located, generating a relationship dependency list corresponding to the resources and the dependent bundle package list, and writing the dependency file; update synchronization, when packaging a new bundle package, synchronously sending the dependency file to the client.

[0024] Figure 2 The figure is a schematic diagram of a process of reducing a bundle dependency chain according to an embodiment of the present invention, including:

[0025] S100, when bundling resources, first allocate which resources go into which bundles, that is, the Asset2Bundle table (such as Asset_A.prefab in Bundle_1.Bundle, Asset_A.mat in Bundle_1.Bundle, Asset_A.png in Bundle_2.Bundle, Asset_B.prefab in Bundle_1.Bundle, Asset_B.png in Bundle_3.Bundle, Asset_B.mat in Bundle_4.Bundle) and write the Asset2Bundle allocation relationship table into the json table to record the relationship between resources and bundles.

[0026] S200, analyze the dependency relationship, traverse all resources, find all dependent resources of each resource, and find the bundle where all dependent resources of the resource are located through the Asset2Bundle table, that is, find all bundle IDs that the resource depends on. The bundle dependency table found in this way, without any redundancy, records the dependency relationship of the Asset level and the list of dependent bundles at the Asset level and writes it into a local binary file (reducing the file size, and at the same time being unreadable to players to enhance confidentiality)

[0027] For example, Asset_A.prefab depends on Asset_A.mat and Asset_a.png. According to Asset2Bundle, Asset_A.prefab depends on Bundle_1.Bundle and Bundle_2.Bundle. Then the resource-level Bundle dependency table has only two bundles, while the bundle-level dependency table may have dozens to hundreds of bundles. In this case, there are four bundle-level dependency tables, resulting in redundancy in the dependency list.

[0028] Reasons for bundle-level dependency redundancy:

[0029] Asset_A.prefab depends on the resource Asset_A.matAsset_A.png

[0030] Asset_B.prefab depends on the resource Asset_B.matAsset_B.png

[0031] Asset_A.prefab is in Bundle_1.Bundle, and the system automatically generates the Bundle_1.Bundle dependency table in the AssetBundleManifest (bundle dependency table). Principle: To find out the dependent bundles of Bundle_1.Bundle, the solution is to find the bundleID where all the resources of Bundle_1.Bundle and its dependent resources are located, and at the same time, recursively find all the dependent bundleldIDs of all the found bundleIDs, which is all the dependent bundles of the bundleID. Because Asset_A.prefabAsset_B.prefab are all in Bundle_1.Bundle, many resource dependencies that you don't want to be related are in the bundle dependency table, resulting in a lot of redundancy.

[0032] S300, every time an update package is installed, if the list of asset-level dependent bundles changes, the binary file needs to be updated and sent to the client.

[0033] Figure 3The diagram shows a device according to an embodiment of the present invention. 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: system dependency generation, when bundling resources through the server, traverse the resource information in each bundle package, and generate a relationship dependency table corresponding to the bundle package; dependency chain traversal, according to the relationship dependency table, traverse resources for multiple bundle packages, obtain the resource dependency of each bundle package and the bundle package where the resource is located, generate the relationship dependency corresponding to the resource and the list of dependent bundle packages, and write the dependency file; update synchronization, when a new bundle package is packaged, the dependency file is synchronously sent to the client. Among them, the memory 100 is used to store data.

[0034] 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 reducing bundle dependency chain redundancy, characterized in that: The method includes: Dependency generation: When bundling resources through the server, first assign which resources go into which bundles, traverse the resource information in each bundle, and generate the Asset2Bundle table of the corresponding bundle. The Asset2Bundle table records the correspondence between the resources and the bundles they belong to. Dependency chain traversal: According to the Asset2Bundle table, perform resource traversal on multiple bundle packages, obtain the dependent resources of each bundle package and the bundle package where the dependent resources are located, generate the dependency relationship corresponding to the resource and the list of dependent bundle packages, and write them to the local file. The dependency chain traversal includes: traversing all resources in the dependency chain of each bundle package, finding all dependent resources of each resource, and finding the bundle package where all dependent resources of the resource are located through the Asset2Bundle table for each resource, that is, finding all bundle IDs that the resource depends on, and based on all bundle IDs that the resource depends on, generate the Asset-level dependency relationship Asset-level dependency bundle list between the resource and all bundle IDs that it depends on, and then determine the relationship dependency table of the bundle package, record the Asset-level dependency relationship Asset-level dependency bundle list of all resources, and write them to the local file; Update synchronization: When a new bundle is packaged, the local files are synchronously sent to the client. The update synchronization includes: when a new bundle is packaged, if a change in the relationship dependency table of the bundle is detected, the dependency generation and dependency chain traversal processing are re-executed, and the local files are regenerated.

2. The method for reducing bundle dependency chain redundancy according to claim 1, characterized in that: The dependency relationship generation includes: storing the dependency relationship between the bundle package and the resource in a json table through the allocation relationship of the Asset2Bundle table.

3. The method for reducing bundle dependency chain redundancy according to claim 1, characterized in that: The local file is a localized unreadable binary file.

4. A device for reducing bundle dependency chain redundancy, 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 3 are implemented.

5. 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 3 are implemented.

Citation Information

Patent Citations

  • Resource loading method and device, server and storage medium

    CN110865888A