Real lifeJohan Lindfors
windows phone for games•   impressive performance•   sensors and touch•   potentially xbox-live•   ads and trials
kinectimals
harvest
implode
doodle fit
ilomilo
other favorites
xna in 1 minute•   a comprehensive framework for games•   integrated management of content•   games with 2d and ”sprites”•...
initialize   update   render
managing content•   content pipeline•   import common files•   leverage compile time•   optimized binary format•   extensi...
first some 2d•   x and y (and z)•   spriteBatch•   sprites/sprite sheets•   blending
and then some 3d• x, y and z• camera is described with matrices  • view  • projection• world matrix transforms objects rel...
demo
effects - shaders• configurable  •   basic  •   skinned  •   environmentMap  •   dualTexture  •   alphaTest
demo
”hardware scaler”• 800x480       =    384 000 pixels• 600x360       =    216 000 pixels (56%)• 400x240       =    96 000 p...
performance tips• manage the stack and heap  • reference types live on the _______!  • value types live on the _______!• p...
performance tips• gc is ”simpler” than on pc  • allocate objects early, reuse• GC.Collect() can be your friend!  • after l...
demo
sound and music•   soundEffect•   load as content•   wp handles 64 simultaneously•   possible to change    • pitch    • vo...
orientation graphics.SupportedOrientations =     DisplayOrientation.Portrait |     DisplayOrientation.LandscapeLeft |     ...
orientation Window.OrientationChanged += (s, e) => {     switch (Window.CurrentOrientation)     {         case DisplayOrie...
accelerometer    using Microsoft.Devices.Sensors;•    measures acceleration in X, Y and Z•    values returned between -1 a...
start accelerometer Accelerometer accel; private void startAccelerometer() {     accel = new Accelerometer();     accel.Re...
read the accelerometer Vector3 accelReading; void accel_ReadingChanged(object sender,         AccelerometerReadingEventArg...
touch• windows phone handles 4 touch points  • all points have unique id  • pressed | moved | released TouchCollection tou...
gestures• wp can also handle gestures  • tap | drag | hold | flick | pinch ... TouchPanel.EnabledGestures =     GestureTyp...
network• http, rest, xml, sockets... void wc_OpenReadCompleted(object sender,           OpenReadCompletedEventArgs e) {   ...
xbox live• avatars and “trials” available for all• developers with agreements  •   profile  •   invites  •   achievements ...
trial mode #if DEBUG     Guide.SimulateTrialMode = true; #endif bool isTrial = Guide.IsTrialMode; ... Guide.ShowMarketplac...
ads• instead of user paying for app• not for swedish apps yet* using Microsoft.Advertising.Mobile.Xna; ... AdManager adMan...
marketplace•   local structure•   test kit in VS2010•   updates•   auto-publish
protect yourself• ready for obfuscation?public void d(bp.b A_0){       this.l = A_0;       this.i = new List<string>();   ...
news in mango•   silverlight + xna•   fast application switching•   profiling•   combined api for movement
demo
tripeaks solitaire• fabrication games• true 3D• all code in objective-c
-(BOOL)      animate{    if([self animation] == nil)    {         [self draw];         return NO;    }    else    {       ...
public bool Animate(){    if (this.Animation == null)    {         this.Draw();         return false;    }    else    {   ...
public bool Animate(GraphicsDevice graphics, BasicEffect effect){    if (this.Animation == null)    {         this.Draw(gr...
demo
future of xna?• silverlight 5.0  • subset of XNA  • focused on business apps• windows 8  • leverages directx 11  • likely ...
johan.lindfors@coderox.se
resources•   create.msdn.com•   jodegreef.wordpress.com - angry pigs•   www.xnaresources.com•   http://msdn.microsoft.com/...
Real life XNA
Real life XNA
Real life XNA
Real life XNA
Upcoming SlideShare
Loading in …5
×

Real life XNA

1,100 views
1,012 views

Published on

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,100
On SlideShare
0
From Embeds
0
Number of Embeds
117
Actions
Shares
0
Downloads
8
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Real life XNA

  1. 1. Real lifeJohan Lindfors
  2. 2. windows phone for games• impressive performance• sensors and touch• potentially xbox-live• ads and trials
  3. 3. kinectimals
  4. 4. harvest
  5. 5. implode
  6. 6. doodle fit
  7. 7. ilomilo
  8. 8. other favorites
  9. 9. xna in 1 minute• a comprehensive framework for games• integrated management of content• games with 2d and ”sprites”• games with 3d and ”meshes”• shared features for pc, wp, xbox
  10. 10. initialize update render
  11. 11. managing content• content pipeline• import common files• leverage compile time• optimized binary format• extensible
  12. 12. first some 2d• x and y (and z)• spriteBatch• sprites/sprite sheets• blending
  13. 13. and then some 3d• x, y and z• camera is described with matrices • view • projection• world matrix transforms objects relatively • movement (translation) • rotation • size (scale)
  14. 14. demo
  15. 15. effects - shaders• configurable • basic • skinned • environmentMap • dualTexture • alphaTest
  16. 16. demo
  17. 17. ”hardware scaler”• 800x480 = 384 000 pixels• 600x360 = 216 000 pixels (56%)• 400x240 = 96 000 pixels (25%) graphics.PreferredBackBufferHeight = 800; graphics.PreferredBackBufferWidth = 480;
  18. 18. performance tips• manage the stack and heap • reference types live on the _______! • value types live on the _______!• pass large structures by reference Matrix a, b, c; c = Matrix.Multiply(a, b); // copies 192 bytes! Matrix.Multiply(ref a, ref b, out c);• don’t foreach or linq (know code cost)
  19. 19. performance tips• gc is ”simpler” than on pc • allocate objects early, reuse• GC.Collect() can be your friend! • after load, while paused• cpu or gpu based? • you can go up to 60 fps (60 hz)
  20. 20. demo
  21. 21. sound and music• soundEffect• load as content• wp handles 64 simultaneously• possible to change • pitch • volume • 3d location
  22. 22. orientation graphics.SupportedOrientations = DisplayOrientation.Portrait | DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight;• default is ”LandscapeLeft”
  23. 23. orientation Window.OrientationChanged += (s, e) => { switch (Window.CurrentOrientation) { case DisplayOrientation.Portrait: graphics.PreferredBackBufferHeight = 800; graphics.PreferredBackBufferWidth = 480; break; default: graphics.PreferredBackBufferHeight = 480; graphics.PreferredBackBufferWidth = 800; break; } graphics.ApplyChanges(); };
  24. 24. accelerometer using Microsoft.Devices.Sensors;• measures acceleration in X, Y and Z• values returned between -1 and +1• event based• read values in event, store for usage
  25. 25. start accelerometer Accelerometer accel; private void startAccelerometer() { accel = new Accelerometer(); accel.ReadingChanged += new EventHandler <AccelerometerReadingEventArgs> (accel_ReadingChanged); accel.Start(); }
  26. 26. read the accelerometer Vector3 accelReading; void accel_ReadingChanged(object sender, AccelerometerReadingEventArgs e) { lock (this) { accelReading.X = (float)e.X; accelReading.Y = (float)e.Y; accelReading.Z = (float)e.Z; } }
  27. 27. touch• windows phone handles 4 touch points • all points have unique id • pressed | moved | released TouchCollection touches; protected override void Update(GameTime gt) { touches = TouchPanel.GetState(); ... }
  28. 28. gestures• wp can also handle gestures • tap | drag | hold | flick | pinch ... TouchPanel.EnabledGestures = GestureType.Flick; while (TouchPanel.IsGestureAvailable) { GestureSample g = TouchPanel.ReadGesture(); if (g.GestureType == GestureType.Flick) { ... } }
  29. 29. network• http, rest, xml, sockets... void wc_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { if (e.Error == null) { mapImage = Texture2D.FromStream( graphics.GraphicsDevice, e.Result); } }
  30. 30. xbox live• avatars and “trials” available for all• developers with agreements • profile • invites • achievements • leaderboard • gamerServices• contact: wpgames@microsoft.com
  31. 31. trial mode #if DEBUG Guide.SimulateTrialMode = true; #endif bool isTrial = Guide.IsTrialMode; ... Guide.ShowMarketplace(PlayerIndex.One);• call to IsTrialMode takes 60 ms, cache!• be creative in feature set• trial or free light?
  32. 32. ads• instead of user paying for app• not for swedish apps yet* using Microsoft.Advertising.Mobile.Xna; ... AdManager adManager; Ad bannerAd; *not from Microsoft that is, there are options
  33. 33. marketplace• local structure• test kit in VS2010• updates• auto-publish
  34. 34. protect yourself• ready for obfuscation?public void d(bp.b A_0){ this.l = A_0; this.i = new List<string>(); this.i.Add(am.a().e("SK_NO")); this.i.Add(am.a().e("SK_YES")); this.g = bo.a; SignedInGamer.SignedIn += new EventHandler<SignedInEventArgs>(this.d);}
  35. 35. news in mango• silverlight + xna• fast application switching• profiling• combined api for movement
  36. 36. demo
  37. 37. tripeaks solitaire• fabrication games• true 3D• all code in objective-c
  38. 38. -(BOOL) animate{ if([self animation] == nil) { [self draw]; return NO; } else { BOOL animationDone = [[self animation] animate]; [self draw]; if (animationDone) { x += [[self animation] currentX]; y += [[self animation] currentY]; z += [[self animation] currentZ]; rotation += [[self animation] currentRotation]; [animations removeObjectAtIndex:0]; } return animationDone; }}
  39. 39. public bool Animate(){ if (this.Animation == null) { this.Draw(); return false; } else { bool animationDone = this.Animation.Animate(); this.Draw(); if (animationDone) { x += this.Animation.CurrentX; y += this.Animation.CurrentY; z += this.Animation.CurrentZ; rotation += this.Animation.CurrentRotation; animations.RemoveAt(0); } return animationDone; }}
  40. 40. public bool Animate(GraphicsDevice graphics, BasicEffect effect){ if (this.Animation == null) { this.Draw(graphics, effect); return false; } else { bool animationDone = this.Animation.Animate(); this.Draw(graphics, effect); if (animationDone) { x += this.Animation.CurrentX; y += this.Animation.CurrentY; z += this.Animation.CurrentZ; rotation += this.Animation.CurrentRotation; animations.RemoveAt(0); } return animationDone; }}
  41. 41. demo
  42. 42. future of xna?• silverlight 5.0 • subset of XNA • focused on business apps• windows 8 • leverages directx 11 • likely to attract commercial studios
  43. 43. johan.lindfors@coderox.se
  44. 44. resources• create.msdn.com• jodegreef.wordpress.com - angry pigs• www.xnaresources.com• http://msdn.microsoft.com/en- us/library/bb417503(XNAGameStudio.41).aspx• programmeramera.se• www.coderox.se

×