SlideShare a Scribd company logo
Optimizing Large Scenes in Unity
How we put 5,000 bases on a planet and
lived to tell about it
Noam Gat
Tacticsoft
@noamgat
Hello!
Noam Gat
CTO @ Tacticsoft
Past - JoyTunes, Omek Interactive, OGRE
Earth Arena Case Study
Tacticsoft’s upcoming Mobile Strategy MMO
Take over the world with your friends!
http://www.eartharena.com
Earth Arena Case Study
5,000 bases on a planet, with 3 levels of detail
and smooth transitions
The challenge (today) is not to make a single object
look good, but to make an entire scene run
smoothly
- Frames per second
- Loading Time
- Memory footprint
- Artist pipeline
Scene Management
Step 1 - Prove the problem
Step 1 - Prove the problem
Premature optimization is the
root of all evil
Naive solution
- Instantiate a prefab for every base in the world
- Each object contains 3 LOD objects
- Show / hide object groups based on camera
https://youtu.be/Q2gNauFxwMA
Naive solution
Worked surprisingly well!
- It was faster to disable/enable renderers rather
than game objects
- Started becoming heavy on iPhone 6 with 1k
objects, but was good enough
Test Driven Development (TDD)
Not only about unit tests.
Create a consistent, easy to run, reproducible
environment to check that what you created
meets your expectations.
Stress Test, Take 1
https://youtu.be/fjEkRZsrUSA
Step 1 - Prove the problem
Not stupid, but naive.
Step 2 - Investigate
Step 2 - Investigate
Between the different aspects of the scene, which
one was causing the crash?
- Frames per second
- Loading Time
- Memory footprint
- Artist pipeline
Unity’s Toolset
Benchmarking
A few experiments revealed:
- Unity objects / components cost ~1k per
instance
- 5k objects, 10 GOs/object, 3 components / GO -
> 150k components -> 150MB scene
- Dynamic batching was the biggest CPU hit, and
batching was also becoming a problem
Step 3 - Solve
We wanted a solution that has:
- A stable memory footprint in large worlds
- Good FPS / batching performance
- Looks like the previous solution
- Won’t be a nightmare to control artistically
Solution approaches
Two approaches:
- Pooling - Return out of camera objects to a pool,
reuse them when the camera moves
- Baking - Dynamically a large mesh with many
objects packed together (similar to Unity’s static
batching)
Solution problems
Pooling - When looking at the
world from far away, we see half
of the objects in the world, so
pooling is only a 50% reduction
Solution problems
Baking - When looking at the
world from up close, we have 3d
models with relatively high poly
counts and some with animations
Solution
The problems never happen at the same time, and
we can predict which will happen when.
Solution (Artist side)
Baked objects go
to baking pipeline
Instanced objects go
to pooling pipeline
Array of Structs / Struct of Arrays
- Array of structs is the intuitive way to look at
things (every object has several properties)
- Struct of arrays is a bit weird (several properties
have values for every object)
Struct of arrays allows us to look at a vertical of all
objects (“All baked LOD1 objects”) and do
something special for them
Baked pipeline
Not MonoBehaviour,
~ 200 bytes memory
Minimal amount of
information to
render and order
Baked pipeline
Baked pipeline
Less batches, much less game objects / components
Baked pipeline gotcha
When viewing a lot of sprites from far away, better to
turn off “Tight” sprite packing to allow more sprites in
same amount of geometry
Pooled pipeline
Which instance to
instantiate
Where to put it
Pooled pipeline
Rest of pooled pipeline reiles on previous “camera
culling” method from first naive attempt - instead
of disabling / enabling objects we take / return
them to the pool
Object permutations
The objects have different properties (colors etc)
based on their role in the world.
We do not want a different prefab for each
permutation of each object.
“Visitor” Design Pattern
“Visitor” Design Pattern
“Visitor” Design Pattern
The visitor pattern allows us to easily reuse
prefabs, making modifications as needed in both
the baked and pooled pipelines.
It puts healthy design constraints on what you can
and can’t put on objects placed on the map (MVC
principles etc)
Step 4 - Test
Number of objects
Number of batches
https://youtu.be/Jys5bdeJCtM
Device performance
https://youtu.be/skRCgq093Mc
The future...
https://youtu.be/sOnzYTT793Y
TL;DR
- It’s OK to be naive for 99% of the code
- TDD applies to optimization as well
- Many approaches to solve problems, the
correct one stems from understanding the
problem
- Several design patterns are very useful for
optimization
Thank You!
Come play our games!
http://www.eartharena.com
http://www.tacticsoft.net
@noamgat

More Related Content

What's hot (20)

PDF
Taking Killzone Shadow Fall Image Quality Into The Next Generation
Guerrilla
 
PDF
Advanced Scenegraph Rendering Pipeline
Narann29
 
PDF
Lighting Shading by John Hable
Naughty Dog
 
PPT
NDC2015 유니티 정적 라이팅 이게 최선인가요
Wuwon Yu
 
PPTX
Umg ,이벤트 바인딩, Invaidation Box
대영 노
 
PDF
Getting started with Burst – Unite Copenhagen 2019
Unity Technologies
 
PPTX
Relic's FX System
Daniel Barrero
 
PDF
Ndc2010 전형규 마비노기2 캐릭터 렌더링 기술
henjeon
 
PDF
The Guerrilla Guide to Game Code
Guerrilla
 
PDF
NDC2016 프로젝트 A1의 AAA급 캐릭터 렌더링 기술
Ki Hyunwoo
 
PDF
Deferred Rendering in Killzone 2
Guerrilla
 
PPTX
Recast Detour.pptx
MUUMUMUMU
 
PDF
Game Engine Architecture
Attila Jenei
 
PDF
Siggraph2016 - The Devil is in the Details: idTech 666
Tiago Sousa
 
PDF
Custom fabric shader for unreal engine 4
동석 김
 
PPT
How we optimized our Game - Jake & Tess' Finding Monsters Adventure
Felipe Lira
 
PDF
IndirectDraw with unity
Jung Suk Ko
 
PDF
[NDC 2010] 그럴듯한 랜덤 생성 컨텐츠 만들기
Yongha Kim
 
PDF
전형규, SilvervineUE4Lua: UE4에서 Lua 사용하기, NDC2019
devCAT Studio, NEXON
 
PPTX
Parallel Futures of a Game Engine (v2.0)
repii
 
Taking Killzone Shadow Fall Image Quality Into The Next Generation
Guerrilla
 
Advanced Scenegraph Rendering Pipeline
Narann29
 
Lighting Shading by John Hable
Naughty Dog
 
NDC2015 유니티 정적 라이팅 이게 최선인가요
Wuwon Yu
 
Umg ,이벤트 바인딩, Invaidation Box
대영 노
 
Getting started with Burst – Unite Copenhagen 2019
Unity Technologies
 
Relic's FX System
Daniel Barrero
 
Ndc2010 전형규 마비노기2 캐릭터 렌더링 기술
henjeon
 
The Guerrilla Guide to Game Code
Guerrilla
 
NDC2016 프로젝트 A1의 AAA급 캐릭터 렌더링 기술
Ki Hyunwoo
 
Deferred Rendering in Killzone 2
Guerrilla
 
Recast Detour.pptx
MUUMUMUMU
 
Game Engine Architecture
Attila Jenei
 
Siggraph2016 - The Devil is in the Details: idTech 666
Tiago Sousa
 
Custom fabric shader for unreal engine 4
동석 김
 
How we optimized our Game - Jake & Tess' Finding Monsters Adventure
Felipe Lira
 
IndirectDraw with unity
Jung Suk Ko
 
[NDC 2010] 그럴듯한 랜덤 생성 컨텐츠 만들기
Yongha Kim
 
전형규, SilvervineUE4Lua: UE4에서 Lua 사용하기, NDC2019
devCAT Studio, NEXON
 
Parallel Futures of a Game Engine (v2.0)
repii
 

Similar to Optimizing Large Scenes in Unity (20)

PPTX
Developing and optimizing a procedural game: The Elder Scrolls Blades- Unite ...
Unity Technologies
 
ZIP
Unite2012 Click and Gun - Lighting workflow
Jaroslav Stehlík
 
PDF
Unity optimization techniques applied in Catan Universe
Exozet Berlin GmbH
 
PPTX
Tales from the Optimization Trenches - Unite Copenhagen 2019
Unity Technologies
 
PPT
Umbra 3 IGDA & Unity Presentation
Thomas Puha
 
PPT
Umbra 3 & Unity 3.5 - IGDA Helsinki 2012
Sampo Lappalainen
 
PDF
【Unite 2017 Tokyo】Unity最適化講座 ~スペシャリストが教えるメモリとCPU使用率の負担最小化テクニック~
Unity Technologies Japan K.K.
 
PPTX
Practical Guide for Optimizing Unity on Mobiles
Valentin Simonov
 
PPTX
[Unite Seoul 2020] Mobile Graphics Best Practices for Artists
Owen Wu
 
PPTX
Optimizing mobile applications - Ian Dundore, Mark Harkness
ozlael ozlael
 
PDF
Introduction to Game Programming: Using C# and Unity 3D - Chapter 3 (Preview)
noorcon
 
PDF
Unite2013-gavilan-pdf
David Gavilan
 
PDF
Save System in Garden of the Sea: How to save the state of an open-ended gard...
DevGAMM Conference
 
PPTX
Game optimization techniques - Most Commons
niraj vishwakarma
 
PDF
What the Unity engine documentation does not tell you?
Łukasz Stępniak
 
PDF
【Unite Tokyo 2018】実践的なパフォーマンス分析と最適化
Unity Technologies Japan K.K.
 
PPTX
Terrain in Battlefield 3: A Modern, Complete and Scalable System
Electronic Arts / DICE
 
PPTX
Efficient Scheduling for Dynamic Streaming of 3D Scene for Mobile Devices
Budianto Tandianus
 
PDF
Introduction to Unity by Purdue university
asdf936939
 
Developing and optimizing a procedural game: The Elder Scrolls Blades- Unite ...
Unity Technologies
 
Unite2012 Click and Gun - Lighting workflow
Jaroslav Stehlík
 
Unity optimization techniques applied in Catan Universe
Exozet Berlin GmbH
 
Tales from the Optimization Trenches - Unite Copenhagen 2019
Unity Technologies
 
Umbra 3 IGDA & Unity Presentation
Thomas Puha
 
Umbra 3 & Unity 3.5 - IGDA Helsinki 2012
Sampo Lappalainen
 
【Unite 2017 Tokyo】Unity最適化講座 ~スペシャリストが教えるメモリとCPU使用率の負担最小化テクニック~
Unity Technologies Japan K.K.
 
Practical Guide for Optimizing Unity on Mobiles
Valentin Simonov
 
[Unite Seoul 2020] Mobile Graphics Best Practices for Artists
Owen Wu
 
Optimizing mobile applications - Ian Dundore, Mark Harkness
ozlael ozlael
 
Introduction to Game Programming: Using C# and Unity 3D - Chapter 3 (Preview)
noorcon
 
Unite2013-gavilan-pdf
David Gavilan
 
Save System in Garden of the Sea: How to save the state of an open-ended gard...
DevGAMM Conference
 
Game optimization techniques - Most Commons
niraj vishwakarma
 
What the Unity engine documentation does not tell you?
Łukasz Stępniak
 
【Unite Tokyo 2018】実践的なパフォーマンス分析と最適化
Unity Technologies Japan K.K.
 
Terrain in Battlefield 3: A Modern, Complete and Scalable System
Electronic Arts / DICE
 
Efficient Scheduling for Dynamic Streaming of 3D Scene for Mobile Devices
Budianto Tandianus
 
Introduction to Unity by Purdue university
asdf936939
 
Ad

Recently uploaded (20)

PDF
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 
PDF
Water Design_Manual_2005. KENYA FOR WASTER SUPPLY AND SEWERAGE
DancanNgutuku
 
PDF
MAD Unit - 2 Activity and Fragment Management in Android (Diploma IT)
JappanMavani
 
PDF
Zilliz Cloud Demo for performance and scale
Zilliz
 
PDF
Design Thinking basics for Engineers.pdf
CMR University
 
PPTX
Lecture 1 Shell and Tube Heat exchanger-1.pptx
mailforillegalwork
 
PPTX
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
PDF
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
PPTX
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
PPTX
Server Side Web Development Unit 1 of Nodejs.pptx
sneha852132
 
PPT
PPT2_Metal formingMECHANICALENGINEEIRNG .ppt
Praveen Kumar
 
PPTX
MPMC_Module-2 xxxxxxxxxxxxxxxxxxxxx.pptx
ShivanshVaidya5
 
PPTX
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
PPTX
Arduino Based Gas Leakage Detector Project
CircuitDigest
 
DOCX
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
PPTX
Day2 B2 Best.pptx
helenjenefa1
 
PPTX
Introduction to Design of Machine Elements
PradeepKumarS27
 
PDF
Book.pdf01_Intro.ppt algorithm for preperation stu used
archu26
 
PPTX
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
PDF
6th International Conference on Machine Learning Techniques and Data Science ...
ijistjournal
 
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 
Water Design_Manual_2005. KENYA FOR WASTER SUPPLY AND SEWERAGE
DancanNgutuku
 
MAD Unit - 2 Activity and Fragment Management in Android (Diploma IT)
JappanMavani
 
Zilliz Cloud Demo for performance and scale
Zilliz
 
Design Thinking basics for Engineers.pdf
CMR University
 
Lecture 1 Shell and Tube Heat exchanger-1.pptx
mailforillegalwork
 
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
PORTFOLIO Golam Kibria Khan — architect with a passion for thoughtful design...
MasumKhan59
 
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
Server Side Web Development Unit 1 of Nodejs.pptx
sneha852132
 
PPT2_Metal formingMECHANICALENGINEEIRNG .ppt
Praveen Kumar
 
MPMC_Module-2 xxxxxxxxxxxxxxxxxxxxx.pptx
ShivanshVaidya5
 
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
Arduino Based Gas Leakage Detector Project
CircuitDigest
 
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
Day2 B2 Best.pptx
helenjenefa1
 
Introduction to Design of Machine Elements
PradeepKumarS27
 
Book.pdf01_Intro.ppt algorithm for preperation stu used
archu26
 
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
6th International Conference on Machine Learning Techniques and Data Science ...
ijistjournal
 
Ad

Optimizing Large Scenes in Unity