The document discusses game optimization, emphasizing its importance for delivering a smooth gameplay experience across various hardware configurations. Key optimization techniques include reducing textures, utilizing occlusion culling, batching draw calls, implementing levels of detail (LOD), employing lightmapping, adjusting quality settings, and writing clean code. The author, Niraj Vishwakarma, suggests that optimization should begin early in the development process and offers insights on tools like the Unity profiler for performance assessment.
ABout me
Niraj Vishwakarma
FromKolkata
Sr. Game Developer @ Games2Win Pvt. Ltd.
LinkedIn: https://in.linkedin.com/in/niraj-
vishwakarma
Email:
nirajv21@gmail.com
3.
Intro
"Game optimization meansimproving the
game application so it runs at the
smooth framerate across a wide range
of hardware specs, including low-end
configurations.
In this discussion we will discuss
about some common Game optimization
techniques irrespective of what Game
engine you are using.
4.
Why do wecare about game optimization
Answer should be -
To serve the Users with better
gameplay experience and to avoid
user complaints like this
There are tons of devices out there
in market and it becomes
responsibility of the developer to
take care about every possible
hardware configs for maximum reach
and positive user experience.
5.
What is happeningunder the hood
CPU processes the Player
inputs and doing
mathematical and physics
related tasks.
CPU send instructions to the
GPU to render or draw the
frame on the screen.
So the CPU and GPU working
together to bring the game
on the screen with optimal
frames per second (30 fps on
mobile and 60 fps or more on
gaming console).
6.
CPU vs GPU
ACPU with 4 (6 or 10) Cores. A GPU with Thousands of Cores.
7.
Different Game Optimizationtechniques
● Reduce and Combine Textures
● Use Occlusion Culling
● Batching Draw Calls
● Using LOD (Levels of Details)
● Lightmapping
● Tweaking Quality Settings
● Code Optimization
These techniques applicable and
common to all Game engines.
To use NewTexture GPU has to change the Render State to load
New Texture before drawing them on screen.
Render Texture Change Request
Happening for each Separated
Textures which needs to drawn
on screen
Separate Images -
>
10.
Solution : Wecan merge multiple seperated images into Single
Large image known as Sprite-Sheet.
Render Texture Change Request
Happening only once at start
and now it can extract the
required images from the
Loaded Texture
Single Merged
Image ->
Occlusion Culling isa feature that disables drawing of objects when
they are not currently seen by the camera because they are obscured
(occluded) by other objects.
This way we can Avoid -
● Drawing Objects unnecessarily
● Loading Textures for Them
● Calculating effects of lights for them
● Calculating effect of shadows because of them
● etc.
13.
In Game Engineswe can create the Occlusion Data so when the game
runs on target platform it can detect what to render based on the
what camera sees.
Draw Call:
Draw callsare simple plain command
from CPU to GPU to draw something
on Screen with Specific Set of Draw
properties(visual information).Like
Draw a Chair.
SET pass:
SetPass is the process of loading
material data like Textures, Normal
Maps and Shader properties. Like to
Draw the chair it needs to load the
Material data and Textures.
Using lods
(levels ofdetail)
Show Level of quality
depending on distance from
camera.
18.
What is LOD:
LODSare basically different levels
of the same 3d model which we can
enable based on the distance from
the rendering camera.
When some objects are far from the
camera view there is no need to
draw that object in high detail as
it does not make sense. We can use
low quality version of the same
model to draw at that moment and as
the camera comes close we can
promote the quality higher level.
What is lightmapping:
Lightmappingis the process of pre-
calculating the brightness of
surfaces in the Scene. ...
Lightmaps allow you to add global
illumination, shadows, and ambient
lighting at a relatively low
computational cost.
24.
Advantage of lightmaps:
AsLightmaps are precalculated the
GPU does not need to recalculate
effects of lights on the scene ever
frame and it can use the
Precalculated lightmaps for this
purpose which makes the over all
performance more smooth.
How to useQuality Settings:
Game engines provides quality settings that we can tweak to get best possible
results on the target device. Now for example -
For Mobile devices the quality should be Good, while for PC it can be Best and
for the Gaming consoles like Xbox and PS it can be set to Fantastic.
Code optimization:
Few bestpractices for writing optimized and clean codes are:
- Use Game Design patterns
- Using best use Data structure to store and manipulate data
- Use data caching if they are going to be used frequently
- Object Pooling
- Perform physics related calculations at frequent intervals.
- Make use of Threads whenever possible.
31.
At which stagewe should start working on game
optimization ?
Right from the scratch :
- During 3d modeling
- During Texturing
- During UI Development
- During Environment creation
- During coding
32.
Any Specific toolsto detect what causing issue in
performance:
We can make use of Unity Profiler in Unity Game engine.