Administrivia - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

Administrivia

Description:

Initialize setup (one time) Update compute game logic. Draw ... Problem how do you deal with Windows and Xbox 360 assets? Solution: XNA Content Pipeline ... – PowerPoint PPT presentation

Number of Views:63
Avg rating:3.0/5.0
Slides: 17
Provided by: RobertR84
Category:

less

Transcript and Presenter's Notes

Title: Administrivia


1
Administrivia
  • Any questions?
  • Homework 1 (second hw)

2
XNA (XNA Not Acronymed ?)
  • Derive from Game class
  • Must override
  • Initialize setup (one time)
  • Update compute game logic
  • Draw display
  • Separation of logic and display is an important
    model
  • Not just for games, but in general this is a good
    idea
  • Game.Run starts the game loop

3
Fixed-Step Game Loop
Initialize
  • Set Game.IsFixedTimeStep to true (default)
  • TargetElapsedTime default 1/60th of a sec
  • Slow IsRunningSlowly (bool)

Update
Times up
Set Slow
Not Time Yet
Draw
Times up
Not Time Yet
Wait
4
Variable-Step Game Loop
  • Set Game.IsFixedTimeStep to false
  • TargetElapsedTime ignored
  • ElapsedGameTime time since last call to Update
  • This works in either model

Initialize
Update
Draw
5
Contrast The Two Models
  • What if user has lots of other tasks running?
  • What if you use two different computers?
  • If you have a sprite moving across the screen,
    how will it behave?
  • Note debugger entrance causes timer to be
    suspended

6
GameComponent
  • Game provides a collection of GameComponent
    objects or DrawableGameComponent objects
  • Mechanism to modularize your solution
  • Good if you want to create components that are
    reusable
  • Game.Components.Add

7
GameServices
  • Allows interface to services
  • Look up by finding a service that implements an
    interface
  • Dont have to use explicit object reference
  • Good for modularity and reusability
  • Services.AddService( typeof( IMyService ),
    myobject )
  • IMyService myservice (IMyService)Services.GetSer
    vice( typeof(IMyService) )
  • Graphics services, networking services, etc.

8
Game Content
  • Problem how do you make it easy for content
    authors and programmers to work together?
  • Artists create content using many different
    Digital Content Creation (DCC) tools
  • Problem how do you deal with Windows and Xbox
    360 assets?
  • Solution XNA Content Pipeline

9
Content Pipeline Architecture
  • XNA provides content importers and processors
    that will load and process the content for your
    game
  • Creates Managed Object with Strong Typing
  • Content manager (Content.Load)

10
Standard Importers
  • Autodesk FBX format
  • Directx Effects File format
  • Sprite Font file
  • Texture importer (.bmp, .dds, .dib, .hdr, .jpg,
    .pfm, .png, .ppm, and .tga)
  • DirectX X file format (coordinates)
  • XACT for sounds
  • XML Content
  • Note 3rd party importers available or you can
    write your own

11
Understanding the Displays
12
Back Buffer
  • Title safe area is inner 80 of the back buffer

13
2D Graphics
  • Drawing sprites
  • Sprite origin normally upper left corner, but you
    can change that
  • Sprite depth (floating point number) between 0
    (front) and 1 (back)
  • Use sourceRectangle if you want to draw part of a
    texture
  • You can also scale the texture in the Draw
    command (uniform or non-uniform)
  • SpriteBatch lets you do a transformation matrix
    (rotation, translation, scaling)

14
3D Graphics
  • Triangles, triangles, triangles lots of them
  • 3 vertices
  • Vertex X,Y,Z coordinates, color, normal, etc.
  • World Coordinate space (position of vertices)
  • Position camera to view triangles

Map to 2D
15
3D Graphics - 2
  • Shader and effects
  • Allow display of vertices (and pixels) using a
    program written in HLSL (High Level Shader
    language)
  • Transparent, semi-transparent, use particular
    colors, etc.
  • In XNA always have to use an shader/effect
  • Matrix transformations to vertices
  • Translation
  • Rotation
  • Scale
  • Apply texture to a triangle
  • Specify lighting location
  • Vertex and Index buffers to stream lots of points
    to the graphics device for rendering

16
Multiplayer
  • See Tutorial 5 Adding Multiplayer and
    Networking Support to the Game
  • Support for
  • Gamer sign in
  • Gamer creating or joining a session
  • Lobby waiting for players
  • Reading and writing network packets of the game
    state
  • Think about Two-Player, Networked Game
  • Issue is what do you send back and forth
  • Reduce network traffic and lag time by reducing
    what you send
Write a Comment
User Comments (0)
About PowerShow.com