SlideShare a Scribd company logo
1 of 43
Threading Game Engines -   QUAKE 4 & Enemy Territory QUAKE Wars Anu  Kalra   - Intel Corporation Jan Paul van Waveren   -   id Software Feb 21, 2006
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Legal Disclaimer ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Concurrency In Games ,[object Object],[object Object],[object Object],[object Object]
QUAKE 4 Engine ,[object Object],[object Object],[object Object],[object Object]
QUAKE 4 Analysis ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Constraints ,[object Object],[object Object],[object Object],[object Object]
Threading ,[object Object],[object Object],[object Object],[object Object],Frontend Backend Thread 1 Thread 2 Cmd Queue Backend
Threading ,[object Object],[object Object],[object Object],[object Object],[object Object]
Synchronization Front End Backend Frame n Frame n-1 Frame n Frame n+1 Frame n+2 Frame n+1
Issues with Threading ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Performance Improvements ,[object Object]
Multi-Threaded Drivers Driver Thread Driver FIFO Sound Thread Game Engine Loop OpenGL/D3D Main Thread  Graphics Driver Front End 3D HW
Current Performance
Renderer Threading with ETQW ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
ETQW
Quake III Arena ,[object Object],[object Object]
DOOM III ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
ETQW Threading overview Game Logic Bot AI Sound Engine Renderer Sound Driver Graphics Driver MegaTexture Transcoding MegaTexture Streaming
Mega Texture Streaming Game Logic Bot AI Sound Engine Renderer Sound Driver Graphics Driver MegaTexture Transcoding MegaTexture Streaming
Mega Texture Streaming ,[object Object],[object Object],[object Object],[object Object]
Mega Texture Transcoding Game Logic Bot AI Sound Engine Renderer Sound Driver Graphics Driver MegaTexture Transcoding MegaTexture Streaming
Mega Texture Transcoding ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Sound Engine Game Logic Bot AI Sound Engine Renderer Sound Driver Graphics Driver MegaTexture Transcoding MegaTexture Streaming
Sound Engine ,[object Object],[object Object],[object Object]
Game Logic Game Logic Bot AI Sound Engine Renderer Sound Driver Graphics Driver MegaTexture Transcoding MegaTexture Streaming
Game Logic ,[object Object],[object Object],[object Object],[object Object]
Bot AI Game Logic Bot AI Sound Engine Renderer Sound Driver Graphics Driver MegaTexture Transcoding MegaTexture Streaming
Bot AI ,[object Object],[object Object],[object Object]
Bot AI ,[object Object],[object Object],[object Object],[object Object]
Bot AI ,[object Object],[object Object],[object Object],[object Object]
Bot AI static const int MIN_FRAME_DELAY = 0; static const int MAX_FRAME_DELAY = 4; HANDLE gameSignal; HANDLE aiSignal; Int gameFrameNum; int lastAIGameFrameNum; void GameThread() { for ( ; ; ) { SetCurrentGameOutputState(); AdvanceWorld(); SetCurrentGameWorldState(); gameFrameNum++ // let the AI thread know there's another game frame ::SetEvent( gameSignal ); // wait if the AI thread is falling too far behind while( lastAIGameFrameNum < gameFrameNum - MAX_FRAME_DELAY ) { ::SignalObjectAndWait( gameSignal, aiSignal, INFINITE, FALSE ); } } }
Bot AI void AIThread() { for ( ; ; ) { // let the game thread know another AI frame has started ::SetEvent( aiSignal ); // never run more AI frames than game frames while( lastAIGameFrameNum >= gameFrameNum - MIN_FRAME_DELAY ) { ::SignalObjectAndWait( aiSignal, gameSignal, INFINITE, FALSE ); } lastAIGameFrameNum = gameFrameNum; SetCurrentAIWorldState(); AdvanceAI(); SetCurrentAIOutputState(); } }
Bot AI ,[object Object],[object Object],[object Object]
Threading On/Off ,[object Object],[object Object],[object Object]
Common Issues ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Scalability ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Alternate Threading Paradigms ,[object Object],AI AI AI AI Physics Physics Physics Physics Renderer
Alternate Threading Paradigms ,[object Object],Frame AI Physics Render FE Render BE AI Physics Render FE Task Stealing T 0 T 1
Design with threading in mind ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Summary ,[object Object],[object Object],[object Object],[object Object],[object Object]
Contact Info ,[object Object]
Threading Game Engines: QUAKE 4 & Enemy Territory QUAKE Wars

More Related Content

What's hot

Robotics and Machine Learning: Working with NVIDIA Jetson Kits
Robotics and Machine Learning: Working with NVIDIA Jetson KitsRobotics and Machine Learning: Working with NVIDIA Jetson Kits
Robotics and Machine Learning: Working with NVIDIA Jetson Kits
Data Works MD
 

What's hot (20)

Streamed Cloud Gaming Solutions for Android* and PC Games
Streamed Cloud Gaming Solutions for Android* and PC GamesStreamed Cloud Gaming Solutions for Android* and PC Games
Streamed Cloud Gaming Solutions for Android* and PC Games
 
Accelerate Large-Scale Inverse Kinematics with the Intel® Distribution of Ope...
Accelerate Large-Scale Inverse Kinematics with the Intel® Distribution of Ope...Accelerate Large-Scale Inverse Kinematics with the Intel® Distribution of Ope...
Accelerate Large-Scale Inverse Kinematics with the Intel® Distribution of Ope...
 
HITBSecConf 2016-Create Your Own Bad Usb
HITBSecConf 2016-Create Your Own Bad UsbHITBSecConf 2016-Create Your Own Bad Usb
HITBSecConf 2016-Create Your Own Bad Usb
 
Multiple Cores, Multiple Pipes, Multiple Threads – Do we have more Parallelis...
Multiple Cores, Multiple Pipes, Multiple Threads – Do we have more Parallelis...Multiple Cores, Multiple Pipes, Multiple Threads – Do we have more Parallelis...
Multiple Cores, Multiple Pipes, Multiple Threads – Do we have more Parallelis...
 
Embree Ray Tracing Kernels | Overview and New Features | SIGGRAPH 2018 Tech S...
Embree Ray Tracing Kernels | Overview and New Features | SIGGRAPH 2018 Tech S...Embree Ray Tracing Kernels | Overview and New Features | SIGGRAPH 2018 Tech S...
Embree Ray Tracing Kernels | Overview and New Features | SIGGRAPH 2018 Tech S...
 
clCaffe*: Unleashing the Power of Intel Graphics for Deep Learning Acceleration
clCaffe*: Unleashing the Power of Intel Graphics for Deep Learning AccelerationclCaffe*: Unleashing the Power of Intel Graphics for Deep Learning Acceleration
clCaffe*: Unleashing the Power of Intel Graphics for Deep Learning Acceleration
 
HITBSecConf 2017-Shadow-Box-the Practical and Omnipotent Sandbox
HITBSecConf 2017-Shadow-Box-the Practical and Omnipotent SandboxHITBSecConf 2017-Shadow-Box-the Practical and Omnipotent Sandbox
HITBSecConf 2017-Shadow-Box-the Practical and Omnipotent Sandbox
 
BlackHat Asia 2017-Myth and Truth about Hypervisor-Based Kernel Protector
BlackHat Asia 2017-Myth and Truth about Hypervisor-Based Kernel ProtectorBlackHat Asia 2017-Myth and Truth about Hypervisor-Based Kernel Protector
BlackHat Asia 2017-Myth and Truth about Hypervisor-Based Kernel Protector
 
Masked Occlusion Culling
Masked Occlusion CullingMasked Occlusion Culling
Masked Occlusion Culling
 
It Doesn't Have to Be Hard: How to Fix Your Performance Woes
It Doesn't Have to Be Hard: How to Fix Your Performance WoesIt Doesn't Have to Be Hard: How to Fix Your Performance Woes
It Doesn't Have to Be Hard: How to Fix Your Performance Woes
 
Getting the maximum performance in distributed clusters Intel Cluster Studio XE
Getting the maximum performance in distributed clusters Intel Cluster Studio XEGetting the maximum performance in distributed clusters Intel Cluster Studio XE
Getting the maximum performance in distributed clusters Intel Cluster Studio XE
 
Ray Tracing with Intel® Embree and Intel® OSPRay: Use Cases and Updates | SIG...
Ray Tracing with Intel® Embree and Intel® OSPRay: Use Cases and Updates | SIG...Ray Tracing with Intel® Embree and Intel® OSPRay: Use Cases and Updates | SIG...
Ray Tracing with Intel® Embree and Intel® OSPRay: Use Cases and Updates | SIG...
 
Ultra HD Video Scaling: Low-Power HW FF vs. CNN-based Super-Resolution
Ultra HD Video Scaling: Low-Power HW FF vs. CNN-based Super-ResolutionUltra HD Video Scaling: Low-Power HW FF vs. CNN-based Super-Resolution
Ultra HD Video Scaling: Low-Power HW FF vs. CNN-based Super-Resolution
 
Methods and practices to analyze the performance of your application with Int...
Methods and practices to analyze the performance of your application with Int...Methods and practices to analyze the performance of your application with Int...
Methods and practices to analyze the performance of your application with Int...
 
Getting Space Pirate Trainer* to Perform on Intel® Graphics
Getting Space Pirate Trainer* to Perform on Intel® GraphicsGetting Space Pirate Trainer* to Perform on Intel® Graphics
Getting Space Pirate Trainer* to Perform on Intel® Graphics
 
Early Benchmarking Results for Neuromorphic Computing
Early Benchmarking Results for Neuromorphic ComputingEarly Benchmarking Results for Neuromorphic Computing
Early Benchmarking Results for Neuromorphic Computing
 
Robotics and Machine Learning: Working with NVIDIA Jetson Kits
Robotics and Machine Learning: Working with NVIDIA Jetson KitsRobotics and Machine Learning: Working with NVIDIA Jetson Kits
Robotics and Machine Learning: Working with NVIDIA Jetson Kits
 
Asus Tinker Board
Asus Tinker BoardAsus Tinker Board
Asus Tinker Board
 
Intel Edison: Beyond the Breadboard
Intel Edison: Beyond the BreadboardIntel Edison: Beyond the Breadboard
Intel Edison: Beyond the Breadboard
 
Intel® Open Image Denoise: Optimized CPU Denoising | SIGGRAPH 2019 Technical ...
Intel® Open Image Denoise: Optimized CPU Denoising | SIGGRAPH 2019 Technical ...Intel® Open Image Denoise: Optimized CPU Denoising | SIGGRAPH 2019 Technical ...
Intel® Open Image Denoise: Optimized CPU Denoising | SIGGRAPH 2019 Technical ...
 

Viewers also liked

BSPTreesGameEngines-2
BSPTreesGameEngines-2BSPTreesGameEngines-2
BSPTreesGameEngines-2
Jason Calvert
 
BSPTreesGameEngines-1
BSPTreesGameEngines-1BSPTreesGameEngines-1
BSPTreesGameEngines-1
Jason Calvert
 
GPS en verplaatsingsgedrag
GPS en verplaatsingsgedrag GPS en verplaatsingsgedrag
GPS en verplaatsingsgedrag
Kantar TNS
 
Shadow Techniques for Real-Time and Interactive Applications
Shadow Techniques for Real-Time and Interactive ApplicationsShadow Techniques for Real-Time and Interactive Applications
Shadow Techniques for Real-Time and Interactive Applications
stefan_b
 
Hageman id software project
Hageman id software projectHageman id software project
Hageman id software project
Adam Hageman
 
map projections
map projectionsmap projections
map projections
om290979
 

Viewers also liked (15)

Beyond GPS - Neogeograpy Data Collection
Beyond GPS - Neogeograpy Data CollectionBeyond GPS - Neogeograpy Data Collection
Beyond GPS - Neogeograpy Data Collection
 
BSPTreesGameEngines-2
BSPTreesGameEngines-2BSPTreesGameEngines-2
BSPTreesGameEngines-2
 
BSPTreesGameEngines-1
BSPTreesGameEngines-1BSPTreesGameEngines-1
BSPTreesGameEngines-1
 
GPS en verplaatsingsgedrag
GPS en verplaatsingsgedrag GPS en verplaatsingsgedrag
GPS en verplaatsingsgedrag
 
Doom3
Doom3Doom3
Doom3
 
Shadow Techniques for Real-Time and Interactive Applications
Shadow Techniques for Real-Time and Interactive ApplicationsShadow Techniques for Real-Time and Interactive Applications
Shadow Techniques for Real-Time and Interactive Applications
 
Implementing Server Side Data Synchronization for Mobile Apps
Implementing Server Side Data Synchronization for Mobile AppsImplementing Server Side Data Synchronization for Mobile Apps
Implementing Server Side Data Synchronization for Mobile Apps
 
Hageman id software project
Hageman id software projectHageman id software project
Hageman id software project
 
Introduction to MAPS,Coordinate System and Projection System
Introduction to MAPS,Coordinate System and Projection SystemIntroduction to MAPS,Coordinate System and Projection System
Introduction to MAPS,Coordinate System and Projection System
 
Geographic coordinate system & map projection
Geographic coordinate system & map projectionGeographic coordinate system & map projection
Geographic coordinate system & map projection
 
map projections
map projectionsmap projections
map projections
 
Understanding Coordinate Systems and Projections for ArcGIS
Understanding Coordinate Systems and Projections for ArcGISUnderstanding Coordinate Systems and Projections for ArcGIS
Understanding Coordinate Systems and Projections for ArcGIS
 
Map Projections
Map ProjectionsMap Projections
Map Projections
 
Gps ppt
Gps pptGps ppt
Gps ppt
 
GPS ppt.
GPS ppt. GPS ppt.
GPS ppt.
 

Similar to Threading Game Engines: QUAKE 4 & Enemy Territory QUAKE Wars

Threading Successes 01 Intro
Threading Successes 01   IntroThreading Successes 01   Intro
Threading Successes 01 Intro
guest40fc7cd
 
Threading Successes 06 Allegorithmic
Threading Successes 06   AllegorithmicThreading Successes 06   Allegorithmic
Threading Successes 06 Allegorithmic
guest40fc7cd
 
Architectural Analysis of Game Machines
Architectural Analysis of Game MachinesArchitectural Analysis of Game Machines
Architectural Analysis of Game Machines
Praveen AP
 

Similar to Threading Game Engines: QUAKE 4 & Enemy Territory QUAKE Wars (20)

DPDK: Multi Architecture High Performance Packet Processing
DPDK: Multi Architecture High Performance Packet ProcessingDPDK: Multi Architecture High Performance Packet Processing
DPDK: Multi Architecture High Performance Packet Processing
 
Unleashing Data Intelligence with Intel and Apache Spark with Michael Greene
Unleashing Data Intelligence with Intel and Apache Spark with Michael GreeneUnleashing Data Intelligence with Intel and Apache Spark with Michael Greene
Unleashing Data Intelligence with Intel and Apache Spark with Michael Greene
 
Threading Successes 01 Intro
Threading Successes 01   IntroThreading Successes 01   Intro
Threading Successes 01 Intro
 
Optimization Deep Dive: Unreal Engine 4 on Intel
Optimization Deep Dive: Unreal Engine 4 on IntelOptimization Deep Dive: Unreal Engine 4 on Intel
Optimization Deep Dive: Unreal Engine 4 on Intel
 
The Architecture of Intel Processor Graphics: Gen 11
The Architecture of Intel Processor Graphics: Gen 11The Architecture of Intel Processor Graphics: Gen 11
The Architecture of Intel Processor Graphics: Gen 11
 
No[1][1]
No[1][1]No[1][1]
No[1][1]
 
Optimizing Direct X On Multi Core Architectures
Optimizing Direct X On Multi Core ArchitecturesOptimizing Direct X On Multi Core Architectures
Optimizing Direct X On Multi Core Architectures
 
Ivy bridge vs Sandy bridge Micro-architecture.
Ivy bridge vs Sandy bridge Micro-architecture.Ivy bridge vs Sandy bridge Micro-architecture.
Ivy bridge vs Sandy bridge Micro-architecture.
 
Threading Successes 06 Allegorithmic
Threading Successes 06   AllegorithmicThreading Successes 06   Allegorithmic
Threading Successes 06 Allegorithmic
 
FPGA_prototyping proccesing with conclusion
FPGA_prototyping proccesing with conclusionFPGA_prototyping proccesing with conclusion
FPGA_prototyping proccesing with conclusion
 
Gpu and The Brick Wall
Gpu and The Brick WallGpu and The Brick Wall
Gpu and The Brick Wall
 
Introduction to Game Engine: Concepts & Components
Introduction to Game Engine: Concepts & ComponentsIntroduction to Game Engine: Concepts & Components
Introduction to Game Engine: Concepts & Components
 
Trends in Systems and How to Get Efficient Performance
Trends in Systems and How to Get Efficient PerformanceTrends in Systems and How to Get Efficient Performance
Trends in Systems and How to Get Efficient Performance
 
GPU Architecture NVIDIA (GTX GeForce 480)
GPU Architecture NVIDIA (GTX GeForce 480)GPU Architecture NVIDIA (GTX GeForce 480)
GPU Architecture NVIDIA (GTX GeForce 480)
 
Intel ndk - a few Benchmarks
Intel ndk - a few BenchmarksIntel ndk - a few Benchmarks
Intel ndk - a few Benchmarks
 
UplinQ - qualcomm® snapdragon™ processors a super gaming platform
UplinQ - qualcomm® snapdragon™ processors a super gaming platformUplinQ - qualcomm® snapdragon™ processors a super gaming platform
UplinQ - qualcomm® snapdragon™ processors a super gaming platform
 
Qualcomm Snapdragon Processors: A Super Gaming Platform
Qualcomm Snapdragon Processors: A Super Gaming Platform Qualcomm Snapdragon Processors: A Super Gaming Platform
Qualcomm Snapdragon Processors: A Super Gaming Platform
 
Architectural Analysis of Game Machines
Architectural Analysis of Game MachinesArchitectural Analysis of Game Machines
Architectural Analysis of Game Machines
 
Pedal to the Metal: Accelerating Spark with Silicon Innovation
Pedal to the Metal: Accelerating Spark with Silicon InnovationPedal to the Metal: Accelerating Spark with Silicon Innovation
Pedal to the Metal: Accelerating Spark with Silicon Innovation
 
Introduction to Programmable Networks by Clarence Anslem, Intel
Introduction to Programmable Networks by Clarence Anslem, IntelIntroduction to Programmable Networks by Clarence Anslem, Intel
Introduction to Programmable Networks by Clarence Anslem, Intel
 

Recently uploaded

Mifty kit IN Salmiya (+918133066128) Abortion pills IN Salmiyah Cytotec pills
Mifty kit IN Salmiya (+918133066128) Abortion pills IN Salmiyah Cytotec pillsMifty kit IN Salmiya (+918133066128) Abortion pills IN Salmiyah Cytotec pills
Mifty kit IN Salmiya (+918133066128) Abortion pills IN Salmiyah Cytotec pills
Abortion pills in Kuwait Cytotec pills in Kuwait
 
Mifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in Oman
Mifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in OmanMifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in Oman
Mifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in Oman
instagramfab782445
 
Structuring and Writing DRL Mckinsey (1).pdf
Structuring and Writing DRL Mckinsey (1).pdfStructuring and Writing DRL Mckinsey (1).pdf
Structuring and Writing DRL Mckinsey (1).pdf
laloo_007
 
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai KuwaitThe Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
daisycvs
 

Recently uploaded (20)

Cannabis Legalization World Map: 2024 Updated
Cannabis Legalization World Map: 2024 UpdatedCannabis Legalization World Map: 2024 Updated
Cannabis Legalization World Map: 2024 Updated
 
Putting the SPARK into Virtual Training.pptx
Putting the SPARK into Virtual Training.pptxPutting the SPARK into Virtual Training.pptx
Putting the SPARK into Virtual Training.pptx
 
Getting Real with AI - Columbus DAW - May 2024 - Nick Woo from AlignAI
Getting Real with AI - Columbus DAW - May 2024 - Nick Woo from AlignAIGetting Real with AI - Columbus DAW - May 2024 - Nick Woo from AlignAI
Getting Real with AI - Columbus DAW - May 2024 - Nick Woo from AlignAI
 
Call 7737669865 Vadodara Call Girls Service at your Door Step Available All Time
Call 7737669865 Vadodara Call Girls Service at your Door Step Available All TimeCall 7737669865 Vadodara Call Girls Service at your Door Step Available All Time
Call 7737669865 Vadodara Call Girls Service at your Door Step Available All Time
 
New 2024 Cannabis Edibles Investor Pitch Deck Template
New 2024 Cannabis Edibles Investor Pitch Deck TemplateNew 2024 Cannabis Edibles Investor Pitch Deck Template
New 2024 Cannabis Edibles Investor Pitch Deck Template
 
Mifty kit IN Salmiya (+918133066128) Abortion pills IN Salmiyah Cytotec pills
Mifty kit IN Salmiya (+918133066128) Abortion pills IN Salmiyah Cytotec pillsMifty kit IN Salmiya (+918133066128) Abortion pills IN Salmiyah Cytotec pills
Mifty kit IN Salmiya (+918133066128) Abortion pills IN Salmiyah Cytotec pills
 
Power point presentation on enterprise performance management
Power point presentation on enterprise performance managementPower point presentation on enterprise performance management
Power point presentation on enterprise performance management
 
Famous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st CenturyFamous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st Century
 
Mifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in Oman
Mifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in OmanMifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in Oman
Mifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in Oman
 
Arti Languages Pre Seed Teaser Deck 2024.pdf
Arti Languages Pre Seed Teaser Deck 2024.pdfArti Languages Pre Seed Teaser Deck 2024.pdf
Arti Languages Pre Seed Teaser Deck 2024.pdf
 
Falcon Invoice Discounting: Aviate Your Cash Flow Challenges
Falcon Invoice Discounting: Aviate Your Cash Flow ChallengesFalcon Invoice Discounting: Aviate Your Cash Flow Challenges
Falcon Invoice Discounting: Aviate Your Cash Flow Challenges
 
Horngren’s Cost Accounting A Managerial Emphasis, Canadian 9th edition soluti...
Horngren’s Cost Accounting A Managerial Emphasis, Canadian 9th edition soluti...Horngren’s Cost Accounting A Managerial Emphasis, Canadian 9th edition soluti...
Horngren’s Cost Accounting A Managerial Emphasis, Canadian 9th edition soluti...
 
Paradip CALL GIRL❤7091819311❤CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
Paradip CALL GIRL❤7091819311❤CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDINGParadip CALL GIRL❤7091819311❤CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
Paradip CALL GIRL❤7091819311❤CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
 
Structuring and Writing DRL Mckinsey (1).pdf
Structuring and Writing DRL Mckinsey (1).pdfStructuring and Writing DRL Mckinsey (1).pdf
Structuring and Writing DRL Mckinsey (1).pdf
 
Falcon's Invoice Discounting: Your Path to Prosperity
Falcon's Invoice Discounting: Your Path to ProsperityFalcon's Invoice Discounting: Your Path to Prosperity
Falcon's Invoice Discounting: Your Path to Prosperity
 
Lucknow Housewife Escorts by Sexy Bhabhi Service 8250092165
Lucknow Housewife Escorts  by Sexy Bhabhi Service 8250092165Lucknow Housewife Escorts  by Sexy Bhabhi Service 8250092165
Lucknow Housewife Escorts by Sexy Bhabhi Service 8250092165
 
Rice Manufacturers in India | Shree Krishna Exports
Rice Manufacturers in India | Shree Krishna ExportsRice Manufacturers in India | Shree Krishna Exports
Rice Manufacturers in India | Shree Krishna Exports
 
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai KuwaitThe Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
 
TVB_The Vietnam Believer Newsletter_May 6th, 2024_ENVol. 006.pdf
TVB_The Vietnam Believer Newsletter_May 6th, 2024_ENVol. 006.pdfTVB_The Vietnam Believer Newsletter_May 6th, 2024_ENVol. 006.pdf
TVB_The Vietnam Believer Newsletter_May 6th, 2024_ENVol. 006.pdf
 
Over the Top (OTT) Market Size & Growth Outlook 2024-2030
Over the Top (OTT) Market Size & Growth Outlook 2024-2030Over the Top (OTT) Market Size & Growth Outlook 2024-2030
Over the Top (OTT) Market Size & Growth Outlook 2024-2030
 

Threading Game Engines: QUAKE 4 & Enemy Territory QUAKE Wars

  • 1. Threading Game Engines - QUAKE 4 & Enemy Territory QUAKE Wars Anu Kalra - Intel Corporation Jan Paul van Waveren - id Software Feb 21, 2006
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10. Synchronization Front End Backend Frame n Frame n-1 Frame n Frame n+1 Frame n+2 Frame n+1
  • 11.
  • 12.
  • 13. Multi-Threaded Drivers Driver Thread Driver FIFO Sound Thread Game Engine Loop OpenGL/D3D Main Thread Graphics Driver Front End 3D HW
  • 15.
  • 16. ETQW
  • 17.
  • 18.
  • 19. ETQW Threading overview Game Logic Bot AI Sound Engine Renderer Sound Driver Graphics Driver MegaTexture Transcoding MegaTexture Streaming
  • 20. Mega Texture Streaming Game Logic Bot AI Sound Engine Renderer Sound Driver Graphics Driver MegaTexture Transcoding MegaTexture Streaming
  • 21.
  • 22. Mega Texture Transcoding Game Logic Bot AI Sound Engine Renderer Sound Driver Graphics Driver MegaTexture Transcoding MegaTexture Streaming
  • 23.
  • 24. Sound Engine Game Logic Bot AI Sound Engine Renderer Sound Driver Graphics Driver MegaTexture Transcoding MegaTexture Streaming
  • 25.
  • 26. Game Logic Game Logic Bot AI Sound Engine Renderer Sound Driver Graphics Driver MegaTexture Transcoding MegaTexture Streaming
  • 27.
  • 28. Bot AI Game Logic Bot AI Sound Engine Renderer Sound Driver Graphics Driver MegaTexture Transcoding MegaTexture Streaming
  • 29.
  • 30.
  • 31.
  • 32. Bot AI static const int MIN_FRAME_DELAY = 0; static const int MAX_FRAME_DELAY = 4; HANDLE gameSignal; HANDLE aiSignal; Int gameFrameNum; int lastAIGameFrameNum; void GameThread() { for ( ; ; ) { SetCurrentGameOutputState(); AdvanceWorld(); SetCurrentGameWorldState(); gameFrameNum++ // let the AI thread know there's another game frame ::SetEvent( gameSignal ); // wait if the AI thread is falling too far behind while( lastAIGameFrameNum < gameFrameNum - MAX_FRAME_DELAY ) { ::SignalObjectAndWait( gameSignal, aiSignal, INFINITE, FALSE ); } } }
  • 33. Bot AI void AIThread() { for ( ; ; ) { // let the game thread know another AI frame has started ::SetEvent( aiSignal ); // never run more AI frames than game frames while( lastAIGameFrameNum >= gameFrameNum - MIN_FRAME_DELAY ) { ::SignalObjectAndWait( aiSignal, gameSignal, INFINITE, FALSE ); } lastAIGameFrameNum = gameFrameNum; SetCurrentAIWorldState(); AdvanceAI(); SetCurrentAIOutputState(); } }
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.