florian-olivo-4hbJ-eymZ1o-unsplash

Introduction to Game Performance

The constant evolution of technology and the capacity of computers in the last century have drastically influenced our lives in different spheres, from performing automated calculations to entertainment and even the way we relate to each other. This technological advance was responsible for both the creation of the first electronic games and their evolution into the examples we know today. We have more computing and graphics processing power, but the gaming industry and its solutions are always looking for products that can impress and attract customers. Innovative solutions in this sense are more sophisticated graphics or even greater portability of consoles, as we can see in the rise in popularity of mobile games. Therefore, the search for performance in a game will always be on the minds of developers so that their product has more market value and competitiveness.

comparison between the mobile games Snake (1997) and Call of Duty Mobile (2019)

Ok, but what exactly is this performance? 

There are many similar words when talking about performance, performance, optimization, efficiency, etc. You could say that they are all briefly about “doing more with less”. A computer is a system that is doing many calculations while we are using it. Each calculation it performs has a cost, which often goes unnoticed by its user. The speed at which a computer performs these calculations is mainly tied to 2 things: The processing power of the machine and the complexity of the problem it is solving. So, in a generic way, you improve the performance of a program by increasing the capacity of the system that is running it or by reducing the complexity of the problems it is calculating. 

Right, but where do games come into all this?

Well, games are programs, so they are constantly making calculations. These depend on the nature of the game, but commonly involve elements like physics, organizing any kind of resources (including characters, items, etc.), loading and unloading sound elements, images, 3D models, and so on. Basically, all the behaviors of objects that act in a game need to be calculated at some point “behind the scenes” for you to see the final result.

In addition, many of these jobs involve complex visual elements that reach the user’s eyes, and this is where the need for a unique component to solve problems of this nature in our computers arose, the so-called video cards, or GPUs (Graphics Processing Unit). 

Furthermore, another striking feature of the importance of performance in games is that all the necessary calculations need to be solved in a very short period of time. Every time an image in the game changes, something had to be redesigned to make the new image appear and give the illusion of motion. By the way, this is a great stroke of animation, art that if you are more interested in reading about, I recommend Alisson’s compass. Commonly the standard for a fluid execution to the eye is 60 FPS (Frames Per Second). This means that in one second, the image on a computer screen is redone 60 times. So the math required for all the above needs to be solved and then the new images need to be redrawn on the screen (more calculation), all within an interval of about 16.67 milliseconds between each of these frames! 

Any frame that takes longer than this will generate delays in the delivery of the frames, leading to the well-known frame rate drops. All these processes are still inconstant, depending on the state the player is in the game, so certain frames may require more time than others, generating frame inconsistency and harming the user experience with a slow or ‘choked’ game at certain moments.

Even if subtle, frame rate drops are noticeable, especially with inconsistent frame rates.
Source: Reddit

CPU vs GPU limitation

As I talked about, there are two different types of limitations that computers are subjected to, that of logic and of graphics. It is customary to refer to them as CPU and GPU bottlenecks, respectively. The reason is simply the part of the computer where these problems occur, the processor for the logic part and the graphics unit for everything image-related. Most commonly, problems are investigated and identified in these bottlenecks separately.

Besides these 2 limiting factors, there is a third factor that needs to be observed, namely memory usage. The primary memory of a system is the memory into which a program will be loaded for use. The most commonly found in devices is RAM (Random Access Memory). Briefly, it is interesting to note that it has fast access and limited size, so we can’t just throw things in there indiscriminately. If the RAM gets full it does not stop a program from running but forces the processor to perform procedures that can generate large performance drops.

Some game engines (game creation software) have tools to measure and evaluate these performance parameters. Unity, for example, has the Profiler, where you can separately analyze the cost of different processes taking place while your game is running.

The profiler allows you to investigate the performance of a game on unity in different spheres.

Optimization Techniques

With all this in mind, there are many variables that a developer needs to keep in mind when it comes to performance. Fortunately, there is a wide range of techniques have been developed to alleviate all the identified limiting factors:

Polygon reduction in 3D models

In 3D games, the models we see are made up of a kind of virtual mesh made up of small polygons, almost imperceptible to our eye. The more polygons a model has, the smoother the texture of a model, roughly equivalent to the resolution of an image in relation to its number of pixels. 

In exchange for a more detailed model, there is the cost of what it will take to calculate all those extra polygons on the screens. So there is an effort to minimize the number of polygons in any model while still trying to preserve as much of its visual quality as possible. To compensate for this ‘reduction of detail’ and get graphic payback with less performance investment, artists use ingenious techniques like UV mapping and Texture baking. 

Comparison of 3D models with different amounts of polygons.

Intelligent resource preloading

When playing a game, you may have come across a loading screen. The classic loading screens are a way to preload resources needed for a part of the game so that when you need them, you have everything ready. There are even cases where resources can be loaded without the player even realizing it, such as during a waiting moment when a character is inside an elevator. As long as there is enough RAM to support the desired resources, performance should not suffer.

Partial Object Loading and Occlusion Culling

Another conceptually simple yet brilliant technique is to use only what is immediately needed, ignoring the rest. This concept applies almost perfectly to the definition of Occlusion Culling, a technique that prevents the rendering of objects that are not being seen by the camera.

In Unity, occlusion culling uses data associated with the project’s main camera to determine which objects do not need to be rendered in that frame.

Pooling

Loading and unloading objects from a scene is a crucial element in games. Depending on the frequency and nature of the object, these processes can have a significant impact on performance as well. One technique to deal with this is pooling, which consists of preloading these object instances into a data structure and only activating them as needed. When the object is no longer needed, it is just deactivated.

Closing remarks

Whew, I think I summarized my first impressions as best I could! Game performance is a recurring challenge in the lives of developers and a broad field of study, it is even possible to pursue careers focused only on this. So of course it wouldn’t be possible to talk about everything there is to talk about here! 

The possibility of applying all this technical knowledge to the delivery of a product that promotes experiences is something very incredible in my view, it only makes me want to continue learning and enjoying this fascinating mixture of art and technology that are the games. Who knows, maybe at another moment I will have the opportunity to develop more on the subject. 

ABOUT US

original

Since 2014, GamePlan has been the destination for developers, publishers, entrepreuners and gaming industry companies that are looking for Game Development (serious games, international co-development, and copyright games), Gamification and Ecosystem Structuring.

Here at GamePlan Compass we share, in a more informal way, about the gaming industry and market.

CATEGORY

GAMEPLAN TOUR

Meet us at the following Industry events and let’s talk about games.

July 7th – 10th
Big Festival