Computers, C#, XNA, and You

32
1 Computers, C#, XNA, and You Session 1.1

description

Session 1.1. Computers, C#, XNA, and You. Find out what computers are all about ...and what makes a great programmer Discover how C#, XNA, and Microsoft Visual Studio fit together to allow you to make games See how to set up a development environment to create game programs - PowerPoint PPT Presentation

Transcript of Computers, C#, XNA, and You

Page 1: Computers, C#, XNA, and You

1

Computers, C#, XNA, and You

Session 1.1

Page 2: Computers, C#, XNA, and You

Session Overview Find out what computers are all about

...and what makes a great programmer Discover how C#, XNA, and Microsoft Visual

Studio fit together to allow you to make games

See how to set up a development environment to create game programs

Run our first-ever XNA game

Chapter 1: Computers, C#, XNA, and You 2

Page 3: Computers, C#, XNA, and You

COMPUTERS AND PROGRAMS A program is a list of instructions that tell a

computer what to do When you write a program you have to do

two things:1. Figure out how to solve the problem2. Express your solution in a form the

computer can understand If you can’t do it, neither can the computer!

Chapter 1: Computers, C#, XNA, and You 3

Page 4: Computers, C#, XNA, and You

Learning to Program To be able to program you must be able to

do two things:1. Solve problems2. Explain your solution to something very

stupid (the computer) There is actually a step 0 as well:

0. Find out what the customer wants This is the most important step in real-

world applications

Chapter 1: Computers, C#, XNA, and You 4

Page 5: Computers, C#, XNA, and You

Becoming a Great Programmer Great Programmers are:

Knowledgeable – they know a lot about how to tell computers what to do and what computers are capable of doing

Creative – they enjoy finding new ways to do things

Good Company – they have to work with other programmers, and sometimes find out what the customer wants, even if the customer doesn’t actually know themselves

Persistent – they will keep working at a problem until they find a way to solve it

Chapter 1: Computers, C#, XNA, and You 5

Page 6: Computers, C#, XNA, and You

How You Will Learn You are going to find out how to write C#

programs by creating games You are also going to learn how games

themselves are made to work, based on your experience with the XNA Framework

There will be lots of game examples along the way which you can make, play, and modify

There will presentations like this, practical sessions, and hands on practical activities Along with the odd test....

Chapter 1: Computers, C#, XNA, and You 6

Page 7: Computers, C#, XNA, and You

Three Things To Learn The C# programming

language Used to tell the computer

what to do The XNA game development

framework A set of resources to help

you make games Visual Studio

A tool used to create, run, and debug programs

Chapter 1: Computers, C#, XNA, and You 7

Page 8: Computers, C#, XNA, and You

The C# Programming Language Lets you tell the

computer how to do something

You write programs as a sequence of simple steps

A thing called a compiler converts your C# into computer instructions

Chapter 1: Computers, C#, XNA, and You 8

Page 9: Computers, C#, XNA, and You

The XNA Framework A framework for

creating games XNA Game Studio

provides resources for game programmers

XNA also runs the “game loop”

Chapter 1: Computers, C#, XNA, and You 9

Page 10: Computers, C#, XNA, and You

Microsoft Visual Studio An “Integrated

Development Environment” (IDE)

Where you write, run, and debug C# programs

A “word processor” for software

Chapter 1: Computers, C#, XNA, and You 10

Page 11: Computers, C#, XNA, and You

Getting Started Creating Games To get started you need to:

Install Visual Studio 2010 Install XNA Game Studio 3.0

Both these items are available for free They will run on most modern Windows PCs

which support Windows XP or Vista You don’t need a massively powerful

computer to learn to program with XNA You can even use a NetBook

Chapter 1: Computers, C#, XNA, and You 11

Page 12: Computers, C#, XNA, and You

The XNA Creators Club Only Trial and Premium members of XNA

Creators Club can send their games programs to an Xbox

Only Premium members of the XNA Creators Club can sell their games on Xbox Live Trial membership is available to students Premium membership costs $99 a year

You don’t need to join the Creators Club to run your game programs on a Windows PC or Zune

Creators Club Web site: http://creators.xna.com

Chapter 1: Computers, C#, XNA, and You 12

Page 13: Computers, C#, XNA, and You

Linking a PC and an Xbox 360 The PC sends XNA games into the Xbox 360 via

the network connection The PC and the Xbox must be “bonded”

together so they know about each other You do this once and both devices then

remember the connection The XNA Game Studio Device Center program

manages this for you XNA game programs are stored on the hard disk

inside the Xbox, so you can play them later

Chapter 1: Computers, C#, XNA, and You 13

Page 14: Computers, C#, XNA, and You

Linking a PC and a Zune The Zune portable music device can also run

XNA programs You do not need to be in the XNA Creators

Club to send game programs to your Zune The Zune is connected to the Windows PC

using its USB cable The Zune and the Windows PC are “bonded”

using XNA Game Studio Device Center XNA games are stored on the Zune hard disk

Chapter 1: Computers, C#, XNA, and You 14

Page 15: Computers, C#, XNA, and You

XNA Game Studio Device Center

Used to manage the connection between devices

You can run it from within Visual Studio, or as a free-standing program

Chapter 1: Computers, C#, XNA, and You 15

Page 16: Computers, C#, XNA, and You

Running Your First Game Program A game contains lots of content. This is the

stuff that is not program code: Graphics, sounds, level designs, scripts, help

text This must all be managed as part of the game

so that when it is sent to the Xbox 360 it is all available for use

XNA Game Studio provides a Content Manager to look after this

Works with Visual Studio to create a project that contains everything the game needs to run

Chapter 1: Computers, C#, XNA, and You 16

Page 17: Computers, C#, XNA, and You

Making an Empty Project Visual Studio will make you an empty game

project This is like giving a sculptor a block of clay You select the target device when you make the

project You then add your program code and your

content to make your game Visual Studio will then use this project to build

the game and send it to your target device All XNA games start from the same empty project

Chapter 1: Computers, C#, XNA, and You 17

Page 18: Computers, C#, XNA, and You

Running a Game Project Visual Studio provides commands to run and

stop a game program Visual Studio compiles the game program from

C# into instructions the target can understand The game program runs alongside Visual

Studio You can think of Visual Studio as the “Remote

Control” for your game program The game can also run “free standing”

without Visual Studio

Chapter 1: Computers, C#, XNA, and You 18

Page 19: Computers, C#, XNA, and You

1. Creating an Empty XNA Game Project

Chapter 1: Computers, C#, XNA, and You 19

It is very easy to create an empty XNA game project

It will even run However, it won’t

do much

Page 20: Computers, C#, XNA, and You

Using Multiple Hardware Platforms XNA is a framework which is designed to be

independent of the actual game hardware Can run on a Windows PC, a Zune, or an

Xbox 360 Might even be new XNA devices in the future

When you create a game, you can consider running it on any one or all three of these platforms

Now you are going to find out how run the same game on a different device

Chapter 1: Computers, C#, XNA, and You 20

Page 21: Computers, C#, XNA, and You

XNA Project as Containers People create projects to manage all the

aspects of a job A director of a play will have scripts, costume

designs, sound effects, tickets, etc. Visual Studio creates a project to keep all

the items together for a particular game The Content Manager looks after the game

assets A particular project is targeted at a

particular XNA device

Chapter 1: Computers, C#, XNA, and You 21

Page 22: Computers, C#, XNA, and You

Making Multiple Projects in Solutions A solution is a container for projects

Think of it as a filing cabinet that we can put plays in if you like

A solution can hold multiple projects so that a single game development can be aimed at different hardware They can share the same program code, but

perhaps use different asset files to match the target device

Visual Studio can copy projects from one device to another

Chapter 1: Computers, C#, XNA, and You 22

Page 23: Computers, C#, XNA, and You

2. Making Multiple XNA Projects

Chapter 1: Computers, C#, XNA, and You 23

You can copy a Windows PC project to run on either a Zune or an Xbox

Page 24: Computers, C#, XNA, and You

Summary Programs tell computers what to do People write programs in a programming language

(we use C#) to provide these instructions XNA is a framework for writing computer games Visual Studio is a tool for program (and game)

creation You can target a Windows PC, Xbox 360, or Zune

with XNA games To target Xbox 360 you need to be a “Trial” member

of the Creators Club To sell games you need to be a “Premier” member

Chapter 1: Computers, C#, XNA, and You 24

Page 25: Computers, C#, XNA, and You

True/False Pop Quiz Computers write their own programs XNA is a programming language Visual Studio is used to write C# programs You have to have a huge brain to write games You need to be in the Creators Club to write

XNA games C# is just for writing games XNA stands for Xbox is Nicer than All other

consoles

Chapter 1: Computers, C#, XNA, and You 25

Page 26: Computers, C#, XNA, and You

True/False Pop Quiz Computers write their own programs XNA is a programming language Visual Studio is used to write C# programs You have to have a huge brain to write games You need to be in the Creators Club to write

XNA games C# is just for writing games XNA stands for Xbox is Nicer than All other

consoles

Chapter 1: Computers, C#, XNA, and You 26

Page 27: Computers, C#, XNA, and You

True/False Pop Quiz Computers write their own programs XNA is a programming language Visual Studio is used to write C# programs You have to have a huge brain to write games You need to be in the Creators Club to write

XNA games C# is just for writing games XNA stands for Xbox is Nicer than All other

consoles

Chapter 1: Computers, C#, XNA, and You 27

Page 28: Computers, C#, XNA, and You

True/False Pop Quiz Computers write their own programs XNA is a programming language Visual Studio is used to write C# programs You have to have a huge brain to write games You need to be in the Creators Club to write

XNA games C# is just for writing games XNA stands for Xbox is Nicer than All other

consoles

Chapter 1: Computers, C#, XNA, and You 28

Page 29: Computers, C#, XNA, and You

True/False Pop Quiz Computers write their own programs XNA is a programming language Visual Studio is used to write C# programs You have to have a huge brain to write games You need to be in the Creators Club to write

XNA games C# is just for writing games XNA stands for Xbox is Nicer than All other

consoles

Chapter 1: Computers, C#, XNA, and You 29

Page 30: Computers, C#, XNA, and You

True/False Pop Quiz Computers write their own programs XNA is a programming language Visual Studio is used to write C# programs You have to have a huge brain to write games You need to be in the Creators Club to write

XNA games C# is just for writing games XNA stands for Xbox is Nicer than All other

consoles

Chapter 1: Computers, C#, XNA, and You 30

Page 31: Computers, C#, XNA, and You

True/False Pop Quiz Computers write their own programs XNA is a programming language Visual Studio is used to write C# programs You have to have a huge brain to write games You need to be in the Creators Club to write

XNA games C# is just for writing games XNA stands for Xbox is Nicer than All other

consoles

Chapter 1: Computers, C#, XNA, and You 31

Page 32: Computers, C#, XNA, and You

True/False Pop Quiz Computers write their own programs XNA is a programming language Visual Studio is used to write C# programs You have to have a huge brain to write games You need to be in the Creators Club to write

XNA games C# is just for writing games XNA stands for Xbox is Nicer than All other

consoles

Chapter 1: Computers, C#, XNA, and You 32