I don’t understand graphics optimization, can you guys help me?

798 views

I dont understand that some PC games like Witcher 3 or Hellblade Senua’s Sacrifice have awesome graphics and don’t too much pain for PCs but some old or meh graphics games make PC sounds like a plane and drops FPS (heating etc.). Everybody says because that games optimized very well but how and why all game devs do that? Can you guys help me?
Ps: I am not native so sorry for my English.

Thanks

In: Technology

3 Answers

Anonymous 0 Comments

Game programs are made up of lines of code that, when compiled, get broken down to a language the computer understands. Being a non-English speaker this is the same as something being translated to your native language; simpler sentences are translated faster. So the same goes for PC games.

Code, graphics, and game optimization means less lines are used to do the same things so there is less to read, code is stored in memory sequentially so the computer has to “seek” for it less, and game data is stored on the HDD in similar sectors so the read arm has to move less.

Things like Solid State Drives eliminate the need for a seek arm on HDDs which means you have to optimize less for it to work the same.

So if a game is written with a lot of code, or data is stored all over, or video memory is “streamed” into the GPU instead of stored can all increase load times and hardware work loads.

Anonymous 0 Comments

There are smart ways of doing things, and silly ways of doing things. Same applies to coding.

Smart takes effort, money, skill and time so sometimes shortcuts were taken or cheats were used to take advantage of a feature that was fast on a particular popular graphics card or processor that was around at the time.

Rather than try to make the game work in a way that would work the same on all PCs, all cards, in all combinations, some programmers just throw code at the problem until it works, and then ship the game.

And the way that we do things changes over time. Just in OpenGL, we’ve gone from having to use immediate mode, to display lists, to vertex lists, to shaders, to compute shaders, etc. Modern cards aren’t optimised for immediate mode and just “emulate” it, in essence.

It’s like making a car. You can make a car that everyone can drive, that can drive on every road, that’s fast and economical. Or you can just throw out something that you have to squeeze into, that large people can’t drive, that only works on side-streets and can’t go on the motorway, or burns so much fuel that it’s impractical but gets you where you want to go.

There is no one “way” of coding. There’s an ideal, which changes over time, and there are myriad ways to get there. Coding is far more akin to writing a book, or an instruction manual. If you wanted to write a book about how something worked, there are MILLIONS of different ways to write that book… but some people will write books that are easier to understand, some will write books that are more accurate, some will write books that don’t even describe reality, some will write horrendously so you can barely understand them even if you’re correct, and some might even write the book in Chinese which might be perfect for some people, and terrible for others to read.

Games are millions upon millions of lines of code, often running on dozens of platforms, with sometimes millions of potential hardware combinations (e.g. CPU, RAM, graphics card, motherboard bus speed, etc.). A good, well-optimised game will work the best it can for everyone. But a game that’s badly coded, rushed, or done on a small budget will more likely only work on a handful of combinations with any decent speed because it will assumptions about the kind of hardware it’s running on.

This is also why console ports are often terrible – they were written by one team who were told “This will only ever run on Playstation 4”, so they heavily optimise everything from the screen size to the number of things in memory to the speed which they pull stuff from the disk or Internet to those assumptions. Then a year later some other poor sod gets nowhere near the same amount of time or budget but is told “Make this work for every PC”.

Anonymous 0 Comments

It is all about algorithms. Algorithm is a sequence of actions needed to accomplish a task. A task can be accomplished in a lot of different ways. A game is just a huge algorithm – set of instructions for a computer to do. When it does them – you have your game, your moving pictures on the screen.

Suppose I’m in the kitchen I wanna make some fried eggs. One algorithm would be: Go to the shop – buy oil (butter). Come back. Put the pan on the fire. Wait for it to heat up. Put oil (butter) on the pan. Go to the shop – buy an egg (turn off the fire so it doesn’t burn while you’re gone). Come back. Wait for the pan to heat up. Crack an egg. Wait till it is cooked. Done.

You can see at least one **optimization** here – buy all the stuff in the shop at once. Otherwise you’re wasting a lot of time going there. And you’re heating the pan twice. Wasted time means the game will lag. For the game to be fast it needs to optimize for time as well as recources used (your memory, etc). For another extreme example see [Rube Goldberg machine](https://en.wikipedia.org/wiki/Rube_Goldberg_machine).

The algorithm for a computer to display a game for you is very complex. A lot of things need to be done. Game needs to process the buttons you click. It needs to calculate how much damage you deal. It needs to draw a picture you see on the screen (itself a very complicated task). It needs to do all of that and more 30-60 times per second.

With complex algorithm it’s not easy to figure out how to do it effeciently. You need to be clever and you need to have know-how. Compare frying some eggs with organizing a fancy dinner for 200 guests. You need to think about resources you have – people you hire (CPU – processing power), money to buy ingredients (computer memory), etc. For the fancy dinner it would be useful to know the paricular skills of people, who can do what best and where you can buy what at which price and then you can figure out a clever way to spend minimum time and money.

When the game is poorly optimized it usually means that game developers didn’t spend enought time on figuring out the best algorithms for everything. Could be because they were producing more content, remaking the game 10 times from scratch because ideas of what the game should be changed – there can be a lot of good reasons, actually. After all, optimizations isn’t the only work that needs to be done on the game.