How does game “optimization” work? Are people sitting there changing lines of code to more “optimal” ones? What is “optimized”?

2.15K views

The recent The Last of Us for PC made me realize I had no idea what’s meant by “optimizing” a game.

Same with optifine in Minecraft improving performance. How do these things work to just make games use fewer resources?

In: 158

105 Answers

Anonymous 0 Comments

In general optimizing something just means “making it better” or closer to the optimal, i.e. best possible performance.

When discussing optimizing code, there are two main focuses; optimizing memory usage and optimizing processing speed. In general you achieve one of these by sacrificing the other.

For example if you are designing a game for an older console system, you’d want to focus heavily on optimizing the usage of the limited, non-upgradable RAM memory. That means getting creative with how you fetch and store data in your code so that your game doesn’t max out the available memory.

If processing speed is the end-goal, then often that means sacrificing some memory optimization and storing more information in RAM and using creative algorithms to process data more efficiently.

To be more precise programmers can evaluate a piece of code and give it a complexity value that essentially tells other programmers how efficient/optimized it is for memory and speed. Check out [Big O notation](https://en.wikipedia.org/wiki/Big_O_notation) and [computational complexity](https://en.wikipedia.org/wiki/Computational_complexity) if you want to learn more about that.

You are viewing 1 out of 105 answers, click here to view all answers.