Inclusion effect
For small games, package size affects many aspects.
Loading speed
The size of resources affects the loading speed of the first screen. Optimization of package also optimizes the loading speed of the first screen. However, package optimization does not necessarily optimize the loading speed of the first screen. Secondly, it also affects the loading speed of resources during the game. If the game is uniformly loaded, the waiting time of the progress bar will also be affected.
Expenses and maintenance costs
Currently, the subcontracting size of small games has the following limitations:
- All subcontracting sizes of the entire mini-game shall not exceed 16 M
- The size of a single subcontract/main package shall not exceed 4m)
so
-
For simple small games, the size limit of the first package is firstly affected. When the package size exceeds 4M, small games cannot be uploaded (the upload can only be completed by relying on CDN for remote loading of resource package, but this method generates extra resource flow cost that can be avoided. When the user group is large, it is not a small cost)
-
For complex games, there is no way to avoid using A CDN, and the size of the package still affects the cost.
-
Secondly, by uploading THE CDN, there is a process of version management, and each packet is more complicated.
To optimize the direction
Resource optimization
Toolkits will be available for download at the end of the article. Free your hands
-
2 d / 3 d
-
Texture compression, using pngQuant, Pngyu,tinyPng tools to complete. The plugin store has pngQuant ready to use.
-
Audio resource compression. This can be optimized using third-party tools such as FFMPEG.
-
Font. Font files are generally relatively large, a few M to when M have. Font files contain thousands of characters, but OFTEN I only use a small part of them. At this time, I can use the font extraction tool to extract, and get the font file containing only the words used. This optimization is also fairly obvious. The fontmin_tool tool is recommended.
-
Split PreFab to improve preFab reuse rate. For preFab with a lot of information, you can write parsers that save the runtime simplified structure as json files with simpler J-structures and wait for the player user runtime to parse the JSON to generate the prefab. This is time for space optimization.
-
Check resources in resource. Resources that do not need to be loaded during dynamic loading must be removed from the package. Otherwise, unnecessary resources will be added to the package and the package size will become larger.
-
-
3D
- 3d model faces reduced. Professional students can choose 3D Max for operation, also can choose the simple Skinny3D surface reduction tool (operation is quite simple, the forum provides the download link), for rapid surface reduction operation, 3.0 provides direct model compression function.
7. Reduce duplicate maps and materials. For models that use duplicate maps, you can create shared materials and assign shared material maps to greatly reduce duplicate resources. 8. Reduce repetitive action information. For models with the same bone structure and using the same animation, the animation file can be exported as a separate file and animation can be added to the model in Creator editor to reduce the repetition of animation information. For overly complex animations (too many K frames lead to too large model size), animations should be simplified as appropriate.
Cut out the engine
Remove unused engine modules and set them directly in the 2D /3.x editor interface. The 2d opening path is: Settings -> Project Settings
The separation of the engine
In wechat small game platform, the release platform supports engine separation. After checking the “allow engine separation” button in the release interface, if users have run small games released by cocos engine of the same version and the cache is generated, the size of the first package will be automatically eliminated.
Code compression
Yans has shared tools on the forum, has posted the end kit: code compression tool
Forum.cocos.org/t/topic/900…
ZIP packet processing
You can put remote resources into a ZIP package, download the ZIP when loading resources, decompress the ZIP to the local, and then directly read the local resources. This compression rate is also considerable. I have not carried out the practical operation of this implementation scheme, and I will introduce the practical results in detail in the following specific articles. If there is a big man practice, very look forward to sharing. Link sharing:
Blog.csdn.net/erweimac/ar…
forum.cocos.org/t/zip/77500
Unzip zip files with jszip
Forum.cocos.org/t/jszip-zip…
summary
The following priorities can be followed for inclusion optimization
- Try to compress the package within 4M by means of resource optimization, clipping engine, code compression and separation engine
- If it cannot be compressed within 4M, subcontracting is used
- The sum of subcontracting still exceeds 16M (wechat platform, values of other platforms need to be queried), and the problem cannot be solved. If remote resources are used for loading, zip mode can be considered for unified loading at the start of the game.
For resources on the first screen, do not perform operations such as combining images with other resources to avoid downloading large images. Secondly, make resources on the first screen as simple as possible. Optimize user experience by loading remote resources or sub-packages on the first screen with a progress bar.
If there are omissions in the article, we welcome you to correct and supplement.
More and more
Declare a custom data array in the editor
. Inclusion optimization guide
Irregular 3D terrain walking
3D dressing based on Creator3.0
Fast 3d parabola drawing
Odd-shaped – Irregular button implementation
Did you lose your skills today?
More wonderful welcome to pay attention to wechat public number?