Eli5: What does it mean to optimize a video game?

901 views

Eli5: What does it mean to optimize a video game?

In: Technology

3 Answers

Anonymous 0 Comments

Hi, I’m a hobbyist Unity developer and computer science student. I am definitely not an expert but for the sake of this sub I can give some examples of optimization I have personally used that should be fairly easy to understand.

There’s a lot you can do to optimize a game, but basically it’s a term to refer to modifying a game in order to make it perform better.

You can optimize your code in a lot of ways. If you can reduce the number of instructions being run every frame that will generally be beneficial to your processor. Let’s say you have a game with AI controlled units. The object associated with that unit will have a script governing its behavior. You might write the script to check what it should be doing, and execute that, once every frame. If your target frame rate is 60 FPS, that means that those instructions will be run every frame. But the player likely won’t notice a unit making decisions 60 times a second. What if, instead of 60 times a second, we tell it to check what it should be doing every OTHER frame? That’s 30 times a second, which is still super frequent. What if we halve it again and check what it should be doing 15 times a second? You can experiment with executing those instructions as few times as possible without negatively impacting the player experience. You can also tell the game to turn off the enemy AI when the player is a certain distance away, or if they can’t see them, or both. No point in running those instructions if it isn’t going to do anything. There’s about a million and one ways to optimize code. If you’re using a language that has manual memory allocation, making sure to get rid of variables after you’re done with them will avoid memory leaks.

You can often optimize 3D models or the textures / materials on them by reducing their poly counts or how system-intensive their shaders are. Nowadays increasing poly counts often result in highly diminishing returns. A lot of the time you can halve the number of polygons in a model and passive observers won’t notice the reduction in quality at all. Other times you can prioritize where detail needs to be higher and reduce it elsewhere. It’s unlikely that far off buildings in your skybox need to be particularly detailed since the player will never go near them. You can also get rid of geometry that the player will never see, duplicated vertices and other things that either won’t be noticed or are so negligible that keeping them isn’t worth the performance hit.

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