SlideShare a Scribd company logo
The inner workings of a VR capable game engine
@gormlaigorm@kotoristudios.com
International Team
● @melodive
● @marcoapc_art
● @martinkvale
● @gormlai
@gormlaigorm@kotoristudios.com
Gorm Lai
● MSc from DAIMI 2004
● Worked on 16 commercial games
● Started in VR in 2001 at Center for Advanced
Visualisation and Interaction in Aarhus
● Worked on games, interactive installations and vr
since then
@gormlaigorm@kotoristudios.com
@gormlaigorm@kotoristudios.com
Basic VR Requirements
@gormlaigorm@kotoristudios.com
Basic VR Requirements
User needs to feel in control 100% of the time
@gormlaigorm@kotoristudios.com
Basic VR Requirements
User needs to feel in control 100% of the time
● Immediate reaction on input
@gormlaigorm@kotoristudios.com
Basic VR Requirements
User needs to feel in control 100% of the time
● Immediate reaction on input
● Minimize interpolation on direct movement
@gormlaigorm@kotoristudios.com
Basic VR Requirements
User needs to feel in control 100% of the time
● Immediate reaction on input
● Minimize interpolation on direct movement
● Movement needs to map intuitively for the brain
○ 3rd person can help
@gormlaigorm@kotoristudios.com
Basic VR Requirements
User needs to feel in control 100% of the time
● Immediate reaction on input
● Minimize interpolation on direct movement
● Movement needs to map intuitively for the brain
○ 3rd person can help
● 90 fps on each eye
@gormlaigorm@kotoristudios.com
Possible VR Improvements
● Better ground camera
● Crashes can be dis-orientering
● Bird can move out of view
● Turns can be uncomfortable
@gormlaigorm@kotoristudios.com
Key Realtime Challenges
● Terrain Generation (cpu)
● Terrain Generation (gpu)
● Populating world with animals
● Updating AI
● Sounds
● Tesselate the bird
● VR Rendering
● General performance
@gormlaigorm@kotoristudios.com
Terrain
@gormlaigorm@kotoristudios.com
Terrain
● Cylindric World
@gormlaigorm@kotoristudios.com
Terrain
● Cylindric World
● Everything divided into slices of 1024x256x32
voxels
@gormlaigorm@kotoristudios.com
Terrain
● Cylindric World
● Everything divided into slices of size 1024x256x32
● 64 Buckets
@gormlaigorm@kotoristudios.com
Terrain
● Cylindric World
● Everything divided into slices of size 1024x256x32
● 64 Buckets
● Terrain generated ahead of player and saved as a
slice
@gormlaigorm@kotoristudios.com
Terrain
● Cylindric World
● Everything divided into slices of size 1024x256x32
● 64 Buckets
● Terrain generated ahead of player and saved as a
slice
● Bucket contents are loaded on demand on a
separate thread
@gormlaigorm@kotoristudios.com
Terrain - Typical Frame
MAIN THREAD
CHECK TERRAIN UPDATE
COPY COMPUTE DATA
COPY RENDER DATA
RENDER
DISPATCH COMPUTE
GENERATE
THREAD
CHECK TERRAIN UPDATE
& COMPUTE & SAVE SLICE
IF NEEDED
(typically takes much longer
than one frame)
LOAD THREAD
LOAD SLICE
(typically much faster than
one frame)
READ PLAYER POSITION
@gormlaigorm@kotoristudios.com
@gormlaigorm@kotoristudios.com
@gormlaigorm@kotoristudios.com
@gormlaigorm@kotoristudios.com
Populating the World
@gormlaigorm@kotoristudios.com
Populating the World
● World must always seem full of life
@gormlaigorm@kotoristudios.com
Populating the World
● World must always seem full of life
● Animals must spawn in plausible places
○ Crabs near the beach
○ Fish in the water
○ Eagles high up in the mountains
@gormlaigorm@kotoristudios.com
Populating the World
● World must always seem full of life
● Animals must spawn in plausible places
○ Crabs near the beach
○ Fish in the water
○ Eagles high up in the mountains
Main data structure for populating is a KD-Tree
@gormlaigorm@kotoristudios.com
AI
● Update all animals within range
@gormlaigorm@kotoristudios.com
AI
● Update all animals within range
● KD-Tree of animals balanced every frame
@gormlaigorm@kotoristudios.com
AI
● Update all animals within range
● KD-Tree of animals balanced every frame
● KD-Tree used for lookup of close by animals
@gormlaigorm@kotoristudios.com
AI
● Update all animals within range
● KD-Tree of animals balanced every frame
● KD-Tree used for lookup of close by animals
● State machines / Behaviour trees used for local AI
@gormlaigorm@kotoristudios.com
AI - Typical Frame
MAIN THREAD
CHECK TERRAIN UPDATE
COPY COMPUTE DATA
COPY SIMULATION DATA
RENDER
DISPATCH COMPUTE
UPDATE THREAD
UPDATE WORLD
SIMULATIONS AND
PHYSICS
(typically much faster than
one frame)
READ PLAYER POSITION
@gormlaigorm@kotoristudios.com
General Performance 1
● Multi threading
● Absolutely essential for performance
● Primitives:
○ std::mutex / std::recursive_mutex
○ std::condition_variable
○ std::lock_guard / std::unique_lock
○ custom thread safe containers
@gormlaigorm@kotoristudios.com
General Performance 2
● Custom task manager
● Everything that doesn’t run on the gpu or the main
thread is a task
● Tasks can also run on the main thread
○ Allows tasks to reschedule themselves for ogl
data. For example load thread might
preprocess data, then schedule sub-task on
main to hand processed data to opengl
@gormlaigorm@kotoristudios.com
General Performance 3
● Minimize dynamic allocations
● Allocate as much data as possible up front
● Object pools
● Double/triple buffering of data structures
● Avoid graphs with pointers as it causes caching
issues
@gormlaigorm@kotoristudios.com
General Performance 4
● Avoid recursion
@gormlaigorm@kotoristudios.com
General Performance 5
● Custom culling algorithm
● Use chunks of size 32x32x32
● At load time generate connectivity graph inside
each chunk
○ Which 6 sides in a chunk are connected?
○ Build graph with connected chunk
● Each frame traverse from camera pos
@gormlaigorm@kotoristudios.com
VR Render
● The easy part!
● For each frame:
○ Update the world
○ For each frame:
■ Calculate perspective matrix
■ Setup render target
■ Render frame
○ Submit frame to vr headset
@gormlaigorm@kotoristudios.com
Open Source
● SDL
● SDL_mixer
● Cpp fsm
● Glm
● Glsl-optimiser
● Dear Imgui
● Micropather
● rapidjson
● stb libs
● misc noise libs
@gormlaigorm@kotoristudios.com
Questions?
@gormlaigorm@kotoristudios.com

More Related Content

Similar to The inner workings of a vr capable game engine

Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
Opersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
Karim Yaghmour
 
OSCON Kids GetMakered 3D Selfie Workshop
OSCON Kids GetMakered 3D Selfie WorkshopOSCON Kids GetMakered 3D Selfie Workshop
OSCON Kids GetMakered 3D Selfie Workshop
Diane Mueller
 
Power to the Artists: The Evolution of 2D Game Tools / Rus Scammell (Unity Te...
Power to the Artists: The Evolution of 2D Game Tools / Rus Scammell (Unity Te...Power to the Artists: The Evolution of 2D Game Tools / Rus Scammell (Unity Te...
Power to the Artists: The Evolution of 2D Game Tools / Rus Scammell (Unity Te...
DevGAMM Conference
 
Cyborgstack
CyborgstackCyborgstack
Cyborgstack
Opersys inc.
 
Troubleshooting MySQL from a MySQL Developer Perspective
Troubleshooting MySQL from a MySQL Developer PerspectiveTroubleshooting MySQL from a MySQL Developer Perspective
Troubleshooting MySQL from a MySQL Developer Perspective
Marcelo Altmann
 
Tools and libraries for common problems (Early Draft)
Tools and libraries for common problems (Early Draft)Tools and libraries for common problems (Early Draft)
Tools and libraries for common problems (Early Draft)
rc2209
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
Opersys inc.
 
Kernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernel
Kernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernelKernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernel
Kernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernel
Anne Nicolas
 
Go in Production
Go in ProductionGo in Production
Go in Production
John-Alan Simmons
 
Kernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernel
Kernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernelKernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernel
Kernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernel
Anne Nicolas
 
Headless Android at AnDevCon3
Headless Android at AnDevCon3Headless Android at AnDevCon3
Headless Android at AnDevCon3
Opersys inc.
 
High performance json- postgre sql vs. mongodb
High performance json- postgre sql vs. mongodbHigh performance json- postgre sql vs. mongodb
High performance json- postgre sql vs. mongodb
Wei Shan Ang
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
Opersys inc.
 
Artificial intelligence on the Edge
Artificial intelligence on the EdgeArtificial intelligence on the Edge
Artificial intelligence on the Edge
Usman Qayyum
 
Yocto and IoT - a retrospective
Yocto and IoT - a retrospectiveYocto and IoT - a retrospective
Yocto and IoT - a retrospective
Open-RnD
 
MongoDB Days UK: Run MongoDB on Google Cloud Platform
MongoDB Days UK: Run MongoDB on Google Cloud PlatformMongoDB Days UK: Run MongoDB on Google Cloud Platform
MongoDB Days UK: Run MongoDB on Google Cloud Platform
MongoDB
 
Autodesk EAGLE and OSH Park
Autodesk EAGLE and OSH ParkAutodesk EAGLE and OSH Park
Autodesk EAGLE and OSH Park
Drew Fustini
 
BloodHound Unleashed.pdf
BloodHound Unleashed.pdfBloodHound Unleashed.pdf
BloodHound Unleashed.pdf
n00py1
 
Introduction to Procedural Contents Generation
Introduction to Procedural Contents GenerationIntroduction to Procedural Contents Generation
Introduction to Procedural Contents Generation
Davide Aversa
 

Similar to The inner workings of a vr capable game engine (20)

Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
OSCON Kids GetMakered 3D Selfie Workshop
OSCON Kids GetMakered 3D Selfie WorkshopOSCON Kids GetMakered 3D Selfie Workshop
OSCON Kids GetMakered 3D Selfie Workshop
 
Power to the Artists: The Evolution of 2D Game Tools / Rus Scammell (Unity Te...
Power to the Artists: The Evolution of 2D Game Tools / Rus Scammell (Unity Te...Power to the Artists: The Evolution of 2D Game Tools / Rus Scammell (Unity Te...
Power to the Artists: The Evolution of 2D Game Tools / Rus Scammell (Unity Te...
 
Cyborgstack
CyborgstackCyborgstack
Cyborgstack
 
Troubleshooting MySQL from a MySQL Developer Perspective
Troubleshooting MySQL from a MySQL Developer PerspectiveTroubleshooting MySQL from a MySQL Developer Perspective
Troubleshooting MySQL from a MySQL Developer Perspective
 
Tools and libraries for common problems (Early Draft)
Tools and libraries for common problems (Early Draft)Tools and libraries for common problems (Early Draft)
Tools and libraries for common problems (Early Draft)
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Kernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernel
Kernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernelKernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernel
Kernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernel
 
Go in Production
Go in ProductionGo in Production
Go in Production
 
Kernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernel
Kernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernelKernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernel
Kernel Recipes 2019 - Hunting and fixing bugs all over the Linux kernel
 
Headless Android at AnDevCon3
Headless Android at AnDevCon3Headless Android at AnDevCon3
Headless Android at AnDevCon3
 
High performance json- postgre sql vs. mongodb
High performance json- postgre sql vs. mongodbHigh performance json- postgre sql vs. mongodb
High performance json- postgre sql vs. mongodb
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Artificial intelligence on the Edge
Artificial intelligence on the EdgeArtificial intelligence on the Edge
Artificial intelligence on the Edge
 
Yocto and IoT - a retrospective
Yocto and IoT - a retrospectiveYocto and IoT - a retrospective
Yocto and IoT - a retrospective
 
MongoDB Days UK: Run MongoDB on Google Cloud Platform
MongoDB Days UK: Run MongoDB on Google Cloud PlatformMongoDB Days UK: Run MongoDB on Google Cloud Platform
MongoDB Days UK: Run MongoDB on Google Cloud Platform
 
Autodesk EAGLE and OSH Park
Autodesk EAGLE and OSH ParkAutodesk EAGLE and OSH Park
Autodesk EAGLE and OSH Park
 
BloodHound Unleashed.pdf
BloodHound Unleashed.pdfBloodHound Unleashed.pdf
BloodHound Unleashed.pdf
 
Introduction to Procedural Contents Generation
Introduction to Procedural Contents GenerationIntroduction to Procedural Contents Generation
Introduction to Procedural Contents Generation
 

More from Gorm Lai

Game jam license fdg 19
Game jam license   fdg 19Game jam license   fdg 19
Game jam license fdg 19
Gorm Lai
 
Tips & Tricks that every game developer should know
Tips & Tricks that every game developer should knowTips & Tricks that every game developer should know
Tips & Tricks that every game developer should know
Gorm Lai
 
Game Jams & Hobbyists
Game Jams & HobbyistsGame Jams & Hobbyists
Game Jams & Hobbyists
Gorm Lai
 
Making A Game Engine Is Easier Than You Think
Making A Game Engine Is Easier Than You ThinkMaking A Game Engine Is Easier Than You Think
Making A Game Engine Is Easier Than You Think
Gorm Lai
 
Global Game Jam @ Develop
Global Game Jam @ DevelopGlobal Game Jam @ Develop
Global Game Jam @ Develop
Gorm Lai
 
Global Game Jam @ Develop 09
Global Game Jam @ Develop 09Global Game Jam @ Develop 09
Global Game Jam @ Develop 09Gorm Lai
 

More from Gorm Lai (6)

Game jam license fdg 19
Game jam license   fdg 19Game jam license   fdg 19
Game jam license fdg 19
 
Tips & Tricks that every game developer should know
Tips & Tricks that every game developer should knowTips & Tricks that every game developer should know
Tips & Tricks that every game developer should know
 
Game Jams & Hobbyists
Game Jams & HobbyistsGame Jams & Hobbyists
Game Jams & Hobbyists
 
Making A Game Engine Is Easier Than You Think
Making A Game Engine Is Easier Than You ThinkMaking A Game Engine Is Easier Than You Think
Making A Game Engine Is Easier Than You Think
 
Global Game Jam @ Develop
Global Game Jam @ DevelopGlobal Game Jam @ Develop
Global Game Jam @ Develop
 
Global Game Jam @ Develop 09
Global Game Jam @ Develop 09Global Game Jam @ Develop 09
Global Game Jam @ Develop 09
 

Recently uploaded

[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
awadeshbabu
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
camseq
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
NidhalKahouli2
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
Divyam548318
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptxTOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
nikitacareer3
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Online aptitude test management system project report.pdf
Online aptitude test management system project report.pdfOnline aptitude test management system project report.pdf
Online aptitude test management system project report.pdf
Kamal Acharya
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
anoopmanoharan2
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Soumen Santra
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
aqil azizi
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
gestioneergodomus
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
heavyhaig
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 

Recently uploaded (20)

[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptxTOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Online aptitude test management system project report.pdf
Online aptitude test management system project report.pdfOnline aptitude test management system project report.pdf
Online aptitude test management system project report.pdf
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 

The inner workings of a vr capable game engine

  • 1. The inner workings of a VR capable game engine @gormlaigorm@kotoristudios.com
  • 2. International Team ● @melodive ● @marcoapc_art ● @martinkvale ● @gormlai @gormlaigorm@kotoristudios.com
  • 3. Gorm Lai ● MSc from DAIMI 2004 ● Worked on 16 commercial games ● Started in VR in 2001 at Center for Advanced Visualisation and Interaction in Aarhus ● Worked on games, interactive installations and vr since then @gormlaigorm@kotoristudios.com
  • 6. Basic VR Requirements User needs to feel in control 100% of the time @gormlaigorm@kotoristudios.com
  • 7. Basic VR Requirements User needs to feel in control 100% of the time ● Immediate reaction on input @gormlaigorm@kotoristudios.com
  • 8. Basic VR Requirements User needs to feel in control 100% of the time ● Immediate reaction on input ● Minimize interpolation on direct movement @gormlaigorm@kotoristudios.com
  • 9. Basic VR Requirements User needs to feel in control 100% of the time ● Immediate reaction on input ● Minimize interpolation on direct movement ● Movement needs to map intuitively for the brain ○ 3rd person can help @gormlaigorm@kotoristudios.com
  • 10. Basic VR Requirements User needs to feel in control 100% of the time ● Immediate reaction on input ● Minimize interpolation on direct movement ● Movement needs to map intuitively for the brain ○ 3rd person can help ● 90 fps on each eye @gormlaigorm@kotoristudios.com
  • 11. Possible VR Improvements ● Better ground camera ● Crashes can be dis-orientering ● Bird can move out of view ● Turns can be uncomfortable @gormlaigorm@kotoristudios.com
  • 12. Key Realtime Challenges ● Terrain Generation (cpu) ● Terrain Generation (gpu) ● Populating world with animals ● Updating AI ● Sounds ● Tesselate the bird ● VR Rendering ● General performance @gormlaigorm@kotoristudios.com
  • 15. Terrain ● Cylindric World ● Everything divided into slices of 1024x256x32 voxels @gormlaigorm@kotoristudios.com
  • 16. Terrain ● Cylindric World ● Everything divided into slices of size 1024x256x32 ● 64 Buckets @gormlaigorm@kotoristudios.com
  • 17. Terrain ● Cylindric World ● Everything divided into slices of size 1024x256x32 ● 64 Buckets ● Terrain generated ahead of player and saved as a slice @gormlaigorm@kotoristudios.com
  • 18. Terrain ● Cylindric World ● Everything divided into slices of size 1024x256x32 ● 64 Buckets ● Terrain generated ahead of player and saved as a slice ● Bucket contents are loaded on demand on a separate thread @gormlaigorm@kotoristudios.com
  • 19. Terrain - Typical Frame MAIN THREAD CHECK TERRAIN UPDATE COPY COMPUTE DATA COPY RENDER DATA RENDER DISPATCH COMPUTE GENERATE THREAD CHECK TERRAIN UPDATE & COMPUTE & SAVE SLICE IF NEEDED (typically takes much longer than one frame) LOAD THREAD LOAD SLICE (typically much faster than one frame) READ PLAYER POSITION @gormlaigorm@kotoristudios.com
  • 24. Populating the World ● World must always seem full of life @gormlaigorm@kotoristudios.com
  • 25. Populating the World ● World must always seem full of life ● Animals must spawn in plausible places ○ Crabs near the beach ○ Fish in the water ○ Eagles high up in the mountains @gormlaigorm@kotoristudios.com
  • 26. Populating the World ● World must always seem full of life ● Animals must spawn in plausible places ○ Crabs near the beach ○ Fish in the water ○ Eagles high up in the mountains Main data structure for populating is a KD-Tree @gormlaigorm@kotoristudios.com
  • 27. AI ● Update all animals within range @gormlaigorm@kotoristudios.com
  • 28. AI ● Update all animals within range ● KD-Tree of animals balanced every frame @gormlaigorm@kotoristudios.com
  • 29. AI ● Update all animals within range ● KD-Tree of animals balanced every frame ● KD-Tree used for lookup of close by animals @gormlaigorm@kotoristudios.com
  • 30. AI ● Update all animals within range ● KD-Tree of animals balanced every frame ● KD-Tree used for lookup of close by animals ● State machines / Behaviour trees used for local AI @gormlaigorm@kotoristudios.com
  • 31. AI - Typical Frame MAIN THREAD CHECK TERRAIN UPDATE COPY COMPUTE DATA COPY SIMULATION DATA RENDER DISPATCH COMPUTE UPDATE THREAD UPDATE WORLD SIMULATIONS AND PHYSICS (typically much faster than one frame) READ PLAYER POSITION @gormlaigorm@kotoristudios.com
  • 32. General Performance 1 ● Multi threading ● Absolutely essential for performance ● Primitives: ○ std::mutex / std::recursive_mutex ○ std::condition_variable ○ std::lock_guard / std::unique_lock ○ custom thread safe containers @gormlaigorm@kotoristudios.com
  • 33. General Performance 2 ● Custom task manager ● Everything that doesn’t run on the gpu or the main thread is a task ● Tasks can also run on the main thread ○ Allows tasks to reschedule themselves for ogl data. For example load thread might preprocess data, then schedule sub-task on main to hand processed data to opengl @gormlaigorm@kotoristudios.com
  • 34. General Performance 3 ● Minimize dynamic allocations ● Allocate as much data as possible up front ● Object pools ● Double/triple buffering of data structures ● Avoid graphs with pointers as it causes caching issues @gormlaigorm@kotoristudios.com
  • 35. General Performance 4 ● Avoid recursion @gormlaigorm@kotoristudios.com
  • 36. General Performance 5 ● Custom culling algorithm ● Use chunks of size 32x32x32 ● At load time generate connectivity graph inside each chunk ○ Which 6 sides in a chunk are connected? ○ Build graph with connected chunk ● Each frame traverse from camera pos @gormlaigorm@kotoristudios.com
  • 37. VR Render ● The easy part! ● For each frame: ○ Update the world ○ For each frame: ■ Calculate perspective matrix ■ Setup render target ■ Render frame ○ Submit frame to vr headset @gormlaigorm@kotoristudios.com
  • 38. Open Source ● SDL ● SDL_mixer ● Cpp fsm ● Glm ● Glsl-optimiser ● Dear Imgui ● Micropather ● rapidjson ● stb libs ● misc noise libs @gormlaigorm@kotoristudios.com