cs 179.14 pc/console game programming/development chapter 1: introduction to xna

26
CS 179.14 PC/CONSOLE G AME PROG RAMMING/DEVELOPMENT CHA PTER 1: INTR ODUC T ION T O XNA

Upload: gilbert-atkinson

Post on 23-Dec-2015

235 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CS 179.14 PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 1: INTRODUCTION TO XNA

CS 179.1

4 PC/C

ONSOLE G

AME

PROGRAMMIN

G/DEVELO

PMENT

CH

AP

TE

R 1

: I N

TR

OD

UC

TI O

N T

O X

NA

Page 2: CS 179.14 PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 1: INTRODUCTION TO XNA

TABLE OF CONTENTS

Syllabus Discussion

What is XNA?

Tools of the Trade

XNA Framework

Programming your first XNA Application

Game Design Notes: Video Game History

Page 3: CS 179.14 PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 1: INTRODUCTION TO XNA

SYLLABUS DISCUSSION

Syllabus

Page 4: CS 179.14 PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 1: INTRODUCTION TO XNA

XNA GAME

PROGRAMMIN

G

I NT

RO

DU

CT

I ON

TO

XN

A

Page 5: CS 179.14 PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 1: INTRODUCTION TO XNA

WHAT IS XNA?

XNA XNA is Not an Acronym

It is a Software Development Kit (SDK) that is used in other programs (Visual Studio) to build a specific program… Games.

The XNA Framework encompasses all of the features the SDK has.

Page 6: CS 179.14 PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 1: INTRODUCTION TO XNA

WHAT IS XNA?

Why study XNA?

- XNA Provides an easy to learn Framework that provides all necessary pieces in order to build a working game.

- It uses C#, an easy to pick-up and learn OOP language.

- We produce games for multiple platforms in one code!

Page 7: CS 179.14 PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 1: INTRODUCTION TO XNA

TOOLS OF THE TRADE

• Microsoft Visual Studio 2008/2010 with C# development Environment

• XNA Game Studio 3.0/4.0

• Console Test: an XBOX 360 with Hard Disk and XNA Creators Club Account

• Portable Media Player Test: A Zune Media Player or a Windows Phone 7 System

Page 8: CS 179.14 PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 1: INTRODUCTION TO XNA

TOOLS OF THE TRADE

Installation Have Visual Studio 2008/2010 installed on your computer Install the latest XNA SDK from http://create.msdn.com Configure XNA Game Studio Device Center

Page 9: CS 179.14 PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 1: INTRODUCTION TO XNA

XNA FRAMEWORK

• The XNA Framework contains the necessary pre-built classes to aid in creating your games.

• The link provided gives access to the online library for the XNA Framework.http://msdn.microsoft.com/en-us/library/bb203940.aspx

• To know more about other programming techniques in XNA, a website was developed to cater the creation of content for learning and creating games.http://create.xna.com

Page 10: CS 179.14 PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 1: INTRODUCTION TO XNA

PROGRAMMING YOUR FIRST XNA APPLICATION

1. Download the lesson files from: http://www.microsoft.com/learning/en/us/books/13411.aspx and save it to your computer. Most of the lessons will use the premade codes here.

Page 11: CS 179.14 PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 1: INTRODUCTION TO XNA

PROGRAMMING YOUR FIRST XNA APPLICATION

2. In XNA Game Studio, select New Project from the File Menu. (This will create the entire project) (hint: there are starter kits scattered around the Create website)

3. Select the correct project (template). And no, don’t select any of the game libraries there.

4. Name the project as “MoodLight”. Click on the Browse Button if you want to save it somewhere else.

Page 12: CS 179.14 PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 1: INTRODUCTION TO XNA

PROGRAMMING YOUR FIRST XNA APPLICATION

5. Once created/saved, the familiar Visual Studio IDE will appear.

6. You can click on the play button to run the app, but there’s nothing happening – except for a blue screen, since there’s no logic yet. (and later I’ll teach how to actually print Hello World there)

Page 13: CS 179.14 PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 1: INTRODUCTION TO XNA

PROGRAMMING YOUR FIRST XNA APPLICATION

7. To correctly stop a program, press the Back Button on the Xbox 360 Gamepad or Zune to instruct the program to finish. Or clicking on the Stop button within the XNA Game Studio will stop the program.

8. It is possible to copy an existing XNA project for other devices.

1. Click on the Solution file name on the Solution Explorer.2. Click on Project from the menu bar and then choose Create

Copy of “project name” for <device>

Page 14: CS 179.14 PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 1: INTRODUCTION TO XNA

GAME DESIG

N NOTE

S

PO

ST

GA

ME

PR

OG

RA

MM

I NG

TO

PI C

Page 15: CS 179.14 PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 1: INTRODUCTION TO XNA

HISTORY OF VIDEO GAMES – 1940 TO 1950

Origins: during the 1940s, a device called the Cathode Ray Tube Amusement Device was patented by Thomas Goldsmith Jr. and Estle Ray Mann. The game involved the player controlling a CRT tube using knobs and direct a ‘missile’ to its targets, paper targets found within the screen.

During the early fifties, Charley Adama developed a bouncing ball… which will soon a precursor of future games that will use the bouncing ball.

Later, a Tic-Tac-Toe game called OXO created by A.S. Douglas as a thesis on early AI.

By the end of the 50’s a game called Tennis for Two by William Higinbotham was created that had trajectories for the ball and the existence of gravity. The trajectory is controlled by knobs and button to simulate a tennis racket.

Page 16: CS 179.14 PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 1: INTRODUCTION TO XNA

HISTORY OF VIDEO GAMES - 1960

During the 60’s, most of the development occurred in Universities having mainframes by student hobbyists.

During this era, programmers began experimenting on the use of other controllers to play their games. Some used light pens, others switches, knobs or whatever they could think of. Most of these were made at MIT.

Games that came out included: Mouse in the Maze – players using a light pen, created the maze walls, cheese, and

then release the mouse to find its way out. HAX – a control based game that changed lights/colors/sounds with a combination of

switches. Tic-Tac-Toe – now using a light pen to play around with the computer as the

opponent. Spacewar! – a two player game played using switches to move their space craft and

shoot each other out.

Ralph Baer restarted his previous idea of a video game machine, and created Chase, that was playable on a TV. Along with his colleagues, they developed an early light gun.

Page 17: CS 179.14 PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 1: INTRODUCTION TO XNA

HISTORY OF VIDEO GAMES - 1970

By the 70’s, Arcade games became the ‘in’ thing among kids, where they play by placing in coins on a slot to let them play.

Nolan Bushnell and Ted Dabney ported Spacewar! to the arcades called Computer Space, the first mass produced game in the world… but were not pleased with the way they were earning. This lead to the founding of the first game development company – Atari (Hit! in English)

After founding Atari, one of their engineers, Allan Alcorn developed a game called Pong as a training exercise. Pong became one of the most popular games during the time.

However, that was also one of the earliest cases of game ideas (or even software ideas) being stolen… and it continues up until today.

By 1978, the Japanese company Taito, released the game Space Invaders, which have ushered in the golden era of arcade gaming. Other games such as Asteroids! (Atari) and Pac-Man (Namco) began arriving. By then games were popping up in color, giving more mass appeal to mall patrons, people eating out in restaurants, etc.

Page 18: CS 179.14 PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 1: INTRODUCTION TO XNA

HISTORY OF VIDEO GAMES - 1970

Alongside the arcade machines in the 70’s, a machine called the console began appearing in living rooms. Developed as a prototype by Ralph Baer, the “Brown Box” (Xbox anyone?) was offered to potential licensees and Magnavox (a very known home AV brand way back then) bought the license and made the Magnavox Odyssey. The device utilized cartridges that have jumpers, which enabled/disabled switches inside the console. It was the first console that had quite a big marketing effort made in order to sell, with big Hollywood names to market it.

Mainframes are still being used by hobbyists to create their games, and these games began to increase in complexity. Some examples are:

Baseball video game – the very first game was created by Don Daglow complete with a running season.

Star Trek – one of the games based on a fiction shown on TV during that time.

Page 19: CS 179.14 PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 1: INTRODUCTION TO XNA

HISTORY OF VIDEO GAMES - 1970 TO 1980

Maze War – one of the first 3D First-Person shooting games that came out.

Airfight – the first flight simulator where players fly around in a single airspace and having the ability to shoot each other.

Dungeons and Dragons – Role Playing Games, normally played on a table with paper and props were now replaced with a computer showing the map, text for the game’s story and actions.

Aside from Mainframes, the Personal Computer was recently introduced during the era, letting more people outside of Universities to try out making games. This entailed users to port games from the mainframe to their own at home. During this time, people share around their codes in prints and each individual typed in the code to get their own copy. Then, there was a small industry of developers writing code and selling it to others for a fee.

Page 20: CS 179.14 PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 1: INTRODUCTION TO XNA

HISTORY OF VIDEO GAMES – 1970 TO 1980

During the late 70’s early 80’s, new models of home consoles appeared. However, there was a slump in the quality of games that have appeared.

Atari and Magnavox continued to sell their consoles and these consoles began to use cartridges with Read Only Memory chips (ROM) to store the programmed game information and the console translates it

In 1979, disgruntled employees from Atari, made their own company called Activision as they said were not properly compensated enough… Activision was the very first third party video game developer.

The market got saturated with consoles like VCS, Intellivision and ColecoVision. Their sales were high but there was a poor release of good quality games during that time and sales went down

Page 21: CS 179.14 PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 1: INTRODUCTION TO XNA

HISTORY OF VIDEO GAMES – 1980

The industry struggled as new publishing companies opened up.

Spurred by the low production costs, Home computer games were profitable as a business.

By the 80’s video game genres began to take form, the games began to innovate in their ways to entertain those who play them. The genres are broken as:

Adventure Games Beat ‘em Up Fighting Games Interactive Movies Maze Games Platform Games Racing Games Role Playing Games Rhythm Games Shooters Stealth Games Survival Horror Vehicle Simulation Games

Page 22: CS 179.14 PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 1: INTRODUCTION TO XNA

HISTORY OF VIDEO GAMES – 1980

The late 80’s introduced more mainstream consoles like the Nintendo Family Computer in Japan (known as Nintendo Entertainment System in US) a popular 8-bit machine. This gave the rise of some popular characters in Video Games: Mario and Luigi, Link, Metroid’s Samus, Solid Snake… etc.

It is through the 80’s that console hardware (starting 3rd generation) development ramped up exponentially, with the release of Sega Master System to rival that of Nintendo.

Controllers of gaming consoles became standardized with the use of the directional gaming pad (or D-Pad), an eight way cross directional pad and two or more buttons on a rectangular piece of plastic.

Also, portable gaming devices began in production. Most famous is the Game & Watch line of portable devices.

Page 23: CS 179.14 PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 1: INTRODUCTION TO XNA

HISTORY OF VIDEO GAMES – 1980 TO 1990Gaming computers emerged after the slump of gaming consoles

(Americans retreated from it), these are home computers (PCs) that focused mainly on gaming, and have the hardware power of PCs at that time. Some of the famous Gaming computers were: Commodore 64, Atari 8-bit, and the MSX (in Asia and made by Japanese companies)

One of the advantages of Gaming Computers was that these had a program called BASIC which enabled a person to program their own game…. Easily

The Commodore 64 was famous as it supported BASIC, had the best sound and graphics for a machine and enabled the backward compatibility of old controllers.

Gaming Magazines began showing up with the introduction of Nintendo Power.

Page 24: CS 179.14 PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 1: INTRODUCTION TO XNA

HISTORY OF VIDEO GAMES - 1990

The decade marked more innovations in gaming, PCs became more powerful and cheaper with the constant update from Intel 386 to Intel Pentium !!! during the decade alone (speed increase from 8MHz to 500MHz)

4th – 5th Generation consoles are introduced in a short span.

The use of optical media (CDs) became popular.

The introduction of “3D” graphics gave more detail in games.

The introduction of new genres like First Person Shooters, Real Time Strategy, and “Sim” games

Handheld gaming consoles advanced with the release of Nintendo’s Game Boy, and later, the release of colored handhelds like the Atari Lynx and Sega Game Gear.

Page 25: CS 179.14 PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 1: INTRODUCTION TO XNA

HISTORY OF VIDEO GAMES – 1990 TO 2000Arcades have begun a decline, as games normally played in the

arcade like shooters, fighting games, racing have moved onto consoles, PCs and even portable systems.

In an effort to stave off losses, game companies made innovations in Arcade Games by producing titles that required controls not found in consoles or PCs. Some games like Dance Dance Revolution required our feet to move, Time Crisis and Police 911 which required either a pedal or the person to move while shooting. Racing, Flight, and even robot games involved sitting inside a booth or enclosed cockpit to provide a more realistic simulation.

It is during this decade there Role Playing Games on the console became big hits, like Final Fantasy VII

Page 26: CS 179.14 PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 1: INTRODUCTION TO XNA

HISTORY OF VIDEO GAMES - 2000

The 6th and 7th Generation of consoles were created, using DVDs and/or Blu-Ray disks as the medium.