In the world of Gamdev, one of the most invisible but critical aspects of development is Optimization of performance . No matter how beautiful your world is, no matter how interesting the mechanic you realize, all this will lose its meaning if the game works at the level of Slideswus, and instead of an exciting gameplay, the player observes freezing, frizes and falling personnel.
The development of a game is always a compromise between the desired and possible. Even on powerful platforms, resources are limited, and on mobile devices or weak PCs - even more so. The task of a gamemerack and a programmer is to make the game be beautiful and saturated, but at the same time Fly , not creeped . In this article, we will consider in detail how to achieve this balance.
The performance of the game is the ability of the engine and the platform to renders the scenes and process logic in real time, providing a stable number of frames per second (FPS).
Basic metrics:
Optimization is work on a decrease in all narrow places that prevent the game from going smoothly. This is not only about "making easier", but also about "make smarter."
The reasons for reducing performance can be different, and they do not always lie on the surface.
Optimization cannot be postponed to the very end - this is the risk of loss of control over performance. However, premature optimization can inhibit the development.
First - functionality, then - optimization. But observation of performance should always go.
Graphics is one of the most resource -intensive aspects of the game. It is here that the source of the lags most often lies.
Use several models with different details depending on the distance to the chamber. Middle objects - high quality, distant - simplified.
Hide objects that are not visible to the camera from rendering. Especially useful in 3D games.
Use lighting baking at static objects. This unloads the GPU from constant light calculations.
Combine small textures into one to reduce the DRAW Calls.
Simple shaders are quick shaders. Check productivity on a weak gland.
Game logic is like the heart of the game. But if it is built inefficiently, this heart can begin to fight too often.
The functions caused by each frame should be minimal. It is better to use events, timers or coroutines.
Instead of constant creation/removal of enemies, shells, particles - create a pool of objects and re -equipped.
Artificial intelligence, generation of maps - do in stages or outside the main stream (asynchronously).
Unity Profiler, Unreal Insights, Visual Studio Profiler - Analyze which methods load the system.
Games can “slow down” due to constant garbage collectors, memory leaks or excessive allocation.
Nintendo limited the drawing range, but did this imperceptibly for the player due to stylistics and competent design.
The game with frantic speed, but excellent optimization. Aggressive Object Pooling is used, key resources are downloaded in advance.
Minimalistic graphics, almost complete absence of animations, but stability even on weak devices.
Optimization of performance is not a development stage, it is its constant background. This is the concern for the player not only to see your game, but I felt it Without frizes and falls. Beauty, plot, mechanics - all this is crumbling, if the interface slows down, the camera twitches, and the character moves late.
Remember that optimization is a manifestation of respect for the player. This is the ability to find a balance between ambitions and capabilities. This is the art of hiding complex behind the simple, to make easy what in practice required titanic efforts. Your game can be brilliant, but only if it works. And the better she works, the easier it is to believe that this world is alive - and I want to return to it.
Thanks to Mericonvyr, I streamlined my game design process with useful tips.
I found Mericonvyr's advice very helpful for designing engaging gameplay.