AB packaging strategy process

       When we play games, we will update some things more or less. This is hot update, which updates the resources we need to increase or change. Don't talk nonsense, just talk about the content.

        Updated process:

1: Set the package resource name and suffix

2: Packaging resources, will distinguish between different platforms for packaging

3: Empty the resource name and suffix, the purpose is to prevent the next time the package is mixed, and the package is repeated

4: Generate a version file, which contains information about all resources, such as dependencies, MD5 codes, etc.

   Notice:

1: The packaging process above can also be replaced with 3124, there is no big difference between clearing and using

2: The package names are all AB package names with paths, the purpose is to prevent duplication, otherwise two objects with the same package name will be entered into one package, which is inconvenient for subsequent use

Packing rules:

By type: by folder, such as models, pictures, animations

According to function: There may be scene resources, character resources, and enemy resources in the same model folder, which are packaged according to different functions

According to the module: For example, if our player model is level 1-10, or if different models are required at different stages, we will package them according to the module. Public resources are packaged separately;

Each special effect and the material maps it depends on reach a package

Code can be packaged by function (no more than 3M)

Use it at the same time as much as possible into a package

Combine the small pictures into a large picture set and pack them into a package (ICON)

The underlying principle of heat

hot change process  

1: When we first entered the game

         It will judge whether there is a P directory, generally there is no, it will create it, then read the version file of our S directory, copy all the resource information in the file to the P directory, and finally write the version file into it

2: When we enter the game many times, we start to open Ctrip to check whether it is updated

       Serialization reads the version file of the P directory, and caches all ab package information into the dictionary. Then apply to the resource server to download the latest version file, analyze the version file downloaded from the server after the download is complete, and compare the version number on the P directory version file with the version number just downloaded.

         If the version numbers are the same, it means no update is required. The version number is different and needs to be updated.

           When it is different, start to compare the MD5 code of the cache pool and the file on the server in a loop, and put the different and non-identical ones into the update collection, indicating that they need to be updated and downloaded. Outside the loop, traverse the collection of resources that need to be updated , download from the server, store in the P directory, and finally write the latest version file.

        

The actual data list of each project, the number of fixed points, the number of faces, and the occupied memory (code)

Unity gets all the faces and vertices of the scene- Sword from the Sky- 博客园

Image compression format, compression ratio, different platforms use different compression formats, compression ratio

Several common picture compression methods in Unity: DXT, ETC, ASTC - Strawberry ♭ Pudding - 博客园

Differences in LZ4 LZMA compression

It can be seen that the compressed size of lzma is smaller than that of lz4. So loading lzma will be fast and lz4 will be slow

The compression ratio here is about 17% for lzma, and about 35% for lz4, so the compression ratio of lz4 will be higher

Compression time lzma will be much higher than lz4.

So is the decompression time. So it can be known that the decompression time of lzma is slower than that of lz4. The decompression time of lz4 is faster.

Therefore, the summary is that the decompression speed of lzma is faster, and the decompression time of lz4 is faster. But in terms of compression ratio and speed, lz4 will be better 

  1. LZMA: Minimal compression, slow decompression, use one resource to decompress all resources under the package.
  2. LZ4: slightly larger compression, fast decompression, what to use to decompress, low memory usage, it is recommended to use.

Reference: https://blog.csdn.net/llsansun/article/details/86215830

        

Guess you like

Origin blog.csdn.net/weixin_60291221/article/details/128328553