SlideShare a Scribd company logo
1 of 40
Download to read offline
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

Unity Internals: Memory and Performance
Unity Internals: Memory and PerformanceUnity Internals: Memory and Performance
Unity Internals: Memory and PerformanceDevGAMM Conference
 
How we optimized our Game - Jake & Tess' Finding Monsters Adventure
How we optimized our Game - Jake & Tess' Finding Monsters AdventureHow we optimized our Game - Jake & Tess' Finding Monsters Adventure
How we optimized our Game - Jake & Tess' Finding Monsters AdventureFelipe Lira
 
Graphics Gems from CryENGINE 3 (Siggraph 2013)
Graphics Gems from CryENGINE 3 (Siggraph 2013)Graphics Gems from CryENGINE 3 (Siggraph 2013)
Graphics Gems from CryENGINE 3 (Siggraph 2013)Tiago Sousa
 
Scene Graphs & Component Based Game Engines
Scene Graphs & Component Based Game EnginesScene Graphs & Component Based Game Engines
Scene Graphs & Component Based Game EnginesBryan Duggan
 
Optimizing unity games (Google IO 2014)
Optimizing unity games (Google IO 2014)Optimizing unity games (Google IO 2014)
Optimizing unity games (Google IO 2014)Alexander Dolbilov
 
Rendering AAA-Quality Characters of Project A1
Rendering AAA-Quality Characters of Project A1Rendering AAA-Quality Characters of Project A1
Rendering AAA-Quality Characters of Project A1Ki Hyunwoo
 
Advanced Scenegraph Rendering Pipeline
Advanced Scenegraph Rendering PipelineAdvanced Scenegraph Rendering Pipeline
Advanced Scenegraph Rendering PipelineNarann29
 
Optimization in Unity: simple tips for developing with "no surprises" / Anton...
Optimization in Unity: simple tips for developing with "no surprises" / Anton...Optimization in Unity: simple tips for developing with "no surprises" / Anton...
Optimization in Unity: simple tips for developing with "no surprises" / Anton...DevGAMM Conference
 
[0122 구경원]게임에서의 충돌처리
[0122 구경원]게임에서의 충돌처리[0122 구경원]게임에서의 충돌처리
[0122 구경원]게임에서의 충돌처리KyeongWon Koo
 
Practical Guide for Optimizing Unity on Mobiles
Practical Guide for Optimizing Unity on MobilesPractical Guide for Optimizing Unity on Mobiles
Practical Guide for Optimizing Unity on MobilesValentin Simonov
 
언리얼을 활용한 오브젝트 풀링
언리얼을 활용한 오브젝트 풀링언리얼을 활용한 오브젝트 풀링
언리얼을 활용한 오브젝트 풀링TonyCms
 
[IGC 2016] 넷게임즈 김영희 - Unreal4를 사용해 모바일 프로젝트 제작하기
[IGC 2016] 넷게임즈 김영희 - Unreal4를 사용해 모바일 프로젝트 제작하기[IGC 2016] 넷게임즈 김영희 - Unreal4를 사용해 모바일 프로젝트 제작하기
[IGC 2016] 넷게임즈 김영희 - Unreal4를 사용해 모바일 프로젝트 제작하기강 민우
 
The Rendering Technology of 'Lords of the Fallen' (Game Connection Europe 2014)
The Rendering Technology of 'Lords of the Fallen' (Game Connection Europe 2014)The Rendering Technology of 'Lords of the Fallen' (Game Connection Europe 2014)
The Rendering Technology of 'Lords of the Fallen' (Game Connection Europe 2014)Philip Hammer
 
【Unite Tokyo 2018】実践的なパフォーマンス分析と最適化
【Unite Tokyo 2018】実践的なパフォーマンス分析と最適化【Unite Tokyo 2018】実践的なパフォーマンス分析と最適化
【Unite Tokyo 2018】実践的なパフォーマンス分析と最適化Unity Technologies Japan K.K.
 
Parallel Futures of a Game Engine
Parallel Futures of a Game EngineParallel Futures of a Game Engine
Parallel Futures of a Game EngineJohan Andersson
 
次の世代のインタラクティブレンダリング5つの挑戦と10の滅ぶべき技術
次の世代のインタラクティブレンダリング5つの挑戦と10の滅ぶべき技術 次の世代のインタラクティブレンダリング5つの挑戦と10の滅ぶべき技術
次の世代のインタラクティブレンダリング5つの挑戦と10の滅ぶべき技術 Masafumi Takahashi
 
Future Directions for Compute-for-Graphics
Future Directions for Compute-for-GraphicsFuture Directions for Compute-for-Graphics
Future Directions for Compute-for-GraphicsElectronic Arts / DICE
 
유니티에서 MMD 사용해보기
유니티에서 MMD 사용해보기유니티에서 MMD 사용해보기
유니티에서 MMD 사용해보기flashscope
 
「原神」におけるコンソールプラットフォーム開発
「原神」におけるコンソールプラットフォーム開発「原神」におけるコンソールプラットフォーム開発
「原神」におけるコンソールプラットフォーム開発Unity Technologies Japan K.K.
 
NDC 2010 이은석 - 마비노기 영웅전 포스트모템 2부
NDC 2010 이은석 - 마비노기 영웅전 포스트모템 2부NDC 2010 이은석 - 마비노기 영웅전 포스트모템 2부
NDC 2010 이은석 - 마비노기 영웅전 포스트모템 2부Eunseok Yi
 

What's hot (20)

Unity Internals: Memory and Performance
Unity Internals: Memory and PerformanceUnity Internals: Memory and Performance
Unity Internals: Memory and Performance
 
How we optimized our Game - Jake & Tess' Finding Monsters Adventure
How we optimized our Game - Jake & Tess' Finding Monsters AdventureHow we optimized our Game - Jake & Tess' Finding Monsters Adventure
How we optimized our Game - Jake & Tess' Finding Monsters Adventure
 
Graphics Gems from CryENGINE 3 (Siggraph 2013)
Graphics Gems from CryENGINE 3 (Siggraph 2013)Graphics Gems from CryENGINE 3 (Siggraph 2013)
Graphics Gems from CryENGINE 3 (Siggraph 2013)
 
Scene Graphs & Component Based Game Engines
Scene Graphs & Component Based Game EnginesScene Graphs & Component Based Game Engines
Scene Graphs & Component Based Game Engines
 
Optimizing unity games (Google IO 2014)
Optimizing unity games (Google IO 2014)Optimizing unity games (Google IO 2014)
Optimizing unity games (Google IO 2014)
 
Rendering AAA-Quality Characters of Project A1
Rendering AAA-Quality Characters of Project A1Rendering AAA-Quality Characters of Project A1
Rendering AAA-Quality Characters of Project A1
 
Advanced Scenegraph Rendering Pipeline
Advanced Scenegraph Rendering PipelineAdvanced Scenegraph Rendering Pipeline
Advanced Scenegraph Rendering Pipeline
 
Optimization in Unity: simple tips for developing with "no surprises" / Anton...
Optimization in Unity: simple tips for developing with "no surprises" / Anton...Optimization in Unity: simple tips for developing with "no surprises" / Anton...
Optimization in Unity: simple tips for developing with "no surprises" / Anton...
 
[0122 구경원]게임에서의 충돌처리
[0122 구경원]게임에서의 충돌처리[0122 구경원]게임에서의 충돌처리
[0122 구경원]게임에서의 충돌처리
 
Practical Guide for Optimizing Unity on Mobiles
Practical Guide for Optimizing Unity on MobilesPractical Guide for Optimizing Unity on Mobiles
Practical Guide for Optimizing Unity on Mobiles
 
언리얼을 활용한 오브젝트 풀링
언리얼을 활용한 오브젝트 풀링언리얼을 활용한 오브젝트 풀링
언리얼을 활용한 오브젝트 풀링
 
[IGC 2016] 넷게임즈 김영희 - Unreal4를 사용해 모바일 프로젝트 제작하기
[IGC 2016] 넷게임즈 김영희 - Unreal4를 사용해 모바일 프로젝트 제작하기[IGC 2016] 넷게임즈 김영희 - Unreal4를 사용해 모바일 프로젝트 제작하기
[IGC 2016] 넷게임즈 김영희 - Unreal4를 사용해 모바일 프로젝트 제작하기
 
The Rendering Technology of 'Lords of the Fallen' (Game Connection Europe 2014)
The Rendering Technology of 'Lords of the Fallen' (Game Connection Europe 2014)The Rendering Technology of 'Lords of the Fallen' (Game Connection Europe 2014)
The Rendering Technology of 'Lords of the Fallen' (Game Connection Europe 2014)
 
【Unite Tokyo 2018】実践的なパフォーマンス分析と最適化
【Unite Tokyo 2018】実践的なパフォーマンス分析と最適化【Unite Tokyo 2018】実践的なパフォーマンス分析と最適化
【Unite Tokyo 2018】実践的なパフォーマンス分析と最適化
 
Parallel Futures of a Game Engine
Parallel Futures of a Game EngineParallel Futures of a Game Engine
Parallel Futures of a Game Engine
 
次の世代のインタラクティブレンダリング5つの挑戦と10の滅ぶべき技術
次の世代のインタラクティブレンダリング5つの挑戦と10の滅ぶべき技術 次の世代のインタラクティブレンダリング5つの挑戦と10の滅ぶべき技術
次の世代のインタラクティブレンダリング5つの挑戦と10の滅ぶべき技術
 
Future Directions for Compute-for-Graphics
Future Directions for Compute-for-GraphicsFuture Directions for Compute-for-Graphics
Future Directions for Compute-for-Graphics
 
유니티에서 MMD 사용해보기
유니티에서 MMD 사용해보기유니티에서 MMD 사용해보기
유니티에서 MMD 사용해보기
 
「原神」におけるコンソールプラットフォーム開発
「原神」におけるコンソールプラットフォーム開発「原神」におけるコンソールプラットフォーム開発
「原神」におけるコンソールプラットフォーム開発
 
NDC 2010 이은석 - 마비노기 영웅전 포스트모템 2부
NDC 2010 이은석 - 마비노기 영웅전 포스트모템 2부NDC 2010 이은석 - 마비노기 영웅전 포스트모템 2부
NDC 2010 이은석 - 마비노기 영웅전 포스트모템 2부
 

Similar to Optimizing Large Scenes in Unity with Pooled and Baked Object Pipelines

Unity optimization techniques applied in Catan Universe
Unity optimization techniques applied in Catan UniverseUnity optimization techniques applied in Catan Universe
Unity optimization techniques applied in Catan UniverseExozet Berlin GmbH
 
Heroes of Paragon: publishing Unity WebGL game on Facebook
Heroes of Paragon: publishing Unity WebGL game on FacebookHeroes of Paragon: publishing Unity WebGL game on Facebook
Heroes of Paragon: publishing Unity WebGL game on FacebookDevGAMM Conference
 
Umbra 3 IGDA & Unity Presentation
Umbra 3 IGDA & Unity PresentationUmbra 3 IGDA & Unity Presentation
Umbra 3 IGDA & Unity PresentationThomas Puha
 
Umbra 3 & Unity 3.5 - IGDA Helsinki 2012
Umbra 3 & Unity 3.5 - IGDA Helsinki 2012Umbra 3 & Unity 3.5 - IGDA Helsinki 2012
Umbra 3 & Unity 3.5 - IGDA Helsinki 2012Sampo Lappalainen
 
Ottawa unity user_group_feb13_2015
Ottawa unity user_group_feb13_2015Ottawa unity user_group_feb13_2015
Ottawa unity user_group_feb13_2015Karman Interactive
 
Pharo Status Fosdem 2015
Pharo Status Fosdem 2015Pharo Status Fosdem 2015
Pharo Status Fosdem 2015Marcus Denker
 
Pharo Status (Fosdem 2015)
Pharo Status (Fosdem 2015)Pharo Status (Fosdem 2015)
Pharo Status (Fosdem 2015)Pharo
 
Performance #1: Memory
Performance #1: MemoryPerformance #1: Memory
Performance #1: MemoryYonatan Levin
 
Unite2013-gavilan-pdf
Unite2013-gavilan-pdfUnite2013-gavilan-pdf
Unite2013-gavilan-pdfDavid Gavilan
 
Visibility Optimization for Games
Visibility Optimization for GamesVisibility Optimization for Games
Visibility Optimization for GamesUmbra
 
Visibility Optimization for Games
Visibility Optimization for GamesVisibility Optimization for Games
Visibility Optimization for GamesSampo Lappalainen
 
SPU Physics
SPU PhysicsSPU Physics
SPU PhysicsSlide_N
 
PHP Backends for Real-Time User Interaction using Apache Storm.
PHP Backends for Real-Time User Interaction using Apache Storm.PHP Backends for Real-Time User Interaction using Apache Storm.
PHP Backends for Real-Time User Interaction using Apache Storm.DECK36
 
FGS 2011: Making A Game With Molehill: Zombie Tycoon
FGS 2011: Making A Game With Molehill: Zombie TycoonFGS 2011: Making A Game With Molehill: Zombie Tycoon
FGS 2011: Making A Game With Molehill: Zombie Tycoonmochimedia
 
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法Unite2017Tokyo
 
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法Unity Technologies Japan K.K.
 
Chance's "Visual Effects" Lecture
Chance's "Visual Effects" LectureChance's "Visual Effects" Lecture
Chance's "Visual Effects" Lecturejpowers
 
Physics Solutions for Innovative Game Design
Physics Solutions for Innovative Game DesignPhysics Solutions for Innovative Game Design
Physics Solutions for Innovative Game DesignJohn Wilker
 

Similar to Optimizing Large Scenes in Unity with Pooled and Baked Object Pipelines (20)

Unity optimization techniques applied in Catan Universe
Unity optimization techniques applied in Catan UniverseUnity optimization techniques applied in Catan Universe
Unity optimization techniques applied in Catan Universe
 
Heroes of Paragon: publishing Unity WebGL game on Facebook
Heroes of Paragon: publishing Unity WebGL game on FacebookHeroes of Paragon: publishing Unity WebGL game on Facebook
Heroes of Paragon: publishing Unity WebGL game on Facebook
 
Umbra 3 IGDA & Unity Presentation
Umbra 3 IGDA & Unity PresentationUmbra 3 IGDA & Unity Presentation
Umbra 3 IGDA & Unity Presentation
 
Umbra 3 & Unity 3.5 - IGDA Helsinki 2012
Umbra 3 & Unity 3.5 - IGDA Helsinki 2012Umbra 3 & Unity 3.5 - IGDA Helsinki 2012
Umbra 3 & Unity 3.5 - IGDA Helsinki 2012
 
Ottawa unity user_group_feb13_2015
Ottawa unity user_group_feb13_2015Ottawa unity user_group_feb13_2015
Ottawa unity user_group_feb13_2015
 
Pharo Status Fosdem 2015
Pharo Status Fosdem 2015Pharo Status Fosdem 2015
Pharo Status Fosdem 2015
 
Pharo Status (Fosdem 2015)
Pharo Status (Fosdem 2015)Pharo Status (Fosdem 2015)
Pharo Status (Fosdem 2015)
 
Performance #1: Memory
Performance #1: MemoryPerformance #1: Memory
Performance #1: Memory
 
Unite2013-gavilan-pdf
Unite2013-gavilan-pdfUnite2013-gavilan-pdf
Unite2013-gavilan-pdf
 
Visibility Optimization for Games
Visibility Optimization for GamesVisibility Optimization for Games
Visibility Optimization for Games
 
Visibility Optimization for Games
Visibility Optimization for GamesVisibility Optimization for Games
Visibility Optimization for Games
 
Synthesizing 3d worlds
Synthesizing 3d worldsSynthesizing 3d worlds
Synthesizing 3d worlds
 
Performance #1 memory
Performance #1   memoryPerformance #1   memory
Performance #1 memory
 
SPU Physics
SPU PhysicsSPU Physics
SPU Physics
 
PHP Backends for Real-Time User Interaction using Apache Storm.
PHP Backends for Real-Time User Interaction using Apache Storm.PHP Backends for Real-Time User Interaction using Apache Storm.
PHP Backends for Real-Time User Interaction using Apache Storm.
 
FGS 2011: Making A Game With Molehill: Zombie Tycoon
FGS 2011: Making A Game With Molehill: Zombie TycoonFGS 2011: Making A Game With Molehill: Zombie Tycoon
FGS 2011: Making A Game With Molehill: Zombie Tycoon
 
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
 
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
 
Chance's "Visual Effects" Lecture
Chance's "Visual Effects" LectureChance's "Visual Effects" Lecture
Chance's "Visual Effects" Lecture
 
Physics Solutions for Innovative Game Design
Physics Solutions for Innovative Game DesignPhysics Solutions for Innovative Game Design
Physics Solutions for Innovative Game Design
 

Recently uploaded

(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 

Recently uploaded (20)

DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 

Optimizing Large Scenes in Unity with Pooled and Baked Object Pipelines

  • 1. Optimizing Large Scenes in Unity How we put 5,000 bases on a planet and lived to tell about it Noam Gat Tacticsoft @noamgat
  • 2. Hello! Noam Gat CTO @ Tacticsoft Past - JoyTunes, Omek Interactive, OGRE
  • 3. Earth Arena Case Study Tacticsoft’s upcoming Mobile Strategy MMO Take over the world with your friends! http://www.eartharena.com
  • 4. Earth Arena Case Study 5,000 bases on a planet, with 3 levels of detail and smooth transitions
  • 5. 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
  • 6. Step 1 - Prove the problem
  • 7. Step 1 - Prove the problem Premature optimization is the root of all evil
  • 8. 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
  • 9. 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
  • 10. 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.
  • 11. Stress Test, Take 1 https://youtu.be/fjEkRZsrUSA
  • 12. Step 1 - Prove the problem Not stupid, but naive.
  • 13. Step 2 - Investigate
  • 14. 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
  • 16. 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
  • 17. 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
  • 18. 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)
  • 19. 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
  • 20. Solution problems Baking - When looking at the world from up close, we have 3d models with relatively high poly counts and some with animations
  • 21. Solution The problems never happen at the same time, and we can predict which will happen when.
  • 22. Solution (Artist side) Baked objects go to baking pipeline Instanced objects go to pooling pipeline
  • 23. 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
  • 24. Baked pipeline Not MonoBehaviour, ~ 200 bytes memory Minimal amount of information to render and order
  • 26. Baked pipeline Less batches, much less game objects / components
  • 27. 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
  • 28. Pooled pipeline Which instance to instantiate Where to put it
  • 29. 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
  • 30. 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.
  • 33. “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)
  • 34. Step 4 - Test
  • 39. 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
  • 40. Thank You! Come play our games! http://www.eartharena.com http://www.tacticsoft.net @noamgat