SlideShare une entreprise Scribd logo
1  sur  27
Advanced techniques for the development of 2D
Windows 8 games using Direct X and C++
Markus Jost
CEO, Lead Programmer, Codebox GmbH
markus.jost@codebox.ch
Agenda
Recap first Session 5’
Cross-Device UI Design 5’
Performance tuning 15’
Advanced Techniques 15’
Questions 5’
Cross-Device UI Design
Chapter 1/4
The Problem:
The Solution:
The Problem:
The Solution:
Illustrating design thoughts by sample
Performance tuning
Chapter 2/4
Texture Atlases
© Gango Games
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with TexturePacker http://texturepacker.com-->
<!-- $TexturePacker:SmartUpdate:963678140e0adc4acab0c90e39ea3d54$ -->
<!--Format:
n => name of the sprite
x => sprite x pos in texture
y => sprite y pos in texture
w => sprite width (may be trimmed)
h => sprite height (may be trimmed)
oX => sprite's x-corner offset (only available if trimmed)
oY => sprite's y-corner offset (only available if trimmed)
oW => sprite's original width (only available if trimmed)
oH => sprite's original height (only available if trimmed)
r => 'y' only set if sprite is rotated
-->
<TextureAtlas imagePath="FlySplash.png" width="512" height="1024">
<sprite n="fly_mouth_frame1.png" x="416" y="210" w="56" h="102" r="y"/>
<sprite n="fly_mouth_frame2.png" x="416" y="106" w="56" h="102" r="y"/>
<sprite n="fly_mouth_frame3.png" x="416" y="2" w="56" h="102" r="y"/>
<sprite n="fly_splash_solid.png" x="2" y="2" w="412" h="298"/>
<sprite n="fly_wings_frame1.png" x="2" y="412" w="228" h="108"/>
<sprite n="fly_wings_frame2.png" x="232" y="314" w="228" h="108"/>
<sprite n="fly_wings_frame3.png" x="2" y="302" w="228" h="108"/>
</TextureAtlas>
Build-time processing media
Pipeline Direct3D 11: http://code.msdn.microsoft.com/windowsapps/Direct3D-Resource-Loading-25406148
Sprite-Batching
SpriteBatch Sample: http://code.msdn.microsoft.com/windowsapps/Direct3D-sprite-sample-97ae6262
The Problem:
The Solution:
Sample optimization
optimization
Advanced Techniques
Chapter 3/4
Sample Pseudo Code for setting Transform:
Vector<Sprite*> parents = getParentSprites();
Matrix translation = Matrix.Identity;
foreach(Sprite *s in parents)
{
translation *= s.getTranslationMatrix();
}
translation *= getTranslationMatrix();
SetTranslation(translation);
SpriteSheet Animation
Create animation sequences from an Atlas
 Pros:
 High level of detail
 Easy to implement
 Cons:
 Very High Memory use
 Low FPS resolution
 Hand drawn frames take time
Bone Animations
Create animations using a tool (e.g. Flash) combining
body parts
 Pros:
 Way less memory consumption
 Allows many many animations to reuse same
texture parts
 Runs at max FPS
 Artists are used to using Flash
 Fast creation
 Cons:
 Low level of details
 Restrictions in design
 More work to implement
3D Animations
Use 3D Animations made with 3DSMax or any other 3D
Animation Tool
 Pros:
 Smooth Animations
 High Level of Details
 Depending on LOD, fast production
 Cons:
 Doesn’t mix well with 2D
 GPU intense
 Also Memory intense due to Animation data
 Used for example for smoke, fire, dust, snow, rain etc.
 Lots of tiny textures that face the camera
 Each particle has its own state
 Position
 Rotation
 Scale
 Color
 1 Texture…
 Using PointSprites, particles have only 1 vertex
 Usually alpha blended -> performance
 Avoid filling Particle Sytsems
 Supported by most GPUs
Sample
Implementation
Ss = Vh * Si * sqrt(1/(A + B * De + C *( De
2 )))
Vh : Viewport height
Si : Initial point size
De
2 : The Distance from eye to position
A, B, C : User defined values
float fPointSize = 1.0f, fPointScaleB = 1.0f;
m_d3dDevice->SetRenderState(D3DRS_POINTSPRITEENABLE, true); //create vertices?
m_d3dDevice->SetRenderState(D3DRS_POINTSCALEENABLE, true); //use scale function?
m_d3dDevice->SetRenderState(D3DRS_POINTSIZE, *((DWORD*)&fPointSize));
m_d3dDevice->SetRenderState(D3DRS_POINTSCALE_B, *((DWORD*)&fPointScaleB));
m_d3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,true);
m_d3dDevice->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_ONE);
m_d3dDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_ONE);
#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ | D3DFVF_PSIZE | D3DFVF_DIFFUSE) struct
D3DVERTEX { float fX, fY, fZ, fSize; DWORD dwColor; };
D3DXCreateTextureFromFile(m_d3dDevice,"texture.png",&pTex);
m_d3dDevice->SetTexture(0,pTex);
m_d3dDevice->SetStreamSource(0,pVB,0,sizeof(D3DVERTEX));
m_d3dDevice->DrawPrimitive(D3DPT_POINTLIST, 0, numPoints);
Box2D
http://www.box2d.org/manual.html
On Windows 8
http://code.msdn.microsoft.com/windowsapps/DWriteHelloWorld-760793d2
On Windows Phone 8
Or use BitmapFonts
http://directxtk.codeplex.com/
http://www.71squared.com/en/glyphdesigner
Questions?
Chapter 4/4
Advanced techniques for development of 2D Windows 8 games

Contenu connexe

Tendances

Facs2930 presentation alex_k
Facs2930 presentation alex_kFacs2930 presentation alex_k
Facs2930 presentation alex_k
alex1229
 
Shaders in Unity by Zoel
Shaders in Unity by ZoelShaders in Unity by Zoel
Shaders in Unity by Zoel
Agate Studio
 

Tendances (20)

3DS Max - Presentation
3DS Max - Presentation3DS Max - Presentation
3DS Max - Presentation
 
Facs2930 presentation alex_k
Facs2930 presentation alex_kFacs2930 presentation alex_k
Facs2930 presentation alex_k
 
Gaming Process
Gaming ProcessGaming Process
Gaming Process
 
Setup for Visualisation & Interactive Prototyping with Unity3D
Setup for Visualisation & Interactive Prototyping with Unity3DSetup for Visualisation & Interactive Prototyping with Unity3D
Setup for Visualisation & Interactive Prototyping with Unity3D
 
Max2015 ch13
Max2015 ch13Max2015 ch13
Max2015 ch13
 
Computer graphics - Nitish Nagar
Computer graphics - Nitish NagarComputer graphics - Nitish Nagar
Computer graphics - Nitish Nagar
 
Ani mation
Ani mationAni mation
Ani mation
 
Computer Graphics Project Development Help with OpenGL computer graphics proj...
Computer Graphics Project Development Help with OpenGL computer graphics proj...Computer Graphics Project Development Help with OpenGL computer graphics proj...
Computer Graphics Project Development Help with OpenGL computer graphics proj...
 
WebGL and three.js - Web 3D Graphics
WebGL and three.js - Web 3D Graphics WebGL and three.js - Web 3D Graphics
WebGL and three.js - Web 3D Graphics
 
Animation presentation
Animation presentationAnimation presentation
Animation presentation
 
ENEI16 - WebGL with Three.js
ENEI16 - WebGL with Three.jsENEI16 - WebGL with Three.js
ENEI16 - WebGL with Three.js
 
VFX & Games: A SImulation Approach
VFX & Games: A SImulation ApproachVFX & Games: A SImulation Approach
VFX & Games: A SImulation Approach
 
3D everywhere
3D everywhere3D everywhere
3D everywhere
 
VFX
VFXVFX
VFX
 
Animation
AnimationAnimation
Animation
 
【Unite 2017 Tokyo】Anima2Dについて語るで!2Dアニメーションの未来
【Unite 2017 Tokyo】Anima2Dについて語るで!2Dアニメーションの未来【Unite 2017 Tokyo】Anima2Dについて語るで!2Dアニメーションの未来
【Unite 2017 Tokyo】Anima2Dについて語るで!2Dアニメーションの未来
 
3D Modeling and Texturing Walkthrough
3D Modeling and Texturing Walkthrough3D Modeling and Texturing Walkthrough
3D Modeling and Texturing Walkthrough
 
Java ME - 05 - Game API
Java ME - 05 - Game APIJava ME - 05 - Game API
Java ME - 05 - Game API
 
Intro to maya
Intro to mayaIntro to maya
Intro to maya
 
Shaders in Unity by Zoel
Shaders in Unity by ZoelShaders in Unity by Zoel
Shaders in Unity by Zoel
 

Similaire à Advanced techniques for development of 2D Windows 8 games

Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
Johan Andersson
 
Game development with Cocos2d-x Engine
Game development with Cocos2d-x EngineGame development with Cocos2d-x Engine
Game development with Cocos2d-x Engine
Duy Tan Geek
 
HA5 – COMPUTER ARTS BLOG ARTICLE – 3D: The Basics
HA5 – COMPUTER ARTS BLOG ARTICLE – 3D: The BasicsHA5 – COMPUTER ARTS BLOG ARTICLE – 3D: The Basics
HA5 – COMPUTER ARTS BLOG ARTICLE – 3D: The Basics
hamza_123456
 
HA5 – COMPUTER ARTS BLOG ARTICLE – 3D: The Basics
HA5 – COMPUTER ARTS BLOG ARTICLE – 3D: The BasicsHA5 – COMPUTER ARTS BLOG ARTICLE – 3D: The Basics
HA5 – COMPUTER ARTS BLOG ARTICLE – 3D: The Basics
hamza_123456
 

Similaire à Advanced techniques for development of 2D Windows 8 games (20)

Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
Frostbite Rendering Architecture and Real-time Procedural Shading & Texturing...
 
Animation's Life Cycle And Its Application
Animation's Life Cycle And Its ApplicationAnimation's Life Cycle And Its Application
Animation's Life Cycle And Its Application
 
Pixel-Lab / Games:EDU / Michel Kripalani / Games Industry Overview and Trends
Pixel-Lab / Games:EDU / Michel Kripalani / Games Industry Overview and TrendsPixel-Lab / Games:EDU / Michel Kripalani / Games Industry Overview and Trends
Pixel-Lab / Games:EDU / Michel Kripalani / Games Industry Overview and Trends
 
Game development with Cocos2d-x Engine
Game development with Cocos2d-x EngineGame development with Cocos2d-x Engine
Game development with Cocos2d-x Engine
 
Chance's "Visual Effects" Lecture
Chance's "Visual Effects" LectureChance's "Visual Effects" Lecture
Chance's "Visual Effects" Lecture
 
The tech. behind RoboBlastPlanet
The tech. behind RoboBlastPlanetThe tech. behind RoboBlastPlanet
The tech. behind RoboBlastPlanet
 
Y1 gd engine_terminology
Y1 gd engine_terminologyY1 gd engine_terminology
Y1 gd engine_terminology
 
Unite 2013 optimizing unity games for mobile platforms
Unite 2013 optimizing unity games for mobile platformsUnite 2013 optimizing unity games for mobile platforms
Unite 2013 optimizing unity games for mobile platforms
 
AAA 3D GRAPHICS ON THE WEB WITH REACTJS + BABYLONJS + UNITY3D by Denis Radin ...
AAA 3D GRAPHICS ON THE WEB WITH REACTJS + BABYLONJS + UNITY3D by Denis Radin ...AAA 3D GRAPHICS ON THE WEB WITH REACTJS + BABYLONJS + UNITY3D by Denis Radin ...
AAA 3D GRAPHICS ON THE WEB WITH REACTJS + BABYLONJS + UNITY3D by Denis Radin ...
 
JS Fest 2019. Денис Радин. AAA 3D графика в Web с ReactJS, BabylonJS и Unity3D
JS Fest 2019. Денис Радин. AAA 3D графика в Web с ReactJS, BabylonJS и Unity3DJS Fest 2019. Денис Радин. AAA 3D графика в Web с ReactJS, BabylonJS и Unity3D
JS Fest 2019. Денис Радин. AAA 3D графика в Web с ReactJS, BabylonJS и Unity3D
 
Going Mobile with AIR+Starling
Going Mobile with AIR+StarlingGoing Mobile with AIR+Starling
Going Mobile with AIR+Starling
 
Gamebryo LightSpeed(English)
Gamebryo LightSpeed(English)Gamebryo LightSpeed(English)
Gamebryo LightSpeed(English)
 
Building a game engine with jQuery
Building a game engine with jQueryBuilding a game engine with jQuery
Building a game engine with jQuery
 
Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)
Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)
Parallel Graphics in Frostbite - Current & Future (Siggraph 2009)
 
HA5 – COMPUTER ARTS BLOG ARTICLE – 3D: The Basics
HA5 – COMPUTER ARTS BLOG ARTICLE – 3D: The BasicsHA5 – COMPUTER ARTS BLOG ARTICLE – 3D: The Basics
HA5 – COMPUTER ARTS BLOG ARTICLE – 3D: The Basics
 
3D - The Basics
3D - The Basics 3D - The Basics
3D - The Basics
 
Lecture 1 Introduction to VR Programming
Lecture 1 Introduction to VR ProgrammingLecture 1 Introduction to VR Programming
Lecture 1 Introduction to VR Programming
 
HA5 – COMPUTER ARTS BLOG ARTICLE – 3D: The Basics
HA5 – COMPUTER ARTS BLOG ARTICLE – 3D: The BasicsHA5 – COMPUTER ARTS BLOG ARTICLE – 3D: The Basics
HA5 – COMPUTER ARTS BLOG ARTICLE – 3D: The Basics
 
Advanced Game Development with the Mobile 3D Graphics API
Advanced Game Development with the Mobile 3D Graphics APIAdvanced Game Development with the Mobile 3D Graphics API
Advanced Game Development with the Mobile 3D Graphics API
 
Develop Games With Cocos Creator - A Game Engine By Cocos
Develop Games With Cocos Creator - A Game Engine By CocosDevelop Games With Cocos Creator - A Game Engine By Cocos
Develop Games With Cocos Creator - A Game Engine By Cocos
 

Plus de Microsoft Schweiz

Auswirkungen des starken Franken auf Schweizer KMU
Auswirkungen des starken Franken auf Schweizer KMUAuswirkungen des starken Franken auf Schweizer KMU
Auswirkungen des starken Franken auf Schweizer KMU
Microsoft Schweiz
 

Plus de Microsoft Schweiz (20)

Auswirkungen des starken Franken auf Schweizer KMU
Auswirkungen des starken Franken auf Schweizer KMUAuswirkungen des starken Franken auf Schweizer KMU
Auswirkungen des starken Franken auf Schweizer KMU
 
Moderne Technologien für Unternehmen
Moderne Technologien für UnternehmenModerne Technologien für Unternehmen
Moderne Technologien für Unternehmen
 
The Internet of Things
The Internet of ThingsThe Internet of Things
The Internet of Things
 
Innovation for Businesses
Innovation for BusinessesInnovation for Businesses
Innovation for Businesses
 
Digital Mega Trends & Security Impact
Digital Mega Trends & Security ImpactDigital Mega Trends & Security Impact
Digital Mega Trends & Security Impact
 
Microsoft Connection Days 2014/2015 keynote
Microsoft Connection Days 2014/2015 keynoteMicrosoft Connection Days 2014/2015 keynote
Microsoft Connection Days 2014/2015 keynote
 
Case Study: Modernisierung der IT Infrastruktur bei Transa
Case Study: Modernisierung der IT Infrastruktur bei TransaCase Study: Modernisierung der IT Infrastruktur bei Transa
Case Study: Modernisierung der IT Infrastruktur bei Transa
 
Mehr als nur ein Smartphone: Mobile Business
Mehr als nur ein Smartphone: Mobile BusinessMehr als nur ein Smartphone: Mobile Business
Mehr als nur ein Smartphone: Mobile Business
 
Der Weg in eine moderne Arbeitswelt mit dem FlexWork Phasenmodell
Der Weg in eine moderne Arbeitswelt mit dem FlexWork PhasenmodellDer Weg in eine moderne Arbeitswelt mit dem FlexWork Phasenmodell
Der Weg in eine moderne Arbeitswelt mit dem FlexWork Phasenmodell
 
Netzwerkunternehmen in Phase 5 - Das FlexWork Phasenmodell
Netzwerkunternehmen in Phase 5 - Das FlexWork PhasenmodellNetzwerkunternehmen in Phase 5 - Das FlexWork Phasenmodell
Netzwerkunternehmen in Phase 5 - Das FlexWork Phasenmodell
 
Flexible Arbeit weitgehend etabliert in Phase 4 - Das FlexWork Phasenmodell
Flexible Arbeit weitgehend etabliert in Phase 4 - Das FlexWork PhasenmodellFlexible Arbeit weitgehend etabliert in Phase 4 - Das FlexWork Phasenmodell
Flexible Arbeit weitgehend etabliert in Phase 4 - Das FlexWork Phasenmodell
 
Ein Umbruch in Phase 3 - Das FlexWork Phasenmodell
Ein Umbruch in Phase 3 - Das FlexWork PhasenmodellEin Umbruch in Phase 3 - Das FlexWork Phasenmodell
Ein Umbruch in Phase 3 - Das FlexWork Phasenmodell
 
Flexible mobile Arbeit als Ausnahme in Phase 2 - Das Flexwork Phasenmodell
Flexible mobile Arbeit als Ausnahme in Phase 2 - Das Flexwork PhasenmodellFlexible mobile Arbeit als Ausnahme in Phase 2 - Das Flexwork Phasenmodell
Flexible mobile Arbeit als Ausnahme in Phase 2 - Das Flexwork Phasenmodell
 
Ortsgebundene Arbeit in Phase 1 - FlexWork Phasenmodell
Ortsgebundene Arbeit in Phase 1 - FlexWork PhasenmodellOrtsgebundene Arbeit in Phase 1 - FlexWork Phasenmodell
Ortsgebundene Arbeit in Phase 1 - FlexWork Phasenmodell
 
A world after cloud computing by Gunter Dueck
A world after cloud computing by Gunter DueckA world after cloud computing by Gunter Dueck
A world after cloud computing by Gunter Dueck
 
A story about marketing power users
A story about marketing power usersA story about marketing power users
A story about marketing power users
 
Was passiert vor und nach dem Like? Social Media Tipps
Was passiert vor und nach dem Like? Social Media TippsWas passiert vor und nach dem Like? Social Media Tipps
Was passiert vor und nach dem Like? Social Media Tipps
 
Cloud + Apps = Marketing Success
Cloud + Apps = Marketing SuccessCloud + Apps = Marketing Success
Cloud + Apps = Marketing Success
 
Explore the Age of the Customer
Explore the Age of the CustomerExplore the Age of the Customer
Explore the Age of the Customer
 
Start with your social strategy
Start with your social strategyStart with your social strategy
Start with your social strategy
 

Dernier

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Dernier (20)

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 

Advanced techniques for development of 2D Windows 8 games

  • 1. Advanced techniques for the development of 2D Windows 8 games using Direct X and C++ Markus Jost CEO, Lead Programmer, Codebox GmbH markus.jost@codebox.ch
  • 2. Agenda Recap first Session 5’ Cross-Device UI Design 5’ Performance tuning 15’ Advanced Techniques 15’ Questions 5’
  • 8.
  • 9. Texture Atlases © Gango Games <?xml version="1.0" encoding="UTF-8"?> <!-- Created with TexturePacker http://texturepacker.com--> <!-- $TexturePacker:SmartUpdate:963678140e0adc4acab0c90e39ea3d54$ --> <!--Format: n => name of the sprite x => sprite x pos in texture y => sprite y pos in texture w => sprite width (may be trimmed) h => sprite height (may be trimmed) oX => sprite's x-corner offset (only available if trimmed) oY => sprite's y-corner offset (only available if trimmed) oW => sprite's original width (only available if trimmed) oH => sprite's original height (only available if trimmed) r => 'y' only set if sprite is rotated --> <TextureAtlas imagePath="FlySplash.png" width="512" height="1024"> <sprite n="fly_mouth_frame1.png" x="416" y="210" w="56" h="102" r="y"/> <sprite n="fly_mouth_frame2.png" x="416" y="106" w="56" h="102" r="y"/> <sprite n="fly_mouth_frame3.png" x="416" y="2" w="56" h="102" r="y"/> <sprite n="fly_splash_solid.png" x="2" y="2" w="412" h="298"/> <sprite n="fly_wings_frame1.png" x="2" y="412" w="228" h="108"/> <sprite n="fly_wings_frame2.png" x="232" y="314" w="228" h="108"/> <sprite n="fly_wings_frame3.png" x="2" y="302" w="228" h="108"/> </TextureAtlas>
  • 10. Build-time processing media Pipeline Direct3D 11: http://code.msdn.microsoft.com/windowsapps/Direct3D-Resource-Loading-25406148
  • 11.
  • 16. Sample Pseudo Code for setting Transform: Vector<Sprite*> parents = getParentSprites(); Matrix translation = Matrix.Identity; foreach(Sprite *s in parents) { translation *= s.getTranslationMatrix(); } translation *= getTranslationMatrix(); SetTranslation(translation);
  • 17. SpriteSheet Animation Create animation sequences from an Atlas  Pros:  High level of detail  Easy to implement  Cons:  Very High Memory use  Low FPS resolution  Hand drawn frames take time
  • 18. Bone Animations Create animations using a tool (e.g. Flash) combining body parts  Pros:  Way less memory consumption  Allows many many animations to reuse same texture parts  Runs at max FPS  Artists are used to using Flash  Fast creation  Cons:  Low level of details  Restrictions in design  More work to implement
  • 19. 3D Animations Use 3D Animations made with 3DSMax or any other 3D Animation Tool  Pros:  Smooth Animations  High Level of Details  Depending on LOD, fast production  Cons:  Doesn’t mix well with 2D  GPU intense  Also Memory intense due to Animation data
  • 20.  Used for example for smoke, fire, dust, snow, rain etc.  Lots of tiny textures that face the camera  Each particle has its own state  Position  Rotation  Scale  Color  1 Texture…  Using PointSprites, particles have only 1 vertex  Usually alpha blended -> performance  Avoid filling Particle Sytsems  Supported by most GPUs
  • 22. Implementation Ss = Vh * Si * sqrt(1/(A + B * De + C *( De 2 ))) Vh : Viewport height Si : Initial point size De 2 : The Distance from eye to position A, B, C : User defined values float fPointSize = 1.0f, fPointScaleB = 1.0f; m_d3dDevice->SetRenderState(D3DRS_POINTSPRITEENABLE, true); //create vertices? m_d3dDevice->SetRenderState(D3DRS_POINTSCALEENABLE, true); //use scale function? m_d3dDevice->SetRenderState(D3DRS_POINTSIZE, *((DWORD*)&fPointSize)); m_d3dDevice->SetRenderState(D3DRS_POINTSCALE_B, *((DWORD*)&fPointScaleB)); m_d3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,true); m_d3dDevice->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_ONE); m_d3dDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_ONE); #define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ | D3DFVF_PSIZE | D3DFVF_DIFFUSE) struct D3DVERTEX { float fX, fY, fZ, fSize; DWORD dwColor; }; D3DXCreateTextureFromFile(m_d3dDevice,"texture.png",&pTex); m_d3dDevice->SetTexture(0,pTex); m_d3dDevice->SetStreamSource(0,pVB,0,sizeof(D3DVERTEX)); m_d3dDevice->DrawPrimitive(D3DPT_POINTLIST, 0, numPoints);
  • 24. On Windows 8 http://code.msdn.microsoft.com/windowsapps/DWriteHelloWorld-760793d2 On Windows Phone 8 Or use BitmapFonts http://directxtk.codeplex.com/ http://www.71squared.com/en/glyphdesigner
  • 25.