Game Development With Microsoft XNA Game Studio
Do It Yourself
Introduction To
XNA Game Studio
By
Chanaka Nakandala
Game Development With Microsoft XNA Game Studio
Do It Yourself
What is XNA Game Studio..?
XNA is a Framework and Toolset Provided by Microsoft Corporation
for game development tasks.
That mean XNA is not a “Game Engine” , It’s a “Code library”.
XNA is build on top of the DirectX 9c.
Core Frameworks in XNA Framework
Graphics Audio Input Game
Math
Storage
Microsoft XNA Game Studio 4.0
Features
Cross platform
Features
What are those platforms..?
Windows Operating Systems (Windows Vista, Windows 7, Windows 8)
XBox 360
Windows Phone
Zune HD (only sprite based 2D games)
Cross platform - Computer
Features
Cross platform – Xbox 360
Features
Cross platform – Windows Mobile
Features
Cross platform - Zune
Features
Graphics
Features
Sprite Batch for develop 2D games and Particale
System
1.Normal Mapping
2.Per Pixel Lighting
3.Parallax Mapping
Enable to using 3D Models , Effects and Shaders
Support for HLSL (High Level Shader Language)
Inputs
Features
Easy to getting User Inputs
1.Mouse
2.Keyboard
3.Xbox 360 Game Controller
4.Touch Panel ( Windows Phone , Zune )
5.Accelermetor
Provides
Audio
Features
Game audio is Based on XACT (Cross-Platform
Audio Creation Tool)
3D Audio
Able to use audio files via their logical names
Inbuilt XACT Tool as the sound asset
Support for Looping , Streaming and Memory
Management
Math
Features
Support for Vector , Matrix , Plane , Sphere ,
Curve
Intersection Helpers
Movement Helpers
Storage
Features
Easier to Read and Write data to save game data
Save game data file in correct location in the
each platform
Networking
Features
Easy to create LAN Based Games.
Support for HTTP and TCP/UDP protocols to
communicate with servers and devices
Able to create Multiplayer games to play
through the Internet
How to develop a game using XNA..?
You may needs
Microsoft Visual Studio
Visual C# / Visual Basic.net
Microsoft XNA Game Studio 4.0
……And Windows Operating System
How to develop a game using XNA..?
You may needs
Graphics Card supports Minimum Shader Model 1.1
DirectX 9.0c
How to develop a game using XNA..?
Gain of Visual C# / Visual Basic.net
Visual C# 2.0 , Visual C# 3.0 or Visual Basic.net are
using as the programming language.
Components of Microsoft XNA Game Studio
Microsoft Visual Studio
XNA Framework
.net
Framework
.net Compact
Framework
Windows
Phone
Xbox 360 Zune
Windows
PC
XNA Game Studio Architecture
Game code (C#,VB) & Content
XNA Framework
Common Language Runtime (CLR)
Windows APIs, DirectX
Provided by you Provided for you
XNA has some sequence of built in methods
i. Initialize Device
ii. Load Game Assets
iii. Update
iv. Draw Game On The Screen
v. Unload Game
vi. Free Resources
Life Cycle Of XNA Game
Life Cycle Of XNA Game
Do It Yourself
Initialize
Device
Load Game
Assets Update
Draw Game
On The Screen
Unload Game
Free
Resources
Microsoft XNA Game Studio 4.0
Develop Games With
Visual C#
Steps
1.Visual Studio > create XNA project
2.Understand IDE
3.Introduction Game1.cs
Add new references to the project
References > Add reference
Microsoft XNA Game Studio 4.0
Game Contents
Content Includes All Game Assets…
Game Contents
Textures , Sprites,
Fonts,
3D Models , Effects,
Music Tracks , Sound Effects,
Game Level Data
Microsoft XNA Game Studio 4.0
Contents Pipeline
Content Pipeline
What is Content Pipeline…?
Content Pipeline is a set of processes applied to a game’s assets
when the game is built.
Advantages of Content Pipeline
Content Pipeline
Make Game fast in the run-time.
Able to use standard file formats such as
jpg,bmp,png for textures and sprites
fbx,x for 3D meshes
mp3,wav for background music and sound fx.
Game Developer can insert the game assets conveniently
design by Game Artists.
Add content to project
Right Click On Content Section
Add content to project
Add > 1.New Item
or
2.Existing Item
Add > New Item
Microsoft XNA Game Studio 4.0
3.Introduction Game1.cs
Using .NET and XNA framework in C# project
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
Frameworks
Dot Net
Framework
XNA
Framework
Life Cycle Of XNA Game
Do It Yourself
Initialize
Device
Load Game
Assets Update
Draw Game
On The Screen
Unload Game
Free
Resources
Initialize Method
protected override void Initialize()
{
// TODO: Add your initialization logic here
base.Initialize();
}
Game1.cs
LoadContent Method
protected override void LoadContent()
{
// Create a new SpriteBatch, which can be used
to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
// TODO: use this.Content to load your game
content here
}
Game1.cs
Update Method
protected override void Update(GameTime gameTime)
{
// Allows the game to exit
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
this.Exit();
// TODO: Add your update logic here
base.Update(gameTime);
}
Game1.cs
Draw Method
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
// TODO: Add your drawing code here
base.Draw(gameTime);
}
Game1.cs
UnloadContent Method
protected override void UnloadContent()
{
// TODO: Unload any non ContentManager content here
}
Game1.cs
Feedback
Chanakanakandala@gmail.com

Xna game development

  • 1.
    Game Development WithMicrosoft XNA Game Studio Do It Yourself Introduction To XNA Game Studio By Chanaka Nakandala
  • 2.
    Game Development WithMicrosoft XNA Game Studio Do It Yourself What is XNA Game Studio..? XNA is a Framework and Toolset Provided by Microsoft Corporation for game development tasks. That mean XNA is not a “Game Engine” , It’s a “Code library”. XNA is build on top of the DirectX 9c.
  • 3.
    Core Frameworks inXNA Framework Graphics Audio Input Game Math Storage
  • 4.
    Microsoft XNA GameStudio 4.0 Features
  • 5.
    Cross platform Features What arethose platforms..? Windows Operating Systems (Windows Vista, Windows 7, Windows 8) XBox 360 Windows Phone Zune HD (only sprite based 2D games)
  • 8.
    Cross platform -Computer Features
  • 9.
    Cross platform –Xbox 360 Features
  • 10.
    Cross platform –Windows Mobile Features
  • 11.
    Cross platform -Zune Features
  • 12.
    Graphics Features Sprite Batch fordevelop 2D games and Particale System 1.Normal Mapping 2.Per Pixel Lighting 3.Parallax Mapping Enable to using 3D Models , Effects and Shaders Support for HLSL (High Level Shader Language)
  • 13.
    Inputs Features Easy to gettingUser Inputs 1.Mouse 2.Keyboard 3.Xbox 360 Game Controller 4.Touch Panel ( Windows Phone , Zune ) 5.Accelermetor Provides
  • 14.
    Audio Features Game audio isBased on XACT (Cross-Platform Audio Creation Tool) 3D Audio Able to use audio files via their logical names Inbuilt XACT Tool as the sound asset Support for Looping , Streaming and Memory Management
  • 15.
    Math Features Support for Vector, Matrix , Plane , Sphere , Curve Intersection Helpers Movement Helpers
  • 16.
    Storage Features Easier to Readand Write data to save game data Save game data file in correct location in the each platform
  • 17.
    Networking Features Easy to createLAN Based Games. Support for HTTP and TCP/UDP protocols to communicate with servers and devices Able to create Multiplayer games to play through the Internet
  • 18.
    How to developa game using XNA..? You may needs Microsoft Visual Studio Visual C# / Visual Basic.net Microsoft XNA Game Studio 4.0 ……And Windows Operating System
  • 19.
    How to developa game using XNA..? You may needs Graphics Card supports Minimum Shader Model 1.1 DirectX 9.0c
  • 20.
    How to developa game using XNA..? Gain of Visual C# / Visual Basic.net Visual C# 2.0 , Visual C# 3.0 or Visual Basic.net are using as the programming language.
  • 21.
    Components of MicrosoftXNA Game Studio Microsoft Visual Studio XNA Framework .net Framework .net Compact Framework Windows Phone Xbox 360 Zune Windows PC
  • 22.
    XNA Game StudioArchitecture Game code (C#,VB) & Content XNA Framework Common Language Runtime (CLR) Windows APIs, DirectX Provided by you Provided for you
  • 23.
    XNA has somesequence of built in methods i. Initialize Device ii. Load Game Assets iii. Update iv. Draw Game On The Screen v. Unload Game vi. Free Resources Life Cycle Of XNA Game
  • 24.
    Life Cycle OfXNA Game Do It Yourself Initialize Device Load Game Assets Update Draw Game On The Screen Unload Game Free Resources
  • 25.
    Microsoft XNA GameStudio 4.0 Develop Games With Visual C#
  • 26.
    Steps 1.Visual Studio >create XNA project 2.Understand IDE 3.Introduction Game1.cs
  • 27.
    Add new referencesto the project References > Add reference
  • 28.
    Microsoft XNA GameStudio 4.0 Game Contents
  • 29.
    Content Includes AllGame Assets… Game Contents Textures , Sprites, Fonts, 3D Models , Effects, Music Tracks , Sound Effects, Game Level Data
  • 30.
    Microsoft XNA GameStudio 4.0 Contents Pipeline
  • 31.
    Content Pipeline What isContent Pipeline…? Content Pipeline is a set of processes applied to a game’s assets when the game is built.
  • 32.
    Advantages of ContentPipeline Content Pipeline Make Game fast in the run-time. Able to use standard file formats such as jpg,bmp,png for textures and sprites fbx,x for 3D meshes mp3,wav for background music and sound fx. Game Developer can insert the game assets conveniently design by Game Artists.
  • 33.
    Add content toproject Right Click On Content Section
  • 34.
    Add content toproject Add > 1.New Item or 2.Existing Item
  • 35.
  • 36.
    Microsoft XNA GameStudio 4.0 3.Introduction Game1.cs
  • 37.
    Using .NET andXNA framework in C# project using System; using System.Collections.Generic; using System.Linq; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.GamerServices; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Media; Frameworks Dot Net Framework XNA Framework
  • 38.
    Life Cycle OfXNA Game Do It Yourself Initialize Device Load Game Assets Update Draw Game On The Screen Unload Game Free Resources
  • 39.
    Initialize Method protected overridevoid Initialize() { // TODO: Add your initialization logic here base.Initialize(); } Game1.cs
  • 40.
    LoadContent Method protected overridevoid LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here } Game1.cs
  • 41.
    Update Method protected overridevoid Update(GameTime gameTime) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) this.Exit(); // TODO: Add your update logic here base.Update(gameTime); } Game1.cs
  • 42.
    Draw Method protected overridevoid Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); // TODO: Add your drawing code here base.Draw(gameTime); } Game1.cs
  • 43.
    UnloadContent Method protected overridevoid UnloadContent() { // TODO: Unload any non ContentManager content here } Game1.cs
  • 44.