XNA Intro Workshop
-
Upload
sjors-miltenburg -
Category
Education
-
view
3.385 -
download
3
description
Transcript of XNA Intro Workshop
![Page 2: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/2.jpg)
Who?
![Page 3: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/3.jpg)
Who?
William
Higinbotham
![Page 4: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/4.jpg)
First video game, 1958
![Page 5: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/5.jpg)
First video game, 1958
![Page 6: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/6.jpg)
Spacewar, 1962
![Page 7: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/7.jpg)
The Galaxy Game, 1971
![Page 8: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/8.jpg)
Pong, 1972
![Page 9: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/9.jpg)
Spaceinvader, 1978
![Page 10: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/10.jpg)
Commodore, 1982
![Page 11: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/11.jpg)
Super Mario Bros, 1985
![Page 12: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/12.jpg)
Wolfenstein 3D, 1992
![Page 13: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/13.jpg)
Duke Nukem 3D, 1996
![Page 14: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/14.jpg)
Call of Duty 4, 2007
![Page 15: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/15.jpg)
Second Life
$5 million p.
month
NL game industry bigger than film industry
NL game
industry bigger
than
music industry
NL Game industie$ 1.47 miljard
Facts
World of Warcraft
[2007]
$ 1.176 BillionUSA [2007]$ 17.9 billion
Halo 3, first 24 hour$ 170 million
Turnover Ubisoft 2007$ 662.7 million
![Page 16: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/16.jpg)
Microsoft’s
Windows
Microsoft’s DirectX
Microsoft’s
Xbox
Microsoft’s Xbox 360
Microsoft & gaming
![Page 17: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/17.jpg)
XNA
• tools for game development
• Completely managed environment
• All aspects of game production in one system
• Game development is accessible
![Page 18: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/18.jpg)
XNA Platform
• XNA Framework
• XNA Build
• XNA Framework Content Pipeline
• XNA Game Studio
![Page 19: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/19.jpg)
What do you need?
• .NET 3.0• Visual Studio (C# Express is free!)• XNA Framework• XNA Game Studio
![Page 20: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/20.jpg)
XNA Framework• Microsoft .NET CLR 3.0 (3.5?)
• Cross-Platform Game Development– Windows XP– Windows Vista– Xbox 360 – Zune
![Page 21: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/21.jpg)
XNA Framework overview
Legend XNA Provides You Provide Community
Platform
CoreFramework
ExtendedFramework
XACT XINPUT XContentDirect3D
Graphics Audio Input Math Storage
Application Model Content Pipeline
Games Starter Kits Code Content Components
![Page 22: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/22.jpg)
XNA Framework overview
Platform
CoreFramework
ExtendedFramework
XACT XINPUT XContentDirect3D
Graphics Audio Input Math Storage
Application Model Content Pipeline
Games Starter Kits Code Content Components
Legend XNA Provides You Provide Community
![Page 23: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/23.jpg)
Starter Kits
“Take our games and make them your own”
• “Complete” games– Starting point for your own games– Available through “New Project…”– Hit F5 and done!– Documentation and tutorials
![Page 24: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/24.jpg)
Components
• They use the standard gameloop– Initialize, Load, Update, Draw, Unload
• Create and re-use functionality• Use 3rd party components• Community has a standard• Menus, virtual keyboard, game
engine, game info, radar’s, map, etc…
![Page 25: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/25.jpg)
Components
• Example of a Component– Virtual keyboard voor de XBOX 360
![Page 26: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/26.jpg)
XNA Framework overview
Platform
CoreFramework
XACT XINPUT XContentDirect3D
Graphics Audio Input Math Storage
Legend XNA Provides You Provide Community
ExtendedFramework Application Model Content Pipeline
Games Starter Kits Code Content Components
![Page 27: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/27.jpg)
Application Model
• Platform abstraction– Don’t worry about the platform
• First line of code is for your game
• Game class– Starting point for your game
![Page 28: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/28.jpg)
Application Model
• Game– Initialize– LoadContent– Update– Draw– UnloadContent
• GameComponent, DrawableGameComponent
Game Class, starting point
![Page 29: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/29.jpg)
Content Pipeline
• extensible content processing framework• 2D File Formats
(.DDS, .BMP, .JPG, .PNG, .TGA)• 3D File Formats (.FBX, .X)• Material File Formats (.FX)• Audio File Formats (.XAP)
![Page 30: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/30.jpg)
Platform
ExtendedFramework
XACT XINPUT XContentDirect3D
Application Model Content Pipeline
Games Starter Kits Code Content Components
XNA Framework overview
Legend XNA Provides You Provide Community
CoreFramework Graphics Audio Input Math Storage
![Page 31: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/31.jpg)
Core Framework
• Graphics– SpriteBatch, BasicEffect, Texture2d,
GraphicsDevice, Model, VertexBuffer• Audio
– SoundBank, WaveBank, Cue, AudioEngine
– Looping, Streaming en memory management
– low-level buffer management• Input
– GamePad, Keyboard, Mouse
![Page 32: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/32.jpg)
Core Framework
• Math– MathHelper.ToRadians(float angle), PiOver4
• Storage– Title Storage (Shaders, Meshes, Textures,
Sounds…)– User Storage (Save games, Scores…)– Emulated on the Windows Platform
• Network– NetworkSession, PacketReader, NetworkGamer
![Page 33: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/33.jpg)
XNA Framework Overzicht
Platform XACT XINPUT XContentDirect3D
Legend XNA Provides You Provide Community
CoreFramework
ExtendedFramework
Graphics Audio Input Math Storage
Application Model Content Pipeline
Games Starter Kits Code Content Components
![Page 34: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/34.jpg)
Platform abstraction
• Don’t worry about the platform, but about your game!
• Mono started an implementation
![Page 35: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/35.jpg)
XACT
• Microsoft Cross-Platform Audio Creation Tool
• Create audio files for XNA games• Compiles .wav files• Add info to the sound
– Looping, volume levels
![Page 36: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/36.jpg)
Community
• 3D Models– Cars, Houses, humans, levels
• Mostly free• http://turbosquid.com/xna
![Page 37: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/37.jpg)
Community
• Example of a community built Component– XNA Console
![Page 38: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/38.jpg)
Deployment to Xbox 360
• What do you need to deploy to Xbox 360?– Xbox Live Account– XNA Game Launcher– Connection to computer– XNA Creators Club account
• XNA Creators Club account– 49 euro (4 months)– 99 euro (1 year)
![Page 39: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/39.jpg)
Getting creative
• Creating games with XNA is easy!
![Page 40: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/40.jpg)
We will be building
• Tank game– Drive, aim and shoot
![Page 41: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/41.jpg)
Steps
• Run an empty game• Load graphical content• Show tank on screen• Handle user input
– Rotate– Move– Shoot
![Page 42: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/42.jpg)
Step 1: Empty game
• Create a new XNA game • Run!
![Page 43: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/43.jpg)
Step 2: Load Content
• Create a Tank Class– Vector2 (x,y) for position– Float (Radians) for direction
• 3 resources (tank, turret, canonball)• Texture2D
– ContentManager.Load<2DTexture>(“Tank”);
![Page 44: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/44.jpg)
Step 3.1: Display content
• Draw tank • Draw turret
• Draw @ center of the screen• Does it matter what you draw first?
![Page 45: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/45.jpg)
Step 3.2: Display content
• SpriteBatch.Begin();• SpriteBatch.Draw(7
implementations);• SpriteBatch.End();
• Screen– GraphicsManager.GraphicsDevice.Viewp
ort– 0,0 = top left corner– 800,600 = bottom right corner
![Page 46: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/46.jpg)
Step 4: Handle User input
• KeyboardState = Keyboard.GetState();
• If (KeyboardState.isKeyDown(Keys.Up));
• Where do we place this code?
• Rotate (Tank & turret)• Move• Vector2 Movement = new Vector2();• Movement.X += moveDist * (float)Math.Cos(Rotation);• Movement.Y += moveDist * (float)Math.Sin(Rotation);
![Page 47: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/47.jpg)
Step 5: Shoot
• CannonBall Class• One shot at a time (space invader
style)
![Page 48: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/48.jpg)
Step 6: Shoot Enemy
• Draw stationary tank• Hit?
– Rectangle.Intersects– Advanced: Per pixel collision– Where should this code go?
• Draw tank health– Add new SpriteFont to content folder– Load Content– SpriteBatch.DrawString();
![Page 49: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/49.jpg)
Step 7: Network code
• Sample code– Search for “XNA Network Prediction”– Uses Microsoft Live
• Create a local account
![Page 50: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/50.jpg)
Resources
• http://creators.xna.com/• http://blogs.msdn.com/xna• http://www.turbosquid.com/xna• http://xbox360homebrew.com• http://www.riemers.net• http://www.xnadevelopment.com• Search for XNA at Google with Live
Search
![Page 51: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/51.jpg)
Vragen?
![Page 52: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/52.jpg)
Nintendo’s Wii!
![Page 53: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/53.jpg)
Wiimote
• Knoppen• Accelerometer• IR-camera• Buzzer• Leds• Bluetooth
![Page 54: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/54.jpg)
Accelerometer
• ADXL330 3-Axis ±3g iMEMS® Accelerometer
![Page 55: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/55.jpg)
Accelerometer
Z (-3G, 3G)
Y (-3G,3G)
![Page 56: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/56.jpg)
Accelerometer
1
0
0
Stil
![Page 57: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/57.jpg)
Accelerometer
>1
0
0
Omhoog
![Page 58: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/58.jpg)
Accelerometer
<1
0
0
Omlaag
![Page 59: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/59.jpg)
IR-camera
• PixArt optical sensorMulti-Object Tracking engine (MOT sensor™)
• Sensor bar
![Page 60: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/60.jpg)
IR-camera
![Page 61: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/61.jpg)
Bluetooth
• BCM2042Advanced Wireless Keyboard/Mouse Bluetooth® Chip
• HID Device
![Page 62: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/62.jpg)
Wiimote -> PC
• OS• Bluetooth Device• Bluetooth stack
![Page 63: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/63.jpg)
API’s
RMX Automation
GlovePIE
WiinRemote
wiimote-api
WMD
WiiYourself!
libwiimote
WiimoteLib
WiimoteCPP
Wiiewer
Wiimotecomm
![Page 64: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/64.jpg)
WiimoteLib classes
![Page 65: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/65.jpg)
Simplicity
![Page 66: XNA Intro Workshop](https://reader033.fdocuments.net/reader033/viewer/2022061222/54c0aca94a7959d33f8b46fa/html5/thumbnails/66.jpg)
Demo time!
• Flying with the Wii