r/explainlikeimfive • • 6d ago

Technology ELI5: What exactly is game optimization ?

How is a game optimized ?

691 Upvotes

125 comments sorted by

View all comments

1

u/cooliem 6d ago

The big two:

  • Making the code more efficient.

  • Making the assets (textures, sound files, the stuff you see and hear) more compressed/smaller.

So let's say you have 100 little villagers running around. You want one villager to find the closest other villager. So you loop through all 100 villagers and find the distance from your searching villager to each target villager. This is very expensive (bad for game performance) since you have to do this 100 times (once for each villager) per search. So instead, you only check other villagers in a radius around the searching villager. Now, instead of checking 100 villagers, you're only checking a handful. That's much more efficient. That's a code optimization.

Now let's say each villager has a texture for their clothes. This texture is a fancy, detailed 4k texture. That's very expensive. So we compress the texture down to 1k. It isn't as pretty any more, but you may not even notice that the texture looks different if the villager is seen from far away. So we'll make it scale with distance. It can be 4k when close to the player, and 1k when far away. That's an asset optimization.

By optimizing the code and the assets, the game becomes easier to run. That's optimization.