xna game development

Post on 08-Feb-2017

316 Views

Category:

Software

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Game Development With Microsoft XNA Game StudioDo It Yourself

Introduction To XNA Game Studio

ByChanaka Nakandala

Game Development With Microsoft XNA Game StudioDo 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 platformFeatures

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 - ComputerFeatures

Cross platform – Xbox 360Features

Cross platform – Windows MobileFeatures

Cross platform - ZuneFeatures

GraphicsFeatures

Sprite Batch for develop 2D games and ParticaleSystem

1.Normal Mapping2.Per Pixel Lighting3.Parallax Mapping

Enable to using 3D Models , Effects and Shaders

Support for HLSL (High Level Shader Language)

InputsFeatures

Easy to getting User Inputs

1.Mouse2.Keyboard3.Xbox 360 Game Controller4.Touch Panel ( Windows Phone , Zune )5.Accelermetor

Provides

AudioFeatures

Game audio is Based on XACT (Cross-PlatformAudio 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 MemoryManagement

MathFeatures

Support for Vector , Matrix , Plane , Sphere , Curve

Intersection Helpers

Movement Helpers

StorageFeatures

Easier to Read and Write data to save game data

Save game data file in correct location in the each platform

NetworkingFeatures

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 playthrough 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 needsGraphics 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 CompactFramework

WindowsPhone

Xbox 360 ZuneWindowsPC

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 methodsi. Initialize Deviceii. Load Game Assetsiii. Updateiv. Draw Game On The Screenv. Unload Gamevi. Free Resources

Life Cycle Of XNA Game

Life Cycle Of XNA GameDo It Yourself

Initialize Device

Load Game Assets Update

Draw Game On The Screen

Unload GameFree

Resources

Microsoft XNA Game Studio 4.0

Develop Games WithVisual 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 meshesmp3,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 NetFramework

XNAFramework

Life Cycle Of XNA GameDo It Yourself

Initialize Device

Load Game Assets Update

Draw Game On The Screen

Unload GameFree

Resources

Initialize Method

protected override void Initialize() { // TODO: Add your initialization logic here

base.Initialize(); }

Game1.cs

LoadContent Methodprotected 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

top related