Lecture 5: Optimization Techniques Flashcards

(14 cards)

1
Q

Optimization

What are some reasons to optimize?

A

Some reasons to optimize could be:
* Runtime Performance
* Build/patch size
* Build time
* Load time
* Pass certification requirements imposed by platfrms
* To increase platform reach
* Reduce battery consumption

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Optimization

What are Memory Budgets?

A

Generally Memory Budget refers to the limited allocation of memory in both runtime (RAM & VRAM) and storage (HDD/SSD) that the game must operate within.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Optimization

What are Storage/Disk budget?

A

They refer to how much space they can take on the HDD or SSD.

They generally contain assets such as textures, models, cutscenes etc.

This budget is limited by playform requirements such as blue-ray size, switch cartridge size or app size limits. (but could also be limited by how long a player wants to wait for the download)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Optimization

What is Runtime memory?

A

Runtime memory refers to how much memory the game can use while running.

There are 2 types of runtime memory:
* RAM (Random Access Memory): general-purpose memory used by the CPU to store data and instructions.
* VRAM (Video RAM): specialized type of memory used by the GPU to store image data, textures and frame buffers needed for rendering graphics.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Optimization

Why should we care about memory?

A

We should care since it allows us to fit our game into devices such as mobile, since they do not have a lot of memory.

It also helps with loading time as well as making room for more content.

If the memory is overloaded it can cause crashes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Optimization

What other budgets are there?

A

Besides Memory budget there are also:
* Time (loading)
* Bandwidth (network)
* Triangles (GPU overhead)
* Among others

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Optimization

When should you Optimize?

A

You should primarily optimize when you have evidence that something is unoptimized.

This can be done by using profiler and document when there are big stutters in frame/ms or check whether it is CPU bund or GPU bound problem among other proofs.

A general rule is to check whether time spent is worth the benefit.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Optimization

What Optimization levels are there?

A

There are two levels of Optimization:
* Micro Optimization: rewrite existing code to be a faster version at the function level.
* System Optimization: Improve or change the overall architecture and design of a system.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Optimization

What are some common Optimization Techniques?

A

Some common optimization techniques could be:
* LOD’s & Imposters
* Asset Streaming
* Baked Lighting
* Frustum and Occlusin Culling
* AI Optimization
* Optimizing shaders

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Optimization

Explain what LOD’s & Imposters are

A

LOD’s (Level of Detail) is a technique that optimizes rendering and performance of 3D models. The further away the 3D object is from the camera the less detailed should the object be.

Imposters are when you take 3D objects and create a flat 2D texture used for far away objects. The 2D texture always face the camera making it appear 3D.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Optimization

Explain what Asset Streaming is

A

Instead of loading assets into memory all at once, this technique dynamically loads and unloads assets based on the player’s position, camera view or game state.

Very common in open world games.
(Example: Marvel’s Spider-Man Fisk mission)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Optimization

Explain what Baked Lighting is

A

Baked Ligting is a technique where you precompute the ligting of static objects and storing this information as lightmaps.

This is used instead of Dynamic lighting, since they are expensive to calculate in real-time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Optimization

Explain Frustum & Occulision Culling

A

Frustum Culling is when you unload things you do not see from the camera but only loads what you need to see.

Occulision Culling is when you unload things behind other objects. The object is still technically there but it unloads from the GPU saving performance.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Optimization

What are some practical Unity Optimization(s)?

A
  • Often a specific solution is better than general ones.
  • You should use one update loop instead of many, since many update loops will affect the performance.
  • Store data in structs instead of classes
  • Thread code rather than single thread

*No algorithm was changed - just the data layour and threading

How well did you know this?
1
Not at all
2
3
4
5
Perfectly