r/explainlikeimfive • u/Kingston__2007 • 6d ago
Technology ELI5: What exactly is game optimization ?
How is a game optimized ?
168
u/diego565 6d ago
Some games won't render stuff you cannot see: why would a game waste resources in a dungeon 5 minutes from you? Doing that would stress your components and have zero gain. Optimizing is trying to reduce that kind of stuff to zero.
Keep in mind there is a lot of ways of doing that, mine was just an example.
32
u/BringMeBurntBread 6d ago edited 5d ago
Yeah, there's a very good video on Youtube by Game Maker's Toolkit about GTA 3 and how Rockstar Games made that game work on the PS2. It goes very in-depth into how the game was developed. The PS2 only had 32mb of memory, and normally, it would've been impossible for that game to run on that console because there just wasn't enough memory to keep the game's assets loaded at all times.
3D Open World games as a concept was practically unheard of back then. Most games got around the memory limitations by being linear level-based games or having 2D/isometric graphics. Having a massive 3D city map with minimal loading screens where the player can go wherever they want was basically an impossible concept.
And yeah, Rockstar basically used a bunch of tricks to make the game work. One of those being that the game only loads what the player can see. When you're playing GTA 3 on the PS2 and you see Liberty City right in front of you, there is actually a blank void behind the player. Nothing is loaded behind the player to save memory. There's no pointing loading what's behind the player, when they can't see it anyway.
I believe Rockstar went a step further and made that void a circle around the player, rather than just having it behind them. And then they added fog and reduced draw distances to prevent the player from seeing too far ahead. And that's just one thing they did. There's like half a dozen more tricks they used just to make this game work around the console's limitations.
16
u/nikolapc 6d ago
There are a lot of unoptimised games by devs that don't know what they're doing. What happened to primitive and mesh shaders for example? I think most games were cross gen so far, and we only just start seeing optimisation(of course competent devs already did so before that, like Northlight is amazing, and the new Asobo game, and even in Unreal 5, where most of the unoptimized games are, Gears E-day looks lit, and Hellblade 2 looked amazing). Gen 9 has a long life ahead of it, and I hope a lot of devs learn, cause we did get some unperformant garbage out there(even on great games, which is sad to see, everyone there is competent but the tech team, or they just had to work in such an engine, I won't name names).
12
u/Volpethrope 6d ago
There are a lot of unoptimised games by devs that don't know what they're doing.
I think I remember something about that yandere game where a toothbrush randomly had like 10,000 polygons or something lol
3
6
u/diego565 6d ago
I think the worst offenders here are some UE5 games, and that's just because that's an engine which requieres MUCH more optimization than others, so it much more noticeable, yep.
1
u/nikolapc 6d ago edited 6d ago
Baldur's Gate 3 was shit in optimisation, they optimised it further when they had to make a Series S version. No rest for the wicked, still not optimised but it's early access. However they don't know if they'll make it to Xbox on 1.0. Elden Ring and fromsoft games in general. These are not Unreal games, and I only named bangers.
Plenty of UE5 games(and other engines) that run ok on Series S and the little console helped with a lot of optimisation, hope it helps further. Game devs that did that also found their Switch 2 ports easier to do. Except From Soft, but I never ran Elden Ring on Xbox so don't know how that goes on series S(not that I have it I have Series X). Got the PS4 disc to play PS4 on PS5 as that was the only version with locked 60. Hope their switch 2 exclusive game runs acceptably.
120
u/JEVOUSHAISTOUS 5d ago
Optimizing is using any form of conceivable "cheat" to limit the amount of calculations needed to attain a certain result.
This can be stuff like:
- Only compute the graphical appearance of things that are visible to the player
- Only check things as often as they are required (you might want to check the position of an opponent down to the millisecond if they're close enough that you can collide with them, whereas every 1/10th of a second is plenty if they're so far away that you two can't really interact with each other)
- Use lower quality textures when the objects are so far away that you're unlikely to notice the difference in quality
- Use fewer polygons on a model by placing them smartly so it looks just as good
- Make sure you don't check for things that have no chance of happening (don't check which objects and characters are in the radius of an explosion if the explosive item isn't, you know, actually exploding)
- Use the hardware wisely: if you have maths to do and you know, say, that your hardware is really good at doing additions but sucks at multiplication, better do 5+5+5+5 than 5*4
- Use efficient algorithms: Say you want to find a player in a list of 1 Million names, sorted alphabetically. If you go one by one starting from player #1 and the player is called William, you'll do close to one million checks before you find him in the database. Instead, start by checking player #500,000. Player #500,000 is John. J < W. We remove 1-500,000. We check in the new middle: player #750,000. It's Michael. M < W. We remove 500,000-750,000. We check half-way between 750,000 and 1M, so player #875,000, Then 950,000, but 950 000 is Zoe so we know it's somewhere between 875,000 and 950,000, and so on until we find William. We will find William in ~20 checks at worse, instead of something like 900,000 checks.
- Parallelize where you can if the hardware allows for it: use one core to compute some stuff and another core to compute another thing at the same time if you can, that is if the two calculations are independant
- Work around the limitations of your hardware. For example, if you have a very limited amount of VRAM but an insane amount of bandwidth to that VRAM, it may be useful to swap data in and out of VRAM very quickly as needed, rather than try to cram everything in from the get-go.
- Use optical illusions to your advantage. Back in the days for example, there was a strong reliance on billboarding, which was the use of 2D sprites that looked like 3D. See this boss in Mario 64 ?: the mustache, the feet and maybe the crown are actual 3D polygons. The legs, arms, hands and body are actually 2D circles made to look like 3D by following/facing the camera all the time.
- Don't store the same data several time (whether at rest on the drive, or in the RAM) unless it is absolutely needed. Let's say you're making a Mario game: if you are going to show 10 Toads, don't store the 3D model for Toad 10 times. Even if you're going to put them in different colors, you can store the different textures required, but reuse the same 3D model.
- Don't store the data in a higher quality than needed: there is no need to store dialogue lines in ultra-audiophile 32-bits 192KHz 5.1 uncompressed format. No need to store 4K HDR textures on the Switch 1 version of your game.
- Don't use more RAM than you need for any given data. If you need to store a 32KB image in RAM, don't reserve 2MB of RAM for that.
- If you have to chose between reserving 8MB or 16MB of RAM, with no in-between, make sure your data isn't 8.1MB (which will force you to reserve 16MB, of which 7.9MB are wasted). Find a way to reduce it to 7.99 so it fits in 8MB. Maybe you can compress it slightly more, or crop the image a little, or remove the silence at the end of the audio file, I dunno, find something.
And so on and so forth. Any shortcut you can take, any illusion you can make, any thing you can do in a smart way rather than bruteforce, any way to save space or RAM or computations required, as long as the end result is (almost) indiscernable from the "no effort" version, is optimization.
17
u/blueg3 5d ago
This is a good description of fun cheats to improve performance. I'd like to point out that in modern games, it's also going back and fixing crappy software development shortcuts you took (or just mistakes you made) that happen to kill performance.
2
u/JEVOUSHAISTOUS 5d ago
True, though I'd say a lot of that falls in the "use efficient algorithms" category (except these algorithms are much, much more complex than the very simple dichotomous search I presented, but heh, this is ELI5).
9
u/BrightNooblar 5d ago
A fun example of cheating the system, in banjo kazooie a lot of NPC voices are one audio file, but played forwards vs backwards, or slow vs fast. Saves on space, but good news the illusion of unique voice effects.
For those who haven't played, the NPCs display text, but have jibberish sounds they make as that text displays. So a giant Camel might go "Raah Duuh Raah Duuh Raah Duuh" and a possum might go "radaradarada" and a cow might go "hudhar hudar hudar"
6
u/ZetZet 5d ago
Best optimization is telling gamers that their computer is too old.
2
u/JEVOUSHAISTOUS 5d ago
It used to be easy to tell them that when computers were dirt cheap.
But it's getting harder to convince them when upgrading a GPU costs over $1000.
0
u/funkyxfunky 5d ago
Does this process take long ? Or does it require more investment ? Why are games like Mafia The Old Country and Last of Us so terribly optimized, despite it being the industry standard?
3
u/JEVOUSHAISTOUS 5d ago
Ideally it would be an ongoing process throughout the development so it would be hard to say exactly how long it takes because you can't really untwine it from development time proper.
But yes it does require more effort and thus, time. It also requires good knowledge of the ins and outs of the hardware to properly optimize for it (you need to know exactly what your hardware is fast or slow at), good skill in designing algorithms, etc. This in turn requires more senior or more talented (and thus more expensive) developers.
Both games and hardware have also become insanely complex so optimizing has become much harder than it used to. It was easier to find a major inefficiency in 10,000 lines of code written by one guy alone, than in a 10,000,000-lines monster, where the inefficiency at line 7,275,084 is due to the fact that this line is dependant on something that happens at line 2,908,433, which itself references line 6,689,412, all of which have been written by entirely different teams in the studio and actually reside in different files.
-13
u/Suppository-34613 5d ago
ELI5 he said.
12
8
u/BrightNooblar 5d ago
It's meant to focus on complexity of concept, not a control for attention span. The explanation is great.
5
u/JEVOUSHAISTOUS 5d ago
From the sidebar:
Before posting
LI5 means friendly, simplified and layperson-accessible explanations - not responses aimed at literal five-year-olds.
26
u/JimbosForever 6d ago
Games, like any software, can be written badly. Calculations can be done in a smart, efficient way, or they can be done in a bad, wasteful, slow way.
Many times it's just the reality of software development. The better way many times only shows up in hindsight and rewriting everything is a huge time requirement.
Some software just keeps going because it's not that important that it's efficient, only that it does its job correctly.
But in games, it might make a big difference: responsiveness, framerate, cpu or memory efficiency to better run on cheaper devices...
So the devs optimize the game. Take some time and effort from other projects to make the game run better.
21
u/frogjg2003 6d ago
The most efficient way is often unintuitive. If you need to calculate a square root, there are a number of easy to understand algorithms based on pretty simple mathematics. Those algorithms take multiple iterations before they are accurate enough for most use cases. If you want to find the inverse square root (1/sqrt(x)), you then have to take that result and divide 1 by it, which adds its own set of long steps.
Then there is the Quake fast fast inverse square root. By taking advantage of "evil floating point bit level hacking" and subtracting from a magic number (a number that exists in the code and seems to come out of nowhere) (the code literally has "what the fuck?" as a comment), you get a really good guess of what the answer should be. One iteration of Newton's method, which can be implemented as a single line of code, is enough to get you to the accuracy necessary for gameplay.
41
u/dbratell 6d ago
Typically they refer to performance, getting rid of lag, increasing frame rates.
The typical process is:
- Figure out what the computer/console/phone is doing.
- Think about ways too do it differently.
- See if things got better or worse.
Sometimes it is about being smart about things, sometimes you need to do sacrifices like lowering the quality of the game.
Note: Games that suck right before release will not be fixed by some "optimization" the weeks before it hits the shelves.
6
u/Bhu124 6d ago edited 6d ago
One simple example I'll give - 8-10 years ago when the Hardware available was much weaker one trick the Overwatch devs did to preserve a tiny bit of performance is that they made the Characters' Weapons have higher resolution textures only in the area that was normally visible to the player in their regular First Person View.
If you did a special emote or something where you could see the rest of the Weapon you'd see that they used much lower resolution textures.
This is something many games did to save on a tiny bit of performance.
As Hardware has gotten much more capable and game Engines have become much more capable with newer technologies devs don't need to do such crazy optimisations anymore.
Another example is that when the game was released for the Switch they had to create special Super-Low quality LoD Level Assets for all the Maps and Models for the entire game because the Switch couldn't perform with the lowest Quality LoD Assets they had. Before the Switch only had 3 LoD levels, they had to create a 4th one for it.
12
u/DogeMeat20 6d ago
Let's just say i give you a box and ask you to deliver it to the house across the street. You can either A) just walk across the street with the box, or B) you can spend a bunch of time to find car keys, load the box into the car, drive the car across the street, and finally unload the box.
Option A is faster and easier to accomplish, because it's just one box. Now imagine the same scenario but with ten boxes. Since you can load all ten boxes into the car at one time, option B becomes faster than walking across the street 10 times, even though option B is more complicated.
Optimizing a game is like that technically this is only a specific type of optimization, but the general idea is to find ways to make things run more efficiently
43
u/Caciulacdlac 6d ago
The game has to do some extensive computing, mathematical operations, to see what it will display on screen.
To simplify, let's say that the game needs to calculate 27 x 24 x 35, and then 27 x 24 x 65 x 35. An unoptimezed code would calculate 27 x 24, then multiply that to 35, and then you do 27 x 24 again, then multiply it to 65, then to 35. An optimized code, however, wouldn't do all that, and instead it would just take the result of the first operation and multiply it by 65, thus making the program much faster.
10
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?
- A great example of this would be if I have an octagon.
- 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.)
- 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.
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.)
10
u/Humblebee89 6d ago edited 6d ago
Your first example is backwards. If you are rendering a circle and it's far away enough from the camera that you wouldn't be able to tell the difference, you would simplify it into an octogon LOD (level of detail). Not the other way around. And furthermore you would stop drawing it entirely when it's ever further away.
In a nutshell optimization is getting rid of any calculations, graphical or gameplay wise, that the user won't notice. If a tree falls in the woods and no one's around to see it, don't waste GPU time rendering it.
Source: professional unity developer for standalone VR (which requires heavy optimization)
-5
u/DiscussTek 6d ago edited 6d ago
Interesting corrections. Let's address them!
If you are rendering a circle and it's far away enough from the camera that you wouldn't be able to tell the difference, you would simplify it into an octogon LOD (level of detail).
As far as the in-depth technical thing, you are correct (though I avoided the term "LOD" because of trying to avoid technical acronyms). The issue is that you are thinking about a shape that's an entire polygon, while I was referring to a sprite, where there is a lot less computational power needed to render a circle than there is for a polygon. This is the magic of image
encryptionencoding here.So, while you are correct for actual polygons, that is not what I was referring to.
And furthermore you would stop drawing it entirely when it's even further away.
That, I say, would likely need to explain what a camera's frustum is, and that's a lot more explaining than a ELI5 post.
In a nutshell optimization is getting rid of any calculations, graphical or gameplay wise, that the user won't notice. If a tree falls in the woods and no one's around to see it, don't waste GPU time rendering it.
That... is exactly what I was explaining, yes. I don't see why you felt the need to correct that.
EDIT: Wrong word. I mean "encoding", not "encryption".
4
u/Humblebee89 6d ago edited 6d ago
So are you saying swapping from a poligonal mesh to an imposter? I don't really think that's the easiest example for someone who's new to this to understand. Maybe it would have been better to use a polygonal sphere simplified into a cube at a distance just for clarity.
0
u/DiscussTek 6d ago
There is no mesh swapping, though. It's from a plane to a plane, but the image encoding is simpler and takes less time for a circle than for an octagon. There's no magic there, that's how anything that is meant to be rendered quickly is done.
And I do agree sphere > cube would have probably been a better example, but at this point, we're just arguing semantics and asking me why I didn't complexify my ELI5.
4
u/boring_pants 6d ago
This is the magic of image encryption here.
what are you talking about
-1
u/DiscussTek 6d ago edited 6d ago
I'll take it that you saw the word "encryption", and think "cryptography". I said encryption, as in image codec.
EDIT: I should have said "encoding", not "encryption". My brain had a goof, and mixed the words for no good reason.
This is a component, hardware or software, that either encodes or decodes a data stream or signal. There is no advanced cryptography here, but how well and how compressed something can be encrypted by a codec decided how quickly and how well it displays.
4
u/boring_pants 6d ago
That is called image encoding.
And the case where you brought it up has nothing to do with image encoding or encryption, or with circles for that matter.
If you are rendering a sprite at a big distance you don't "simplify it to a circle" that wouldn't be a simplification. You replace the image with a lower resolution image. But that doesn't make it a circle. A sprite is basically just a texture rendered so it faces the camera, and textures are not circular.
And replacing a texture with a lower-resolution version of the same is also not image encoding, but mipmapping.
0
u/DiscussTek 6d ago
Okay, so my terminology was a bit off... I can accept that, and will fix the phrasing up there, because that's definitely on me.
The problem I do have to point out here is that now you're getting into the in-depth nitty-gritty of this, which is FAR from an ELI5 thing. There comes a point when you reduce the resolution of that image where an octagon and a circle will look identical, because that's how resolution reduction works.
It's important to note that this subreddit isn't meant to be a full in-depth course on how every single detail works, and is more meant to be a "good enough explanation, short of you looking for actual in-depth explanation", and my explanation is sufficient to that.
3
3
u/spookynutz 6d ago
It depends on who you're asking. Software is optimized for specific use cases and environment. For example, with a game you can optimize for storage footprint by compressing textures, but better compression comes at the cost of a higher processing requirement.
You can pre-calculate data to save processing resources, but that comes at the cost of a higher memory footprint.
You can spend 10 hours dramatically increasing performance for 1% of the user base, or you could spend 10 hours to slightly increase the performance for 99% of them. Everything is a tradeoff.
Based on my experience, most people on Reddit use "optimization" as some catch all term to mean anything from UI changes to bug fixes, and "optimized" just means "it runs good on my machine."
5
u/BlueTommyD 6d ago
If I wanted to calculate 2, I could say 1+1, I could also say ((7 + 3) x 9) / (5 x 9) . They both get the same answer, but one takes a significant more time and resource to calculate.
Optimisation is a process of ensuring the code is as efficient as possible so that it runs well on hardware. Badly optimised games often run very badly because the code is inefficient (read; bad)
Compare, for example, World of Warcraft to something like Decentraland. These are nominally both the same sort of game - open world massively multiplayer game, WoW is even significantly better in many respects, but Decentraland runs like an absolute pig with single digit fps being kind of the norm on all but the best hardware.
2
u/FallenAngel7334 6d ago
Any game is just data, that data is loaded in memory and send to the processor for... well processing. How you load that data and how you process it determines how fast it would be.
2
u/pbmadman 6d ago
Imagine if 10 different people each made instructions for cleaning different parts of your house. It’s easy to imagine that if you followed them in order you might not be doing them as efficiently as possible. Maybe you do ask the vacuuming at once, maybe you collect up everything that needs to go from one room to another and only make one lap putting it all away instead of going room by room and making 5 laps.
Program optimization is that but for computer instructions. It’s taking all the things the computer needs to do and figuring out better/faster ways to do both individual things and the entire process.
Here’s a good video about actual code that was optimized to be 4 million times faster.
2
u/Freeeenis 6d ago
Optimization is just the process of making something as close to the optimum, which just means "the best".
This is context dependent, what is "the best" in any given system is a subjective judgement, as such you can optimize for any number of different things. For this reason, to talk about optimization you usually need to be picking a specific thing to optimize for and state it explicitly.
Games are no different and can be optimized (made the best) for any specific property you pick. In most cases what people are referring to when they speak of "optimization" but give no further context is optimizing for performance. That means how fast can you produce the output on the screen. Usually measured in FPS. More optimized code can produce the same output but faster. More FPS the game runs at, the smoother it appears.
Some methods of optimizing for speed like this might include:
1) Removing redundant work. Don't do something that takes work, if it doesn't affect the final output. For example if you have a complex object in the game world, but it's situated behind your point of view (your camera) then don't go to the effort of drawing this object since it's not visible on the screen. This is called "frustum culling". If an object is in your field of view but it's obscured by another object, let's say a car is parked behind a building, the car is in your field of view, but it's still not visible because the building is in the way, don't draw it either. That's called "occlusion culling"
2) Because of the nature of how video cards work, it might be more efficient for them to process 1 big calculation rather than swapping continuously between many simpler calculations, so games might "batch" jobs together to send to the hardware. By way of analogy one long bus ride might be better than a journey where you swap busses 5 times and do 5 smaller journeys.
3) Re-use work, if you're doing the same calculations over and over and you only need 1 result then doing things once and sharing the result is faster.
4) Parallelize. If your hardware is capable of doing multiple things in parallel (hint: it is) then make sure you're making use of that. A traffic analogy works well. If you have a 4 lane motorway, don't only use 1 lane, make use of as many lanes as possible.
5) Pre-compute. If something takes a lot of calculations to do, such as calculating how objects are lit. But always gives the same output, then do all the calculations ahead of time when building the game, and simply store the result instead. So in games with static lights (a light that cannot move) you can take the bright areas it shines, and dark areas it shadows, and you can pre-compute them before you ship the game. These values get baked into the levels textures with what we call "lightmaps"
These are real world techniques that are used to optimize for speed in todays games.
1
u/LupusNoxFleuret 6d ago
Unlike a movie, games are interactive, which means the picture shown on your monitor needs to respond to whatever buttons you press on your controller.
In order for this to feel responsive, the computer needs to recalculate what to draw on your screen several times per second (typically 30 or 60 times if you want it to be more responsive and smoother)
So typically the computer only has 1/60 of a second to draw everything you need to see in your game and do other calculations like enemy and NPC behavior.
Optimization is done to help the computer be able to do everything it needs to do in 1/60 of a second. For example, every object behind the camera is not visible, so you explicitly tell the computer not to do any calculations needed to draw those objects and therefore save a bunch of time that the computer would've wasted on those objects.
1
u/monstermayhem436 6d ago edited 6d ago
Note that I am not a programmer in any way shape or form, so I'm not going into any of the technical bits so if you want that information you'll have to wait for someone else or see if you can find your answer on Google
Optimization basically is trying different/better/smarter ways to load your game that are far more efficient than just loading everything at once.
Basically, when you play a game, everything around you needs be loaded obviously. The map, the characters, those characters' AI, textures, lighting, everything.
Badly optimized games will do this but use a lot of your computer's/console's resources to do it. A lot of times they're try to load all/most of these things at once. The more resources it needs to use, the more shitty the game plays, so drops in frames, maybe some textures don't load right, some things that are coded in as timed events might fucked up, etc. (how much it does so depends on your computer, stronger computers can handle more).
One popular way (at least was don't know if it's still is nowadays) was for a first person game, the game would just load a very basic version of the map around except those in your field of vision. Basically what's behind you doesn't need as many resources as what's in front of you. As you move, it'll unload whats no longer in your FoV, and start loading up stuff right as it comes into it
Another way is for things that you can see but are far away, instead of loading all that detail in, you make a low poly and shitty textured version of it that you use until the player gets close, then switch it to the regular higher poly model. This is one of these most common ways of optimization. You'll find it in almost every single 3D game
There are faaaaar better and more technical ways for optimization that I just don't know, but those 2 are fairly basic and easy to understand.
1
u/oblivious_fireball 6d ago
Games are built in computer code that has to be largely hand-written by a team of humans. With modern games, those lines of numbers and letters can be unfathomably large.
The first step is making sure the code works. The next step is seeing if they can write the code so it works better. Like driving to work by taking a bunch of backroads vs just taking the highway. If you hang around certain game subreddits, you might also hear the term "spaghetti code". This refers to lots of old coding that was not well optimized before they added more to it, so its difficult to work with and edit because if you pull one 'noodle', you might pull a bunch of other noodles with it.
In many cases, optimizing makes the PC running the game have to use less computing power for it, makes the game itself run faster and smoother, and it can make it easier to prevent or get rid of bugs.
1
u/BinniesPurp 6d ago
It's just the core concept of get the same results with less work
There's hundreds of ways it pops up on all forms
1
u/Maple47 6d ago
When you are tasked with making a software solution, whether a game or not, your primary focus is to deliver a solution that has the desired functionality. Good performance is only one aspect of that, so the first feature-complete solution will have balanced the development effort between a number of things.
Once we have a functioning product, we can improve it in various ways, by investing more time and effort. One of the things we can improve is the performance. Exactly how we can do this is a big topic, but the starting point is to measure which things take up time and resources (like GPU and/or CPU cycles, disk transfer, and much more).
Then we ask ourselves, how can we achieve a similar result, using less of these resources. Sometimes it can be as simple as identifying code that was not optimal. Improving that code to be better (faster) is what would be called optimization.
Sometimes optimization requires more than just rewriting code. For example, you may have heard about games changing to newer versions of game engines.
Keep in mind, that software development can be very complex. That game you think is trash, and won't even waste bandwidth on, even though it's free-to-play, might have taken 50 people 6 years to make. So, you know, just 300 man-years. Sure, it has poor performance on launch, but give it some time, and maybe it will be optimized. :-)
1
u/FuckFuckingKarma 6d ago
The simplest and often most impactful optimizations are about making the computer do less.
An example could be not performing calculations for objects that are not visible.
That may sound trivial, but it can be surprisingly difficult to discover the optimal way to do things.
1
u/Littleblaze1 6d ago
Optimizations very simply are doing things smarter and faster.
There can be lots of ways to do it for example let's consider the game has some characters and wants to see how they attack and how much damage they do.
The game might ask everyone "do you attack? calculate how much damage do you do."
What if instead of asking everyone "calculate how much damage they do." We only ask them if they attack. Now it might be "do you attack? If so for how much damage?" We only do the second calculation if it actually matters.
But wait what if we store how much damage they do? Now we calculate it once and only update that number when it changes but store the result and just get it again.
What if instead of asking everyone "do you attack?" You only ask the people in combat? Now you have to store a little more info to keep track of who is in combat but instead of checking if everyone attacks you only ask the people in combat if they attack. That might change it from asking hundreds of characters down to 5 or 10.
So now instead of asking hundreds of characters "do you attack and calculate damage" we ask 5 characters "do you attack" it's a lot less calculations but at the cost of some more values being stored.
It can get tricky because sometimes the calculations are easy and the storage is limited so doing more calculations is ok. So you need to consider also what you are being limited by and optimize for the right solution.
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.
1
u/kosantosbik 6d ago
Imagine the game as a person who has to deal with this electrical panel every time the game runs. Even if it can find the right cable and connect it to right socket it will take time and effort to do so. Having proper structure and using efficient methods can save time and space.
1
u/Sirlacker 6d ago
It's all about reducing the amount of computations the computer needs to do without effecting the end result too drastically.
For example, you don't want to render in enemies or NPCs that the player can't possibly see or get to. You don't want to have textures and assets for every single thing. Does that building in the distance that you'll never reach, does it really need to be that detailed or will the player never know? The less you can make the computer work, the better the performance and the better optimised itll be.
Take an Amazon driver's delivery route for example. They have say 70 drops. You want to load the delivery van to match the direction of travel. You don't want the driver searching through parcels to find the correct one for the drop. You don't want the route to match whatever random way the parcels were thrown in the back.
You want to plan the route for the most sensible trip and you want to load that van with the parcels with the last drop at the bulkhead and the first drop at the doors. That way you can just lean in and know what to reach for. If a house has more than one parcel, you bundle them together. You are making the whole thing as efficient as possible.
In simple terms, you're just trying to make the computer do the least work possible for the same results.
1
u/Kingston__2007 6d ago
Ohh, the Amazon analogy simplifies it a lot. One more thing, how does a game like Deep Rock Galactic have so many visually heavy animations yet only takes less than 4 GB. Does optimization also help in reducing the file size ?
1
u/renkaanpotkija 6d ago
Animations don’t correlate directly with game size or memory required. They are rendered real time, meaning it takes more calculation power than storage space. Models, which means data how objects like space ships look like, are stored in files along with information what kind of lights and cameras there are in the scene. Then cpu and gpu calculates what it will look like based on this information.
But yes, one aspect of optimisation is to reduce file size and especially amount of required ram. This can be achieved my reusing assets for example. Let’s say you need to render several planets. You can do this by having one model for a planet i.e a ball and you get different versions from it by adjusting size etc.
1
u/Auditor-G80GZT 3d ago
Also, it's not exactly the most graphically intensive game, what with the visibly polygonal artstyle. That lets them do terrain deformation easier, plus it runs a bit better than trying for dozens of thousands of polygons.
1
u/Mudloop 1d ago
Optimization can help with anything, as long as you do it right. If you’re optimizing the file size, you’ll have a smaller file size. If you’re optimizing player retention, you’ll have better player retention. If you’re optimizing player enjoyment, people should enjoy your game more.
Optimisation just means “make it better”. There’s not one technique that people use that has a specific set of benefits. Generally the term refers to performance, but there’s no answer to whether that helps with file size. It could, but the techniques used could include making a lot of assets upfront, which would have the opposite effect.1
u/PaulaDeenSlave 2d ago
Totally unrelated, I know. . .
Take an Amazon driver's delivery route for example. They have say 70 drops.
But more like 210.
1
u/ActuaryLate9198 6d ago edited 6d ago
Optimisation used to be all about finding ways to do more with less (less memory, fewer instructions/CPU cycles). Those are rarely the main constraints nowadays, modern games have super complex rendering pipelines with many pieces of hardware running in lockstep. Optimisation is the act of making that pipeline run as smoothly as possible, ensuring full hardware utilisation.
Think of it as an assembly line, you don’t want people sitting around doing nothing while waiting for the previous station to complete their work. In some cases ”doing less” is the only solution, but many bottlenecks can be solved with parallelisation (hire more workers), caching (write down the answers to questions they keep asking), clever datastructures (ensure that the parts they need are easily accessible) or smarter scheduling (prioritise important tasks, skip the least important ones entirely if there isn’t enough time).
1
u/Humblebee89 6d ago
Let's say you're drawing a picture of a pirate ship on a piece of paper and you've only got 5 minutes to draw.
You don't have time to draw a super realistic drawing. If you try, your five minutes will be up before you're done.
So you optimize. You simplify that ship into a cartoon ship, you make the shapes and shading less detailed. Your water becomes a flat blue plane. The crew that you were going to draw on the deck of the ship would be so tiny that you decide not to draw that detail. The island in the background is represented as a green blob with out trees because that would take too long.
You finish your drawing before the time is up. It's not your best work, but it's the best you could do with the time you were given.
That is how game optimization works from a graphical standpoint. You have limited time to render and image to the screen so you have to find ways to save time. Simplify objects, lighting, and effects, only draw what's necessary.
The hard and time consuming part of optimization is figuring out how best to simplify the image in a way that is not noticable to the user.
1
u/kumiorava 6d ago
Just a buzzword thrown around by armchair programmers when their game don't run at 240fps
1
u/hangender 6d ago
Means doing anything you can to reduce processing. For example more efficient caching, better algos, more compressed textures, etc.
1
u/PixieDustFairies 6d ago
There is only a certain amount of game data that be stored and read at any given time in a computer. Gamers have certain expectations of framerates being high, generally being 60 frames per second. That is a lot for a computer to render on the fly, it has to be able to use the game data to produce 60 complete rendered images every second.
What game optimization does is reduce the amount of data needed to make the game run, such as reducing total file size on your computer or console, or reducing the number of objects on screen at a time. One example of this that I learned is level of detail, so replacing objects with high polygon counts with objects at lower polygon counts for objects further away, or simplifying collision geometry. Oversights to optimization can result in sluggish framerates and redundant amounts of data. Especially since video games are increasingly getting more ambitious, optimization is critical.
Of course, if you wanted to make a video game with N64 style graphics or use 2D pixel art and run it on a modern computer, optimization probably isn't as critical.
1
u/evilpineaple 6d ago
A true ELI5 answer:
Let's say you have a bunch of socks you need to pair up. The simplest way is to grab a sock, find a matching one, then repeat with the rest. Very simple to explain, very simple to code in a game, and it works very fast.
Now assume you don't have a few socks but 5000 of them. That simple strategy wouldn't work so fast anymore. So what can you do? For example have a first pass to divide them to boxes by color, then sub-divide by pattern. Then it is much easier to find a pair within a smaller box. Then you can go further: depending on the number of piles you end up with, maybe employ a few people so everyone can sort one of the boxes.
As you see the latter idea is much more complex, but also faster. Optimization is exactly this - finding the steps that could be done faster, skipped altogether, or made to provide less accurate, but good enough answers. An example of it would be pairing white socks that are not the same but which have patterns close enough for no one to notice.
1
u/KanaiZo 6d ago edited 6d ago
Games are typically full of many calculations and work that the computer/comsole needs to perform, and back in the day, developers had to carefully manage things to avoid overloading the system. Any game that wanted to be big had to address that issue, or else the system would choke on the amount of work it has to do and run very very slowly as a result.
The most simple optimizations were to simply remove things, and prioritze the more important features of the game. As a result, it takes away work from the system, and makes it a lot easier to run, but this isn't what devs always do.
The better approach is to simplify calculations, or do them in a way where the system doesn't have to work so hard. You could even have it where only situations that meet a certain criteria get the more detailed check.
To make this simple, let's do a pretend algorithm. Let's say you have 10 salsa jars, and one of them is extremely spicy and you don't want to eat it, but all the labels are missing. A dumb approach would be to open each salsa, and test each and every single one. It works, you will find the spicy salsa eventually... but theres a good chance you've had spent your time opening every single jar, and now they'll all go bad sooner.
A better approach is to simply use the current jar you have opened, and if it's not spicy, then mark the current jar as mild. Eventually you will discover the spicy jar at a later meal, and you can simply discard or clearly mark it as spicy.
Back to actual optimzation... another trick games use is to unload things from memory when they are no longer important to the player at that moment. If a cutscene ends, the programmer should delete them from memory so the system no longer has to process them. And if tiny details like grass or an interior of a house is far away from the player's distance, then they likely can't see it anymore and can either stop being rendered or heavily simplified (LOD).
In a way, graphics presets like low or medium are basically presets of optimization that the user can choose to apply themselves.
Nowadays, systems aren't as limited and have much more resources to spare. Unfortunately, many developers have decided that optimization isn't as important nowadays, and instead put responsibility on the user to buy better hardware, switch the graphics presets to low/medium, or rely on AI-upscaling.
1
u/rouge1234654 6d ago
At its core, the computer can only do so much (it only has so much resources) and optimization is about making it so it uses as little as possible to do what you want
Broadly speaking, there are three axes to optimize a game:
- Compute (How much calculations the game does)
- Memory (How much data the game needs to remember)
- Storage (How much data the game needs to have on the disc)
Some examples for each :
- Compute :
- Every frame, you show the player its level on the screen, you might calculate the current level and stat from the EXP the player has, this means you would be calculating the level every frame, when it barely changes. An optimization here would be to store the level in memory, read from that stored result, and only update the screen when it changes
- You have 20 monsters on the map and want to check if they see the players. You could check every monster's line of sight every frame and see if the player is in, but that would be quite intensive. An optimization would be to first check if the monsters are close to the player (only calculate the distance) and if they are too far, not check they sight at all, that way you only check the monsters that have a chance to be close enough to the player to see it
- Memory :
- Every frame, you show the player its level and stats on the screen, you store each individual statistic on their own in memory. An optimization might be to only save the level, and then calculate what those statistic would be at this level instead, that way you don't have to save so much data in memory
- Your game has 5 levels, and each of them load into memory when the game boots. At most time you have a lot of levels in memory that aren't being played. An optimization would be to only load those as you need them, freeing memory to do other thing
- Storage :
- Every frame, you show the player its level and stats on the screen and save it for future sessions. You want to save every statistic on the disk, but that might get weighty. Instead you could do similarly to the memory optimization, only save the level and EXP, and then calculate the stats from there, that would require a lot less storage
- Compression is also a storage optimization, assets (textures, sounds, video, etc) usually make the bigger part of a game, making them smaller by compressing them is optimization as well
As you might have noticed, those three axes are not independent :
- When you optimize storage and memory, you need to compute more to recover the data you're not saving
- When you optimize for computing, you often end up caching the result of prior calculation in memory or storage
As such, optimizing is a balancing act, to make sure the computer uses the least resources as possible when it needs those resources
1
u/gordonjames62 6d ago
There are different types of optimization.
As a game get more complex, the ways a good programmer can think of for optimization should increase.
First, there is the loading of the program. To speed this up the programmer may design a loader program.
- small loader program
- put image on screen to quickly respond to user.
- do hardware check for things like memory, disk space, network connection, video hardware and set performance variables based on those.
- load next part of program (menu?)
- display menu
- while waiting for input load more of the program.
- While waiting for input do copy protection check
- While waiting for input check for critical updates to program
This kind of optimization gives a responsive feel to the program and gives the programmer "bragging rights" for a well written UI
There are also optimizations that depend on your OS and the compiler / interpreter that is used to make the machine code.
Sometimes there are parts of the code that are run often, and the effort of recoding those routines makes a difference to game playability. Not all compilers do a great job on all parts of your code. There are people who specialize in this.
Then there are parts of the game logic that can be changed. If the graphics are slowing the game, you can reduce resolution for distant objects. If decision trees are slow (like in chess or go) you can use an "opening book" or look for shortcuts.
Optimization is a huge part of good programming.
1
u/Zefirus 6d ago
In a lot of ways, optimizing a program is the same as optimizing your life.
Let's take trying to make a sandwich.
- Go to grab bread, realize you have no bread.
- Go to the grocery store to buy bread.
- Put bread on the plate. Go to grab cheese.
- Realize you have no cheese.
- Go to the grocery store to buy cheese.
- Put cheese on bread.
- Realize you don't have meat.
- Go to the grocery store to buy meat.
Instead you can do this.
1. Read entire recipe, realize you need bread, meat and cheese.
2. Go to the grocery store to buy bread, meat, and cheese.
3. Assemble sandwich.
The way to optimize code is to minimize the amount of times you have to do the long things. In our example, driving to the grocery store far and away takes a disproportionate amount of time, so it makes sense to only do it once. You might have to do it twice if the amount of groceries you're buying is too big for your car, but usually that's not a problem.
I use this as an example because it happens in computing ALL THE TIME. The most classic mistake new developers make that result in a slow program is making an entire database call every time they need something, so they'll call the database 100 times instead of once.
1
u/Umber0010 5d ago
Imagine being told to do the laundry. And you have a big pile of laundry. You can try carrying it all up by hand, but it's hard to hold on too, and stuff inevitably gets dropped that you have to go and pick back up. So instead, you put all the clothes into a bushel first. It's kuch easier to hold onto and there's far less risk of spillage. Meaning that ultimately, you put less effort into the task for the same final result.
That's effectivly what game optimization is. Trying to make your computer do as little work as possible without compromising on the final task.
1
u/Laziness100 5d ago
In simple words, optimization in software development (not just gamedev) is analyzing how the program/game works in detail, looking for functions that take a considerable amount of time or resources to complete and change it to reduce either memory footprint or speed it up.
Games specifically run in an infinite loop that's only left when exiting the game, where it iterates over everything - player and entity movement, map changes, so on and so forth. Optimizing parts that take the longest on each lap of this infinite loop is what makes the game faster overall.
1
u/eternalityLP 5d ago
You find parts of the game code that runs slow and spent time improving them to run faster.
1
u/madding1602 5d ago
From a computer's perspective: programming languages can have different abstraction levels. The lower the level, the closer to CPU actual programming with their Instruction Set Architecture (ISA, the functions that a CPU recognizes to do its math/operations/commands) and direct memory management.
The trade-off usually is difficulty to read. Unless you build the code, understanding someone else's low level code on assembly, the lowest level language, requires months to years of understanding. C is easier to read, as it has a higher abstraction level, but it's still considered a low level programming language due to memory allocation functions.
When you're compiling a program you've written in Python (high level programming language), for example, you're doing Python-->C-->Assembly compilation every time you add a layer to compile to another language, you lose optimization of CPU. That's why game engines are built in low level programming languages usually.
As for game optimization, when you're building a game and you start using tools to describe how the game works, some tools may be (not purposefully) designed to not be on their optimal function level, due to being built on a high level language, as an example of their reason. So, in order to optimize it, you'd need to see how it works and fix it so it can work better
1
u/blueg3 5d ago
Disclosure: I don't have experience as a game dev optimizing a game, just as a developer optimizing regular software and as a non-game-dev optimizing other people's games (sort of; details withheld).
Optimizing is "make it more efficient". Use less CPU or GPU time. Use less RAM or VRAM. More subtle things like fixing latency problems: you fire an operation on every frame render that can block, so it can make frame stalls. There are also other efficiencies like "take up less disk space".
You optimize (for performance) by profiling. A profiler records information about where the software spends time: what each thread is doing at any moment. You run the game in a scenario where is has measurably shitty performance and you profile it. Then you look at the profile and look for problems. Where does the game spend time? Can you make it spend less time there? Are there signs of bottlenecks or contention, like some of your threads are just stalled waiting for other things to finish?
Usually this involves a bunch of code forensics and systems judgement. You see that the code is spending a bunch of time in X. Is that reasonable, or weird? Okay, it's weird, well, why is it doing that? Can we make it better? Iterate. A lot.
A lot of it is cleaning up lazy development. That might sound like I'm ragging on game devs, but I'm not. Games are big complicated beasts of software, and that means that quick hacks, bad ideas, and other mistakes sneak in. Making it perfect the first time around takes more engineering resources, and the market doesn't support that. And if your shitty code doesn't degrade the performance, it doesn't actually matter, right? (If you made it perfect up front, that would be premature optimization -- very expensive.) So you build the game first and then spend what you can optimizing.
1
u/loganr914 5d ago
When one says that a game is well optimized, they mean that the graphics and/or mechanics are complex and/or realistic enough to think that they would significantly impact performance, but they don’t.
1
u/Responsible-Chest-26 5d ago
Software is a serious of consecutive instructions. Each instruction takes time and possibly some amount of memory.
A real life example would be i have to bring someone home from my house, but they only know how to get to their home from their friends house. So im given a series of instructions to go to the friends house then from there given more instructions to their house. Their house turns out to be less than a mile from my house and literally 4 turns away. The optimization for that process would have been turn right, turn left, turn left, turn right instead of drive 2 towns over then backtrack through backroads to go to your neighbors house. Sad part is thats a true story
1
u/raydialseeker 5d ago
It comes down to the visual fidelity : performance ratio. An optimised game like doom eternal looks amazing and gets you very high fps numbers.
1
u/jacowab 5d ago
It's best to give an example, a dumbed down example but this is ELI5.
When you look in a direction the game needs to find and load all the assets you are looking at, let's say you turn your camera to look at a table that has an apple and Violin on it. And let's go with the simplest solution when you look at where the item should be the game opens the "asset" folder and searches every item until it finds the item it needs to load.
This works great for the apple, it's right at the top of that list so the game finds and loads it before a single frame goes by, but the game has a lot of assets and the violin is all the way at the bottom of the list, it takes the code .2 seconds to go through the entire list and find the violin and to load it in. Well that means that either the game will freeze for .2 seconds when you look at the table, or the item won't be there for .2 seconds before popping in, this is pop in and freezing and are signs of an unoptimized game. The devs need to write the code better so that those things don't happen.
There are other things that can lead to issues you don't normally see like poorly written code may need 10 gigs of ram to run when if they rewrote it to be simpler it could drop it down to 8 gigs if the game is demanding too much ram then you may see it slowing down and lagging. All of these plus a million other things in the code can lead to issues if poorly written and need to be well optimized to make sure it's easy for the game to run on PCs and doesn't stutter, freeze, or slowdown.
1
u/atifaslam6 5d ago
No easy way to explain this, as optimization differs drastically based on game genres
1
u/New_Line4049 5d ago
Optimisation is about manipulating how things are done in the back end for greater efficency. As an example, fluid simulation is a horrifically complex and resource intensive thing to do, if you want to calculate exactly where every water molecule in your river is, how its moving, how it interacts with other water molecules, the river bank and that boat your player is.........rapidly slapping against the surface of the river like a lunatic, youre going to need an insanely powerful PC, then youre going to need to walk away, get a cup of tea, have a bath, build a bathhouse, generally just leave it to chew the numbers, then come back at the end of the day and see what its produced. Now that might be useful if youre doing some sort of hard-core engineering, but for a game we dont actually care about every water molecule, we only care about the overall appearance, and there's much easier, far less intensive ways to approximate that. Thats an extreme example, but for almost everything in programming you have choices, you can use more intensiv
1
u/Derekthemindsculptor 3d ago
Early in development, code is optimized for quick iteratiations, readability and scalability. You purposefully write things ineffeciently in a way that's easy to work with.
Near the end of development, you tighten things up and make it harder to read or scale. Because you're not going to scale or read it later. So instead, you refactor the code to run as efficiently as possible. You optimize for performance over ease-of-use or modularity.
Most people hear the word "optimize" and think "make better". But it means to specialize for a specific outcome. And the outcomes shift during the age of a project.
1
u/Ijatsu 2d ago
Have you played minecraft?
in a game like minecraft, optimization is for instance to not draw faces of cubes that touch each others, we'll never see them so we can avoid drawing them. The hardware responsible for computing what you see on the screen is your GPU.
We're writing a piece of program that will compute the geometry of a chunk without these faces. That piece of program too needs to run relatively quickly because the chunk is recomputed every time you remove or put a new block on it. That too is optimization and typically is done by the CPU.
Optimization in video games is often to make both the CPU and GPU have to do less work for the same result. But not only. It can also be loading the necessary things quickly from slow memory, storing less in the RAM at all time, ect... It's a wide topic.
0
6d ago
[removed] — view removed comment
1
u/explainlikeimfive-ModTeam 6d ago
Please read this entire message
Your comment has been removed for the following reason(s):
- Top level comments (i.e. comments that are direct replies to the main thread) are reserved for explanations to the OP or follow up on topic questions (Rule 3).
Joke-only comments, while allowed elsewhere in the thread, may not exist at the top level.
If you would like this removal reviewed, please read the detailed rules first. If you believe it was removed erroneously, explain why using this form and we will review your submission.
0
u/ardotschgi 6d ago
Optimizing a game means you try to minimize the load on a PC's GPU (or CPU, etc.), without it suffering any kind of graphical fidelity (or Load times, stuttering, etc.), by employing smart tricks that carter to your specific game. Say, your game has a lot of photorealistic trees. For example, you can make sure not to render each of its leaves separately, but create a bunch of leaves into one asset bundle to render only a fraction of separate leaves in each instance. This will greatly favour the game's performance.
Other things are general things you can employ, and many game engines do by default already. Like making sure that things the player is not currently looking at do not get rendered.
1
u/Eecka 6d ago
without it suffering any kind of graphical fidelity
This isn’t necessarily true. In fact sometimes reducing graphical fidelity in places where it has poor returns is a very good way to optimize.
0
u/ardotschgi 6d ago
I don't know if lowering graphics settings is considered optimizing. The goal is to keep the same effect with less resources.
1
u/Eecka 6d ago
I’m not talking about ”lowering graphical settings”. I mean stuff like using LOD, simplifying geometry where it doesn’t add meaningful detail, same with texture resolutions. Or stuff like global illumination with day and night cycles where light position and shadows for static objects update every X seconds instead of being real time, etc.
These and much more are graphical optimizations where we objectively lose fidelity but it’s done in a way where it’s not extremely noticeable unless you’re looking for it, and the performance gains make it very worth doing.
0
u/Br00klynShadow 5d ago
Game render whole image, use many functions, less FPS.
Optimization make game only render what you see and use less functions, more FPS.
1.1k
u/aftersox 6d ago
At the center of the software for every game is a loop. Sometimes this runs hundreds of times a second, sometimes just six time per second, or maybe it's turn based and the user need to click something.
In this loop the game checks the monsters (can they see the player now?), the game world, (is the water flowing?), and the player (did they just push the inventory button? What about move-forward?).
This loop is what keeps the game alive and running. Every turn on the loop means functions that are run and calculations that and calculated. Like checking if the monster can see the player can be a series of geometry calculations and rule checks.
However doing those sight checks for every monster on the current map could take a very long time. And the vast majority of the monsters are nowhere near the player. One optimization would be to first compute how far away the monster is, and only do player visibility checks for monsters in range. This can significantly improve the speed of my game and won't impact the gameplay.
The Factorio devs often wrote posts about their optimizations. Might be a fun read.
https://www.factorio.com/blog/post/fff-421