When you play a game, you may often encounter problems such as lag, latency, crash, and lack of smoothness. How can we minimize the occurrence of these problems? These issues are problems that game developers have to face, and problems that must be solved.
The above examples of problems we may encounter in the process of running the game, each caused by a number of reasons, but we can optimize the overall game from the direction of the overall game, so that the overall performance of the game is better, so as to reduce the occurrence of these situations. For these cases we need to optimize the CPU, then the optimization of the CPU, in short, is the optimization of the operation, we should try to reduce a large number of calculations or a large number of short-term calculations, you can start from four aspects. First, the calculation will be spread to multiple logic to reduce the short time of a large number of calculations. The second is to cache the data that can be cached as much as possible, so as to avoid those repeated calculations. Third, reduce the CPU's application, destruction and deployment of resources. The fourth is to use reasonable algorithms and data structures, which is also the most important in CPU optimization.
GPU optimization, the GPU is responsible for rendering all the images and effects in the game, and high GPU consumption will lead to lag in the game screen, lower image quality, and heating of the phone, which seriously affects the gaming experience. This is fatal for the game. The CPU optimization can start from the following aspects:
1, resource optimization, such as reasonable planning atlas, specify a reasonable particle effect, the number of triangular surfaces of the agreed model
2, simplify the shader, the use of multilevel texture and material mapping technology combined
3, the use of LOD technology, masking culling and other technologies to reduce the number of GPU drawing
4, for different system platforms to use the corresponding compression format.
5, optimize memory bandwidth
Game rendering can be said to be the heart of the game, so GPU optimization is particularly important, and requires developers to pay extra attention to
Memory optimization, I will not introduce the function of memory, I believe that everyone understands. The problems caused by insufficient memory include flashbacks, lagging, and so on. For memory optimization, one is to reduce the size of the resources, such as eliminating unnecessary resources, resource compression, etc.; two is to load and unload resources in a timely and dynamic manner, so that you can greatly reduce the pressure on the instantaneous memory to reduce the waste of memory to the game to bring unnecessary consumption. The third is to reduce the quality of resources, this is a lossy optimization, not until the end of the general do not use, of course, we can also according to different devices to use different quality of resources, the loss will be reduced to a minimum.
Network and IO optimization, they are mainly responsible for the loading of resources, may be network or local. A bad network, or a long loading time for resources, can significantly degrade the user experience. Therefore, after the CPU, GPU, memory optimization we can not ignore the network and IO optimization at the same time, for the network and IO optimization, we can start from the following aspects:
1, to limit the packet rate within a short period of time
2, reasonable optimization of the packet size, to reduce the packet redundancy data, to reduce the number of network requests
3, packet return to the sub-framing processing, to respond in a timely manner. Timely response
4, the use of independent threads, co-programming and other means to optimize resource loading.