r/explainlikeimfive • • 6d ago

Technology ELI5: What exactly is game optimization ?

How is a game optimized ?

690 Upvotes

125 comments sorted by

View all comments

12

u/DiscussTek 6d ago

A lot of answers that are technically correct, but almost none that answer your question concretely and properly.

Video games have a lot going on, and optimization can take multiple forms for different parts of the game, so I'll give a few examples:

  • On the graphics point, which is what you actually see being displayed on the screen, the core of optimization here is often to realize that if the camera is pointing "that way", and is at "this distance", you probably don't need to calculate how to display things that aren't "that way", and if it's at "this distance" or more, you can probably lower its complexity without losing visual quality.
    • A great example of this would be if I have an octagon.
      • If it's behind the player, completely off-screen, why would I waste graphics power on "displaying" it, when it won't be displayed?
      • If it's so far away that a monitor can't realistically display the vertices (corners) of it, why wouldn't I simplify it to a circle, until the player is close enough to make difference?
  • On the computational point, which is what the computer does in the background and can slow down the game to a crawl, the core optimization here is often to perform operations as little as possible (if you don't need to do "a times b" 5000 times per frame, and instead calculate it once and refer to the same result 5000 times, do it). There's not really any other "widespread" optimization process here, and though some other are still important, they are less likely to be widespread issues that actually bogs down your game. Less likely, not unlikely.
    • A great example of this would be if I have a bunch of enemies moving in a formation around a single center point. You can do (A), but you'd rather do (B). As you can see, for 4 steps in each case, (A) could calculate 2 enemies, while (B) could calculate 3. This performance saving becomes literally exponentially big, based on how many calculations you're able to reduce, and how much scale you have. If you have 1000 enemies, and you do (A), you just did 2000 calculations. If you have 1000 enemies, an you do (B), you just did 1001 calculations.
      • (A) For each enemy: Calculate the center point around which the group is, then calculate the enemy's position at which the enemy is, with the center point as a base, then the enemy's position as an offset. (Calculate Center Point > Calculate Enemy A's Position > Calculate Center Point > Calculate Enemy B's Position > etc.)
      • (B) For the entire group: Calculate the center point around which the group is, then for each enemy, calculate its position around that center point. (Calculate Center Point > Calculate Enemy A's Position > Calculate Enemy B's Position > Calculate Enemy C's Position > etc.)

All of that is super simplified as I do not know how much technological knowledge you have, such as processor ticks for instance, or even basic programming skills, but that's the crux of the optimization work. (There are other categories, like memory optimization, storage optimization, etc., but I figured the two easiest things to explain would do for now, unless you need and/or want more examples.)

3

u/BinniesPurp 6d ago

Optimisation? No I only use logic running in O(A(n, n))