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

2.04K 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

Let’s say you have 100 pieces of Lego and you want to sort them by size.

So the easy solution is to pick the smallest one and set it to the side. Then you pick the next smallest one and put it right to the first, and so on.

That’s easy, but takes quite a while because you always have to check which one is actually the smallest.

One optimization would be to just make rough piles first. All the small pieces in one pile, all the medium ones in another and one for large piles. That’s quick to do and now you have way smaller piles you can sort by size. You can repeat this process again and have even smaller piles, so in each pile it will be easy to see which one is actually the smallest.

That’s basically the quicksort algorithm, which is way faster than the selection sort we used in the beginning.

Optimization is about finding better ways to approach problems. Another example is finding an element in a list, pathfinding, collision detection, etc – for all those things you can write simple algorithms that are slow, or better and faster algorithms that are usually more complicated to figure out.

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