xna game development

44
Game Development With Microsoft XNA Game Studi Do It Yourself Introduction To XNA Game Studio By Chanaka Nakandala

Upload: chanakanakandala1993

Post on 08-Feb-2017

316 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Xna game development

Game Development With Microsoft XNA Game StudioDo It Yourself

Introduction To XNA Game Studio

ByChanaka Nakandala

Page 2: Xna game development

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.

Page 3: Xna game development

Core Frameworks in XNA Framework

Graphics Audio Input Game Math

Storage

Page 4: Xna game development

Microsoft XNA Game Studio 4.0

Features

Page 5: Xna game development

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)

Page 6: Xna game development
Page 7: Xna game development
Page 8: Xna game development

Cross platform - ComputerFeatures

Page 9: Xna game development

Cross platform – Xbox 360Features

Page 10: Xna game development

Cross platform – Windows MobileFeatures

Page 11: Xna game development

Cross platform - ZuneFeatures

Page 12: Xna game development

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)

Page 13: Xna game development

InputsFeatures

Easy to getting User Inputs

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

Provides

Page 14: Xna game development

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

Page 15: Xna game development

MathFeatures

Support for Vector , Matrix , Plane , Sphere , Curve

Intersection Helpers

Movement Helpers

Page 16: Xna game development

StorageFeatures

Easier to Read and Write data to save game data

Save game data file in correct location in the each platform

Page 17: Xna game development

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

Page 18: Xna game development

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

Page 19: Xna game development

How to develop a game using XNA..?

You may needsGraphics Card supports Minimum Shader Model 1.1

DirectX 9.0c

Page 20: Xna game development

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.

Page 21: Xna game development

Components of Microsoft XNA Game Studio

Microsoft Visual Studio

XNA Framework

.net Framework

.net CompactFramework

WindowsPhone

Xbox 360 ZuneWindowsPC

Page 22: Xna game development

XNA Game Studio Architecture

Game code (C#,VB) & Content

XNA Framework

Common Language Runtime (CLR)

Windows APIs, DirectX

Provided by you Provided for you

Page 23: Xna game development

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

Page 24: Xna game development

Life Cycle Of XNA GameDo It Yourself

Initialize Device

Load Game Assets Update

Draw Game On The Screen

Unload GameFree

Resources

Page 25: Xna game development

Microsoft XNA Game Studio 4.0

Develop Games WithVisual C#

Page 26: Xna game development

Steps

1.Visual Studio > create XNA project

2.Understand IDE

3.Introduction Game1.cs

Page 27: Xna game development

Add new references to the project

References > Add reference

Page 28: Xna game development

Microsoft XNA Game Studio 4.0

Game Contents

Page 29: Xna game development

Content Includes All Game Assets…

Game Contents

Textures , Sprites,Fonts,3D Models , Effects,Music Tracks , Sound Effects,Game Level Data

Page 30: Xna game development

Microsoft XNA Game Studio 4.0

Contents Pipeline

Page 31: Xna game development

Content Pipeline

What is Content Pipeline…?Content Pipeline is a set of processes applied to a game’s assets when the game is built.

Page 32: Xna game development

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.

Page 33: Xna game development

Add content to project

Right Click On Content Section

Page 34: Xna game development

Add content to project

Add > 1.New Item or 2.Existing Item

Page 35: Xna game development

Add > New Item

Page 36: Xna game development

Microsoft XNA Game Studio 4.0

3.Introduction Game1.cs

Page 37: Xna game development

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

Page 38: Xna game development

Life Cycle Of XNA GameDo It Yourself

Initialize Device

Load Game Assets Update

Draw Game On The Screen

Unload GameFree

Resources

Page 39: Xna game development

Initialize Method

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

base.Initialize(); }

Game1.cs

Page 40: Xna game development

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

Page 41: Xna game development

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

Page 42: Xna game development

Draw Method

protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue);

// TODO: Add your drawing code here base.Draw(gameTime); }

Game1.cs

Page 43: Xna game development

UnloadContent Method

protected override void UnloadContent() { // TODO: Unload any non ContentManager content here }

Game1.cs

Page 44: Xna game development

Feedback

[email protected]