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
Advanced techniques for development of 2D Windows 8 games
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
Advanced techniques for development of 2D Windows 8 games
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
Advanced techniques for development of 2D Windows 8 games
Questions?
Chapter 4/4
Advanced techniques for development of 2D Windows 8 games

More Related Content

PPTX
Application of 3d max for 3d development and rendering and its merits
PPTX
Game Engine for Serious Games
PPTX
3Ds MAX & INTRODUCTION TO ANIMATION IN AUTODESK 3Ds MAX
PPT
Modeling and texturing in 3 ds max
PPTX
Raster animation
PPTX
Gd - 8th - Web Game Design Using Flash
PPT
Overview of graphics systems
PPTX
3 d animation
Application of 3d max for 3d development and rendering and its merits
Game Engine for Serious Games
3Ds MAX & INTRODUCTION TO ANIMATION IN AUTODESK 3Ds MAX
Modeling and texturing in 3 ds max
Raster animation
Gd - 8th - Web Game Design Using Flash
Overview of graphics systems
3 d animation

What's hot (20)

PDF
3DS Max - Presentation
PPT
Facs2930 presentation alex_k
PDF
Gaming Process
PPTX
Setup for Visualisation & Interactive Prototyping with Unity3D
PPT
Max2015 ch13
PPT
Computer graphics - Nitish Nagar
PPTX
PPTX
Computer Graphics Project Development Help with OpenGL computer graphics proj...
PPTX
WebGL and three.js - Web 3D Graphics
PPTX
Animation presentation
PDF
ENEI16 - WebGL with Three.js
PPTX
VFX & Games: A SImulation Approach
PDF
3D everywhere
PPT
Animation
PDF
【Unite 2017 Tokyo】Anima2Dについて語るで!2Dアニメーションの未来
PPT
3D Modeling and Texturing Walkthrough
PPTX
Java ME - 05 - Game API
PDF
Shaders in Unity by Zoel
3DS Max - Presentation
Facs2930 presentation alex_k
Gaming Process
Setup for Visualisation & Interactive Prototyping with Unity3D
Max2015 ch13
Computer graphics - Nitish Nagar
Computer Graphics Project Development Help with OpenGL computer graphics proj...
WebGL and three.js - Web 3D Graphics
Animation presentation
ENEI16 - WebGL with Three.js
VFX & Games: A SImulation Approach
3D everywhere
Animation
【Unite 2017 Tokyo】Anima2Dについて語るで!2Dアニメーションの未来
3D Modeling and Texturing Walkthrough
Java ME - 05 - Game API
Shaders in Unity by Zoel
Ad

Similar to Advanced techniques for development of 2D Windows 8 games (20)

PPTX
Making a game with Molehill: Zombie Tycoon
PDF
Useful Tools for Making Video Games - XNA (2008)
PPTX
Adding more visuals without affecting performance
PPTX
FGS 2011: Making A Game With Molehill: Zombie Tycoon
PPTX
Using The New Flash Stage3D Web Technology To Build Your Own Next 3D Browser ...
PPTX
Beginning direct3d gameprogramming08_usingtextures_20160428_jintaeks
PDF
APB Customisation System
PPTX
4,000 Adams at 90 Frames Per Second | Yi Fei Boon
PPT
D3 D10 Unleashed New Features And Effects
PPT
Crysis Next-Gen Effects (GDC 2008)
PDF
Memory Optimization in Cocos2d-x WP8 using Compressed Textures
PPSX
Dx11 performancereloaded
PPTX
Windows to reality getting the most out of direct3 d 10 graphics in your games
PPTX
Oculus insight building the best vr aaron davies
PPTX
2 Dimensions Of Awesome: Advanced ActionScript For Platform Games by Iain Lobb
PPTX
Developing Next-Generation Games with Stage3D (Molehill)
PDF
Real life XNA
PPT
Secrets of CryENGINE 3 Graphics Technology
PDF
thu-blake-gdc-2014-final
PDF
XNA L09–2D Graphics and Particle Engines
Making a game with Molehill: Zombie Tycoon
Useful Tools for Making Video Games - XNA (2008)
Adding more visuals without affecting performance
FGS 2011: Making A Game With Molehill: Zombie Tycoon
Using The New Flash Stage3D Web Technology To Build Your Own Next 3D Browser ...
Beginning direct3d gameprogramming08_usingtextures_20160428_jintaeks
APB Customisation System
4,000 Adams at 90 Frames Per Second | Yi Fei Boon
D3 D10 Unleashed New Features And Effects
Crysis Next-Gen Effects (GDC 2008)
Memory Optimization in Cocos2d-x WP8 using Compressed Textures
Dx11 performancereloaded
Windows to reality getting the most out of direct3 d 10 graphics in your games
Oculus insight building the best vr aaron davies
2 Dimensions Of Awesome: Advanced ActionScript For Platform Games by Iain Lobb
Developing Next-Generation Games with Stage3D (Molehill)
Real life XNA
Secrets of CryENGINE 3 Graphics Technology
thu-blake-gdc-2014-final
XNA L09–2D Graphics and Particle Engines
Ad

More from Microsoft Schweiz (20)

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

Recently uploaded (20)

PDF
Flame analysis and combustion estimation using large language and vision assi...
PDF
Enhancing plagiarism detection using data pre-processing and machine learning...
PDF
A proposed approach for plagiarism detection in Myanmar Unicode text
PDF
Architecture types and enterprise applications.pdf
PPT
What is a Computer? Input Devices /output devices
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PDF
sbt 2.0: go big (Scala Days 2025 edition)
PPT
Geologic Time for studying geology for geologist
PPTX
GROUP4NURSINGINFORMATICSREPORT-2 PRESENTATION
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PDF
Five Habits of High-Impact Board Members
PDF
OpenACC and Open Hackathons Monthly Highlights July 2025
PPTX
Custom Battery Pack Design Considerations for Performance and Safety
PDF
Taming the Chaos: How to Turn Unstructured Data into Decisions
PPTX
TEXTILE technology diploma scope and career opportunities
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
Developing a website for English-speaking practice to English as a foreign la...
PPTX
Build Your First AI Agent with UiPath.pptx
PPTX
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
Flame analysis and combustion estimation using large language and vision assi...
Enhancing plagiarism detection using data pre-processing and machine learning...
A proposed approach for plagiarism detection in Myanmar Unicode text
Architecture types and enterprise applications.pdf
What is a Computer? Input Devices /output devices
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
sbt 2.0: go big (Scala Days 2025 edition)
Geologic Time for studying geology for geologist
GROUP4NURSINGINFORMATICSREPORT-2 PRESENTATION
A contest of sentiment analysis: k-nearest neighbor versus neural network
Five Habits of High-Impact Board Members
OpenACC and Open Hackathons Monthly Highlights July 2025
Custom Battery Pack Design Considerations for Performance and Safety
Taming the Chaos: How to Turn Unstructured Data into Decisions
TEXTILE technology diploma scope and career opportunities
Zenith AI: Advanced Artificial Intelligence
Getting started with AI Agents and Multi-Agent Systems
Developing a website for English-speaking practice to English as a foreign la...
Build Your First AI Agent with UiPath.pptx
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx

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’
  • 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
  • 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