How does game optimization work?

Any gamer has come across a poorly optimized game at least once in his life. Low FPS, graphics artifacts, bugs, glitches, inconvenient user interface are common characteristics of such projects.

Finding the perfect game that lacks all of these aspects or has minimal impact on gameplay is difficult (but possible). But let’s first define the very concept of video game optimization.

Game optimization is the process of increasing performance to improve the gameplay and visual experience.

More specifically, a well-optimized game performs at the same FPS on most gaming platforms, including technical weak models. This approach to optimization, where the starting point is FPS (frames per second), is not surprising, since most players associate the performance of the game precisely with the smoothness of the display of the picture on the screen. After all, we receive most of the information visually.

Why are games optimized?
Game creators make their creations on top-of-the-line hardware that most users can’t afford. And the task of the developers is to make sure that their brainchild is launched and playable on most gaming devices.

And in order to get an insanely beautiful image and high FPS, the game requires very powerful hardware, often surpassing even what game makers have. Not to mention regular users.

To help you understand better, here are some numbers. The performance of the built-in video chip in Sony Playstation 4 (basic version) is 1.84 teraflops. One of the most popular, but already relatively outdated video cards Nvidia GeForce GTX 1060, produces about 4 teraflops. At the same time, its resource is no longer enough for the most demanding PC games in high definition.

So how do developers manage to release masterpieces like God of War or Last of Us 2 on the outdated PS4 hardware? So much so that such titles not only do not hurt your eyes, but also make you admire such landscapes that you will not see in real life?

C_C4HCX_04

JN0-250

NS0-402

Professional-Machine-Learning-Engineer

PSE-PrismaCloud

SCA-C01

Looker-Business-Analyst

1Z0-1096-21

SPLK-1003

SPLK-3001

C_C4HCX_04

JN0-250

NS0-402

Professional-Machine-Learning-Engineer

PSE-PrismaCloud

They have their own professional secrets and tricks, which will now be discussed.

The Last of Us: Part II Special Edition (PS4) 3,599 *
The world exists as long as I see it
Displaying hundreds of objects on the screen and working with light and shadows are the most resource-intensive processes that require a lot of power. What did the developers come up with in order to reduce the load from the video card?

They make it render (draw) only those objects that the player can see. For example, in GTA V, behind the player’s back, the city, people, cars simply do not exist (but you do not notice it). And this is logical, since it would be a crime to waste a video card resource on simulating the life of a huge city, which you still cannot see.

Game Grand Theft Auto V: Premium Edition (PS4) 1 999 *
Here’s how it works with Horizon Zero Dawn.

And here it is even clearer.

However, here the developers need to be careful with the physics of the object, so that it does not work out like this: the forces of gravity only work when the player is looking at the object.

I haven’t heard about the story of Silent Hill, probably only the lazy one. In 1999, the performance of the Sony PlayStation was so low that it was impossible to display a relatively large world. Then the developers surrounded the player with fog, which limits the visibility range. This allowed us to optimize the game for the capabilities of the console. But the most important thing is that such a “random” decision has become the hallmark of the series. The fog added an element of mysticism to the game and played to the atmosphere of Silent Hill perfectly.

Disappearing objects
To improve performance, developers often get rid of the extra objects by disappearing them. The shell casings that disappear after the shot or the disappearing bodies of defeated opponents – this can be found in at least half of the shooters. Imagine Serious Sam, Painkiller or any other “meat” shooter where the bodies do not disappear. The player would have to at least walk “knee-deep in blood.”

Cloning
Copying textures and objects is the most commonly used way to optimize a game. Take any game and you will find a bunch of identical items. This is especially striking in old games. For example, in the shooter FEAR, most of the offices, including items on tables, chairs, and so on, look like a carbon copy. Indeed, they are the same models. This approach is only bad because it makes the game less unique and varied. But it increases FPS.

There is a lot of this kind of copying in open world games too. Buildings in Mafia or GTA often do not shine with variety: the same “concrete boxes” are simply scattered across different parts of the game locations so as not to be too conspicuous. What can we say about ordinary NPCs: only the plot-wise characters are unique, but the “extras” wandering the streets do not differ in variety.

Textures and mega-textures
Another “feature” of game developers called “megatexture” was developed by the father of first-person shooters, John Carmack. The megatexture covers the entire landscape of the game level (instead of tens and hundreds of small textures). The parts of the mega-texture closest to the player are displayed with maximum detail, but as you move away, the surrounding world becomes “less high quality”. This is reminiscent of real life – after all, we cannot see objects at a distance as well as directly up close.

The principle of operation of the mega-texture in the diagram. Green area – high details, red – low, yellow – medium values.

The mega-texture is located on the hard drive. As needed, it is pumped into RAM, consuming much less resources than with the traditional approach with a large number of different textures.

If the game uses a lot of textures, then the developers do the same: the textures are poorly detailed at a distance and vice versa. 3D models in the distance are cut to 2D: the difference is not visible to the player, but the video card will thank you for reducing the load. Reducing the resolution of textures at a distance, reducing the number of polygons in an object, disabling shaders – all this also refers to optimization and is applied everywhere.

Lighting
Generating realistic beams of light, bouncing them off surfaces and creating shadows is one of the most resource-intensive processes. Therefore, developers often just get rid of shadows at large distances and try to use as little reflective textures as possible.

Reducing the number of objects with dynamic shadows also has a positive effect on improving game performance.

Loading screens
Most older games tend to have constant loading screens. Moving to the next level? Get a long load time. In Half-Life, for example, the developers tried to solve the problem more gracefully: there the loading of levels was very fast, but it was still noticeable.

In modern games such as Last of Us, Uncharted, or God of War, multiple loading screens have been eliminated altogether. New parts of the location are loaded there while the characters are engaged in dialogue or solving puzzles. An ingenious decision must be admitted.

An important point worth mentioning is that optimizing console games is easier than optimizing PC titles. This is due to the fact that the developers of console games know in advance the technical capabilities of the equipment for which they create their creations (for example, PS4). While the spread of similar characteristics among PC owners is very large: someone has an “ancient” computer with a vidyuha from the 2000s, while another has an ultra-modern machine. This explains a lot why console games often outperform their PC competitors, including graphically: better optimization affects.

God of War Game (PS4) 750 *
Optimizing assets
Any asset in the game can be optimized: lower its resolution, decrease the number of polygons. At the same time, it will still look good, but it will consume less computing resources.

A game asset or game resource is a digital object, mainly consisting of data of the same type, an indivisible entity that represents a part of the game content and has certain properties. The concept of “game asset” is used in the development of computer games in relation to those content elements that are processed by the resource system as indivisible (atomic, elementary) entities.

And you can also make some of the objects that players pay attention to more highly detailed (for example, the character’s face), and spend as little resources as possible on secondary details – grass, stones, clothes of the hero. This was done, for example, by the creators of Fallout 4.

Fallout 4: Game of the Year Edition (PS4)
Optimizing your code
This already applies to the very “inner kitchen” of the game. For example, FPS increases the utilization of all processor cores for complex in-game computations. Or optimization of the game code, when it is more profitable to use a constant (some constant value often used in the game) than forcing the processor to calculate this value anew each time. The same is true for graphics: it makes more sense to use a frequently used sprite and save it to a file than to render it with code each time.

User settings
Another tool (or rather several) for optimization, the developers have made available to players. We are talking about the graphics settings, which in most games you are free to change at your discretion. Enable / disable anti-aliasing, vertical sync and many different visual effects, such as Blur, reflections in water, draw distance and others. If you remove all these graphical bells and whistles, the game loses its beauty, but it runs smoothly, even on weak PCs. This is a compromise and open source optimization method.