xna and silverlight

18
XNA and Silverlight Aaron Stanley King

Upload: aaron-king

Post on 22-Jan-2015

2.005 views

Category:

Documents


8 download

DESCRIPTION

My slide deck from presenting to the Cleveland WPF User Group about using XNA inside Silverlight for web gaming.

TRANSCRIPT

Page 1: XNA And Silverlight

XNA and SilverlightAaron Stanley King

Page 2: XNA And Silverlight

XNA and Silverlight

Free game development toolkit using .NET, C#

Extends Visual Studio 2010 Including the free C#

Express Edition Version 4.0

Cross Platform Input API Enhanced Audio and Video Windows Phone 7

App Hub membership Develop and publish for

Xbox 360 or Windows Phone Unlock your phone to

development and publish to the Zune Marketplace

$99/12 months

Common Base Classes

Windows Phone 7

Silverlight XNA

Page 3: XNA And Silverlight

Fundementals

Initialize LoadContent Update

DrawUnloadContent

Page 4: XNA And Silverlight

The Game Loop

while (IsRunning) {

Update(); Draw();

}

Page 5: XNA And Silverlight

The Content Pipeline

Images, fonts, wav

files, models

Importer

ProcessorCompiled Output

Page 6: XNA And Silverlight

ScreenManager

screenManager = new ScreenManager(this);

Components.Add(screenManager);

void OptionsMenuEntrySelected(object sender, PlayerIndexEventArgs e) {

ScreenManager.AddScreen(new OptionsMenuScreen(), e.PlayerIndex); }

Architectural Design (decide early if you want more than one ScreenManager)

GameScreen classes are loaded into a ScreenManager ( pretty! ) Simple transitions can be added (Bing for more) GameComponent is very useful as a base class for most parts of

your game

Page 7: XNA And Silverlight

MSFT.XNA.FW.INPUT

GamePad Buttons ButtonState GamePadDeadZone GamePadType

Keyboard Keys KeyState

Mouse Buttons Position

MSFT.XNA.FW.INPUT.TOUCH

TouchPanel GestureType TouchLocationState

Input API

MSFT.DEVICES.SENSORS Accelerometer

SensorState

Page 8: XNA And Silverlight

_soundEffect = Content.Load<SoundEffect>("ShotEffect");

var pan = (float)((_rnd.NextDouble() - 0.5) * 2.0);var pitch = (float)((_rnd.NextDouble() - 0.5) * 2.0); var volume = (float)((_rnd.NextDouble() / 2.0) + 0.5);

_soundEffect.Play(volume, pitch, pan);

Audio

Page 9: XNA And Silverlight

Sorry, no transforms or storyboards Just Draw ( most powerful method in the XNA universe )

public void Draw ( Texture2D texture, Vector2 position, Nullable<Rectangle> sourceRectangle, Color color, float rotation, Vector2 origin, float scale, SpriteEffects effects, float layerDepth

)

Animations

Page 10: XNA And Silverlight

SilverArcade.SilverSprite.dll SilverArcade.SilverSprite.Core.dll

A little XAML <UserControl x:Class="SilverSprite.Page"

xmlns="http://schem...resentation" xmlns:x="http://schema...xaml" Width="400" Height="300" xmlns:game="clr-namespace:Game"> <Grid x:Name="LayoutRoot" Background="White"> <Canvas> <game:Game1 x:Name="game"/> </Canvas> </Grid> </UserControl>

Add content to your silverlight app (/Content )

Silversprite

Page 11: XNA And Silverlight

Demo

Page 12: XNA And Silverlight

Publish your games to Xbox LIVE Marketplace Profit!! 70%/30% baseline split Time-limited trial, no free games Charge 200, 400, or 800 points

150 MB limit for 400 and 800 point games 50 MB limit for 200 point games

You retain all rights and IP (if Microsoft invests in further marketing, they

reserve the right to take 10-30% more)

Xbox LIVE Indie Games

Page 13: XNA And Silverlight

Publish your games to Windows Phone Marketplace

Profit!! 70%/30% baseline split Free apps are ok Charge $.99 to $499 ( no points )

225 MB limit You retain all rights and IP You can’t charge for updates. It’s not in the

Microsoft marketing strategy.

Windows Phone Marketplace

Page 14: XNA And Silverlight

INDIE

Develop with XNA

Studio

ARCADE

Leaderboards Achievements Xbox LIVE Rich

Presence Xbox LIVE Multiplayer C++ and Native

DirectX Develop with XNA

Studio

Why not go Pro!

Page 15: XNA And Silverlight

XNA Futures

Page 16: XNA And Silverlight

Kinect for Windows SDK ( later this summer )

MSFT.XNA.FW.Input.You

Page 17: XNA And Silverlight

Aaron Stanley King

Twitter -> @trendoid Gamertag -> HeraldStudios Email -> [email protected]

Wanna play?