XNA L01–Introduction

Post on 14-May-2015

586 views 0 download

Tags:

transcript

Mohammad Shakermohammadshaker.com

@ZGTRShaker2011, 2012, 2013, 2014

XNA Game DevelopmentL01 – Introduction

LUBZHTM

References

References of this Course

• Books

– All of previous slide

• Web sites

– Many of them!

• http://www.riemers.net/

• http://rbwhitaker.wikidot.com/xna-tutorials (very good one)

Take a Look on XNA and My Other Courses @ http://www.slideshare.net/ZGTRZGTR

and @ http://mohammadshaker.com/

Available courses to the date of this slide:

Explore My

Authoring tool for Cut the Rope!A Full implementation of a clone of Cut the Rope for Research Purposes

Procedurally Generating Endless Levels for Cut the Rope Game

Is an Ongoing Research ProjectFind out more on my recent publication in:

http://mohammadshakergtr.wordpress.com/publication/

Graphics Engine Implemented in XNA

Watch trailers:http://www.youtube.com/watch?v=FM3v0tbdKrshttp://www.youtube.com/watch?v=NRWEhsFGVgEhttp://www.youtube.com/watch?v=hRxOINEO9fc

So let’s create sth awesome!

XNA! XNA

XNA!XNA Mobile

XNA!XNA Mobile

Xbox LIVE Hub

XNA Game Studio 4.0

• Powerful platform– Managed code platform, no unsafe code

– XNA Game Studio 4.0 is C# exclusive

– Performance

– Productivity

• The XNA Framework– Game Loop

– Graphics

– Audio and Media• Mic\Bluetooth

• Music

• Photos and Video

– Input• Touch\Joystick

– Sensors• Silverlight

• Accelorometer

– Target Platforms• Windows Phone\ Xbox \ PC

• Faaaaaaaaaaast Developement

Our Course!

Our Course

• Slides

• References

• Appendix (Apps, Media, Resources, …etc)

• Quizzes

Image from ebwitiker

New XNA Project!

• Content Pipeline

New XNA Project!

• Content Manager & The Content Pipeline

Content Type File Types

3D Models .x,.fbx

Textures/Images .bmp,.dds,.dib,.hdr,.jpg,.pfm,.png,.ppm,.tga

Audio .xap (an XACT audio project),.wma,.mp3,.wav

Fonts .spritefont

Effects .fx

New XNA Project!

• Content Pipeline

New XNA Project!

• Content Pipeline

New XNA Project!

• Content Pipeline, So easy to handle!

• Loading!

• Unloading

Texture2D image = Content.Load<Texture2D>("FullLogo");

Content.Unload();

New XNA Project!Creating a new project!

Initialize

LoadContent

UnloadContent

Update

Draw

Game1

XNA Game1 Class / Execution Order

New XNA Project!

• Game1()

– Class “Game1” constructor

Initialize

LoadContent

UnloadContent

Update

Draw

Game1

New XNA Project!

• Initialize()

– Allows the game to perform any initialization it needs to before starting to run.

– This is where it can query for any required services and load any non-graphic related content.

Calling base.Initialize will enumerate through any component and initialize them as well.

Initialize

LoadContent

UnloadContent

Update

Draw

Game1

New XNA Project!

• LoadContent()

– LoadContent will be called once per game and is the place to load all of your content.

Initialize

LoadContent

UnloadContent

Update

Draw

Game1

New XNA Project!

• UnloadContent()

– UnloadContent will be called once per game and is the place to unload all content.

Initialize

LoadContent

UnloadContent

Update

Draw

Game1

New XNA Project!

• Update(GameTime gameTime)*

– Allows the game to run logic such as updating the world, checking for collisions, gathering

input, and playing audio.

• Draw(GameTime gameTime)*

• This is called when the game should draw itself.

* “gameTime” Provides a snapshot of timing values.

Initialize

LoadContent

UnloadContent

Update

Draw

Game1

How “Game-Engine” works?!

New XNA Project!How XNA functions (Game1 Functions) they called?!

Initialize

LoadContent

UnloadContent

Update

Draw

Game1

Initialize

LoadContent

UnloadContent

Update

Draw

Game1

Initialize

LoadContent

UnloadContent

Update

Draw

Game1

Initialize

LoadContent

UnloadContent

Update

Draw

Game1

Initialize

LoadContent

UnloadContent

Update

Draw

Game1

Initialize

LoadContent

UnloadContent

Update

Draw

Game1

Initialize

LoadContent

UnloadContent

Update

Draw

Game1

Initialize

LoadContent

UnloadContent

Update

Draw

Game1

Initialize

LoadContent

UnloadContent

Update

Draw

Game1

Update() vs. Draw()

Update() vs. Draw()

• Update and Draw are called at different rates depending on whether

IsFixedTimeStep is true or false.

– If IsFixedTimeStep is false, Update and Draw will be called in a continuous loop.

– If IsFixedTimeStep is true, Update will be called at the interval specified in TargetElapsedTime,

while Draw will only be called if an Update is not due.

– If Draw is not called, IsRunningSlowly will be set to true.

Find out more @ http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.game.update.aspx

3D World

3D World

3D World

Take a Look on my other courses @ http://www.slideshare.net/ZGTRZGTR

Available courses to the date of this slide:

http://www.mohammadshaker.com

mohammadshakergtr@gmail.com

https://twitter.com/ZGTRShaker @ZGTRShaker

https://de.linkedin.com/pub/mohammad-shaker/30/122/128/

http://www.slideshare.net/ZGTRZGTR

https://www.goodreads.com/user/show/11193121-mohammad-shaker

https://plus.google.com/u/0/+MohammadShaker/

https://www.youtube.com/channel/UCvJUfadMoEaZNWdagdMyCRA

http://mohammadshakergtr.wordpress.com/