28
A Brief Introduction to XNA Eric Feng ACRD

A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

A Brief Introduction to XNA

Eric Feng

ACRD

Page 2: A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

Agenda

• Introduction

• Application Model

• History and Roadmap

• Games Powered By XNA

• XNA’s Modules

• Working pipeline

• Performance

• Tips and Golden Rules

Page 3: A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

XNA’s Not Acronymed

• What IS XNA?– A managed framework for developing games on both PC

and Xbox 360• Graphics device, input, and audio management along with

math helpers

• Who is using XNA?– Hobbyists– Students– Independent developers– And…., professionals

• Torpex Games, Hidden Path Entertainment, GarageGamesInc.

Page 4: A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

XNA’s Not Acronymed (cont’d)

• Why XNA?

– Unmanaged background• assembly, C, C++• XNA exposed us to a new language ----- C#

– XNA allows for RAD• Full games can be put together in obscenely short periods of time• Allows developers to focus on content, gameplay, balancing over

technical issues

– XNA does things more intuitively than DirectX• Render Targets• Device Management

Page 5: A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

Game Technology Map Realtime Rendering

RAD Games Tools Pixomatic

ATI Radeon

Nvidia GeForce

Realtime Video Renderer

Creative Soundblaster

REALTEK AC’97

Nvidia NForce

Realtime Audio Renderer

Simulation Technology

Criterion Renderware AI

Biographic AI.implant

Ikuni

AI

LUA

Python

Java

UnrealScript

Scripting Lang

C#, VB, C++

Havok

Criterion Renderware Phyiscs

Novodex Novodex Physics

Physics Engine

Advanced Media OmiVoice

Voice Recognition

Multiplayer Technology

Quazal Net-Z

Terraplay

Demonware BitDemon

Butterfly Butterfly.NET

Networking

DirectPlay

Winsock

Zona TerraZona

Bigworld Bigworld

MMOG

GameSpy GameSpy

Sega SNAP

Valve Steam

Online Services

Live

Audio Content

RAD Game Tools Miles

Creative Labs Sensaura

CRI ADX

Firelight FMOD Sound System

Audio

XACT

DirectSound

Mesh/Material Content

PixoLogic Z-Brush

Interactive Fx Amazon Paint

Right Hemisphere Deep Paint

Right Hemisphere Deep UV

3D Image Editor

Adobe Photoshop

JASC Paintshop PRO

Corel Painter

Web Technology Optpix iMageStudio

Image Editor

Rt/zen RT/Shader

Shader - Creation

Nvidia FX Composer

ATI RenderMonkey

Shader - Composers

3D Editors

Animation Content

Third Wish Software Magpie

OC3 Impersonator

Lip Sync

Biovision

Motion Analysis

Vicon Motion Systems

Motion Capture

Kaydara MotionBuilder

RAD Game Tools Granny 3D

Natural Motion Endorphin

Curious Labs Poser

Animation Editor

Cinematic Content

Pixar PRMan

Mental Images Mental Ray

Splutterfish Brazil

Nvidia Gelato

Offline Renderer

Adobe Premier

AVID Xpress

Adobe AfterEffects

Discreet Combustion

Newtek Digital Fusion

Compositing Editor

RAD Game Tools Bink

CRI Sofdec

Factor 5 DivX

Video Playback

Process

Metroworks

SN Systems

Dev Tools

Visual Studio

Intel Vtune

Sony Performance

Analyzer

Profilers

PIX

Xoreax IncrediBuild

JetFrog JetBuild

Build Tools

MS Build

Alias Maya

Discreet 3D Studio Max

SoftImage XSI

Newtek Lightwave

3D Editor

Game Engines

Criterion Renderware Graphics

Epic Unreal

NDL Gamebyro (NetImerrse)

Touchdown Entertainment Jupiter

Id Quake/Doom

Valve Half Life 2

Crytek CryEngine

Vicarious Visions Intrinsic Alchemy

Spinor GmbH Shark 3D

Trinigy GmbH Vision

Virtools (Prototyping)

Game Engines

Singular Inversions FaceGen

Virtual Clones

Face Generation

Criterion Renderware Studio

Studio

Game Asset Conversion

Game Asset Conversion

Converters

Right Hemisphere Deep Exploration

Okino Polytrans

Converters

UI Creation/Menus

Macromedia Flash

Secret Level Flash Player

Anark GameFace

Criterion Maestro

UI Creation/Menus

Compuware SoftICE

Debugger

Visual Studio

BugZilla

Bug Tracking

Perforce

CVS

Subversion

Source Management

VS SourceSafe

VS Team System

OSS Docbook

Doxygen

ndoc

Document Generation

HTML HelpCakewalk Cakewalk Pro

Sonic Foundry Sound Forge

Adobe Audition

Digidesign ProTools

OSS Audacity

Audio Editors

Alienbrain

Asset Management

World/Level Editors

World/Level Editors

Test Tools

GamePlay Analysis

Page 6: A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

XNA PillarsDesign/Content Creation Game TechnologyProcess

Process/Build

Asset Management

Test Tools

Developer Tools

Game TechnologyDesign/Content Creation

Hybrid Holdings dPVS

Misc

Realtime Rendering

RAD Games Tools Pixomatic

ATI Radeon

Nvidia GeForce

Realtime Video Renderer

Creative Soundblaster

REALTEK AC’97

Nvidia NForce

Realtime Audio Renderer

Simulation Technology

Criterion Renderware AI

Biographic AI.implant

Ikuni

AI

LUA

Python

Java

UnrealScript

Scripting Lang

C#, VB, C++

Havok

Criterion Renderware Phyiscs

Novodex Novodex Physics

Physics Engine

Advanced Media OmiVoice [Xb]

Voice Recognition

Multiplayer Technology

Quazal Net-Z

Terraplay

Demonware BitDemon

Butterfly Butterfly.NET

Networking

DirectPlay

Winsock

Zona TerraZona

Bigworld Bigworld

MMOG

GameSpy GameSpy

Sega SNAP

Valve Steam

Online Services

Live

Audio Content

Metroworks

SN Systems

Dev Tools

Visual Studio

Game Engines

Micro Forte BigWorld

Criterion Renderware Graphics

Epic Unreal

NDL Gamebyro (NetImerrse)

Touchdown Entertainment Jupiter

Id Quake/Doom

Valve Half Life 2

Crytek CryEngine

Vicarious Visions Intrinsic Alchemy

Spinor GmbH Shark 3D

Trinigy GmbH Vision

Virtools (Prototyping)

Game Engines

Criterion Renderware Studio

Studio

Mesh/Material Content

PixoLogic Z-Brush

Interactive Fx Amazon Paint

Right Hemisphere Deep Paint

Right Hemisphere Deep UV

3D Image Editor

Adobe Photoshop

JASC Paintshop PRO

Corel Painter

Web Technology Optpix iMageStudio

Image Editor

Rt/zen RT/Shader

Shader - Creation

Nvidia FX Composer

ATI RenderMonkey

Shader - Composers

Singular Inversions FaceGen

Virtual Clones

Face Generation

3D Editors

Alias Maya

Discreet 3D Studio Max

SoftImage XSI

Newtek Lightwave

3D Editor

Animation Content

Third Wish Software Magpie

OC3 Impersonator

Lip Sync

Biovision

Motion Analysis

Vicon Motion Systems

Motion Capture

Kaydara MotionBuilder

RAD Game Tools Granny 3D

Natural Motion Endorphin

Curious Labs Poser

Animation Editor

Cinematic Content

Compositing Editor

RAD Game Tools Bink

CRI Sofdec

Factor 5 DivX

Video Playback

Pixar PRMan

Mental Images Mental Ray

Splutterfish Brazil

Nvidia Gelato

Offline Renderer

RAD Game Tools Miles

Creative Labs Sensaura

CRI ADX

Firelight FMOD Sound System

Audio

XACT

DirectSound

Design Tool Format Converters

Game Asset Conversion

Game Asset Conversion

Compuware SoftICE

Debugger

Visual Studio

BugZilla

Bug Tracking

Intel Vtune

Sony Performance

Analyzer

Profilers

PIX

Perforce

CVS

Subversion

Source Management

VS SourceSafe

VS Team System

Alienbrain

Asset Management

Cakewalk Cakewalk Pro

Sonic Foundry Sound Forge

Adobe Audition

Digidesign ProTools

OSS Audacity

Audio Editors

Right Hemisphere Deep Exploration

Okino Polytrans

Converters

UI Creation/Menus

Macromedia Flash

Secret Level Flash Player

Anark GameFace

Criterion Maestro

UI Creation/Menus

World/Level Editors

World/Level Editors

Test Tools GamePlay Analysis

Xoreax IncrediBuild

JetFrog JetBuild

Build Tools

MS Build

OSS Docbook

Doxygen

ndoc

Document Generation

HTML Help

Adobe Premier

AVID Xpress

Adobe AfterEffects

Discreet Combustion

Newtek Digital Fusion

Page 7: A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

Application Model

• The XNA Framework is divided into three essential parts– XNA Graphic Engine in the Microsoft.Xna.Framework.dll

– XNA Game Application Model in the Microsoft.Xna.Framework.Game.dll

– XNA Content Pipeline in the Microsoft.Xna.Framework.Content.Pipeline.dlls

XNA Content PipelineMicrosoft.Xna.Framework.Content.Pipeline.dll

Game Application ModelMicrosoft.Xna.Framework.Game.dll

Graphic EngineMicrosoft.Xna.Framework.dll

Page 8: A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

History and Roadmap

• XNA 1.0 – Aug. 2006– Application Model, GameComponenents– GraphicDevice, Graphics– Audio, Input, Storage, Math

• XNA 2.0 – Dec. 2007– Expanded Support for all version of VS2005– MRT, device lost auto restore, occlusion query, etc.– Networking support!

• XNA 3.0 – Christmas. 2008??– Add Zune support– Support for C# 3.0 for all platform(I can use LINQ! Oh, My…)– Content compression, Better FBX support

Page 9: A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

Games Powered By XNA

• XNA Car Racing Game– The Racing Game Starter Kit is a complete XNA

Game Studio game. This highly-anticipated project, originally created for Microsoft by Benjamin Nitschke of exDream Entertainment.

– XNA car Racing Game is a 3D auto racing game that features advanced graphics, audio, and input processing. Race around the track and try to beat the ghost car to achieve the best time.

Page 10: A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

Games Powered By XNA

• The Robot Game– Robot Game was developed by Zepetto, a South Korean game

development company. Previously released titles include Vulcanus and several games for mobile platforms.

– Robot Game is a three-dimensional robot combat game that demonstrates the following components: • Advanced graphics using shaders and post-processing effects

• Advanced particle system

• Collision detection, 3D positional sound, input, and screens management

• Single-player mode and split-screen two-player versus mode

• Customizable game elements, such as robots, weapons, and items

Page 11: A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

Games Powered By XNA

• Singularis

– Developed with XNA 2.0 Sprite with Torque Builder, Singularious is a game about a single cell creature.

– Story: The protozoa Proto has a ambitious goal - he want's to become the

most powerful entity of the universe! To reach his target, Proto invades into animals, travels through their bodies and settles down on their central nerve cord, where he gains control over them. When he has control over them, he uses his victims to get to the next, more powerful animal - until he gains control over the most powerful entity within the universe ... a floating, black cat!

Page 12: A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

Games Powered By XNA

• Other Games

– HurricanX – Action Game

– RPG Starter Kit by XNA Creater Club

– The Zune game

Page 13: A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

XNA’s Modules

• Let’s dig down

– Content Pipeline

– Graphics

• Programable pipeline

• Effect system

• 2D Sprite

– Framework

– Networking

– Audio, etc.

Page 14: A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

Content Pipeline

Page 15: A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

Content Pipeline

• In action!

– To intrude the exist pipeline

– Simple sample from my engine

– Create a terrain from a heightmap

Page 16: A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

Add “Visibility” tag

Add “AABB” tag

Add “Effect” tag

Material converter

Page 17: A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

Attach correct shader to meshes

Page 18: A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

Read the image

Construct vertices

Create a new material

C r e a t e t o p o l o g y

Page 19: A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

What’s the cons of XNA’s Graphics

• GraphicsDeviceManager

• Render States

• Vertex and Index Buffers

• Shaders and Effects

Page 20: A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

XNA Framework

• GameServices container– Loose coupling between modules

• Math Helper– Vector, Color, Matrix, Quaternion,

• MeshBuilder– Generate normal, texture coordinate, binormal,

tangent in content pipeline

Page 21: A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

Working pipeline

• Let’s get our hands dirty!

3Ds Max Modeling

Export to FBX

Generate shader code files

Generate XNB using content pipeline

Display the models on screen

Page 22: A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

Performance

• Graphics– Offload to the GPU

– Choose an appropriate SpriteSortMode

– Avoid StateBlock

• Optimize math where necessary

• Take advantage of multiple threads

• Profile on both Xbox and Windows

Page 23: A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

Performance

• Offload tasks from CPU to GPU

– Mesh Instancing

– Particle 3D samples

– Occlusion Query

Page 24: A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

Performance

• XNA Architecture on XBox360

Page 25: A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

Performance

• GraphicsDevice is somewhat thread-safe– Cannot render from more than one thread at a time

– Can create resources and SetData while another thread renders

• ContentManager is not thread-safe– Ok to have multiple instances, but only one per thread

• Input is not threadable– Windows games must read input on the main game thread

• Audio and networking are thread-safe

Page 26: A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

Golden Rules And Tips

• Tips

– Write the tests first and do not think about the implementation.

– Try to make sure you test as much as possible.

– Start the test constantly from this point on, even when you think it does not make sense.

Page 27: A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

Golden Rules And Tips

• Golden Rules

– Don’t use any external dlls if not required

– Don’t wait with the testing

– Don’t load content directly

– Save games and loading other content

– Test resolutions

– Allow controlling everything with a gamepad

– Debug and unit test on the Xbox 360

Page 28: A Brief Introduction to XNA · and Xbox 360 •Graphics device, input, and audio management along with math helpers •Who is using XNA? –Hobbyists –Students –Independent developers

• Thank you.

• Demo Time

• Q & A

http://www.xna.com