SlideShare a Scribd company logo
1 of 38
Download to read offline
WANG XI GAMES 104 2022
Modern Game Engine - Theory and Practice
Modern Game Engine - Theory and Practice
Lecture 02
Layered Architecture of
Game Engine
Modern Game Engine - Theory and Practice
Sea of Codes
Where to begin?
Modern Game Engine - Theory and Practice
A Glance of Game
Engine Layers
Modern Game Engine - Theory and Practice
Chain of Editors
Tool Layer
Modern Game Engine - Theory and Practice
Make It Visible, Movable and Playable
Rendering
Animation
Physics
Camera, HUD and Input
Script, FSM and AI
Tool Layer
Function Layer
Modern Game Engine - Theory and Practice
Data and Files
Tool Layer
Function Layer
Resource Layer
Scene and Level
Script and Graph
Game Logic Data
Modern Game Engine - Theory and Practice
Animation Physics Render Script Camera
Swiss Knife of Game Engine
Tool Layer
Function Layer
Resource Layer
Core Layer
Modern Game Engine - Theory and Practice
Publishing Platforms
Input Devices
Launch on Different Platforms
Consoles
Tool Layer
Function Layer
Resource Layer
Core Layer
Platform Layer
Operation Systems
Platform File Systems
Graphics API
Platform SDK
…
Modern Game Engine - Theory and Practice
Middleware and 3rd Party Libraries
Tool Layer
Function Layer
Resource Layer
Core Layer
Platform Layer
3
rd
Party
Libraries
Modern Game Engine - Theory and Practice
Explore Game
Engine Layers
Think I’m ready to roll!
Modern Game Engine - Theory and Practice
Practice is the Best Way to Learn
Simple Animated Character Challenge
• Create, animate and render a character
• Playable on selected hardware platforms
I want to build an
animation system
Modern Game Engine - Theory and Practice
Resource - How to Access My Data
Offline Resource Importing
• Unify file access by defining a meta asset file format (ie.ast)
• Assets are faster to access by importing preprocess
• Build a composite asset file to refer to all resources
• GUID is an extra protection of reference
Tool Layer
Function Layer
Resource Layer
Core Layer
Platform Layer
3
rd
Party
Libraries
GUID
texture.ast character.ast mesh.ast animation.ast
Modern Game Engine - Theory and Practice
Resource – Runtime Asset Manager
Runtime Resource Management
• A virtual file system to load/unload assets by path reference
• Manage asset lifespan and reference by handle system
Handle vs. Post Address
Tool Layer
Function Layer
Resource Layer
Core Layer
Platform Layer
3
rd
Party
Libraries
Modern Game Engine - Theory and Practice
Resource – Manage Asset Life Cycle
Memory management for Resources - life cycle
• Different resources have different life cycles
• Limited memory requires release of loaded resources when possible
• Garbage collection and deferred loading is critical features
Tool Layer
Function Layer
Resource Layer
Core Layer
Platform Layer
3
rd
Party
Libraries
Character Scene Cutscene
Modern Game Engine - Theory and Practice
Function - How to Make the World Alive
Physics
Camera
Motor
Character
Controller
Animation
Input
Render
Network.
I/O
Memory
GC
Etc.
Logic
Unbelievably Simple!!!
Tool Layer
Function Layer
Resource Layer
Core Layer
Platform Layer
3
rd
Party
Libraries
• Transmission shaft game_main.
cppvoid tick(int delta_time)
• Endless loop
while (true) { … }
Modern Game Engine - Theory and Practice
Function - Dive into Ticks Tool Layer
Function Layer
Resource Layer
Core Layer
Platform Layer
3
rd
Party
Libraries
Modern Game Engine - Theory and Practice
• In each tick (over-simplified version)
• Fetch animation frame of character
• Drive the skeleton and skin of character
• Renderer process all rendering jobs in an iteration of render tick for each frame
Function -Tick the Animation and Renderer
Tool Layer
Function Layer
Resource Layer
Core Layer
Platform Layer
3
rd
Party
Libraries
Modern Game Engine - Theory and Practice
Function - Heavy-duty Hotchpotch
• Function Layer provides major function modules for the game engine
• Object system (HUGE)
• Game Loop updates the systems periodically
• Game Loop is the key of reading codes of game engines
• Blur the boundary between engine and game
• Camera, character and behavior
• Design extendable engine API for programmer
Tool Layer
Function Layer
Resource Layer
Core Layer
Platform Layer
3
rd
Party
Libraries
Modern Game Engine - Theory and Practice
Advanced
JOB System
Entry
Fixed Thread
Mainstream
Thread Fork/Join
RenderThread
LogicThread
SimulationThre
ad
Visibility GBuffer Shadow Lighting Transparent PostProcess UI
Lua AI Motor …
LOD Animation Physics Particle …
WorkThread
WorkThread
WorkThread
WorkThread
WorkThread
WorkThread
RenderThread
LogicThread
SimulationThre
ad
Visibili
ty
Shadow Lighting
Transpare
nt
PostProce
ss
U
I
AI
Mot
or
…
LOD
Animati
on
…
WorkThread
WorkThread
WorkThread
Visibili
ty
GBuffer
Mot
or
Mot
or
Animati
on
Animati
on
Animati
on
Animati
on
U
I
U
I
U
I
Mot
or
Mot
or
Visibili
ty
Visibil
ity Lua Shadow Lighting
PostProce
ss
…
LOD
Animati
on
Physics
Visibil
ity
Motor
UI
Mot
or
Animati
on
Animati
on
Animati
on
AI
UI
Mot
or
Mot
or
Visibil
ity
GBuffer
Shado
w
Particl
e
Particle …
LOD GBuffer
Animati
on
Particl
e
Particl
e
UI …
Particle
AI Physics UI …
…
Transpare
nt
Physics Particle
Lua
Function - Multi-Threading
Multi-Core CPU
Tool Layer
Function Layer
Resource Layer
Core Layer
Platform Layer
3
rd
Party
Libraries
• Multi-core processors become the mainstream
• Many systems in game engine are built for parallelism
Modern Game Engine - Theory and Practice
Core - Math Library
Tool Layer
Function Layer
Resource Layer
Core Layer
Platform Layer
3
rd
Party
Libraries
Linear algebra
• Rotation, translation,
scaling
• Matrix splines,
quaternion
Modern Game Engine - Theory and Practice
Core - Math Efficiency
SIMD
Quake III Engine
Quick and dirty hacks
• Carmack’s 1/sqrt(x)
• Magic number!
Tool Layer
Function Layer
Resource Layer
Core Layer
Platform Layer
3
rd
Party
Libraries
Modern Game Engine - Theory and Practice
Core - Data Structure and Containers
• Vectors, maps, trees, etc.
• Customized outperforms STL
• Avoid FRAGMENT memory!
• Skeleton tree
• Animation frame sequence
Tool Layer
Function Layer
Resource Layer
Core Layer
Platform Layer
3
rd
Party
Libraries
Modern Game Engine - Theory and Practice
Core - Memory Management
• Major bottlenecks of game engine performance
• Memory Pool / Allocator
• Reduce cache miss
• Memory alignment
• Polymorphic Memory Resource (PMR)
• Cache locality/diffusion
• Memory Arena
• Put data together
• Access data in order
• Allocate and de-allocate as a block
Tool Layer
Function Layer
Resource Layer
Core Layer
Platform Layer
3
rd
Party
Libraries
Modern Game Engine - Theory and Practice
Core - Foundation of Game Engine
• Core layers provide utilities needed in various function modules
• Super high performance design and implementation
• High standard of coding
Tool Layer
Function Layer
Resource Layer
Core Layer
Platform Layer
3
rd
Party
Libraries
Modern Game Engine - Theory and Practice
Compatibility of different platforms, provides platform-independent
services and information for upper layers
• File system
• Path: Slash/backslash, Environment variables
• Directory Traversal
Platform - Target on Different Platform
Time to show off
Tool Layer
Function Layer
Resource Layer
Core Layer
Platform Layer
3
rd
Party
Libraries
S:Main FolderFolder1Folder2FinalFolder
/Volumes/Share/Main Folder/Folder1/Folder2/FinalFolder
Modern Game Engine - Theory and Practice
Platform - Graphics API
Render Hardware Interface (RHI)
• Transparent different GPU architectures and SDK
• Automatic optimization of target platforms
Tool Layer
Function Layer
Resource Layer
Core Layer
Platform Layer
3
rd
Party
Libraries
Modern Game Engine - Theory and Practice
Platform - Hardware Architecture
• Core variants: PPU and SPUs
• UMA: unified memory access
Tool Layer
Function Layer
Resource Layer
Core Layer
Platform Layer
3
rd
Party
Libraries
Modern Game Engine - Theory and Practice
Tool - Allow Anyone to Create Game
Unleash the Creativity
• Build upon game engine
• Create, edit and exchange game play assets
UI Editor
Logical Editor
Shader Editor
Animation Editor
Flexible of coding languages
Level Editor
Tool Layer
Function Layer
Resource Layer
Core Layer
Platform Layer
3
rd
Party
Libraries
Modern Game Engine - Theory and Practice
Tool - Digital Content Creation
Game Engine
Game
Tool Layer
Function Layer
Resource Layer
Core Layer
Platform Layer
3
rd
Party
Libraries
DCC
Editors
Asset
Conditioning
Pipeline
Modern Game Engine - Theory and Practice
Why Layered Architecture?
Decoupling and Reducing Complexity
• Lower layers are independent from upper layers
• Upper layers don’t know how lower layers are implemented
Response for Evolving Demands
• Upper layers evolve fast, but lower layers are stable
Tool Layer
Function Layer
Resource Layer
Core Layer
Platform Layer
3
rd
Party
Libraries
Modern Game Engine - Theory and Practice
Mini Engine- Pilot
Modern Game Engine - Theory and Practice
Neat PILOT Engine
Build by C /C++
• Runtime: ~13,000 lines
• Editor: ~2,000 lines
Follow Engine Layers
• Source code still improving
Support Platform
• Windows
• Linux
• MacOS (working on M1)
Modern Game Engine - Theory and Practice
PILOT Editor and Runtime
Basic Editing
• Add/Delete objects
• Move/Scale/Rotate objects
Simple Functions
• Character control
• Camera
Modern Game Engine - Theory and Practice
Release Plan
1st Release (3/25/2022)
• Editor
• Character/Camera
• Renderer
• Resource system
• Play in editor (PIE)
To be Released with Course
• Animation system
• Collision System
• Gameplay and script systems
• Simple parameter editing
• More graphics features
• …
How to download
• https://github.com/BoomingTech/Pilot simple ECS framework
Modern Game Engine - Theory and Practice
Takeaways
• Engine is designed with a layered architecture
• Lower levels are more stable and upper levels are more customizable
• Virtual world is composed by a set of clocks - ticks
Lecture 02 Contributor
PILOT Engine Contributor
- 一将
- Hoya
- 喵小君
- 呆呆兽
- Olorin
- 靓仔
- 爵爷
- Jason
- 砚书
- BOOK
- MANDY
- 俗哥
- 金大壮
- Leon
- 梨叔
- Shine
- 邓导
- Judy
- QIUU
- C佬
- 阿乐
- 阿熊
- CC
- 大喷
- 靓仔
- 达啦崩吧
- Shy
- Adam
- 人工非智能
- KUN
- o果蝇o
- 弥漫
- 陈皮
Modern Game Engine - Theory and Practice
Enjoy;)
Coding
Please scan here to let
us know what you think
Course Survey
Course Wechat
Please follow us for
further information
Modern Game Engine - Theory and Practice
Modern Game Engine - Theory and Practice
Please note that all videos and images and other media
are cited from the Internet for demonstration only.

More Related Content

Similar to Lecture 02: Layered Architecture of Game Engine | GAMES104 - Modern Game Engine: Theory and Practice

De Re PlayStation Vita
De Re PlayStation VitaDe Re PlayStation Vita
De Re PlayStation VitaSlide_N
 
AWS re:Invent 2016: [REPEAT] How EA Leveraged Amazon Redshift and AWS Partner...
AWS re:Invent 2016: [REPEAT] How EA Leveraged Amazon Redshift and AWS Partner...AWS re:Invent 2016: [REPEAT] How EA Leveraged Amazon Redshift and AWS Partner...
AWS re:Invent 2016: [REPEAT] How EA Leveraged Amazon Redshift and AWS Partner...Amazon Web Services
 
AWS re:Invent 2016| GAM301 | How EA Leveraged Amazon Redshift and AWS Partner...
AWS re:Invent 2016| GAM301 | How EA Leveraged Amazon Redshift and AWS Partner...AWS re:Invent 2016| GAM301 | How EA Leveraged Amazon Redshift and AWS Partner...
AWS re:Invent 2016| GAM301 | How EA Leveraged Amazon Redshift and AWS Partner...Amazon Web Services
 
Game server development in node.js in jsconf eu
Game server development in node.js in jsconf euGame server development in node.js in jsconf eu
Game server development in node.js in jsconf euXie ChengChao
 
Supersize your production pipe enjmin 2013 v1.1 hd
Supersize your production pipe    enjmin 2013 v1.1 hdSupersize your production pipe    enjmin 2013 v1.1 hd
Supersize your production pipe enjmin 2013 v1.1 hdslantsixgames
 
Using The New Flash Stage3D Web Technology To Build Your Own Next 3D Browser ...
Using The New Flash Stage3D Web Technology To Build Your Own Next 3D Browser ...Using The New Flash Stage3D Web Technology To Build Your Own Next 3D Browser ...
Using The New Flash Stage3D Web Technology To Build Your Own Next 3D Browser ...Daosheng Mu
 
Strata NY 2017 Parquet Arrow roadmap
Strata NY 2017 Parquet Arrow roadmapStrata NY 2017 Parquet Arrow roadmap
Strata NY 2017 Parquet Arrow roadmapJulien Le Dem
 
Programming on Windows 8.1: The New Stream and Storage Paradigm (Raffaele Ria...
Programming on Windows 8.1: The New Stream and Storage Paradigm (Raffaele Ria...Programming on Windows 8.1: The New Stream and Storage Paradigm (Raffaele Ria...
Programming on Windows 8.1: The New Stream and Storage Paradigm (Raffaele Ria...ITCamp
 
ITCamp 2013 - Raffaele Rialdi - Windows Runtime (WinRT) deep dive
ITCamp 2013 - Raffaele Rialdi - Windows Runtime (WinRT) deep diveITCamp 2013 - Raffaele Rialdi - Windows Runtime (WinRT) deep dive
ITCamp 2013 - Raffaele Rialdi - Windows Runtime (WinRT) deep diveITCamp
 
Modern Data Stack for Game Analytics / Dmitry Anoshin (Microsoft Gaming, The ...
Modern Data Stack for Game Analytics / Dmitry Anoshin (Microsoft Gaming, The ...Modern Data Stack for Game Analytics / Dmitry Anoshin (Microsoft Gaming, The ...
Modern Data Stack for Game Analytics / Dmitry Anoshin (Microsoft Gaming, The ...DevGAMM Conference
 
Parallelizing Conqueror's Blade
Parallelizing Conqueror's BladeParallelizing Conqueror's Blade
Parallelizing Conqueror's BladeIntel® Software
 
FrameGraph: Extensible Rendering Architecture in Frostbite
FrameGraph: Extensible Rendering Architecture in FrostbiteFrameGraph: Extensible Rendering Architecture in Frostbite
FrameGraph: Extensible Rendering Architecture in FrostbiteElectronic Arts / DICE
 
Threading Successes 03 Gamebryo
Threading Successes 03   GamebryoThreading Successes 03   Gamebryo
Threading Successes 03 Gamebryoguest40fc7cd
 
Benefits/tutorial of Lua in games
Benefits/tutorial of Lua in gamesBenefits/tutorial of Lua in games
Benefits/tutorial of Lua in gamesaction.vn
 
Deep Dive: Amazon Lumberyard & Amazon GameLift
Deep Dive: Amazon Lumberyard & Amazon GameLiftDeep Dive: Amazon Lumberyard & Amazon GameLift
Deep Dive: Amazon Lumberyard & Amazon GameLiftAmazon Web Services
 
SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...
SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...
SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...Chester Chen
 
OGDC2012 Lua In Game_Mr. Van, Nguyen Ngoc
OGDC2012 Lua In Game_Mr. Van, Nguyen NgocOGDC2012 Lua In Game_Mr. Van, Nguyen Ngoc
OGDC2012 Lua In Game_Mr. Van, Nguyen NgocBuff Nguyen
 
Energy efficient AI workload partitioning on multi-core systems
Energy efficient AI workload partitioning on multi-core systemsEnergy efficient AI workload partitioning on multi-core systems
Energy efficient AI workload partitioning on multi-core systemsDeepak Shankar
 
West Coast DevCon 2014: Engine Overview - A Programmers Glimpse at UE4
West Coast DevCon 2014: Engine Overview - A Programmers Glimpse at UE4West Coast DevCon 2014: Engine Overview - A Programmers Glimpse at UE4
West Coast DevCon 2014: Engine Overview - A Programmers Glimpse at UE4Gerke Max Preussner
 

Similar to Lecture 02: Layered Architecture of Game Engine | GAMES104 - Modern Game Engine: Theory and Practice (20)

De Re PlayStation Vita
De Re PlayStation VitaDe Re PlayStation Vita
De Re PlayStation Vita
 
AWS re:Invent 2016: [REPEAT] How EA Leveraged Amazon Redshift and AWS Partner...
AWS re:Invent 2016: [REPEAT] How EA Leveraged Amazon Redshift and AWS Partner...AWS re:Invent 2016: [REPEAT] How EA Leveraged Amazon Redshift and AWS Partner...
AWS re:Invent 2016: [REPEAT] How EA Leveraged Amazon Redshift and AWS Partner...
 
AWS re:Invent 2016| GAM301 | How EA Leveraged Amazon Redshift and AWS Partner...
AWS re:Invent 2016| GAM301 | How EA Leveraged Amazon Redshift and AWS Partner...AWS re:Invent 2016| GAM301 | How EA Leveraged Amazon Redshift and AWS Partner...
AWS re:Invent 2016| GAM301 | How EA Leveraged Amazon Redshift and AWS Partner...
 
Game server development in node.js in jsconf eu
Game server development in node.js in jsconf euGame server development in node.js in jsconf eu
Game server development in node.js in jsconf eu
 
Supersize your production pipe enjmin 2013 v1.1 hd
Supersize your production pipe    enjmin 2013 v1.1 hdSupersize your production pipe    enjmin 2013 v1.1 hd
Supersize your production pipe enjmin 2013 v1.1 hd
 
Using The New Flash Stage3D Web Technology To Build Your Own Next 3D Browser ...
Using The New Flash Stage3D Web Technology To Build Your Own Next 3D Browser ...Using The New Flash Stage3D Web Technology To Build Your Own Next 3D Browser ...
Using The New Flash Stage3D Web Technology To Build Your Own Next 3D Browser ...
 
Strata NY 2017 Parquet Arrow roadmap
Strata NY 2017 Parquet Arrow roadmapStrata NY 2017 Parquet Arrow roadmap
Strata NY 2017 Parquet Arrow roadmap
 
Programming on Windows 8.1: The New Stream and Storage Paradigm (Raffaele Ria...
Programming on Windows 8.1: The New Stream and Storage Paradigm (Raffaele Ria...Programming on Windows 8.1: The New Stream and Storage Paradigm (Raffaele Ria...
Programming on Windows 8.1: The New Stream and Storage Paradigm (Raffaele Ria...
 
ITCamp 2013 - Raffaele Rialdi - Windows Runtime (WinRT) deep dive
ITCamp 2013 - Raffaele Rialdi - Windows Runtime (WinRT) deep diveITCamp 2013 - Raffaele Rialdi - Windows Runtime (WinRT) deep dive
ITCamp 2013 - Raffaele Rialdi - Windows Runtime (WinRT) deep dive
 
Modern Data Stack for Game Analytics / Dmitry Anoshin (Microsoft Gaming, The ...
Modern Data Stack for Game Analytics / Dmitry Anoshin (Microsoft Gaming, The ...Modern Data Stack for Game Analytics / Dmitry Anoshin (Microsoft Gaming, The ...
Modern Data Stack for Game Analytics / Dmitry Anoshin (Microsoft Gaming, The ...
 
Parallelizing Conqueror's Blade
Parallelizing Conqueror's BladeParallelizing Conqueror's Blade
Parallelizing Conqueror's Blade
 
FrameGraph: Extensible Rendering Architecture in Frostbite
FrameGraph: Extensible Rendering Architecture in FrostbiteFrameGraph: Extensible Rendering Architecture in Frostbite
FrameGraph: Extensible Rendering Architecture in Frostbite
 
Threading Successes 03 Gamebryo
Threading Successes 03   GamebryoThreading Successes 03   Gamebryo
Threading Successes 03 Gamebryo
 
Benefits/tutorial of Lua in games
Benefits/tutorial of Lua in gamesBenefits/tutorial of Lua in games
Benefits/tutorial of Lua in games
 
Deep Dive: Amazon Lumberyard & Amazon GameLift
Deep Dive: Amazon Lumberyard & Amazon GameLiftDeep Dive: Amazon Lumberyard & Amazon GameLift
Deep Dive: Amazon Lumberyard & Amazon GameLift
 
SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...
SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...
SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...
 
OGDC2012 Lua In Game_Mr. Van, Nguyen Ngoc
OGDC2012 Lua In Game_Mr. Van, Nguyen NgocOGDC2012 Lua In Game_Mr. Van, Nguyen Ngoc
OGDC2012 Lua In Game_Mr. Van, Nguyen Ngoc
 
H2020-AHTOOLS Use Case 3 Functional Design
H2020-AHTOOLS Use Case 3 Functional DesignH2020-AHTOOLS Use Case 3 Functional Design
H2020-AHTOOLS Use Case 3 Functional Design
 
Energy efficient AI workload partitioning on multi-core systems
Energy efficient AI workload partitioning on multi-core systemsEnergy efficient AI workload partitioning on multi-core systems
Energy efficient AI workload partitioning on multi-core systems
 
West Coast DevCon 2014: Engine Overview - A Programmers Glimpse at UE4
West Coast DevCon 2014: Engine Overview - A Programmers Glimpse at UE4West Coast DevCon 2014: Engine Overview - A Programmers Glimpse at UE4
West Coast DevCon 2014: Engine Overview - A Programmers Glimpse at UE4
 

Recently uploaded

SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 

Recently uploaded (20)

SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 

Lecture 02: Layered Architecture of Game Engine | GAMES104 - Modern Game Engine: Theory and Practice

  • 1. WANG XI GAMES 104 2022 Modern Game Engine - Theory and Practice Modern Game Engine - Theory and Practice Lecture 02 Layered Architecture of Game Engine
  • 2. Modern Game Engine - Theory and Practice Sea of Codes Where to begin?
  • 3. Modern Game Engine - Theory and Practice A Glance of Game Engine Layers
  • 4. Modern Game Engine - Theory and Practice Chain of Editors Tool Layer
  • 5. Modern Game Engine - Theory and Practice Make It Visible, Movable and Playable Rendering Animation Physics Camera, HUD and Input Script, FSM and AI Tool Layer Function Layer
  • 6. Modern Game Engine - Theory and Practice Data and Files Tool Layer Function Layer Resource Layer Scene and Level Script and Graph Game Logic Data
  • 7. Modern Game Engine - Theory and Practice Animation Physics Render Script Camera Swiss Knife of Game Engine Tool Layer Function Layer Resource Layer Core Layer
  • 8. Modern Game Engine - Theory and Practice Publishing Platforms Input Devices Launch on Different Platforms Consoles Tool Layer Function Layer Resource Layer Core Layer Platform Layer Operation Systems Platform File Systems Graphics API Platform SDK …
  • 9. Modern Game Engine - Theory and Practice Middleware and 3rd Party Libraries Tool Layer Function Layer Resource Layer Core Layer Platform Layer 3 rd Party Libraries
  • 10. Modern Game Engine - Theory and Practice Explore Game Engine Layers Think I’m ready to roll!
  • 11. Modern Game Engine - Theory and Practice Practice is the Best Way to Learn Simple Animated Character Challenge • Create, animate and render a character • Playable on selected hardware platforms I want to build an animation system
  • 12. Modern Game Engine - Theory and Practice Resource - How to Access My Data Offline Resource Importing • Unify file access by defining a meta asset file format (ie.ast) • Assets are faster to access by importing preprocess • Build a composite asset file to refer to all resources • GUID is an extra protection of reference Tool Layer Function Layer Resource Layer Core Layer Platform Layer 3 rd Party Libraries GUID texture.ast character.ast mesh.ast animation.ast
  • 13. Modern Game Engine - Theory and Practice Resource – Runtime Asset Manager Runtime Resource Management • A virtual file system to load/unload assets by path reference • Manage asset lifespan and reference by handle system Handle vs. Post Address Tool Layer Function Layer Resource Layer Core Layer Platform Layer 3 rd Party Libraries
  • 14. Modern Game Engine - Theory and Practice Resource – Manage Asset Life Cycle Memory management for Resources - life cycle • Different resources have different life cycles • Limited memory requires release of loaded resources when possible • Garbage collection and deferred loading is critical features Tool Layer Function Layer Resource Layer Core Layer Platform Layer 3 rd Party Libraries Character Scene Cutscene
  • 15. Modern Game Engine - Theory and Practice Function - How to Make the World Alive Physics Camera Motor Character Controller Animation Input Render Network. I/O Memory GC Etc. Logic Unbelievably Simple!!! Tool Layer Function Layer Resource Layer Core Layer Platform Layer 3 rd Party Libraries • Transmission shaft game_main. cppvoid tick(int delta_time) • Endless loop while (true) { … }
  • 16. Modern Game Engine - Theory and Practice Function - Dive into Ticks Tool Layer Function Layer Resource Layer Core Layer Platform Layer 3 rd Party Libraries
  • 17. Modern Game Engine - Theory and Practice • In each tick (over-simplified version) • Fetch animation frame of character • Drive the skeleton and skin of character • Renderer process all rendering jobs in an iteration of render tick for each frame Function -Tick the Animation and Renderer Tool Layer Function Layer Resource Layer Core Layer Platform Layer 3 rd Party Libraries
  • 18. Modern Game Engine - Theory and Practice Function - Heavy-duty Hotchpotch • Function Layer provides major function modules for the game engine • Object system (HUGE) • Game Loop updates the systems periodically • Game Loop is the key of reading codes of game engines • Blur the boundary between engine and game • Camera, character and behavior • Design extendable engine API for programmer Tool Layer Function Layer Resource Layer Core Layer Platform Layer 3 rd Party Libraries
  • 19. Modern Game Engine - Theory and Practice Advanced JOB System Entry Fixed Thread Mainstream Thread Fork/Join RenderThread LogicThread SimulationThre ad Visibility GBuffer Shadow Lighting Transparent PostProcess UI Lua AI Motor … LOD Animation Physics Particle … WorkThread WorkThread WorkThread WorkThread WorkThread WorkThread RenderThread LogicThread SimulationThre ad Visibili ty Shadow Lighting Transpare nt PostProce ss U I AI Mot or … LOD Animati on … WorkThread WorkThread WorkThread Visibili ty GBuffer Mot or Mot or Animati on Animati on Animati on Animati on U I U I U I Mot or Mot or Visibili ty Visibil ity Lua Shadow Lighting PostProce ss … LOD Animati on Physics Visibil ity Motor UI Mot or Animati on Animati on Animati on AI UI Mot or Mot or Visibil ity GBuffer Shado w Particl e Particle … LOD GBuffer Animati on Particl e Particl e UI … Particle AI Physics UI … … Transpare nt Physics Particle Lua Function - Multi-Threading Multi-Core CPU Tool Layer Function Layer Resource Layer Core Layer Platform Layer 3 rd Party Libraries • Multi-core processors become the mainstream • Many systems in game engine are built for parallelism
  • 20. Modern Game Engine - Theory and Practice Core - Math Library Tool Layer Function Layer Resource Layer Core Layer Platform Layer 3 rd Party Libraries Linear algebra • Rotation, translation, scaling • Matrix splines, quaternion
  • 21. Modern Game Engine - Theory and Practice Core - Math Efficiency SIMD Quake III Engine Quick and dirty hacks • Carmack’s 1/sqrt(x) • Magic number! Tool Layer Function Layer Resource Layer Core Layer Platform Layer 3 rd Party Libraries
  • 22. Modern Game Engine - Theory and Practice Core - Data Structure and Containers • Vectors, maps, trees, etc. • Customized outperforms STL • Avoid FRAGMENT memory! • Skeleton tree • Animation frame sequence Tool Layer Function Layer Resource Layer Core Layer Platform Layer 3 rd Party Libraries
  • 23. Modern Game Engine - Theory and Practice Core - Memory Management • Major bottlenecks of game engine performance • Memory Pool / Allocator • Reduce cache miss • Memory alignment • Polymorphic Memory Resource (PMR) • Cache locality/diffusion • Memory Arena • Put data together • Access data in order • Allocate and de-allocate as a block Tool Layer Function Layer Resource Layer Core Layer Platform Layer 3 rd Party Libraries
  • 24. Modern Game Engine - Theory and Practice Core - Foundation of Game Engine • Core layers provide utilities needed in various function modules • Super high performance design and implementation • High standard of coding Tool Layer Function Layer Resource Layer Core Layer Platform Layer 3 rd Party Libraries
  • 25. Modern Game Engine - Theory and Practice Compatibility of different platforms, provides platform-independent services and information for upper layers • File system • Path: Slash/backslash, Environment variables • Directory Traversal Platform - Target on Different Platform Time to show off Tool Layer Function Layer Resource Layer Core Layer Platform Layer 3 rd Party Libraries S:Main FolderFolder1Folder2FinalFolder /Volumes/Share/Main Folder/Folder1/Folder2/FinalFolder
  • 26. Modern Game Engine - Theory and Practice Platform - Graphics API Render Hardware Interface (RHI) • Transparent different GPU architectures and SDK • Automatic optimization of target platforms Tool Layer Function Layer Resource Layer Core Layer Platform Layer 3 rd Party Libraries
  • 27. Modern Game Engine - Theory and Practice Platform - Hardware Architecture • Core variants: PPU and SPUs • UMA: unified memory access Tool Layer Function Layer Resource Layer Core Layer Platform Layer 3 rd Party Libraries
  • 28. Modern Game Engine - Theory and Practice Tool - Allow Anyone to Create Game Unleash the Creativity • Build upon game engine • Create, edit and exchange game play assets UI Editor Logical Editor Shader Editor Animation Editor Flexible of coding languages Level Editor Tool Layer Function Layer Resource Layer Core Layer Platform Layer 3 rd Party Libraries
  • 29. Modern Game Engine - Theory and Practice Tool - Digital Content Creation Game Engine Game Tool Layer Function Layer Resource Layer Core Layer Platform Layer 3 rd Party Libraries DCC Editors Asset Conditioning Pipeline
  • 30. Modern Game Engine - Theory and Practice Why Layered Architecture? Decoupling and Reducing Complexity • Lower layers are independent from upper layers • Upper layers don’t know how lower layers are implemented Response for Evolving Demands • Upper layers evolve fast, but lower layers are stable Tool Layer Function Layer Resource Layer Core Layer Platform Layer 3 rd Party Libraries
  • 31. Modern Game Engine - Theory and Practice Mini Engine- Pilot
  • 32. Modern Game Engine - Theory and Practice Neat PILOT Engine Build by C /C++ • Runtime: ~13,000 lines • Editor: ~2,000 lines Follow Engine Layers • Source code still improving Support Platform • Windows • Linux • MacOS (working on M1)
  • 33. Modern Game Engine - Theory and Practice PILOT Editor and Runtime Basic Editing • Add/Delete objects • Move/Scale/Rotate objects Simple Functions • Character control • Camera
  • 34. Modern Game Engine - Theory and Practice Release Plan 1st Release (3/25/2022) • Editor • Character/Camera • Renderer • Resource system • Play in editor (PIE) To be Released with Course • Animation system • Collision System • Gameplay and script systems • Simple parameter editing • More graphics features • … How to download • https://github.com/BoomingTech/Pilot simple ECS framework
  • 35. Modern Game Engine - Theory and Practice Takeaways • Engine is designed with a layered architecture • Lower levels are more stable and upper levels are more customizable • Virtual world is composed by a set of clocks - ticks
  • 36. Lecture 02 Contributor PILOT Engine Contributor - 一将 - Hoya - 喵小君 - 呆呆兽 - Olorin - 靓仔 - 爵爷 - Jason - 砚书 - BOOK - MANDY - 俗哥 - 金大壮 - Leon - 梨叔 - Shine - 邓导 - Judy - QIUU - C佬 - 阿乐 - 阿熊 - CC - 大喷 - 靓仔 - 达啦崩吧 - Shy - Adam - 人工非智能 - KUN - o果蝇o - 弥漫 - 陈皮 Modern Game Engine - Theory and Practice
  • 37. Enjoy;) Coding Please scan here to let us know what you think Course Survey Course Wechat Please follow us for further information Modern Game Engine - Theory and Practice
  • 38. Modern Game Engine - Theory and Practice Please note that all videos and images and other media are cited from the Internet for demonstration only.