ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
Xna game development
1. Game Development With Microsoft XNA Game Studio
Do It Yourself
Introduction To
XNA Game Studio
By
Chanaka Nakandala
2. 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.
5. 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)
12. 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)
13. 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
14. 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
16. Storage
Features
Easier to Read and Write data to save game data
Save game data file in correct location in the
each platform
17. 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
18. 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
19. How to develop a game using XNA..?
You may needs
Graphics Card supports Minimum Shader Model 1.1
DirectX 9.0c
20. 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.
21. Components of Microsoft XNA Game Studio
Microsoft Visual Studio
XNA Framework
.net
Framework
.net Compact
Framework
Windows
Phone
Xbox 360 Zune
Windows
PC
22. XNA Game Studio Architecture
Game code (C#,VB) & Content
XNA Framework
Common Language Runtime (CLR)
Windows APIs, DirectX
Provided by you Provided for you
23. 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
24. Life Cycle Of XNA Game
Do It Yourself
Initialize
Device
Load Game
Assets Update
Draw Game
On The Screen
Unload Game
Free
Resources
31. Content Pipeline
What is Content Pipeline…?
Content Pipeline is a set of processes applied to a game’s assets
when the game is built.
32. 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.
37. 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
38. Life Cycle Of XNA Game
Do It Yourself
Initialize
Device
Load Game
Assets Update
Draw Game
On The Screen
Unload Game
Free
Resources
40. 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
41. 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
42. Draw Method
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
// TODO: Add your drawing code here
base.Draw(gameTime);
}
Game1.cs