“Live up to the time, the creation of non-stop, this article is participating in 2021 year-end summary essay competition”
I. Project background
In the era of mobile games, elimination has become an important genre in casual games. Exorcism is a match-3 puzzle game that can be played on mobile. In addition to the elimination of horizontal and vertical exchange of objects, the game also adds the interaction mode of row and column sliding similar to the Rubik’s cube, so that users can have the same interactive experience.
1.1 Development Environment:
- Unity2019.4.19
- JetBrains Rifer 2019.1.3
- Xcode 12.5.1
Second, the challenges encountered
2.1 The difficulty lies in finding problems
With the increase of users, more and more user feedback, the game opens slowly.
Any app with experience of launching a game should know that the percentage of users who get feedback from launching a game is small. There are two requirements for user feedback:
- Love your game (need your app)
- There are intolerable problems with the program
So when several users report the same problem, it’s important to pay attention (don’t ask me how I know).
2.2 More Difficult to locate problems
For user feedback about slow startup?
Programmer: Slow start? Slow initial startup? Slow cold start? Or slow hot start? What model? What is the version of the system?
Such a large number of questions, there is no way to ask users ah. And even if they did, there was no answer. Since most users won’t reply (it’s hard enough to give feedback), the rest of us will probably ask: What is a cold start? What is hot start? .
2.3 Obtaining the solution
[umeng + u-apm application performance monitoring platform] :(I used the statistical function of umeng + before, I feel very easy to use. Again, umeng helped solve the big problem.
As you can see from the figure above, [U-APM] provides us with statistics on all the problems raised by the original program in “2.2”, which feels really not too strong.
Three, the steps to solve the problem
3.1 access U – AMP
The access process is as follows :(there are official detailed documents for each step, which will not be described here)
Official website: https://www.umeng.com/
3.2 Locating Faults
Through access to U-AMP combined with the official cloud real machine, multiple models after multiple tests. The problem was identified as a long cold start time.
After several twists and turns, I have checked many articles related to slow startup, and the solution is basically as follows:
-
Resources Management Resources:
All Resources under the Resources directory are recorded in ResourceManager, which is a file, usually a text file in YAML format. This file is loaded on a cold boot. Therefore, the more Resources under the Resources directory, the larger the ResourceManager will be, and the longer the load time will be.
Suggestion: Manage them using AssetBundle. Addressable AssetSystem is now available
-
Shader compilation time:
If the first boot time is too long only after the game is installed, a good chance is that Shader builds and the game starts much faster later because of the Cache. In this case, you are advised to check the Shader content and variations of Always Include.
Suggestion: use shadervariantcollection instead.
-
Texture resources too large:
In the game is generally the largest resource, choose the appropriate compression format for compression, not only can reduce the memory footprint, but also can speed up the loading of resources. The choice of compression format is a trade-off between display and compression.
Advice: Generally use the ETC format on Android and the PVRTC format on iOS. In some cases, you may also consider using the Alpha channel separation technique for compression processing. The ASTC format has a strong trend and is recommended to try.
3.3 Troubleshooting
Due to the slow packaging of the original project, I created a new project to simulate and restore the problem in 3.2: Resources management Resources and texture Resources are too large:
Create a new project, put resources in the Resource folder, and put larger textures in other folders.
The packing test results are as follows:
After reducing the Resource folder resources, and comparing the larger map after compression.
Package test results:
By comparison, it can be seen that the startup time is indeed reduced, which proves that the scheme is feasible and can be applied to the actual project.
Fourth, project summary
Compared to Android or IOS native apps, games developed by the Unity3D engine do have a longer cold startup time. However, too long startup time can lead to poor user experience and even loss of a group of users. Without user feedback, the problem may not be solved and may be a major factor in the loss of revenue.
Therefore, focus on resource management during normal development and you will not have such problems later. In addition, the amount of test data and user experience of low-end models are necessary as key test points.