CS 179.14 PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 2: DRAWING, DATA AND CONTROLS.

Slides:



Advertisements
Similar presentations
2000 Prentice Hall, Inc. All rights reserved. 1 Outline 3.1Introduction 3.2Game Loop Components 3.3How to Implement in C# 3.4Adding Image to XNA Project.
Advertisements

Create a Simple Game in Scratch
Video Game Design Game Maker Ms. Scales. What is game design? Is it art? It is all about artistic expression. Is it technical? Just follow some deign.
Create a Simple Game in Scratch
Microsoft® Small Basic
RAPTOR Syntax and Semantics By Lt Col Schorsch
CS 4730 Defining Formal Elements CS 4730 – Computer Game Design.
11 Reaction Timer Game Session 8.1. Session Overview  Find out how an XNA program can measure the passage of time and trigger events at certain points.
COMPUTER PROGRAMMING 2 Chapter 7 Sound. Objectives Find out how to prepare sounds for inclusion in Microsoft XNA projects. Incorporate sounds into XNA.
Code Club Session 3 Shark Eats Fish. Picture of finished product here.
Mrs. Chapman. Tabs (Block Categories) Commands Available to use Script Area where you type your code Sprite Stage All sprites in this project.
CIS 487 Assignment 1 By Philip Perry September
Computer Science Computer Games1 Are you ready to produce?
SELECT A LESSON 1. A WORLD AND CHARACTERS 2. PATHS AND ENEMIES 4. USING PAGES TO CHANGE THE RULES 5. GAME ANALYSIS AND DESIGN 6-7. CREATING YOUR OWN GAME.
December 1, The Beginnings! Video Games started to be developed as early as 1947! First patent was on January 25, The Game was Pong!
Mr. Wortzman. Tabs (Block Categories) Available Blocks Script Area Sprite Stage All sprites in this project.
GAME:IT Junior Bouncing Ball Objectives: Create Sprites Create Sounds Create Objects Create Room Program simple game.
CHAPTER 1 XNA Game Studio 4.0. Your First Project A computer game is not just a program—it is also lots of other bits and pieces that make playing the.
Chapter Seven Advanced Shell Programming. 2 Lesson A Developing a Fully Featured Program.
MrsBillinghurst. net A2 Computing A2 Computing Projects Game Animation in Pascal.
Copyright 2007, Information Builders. Slide 1 Maintain & JavaScript: Two Great Tools that Work Great Together Mark Derwin and Mark Rawls Information Builders.
Creative Commons Attribution 3.0 creativecommons.org/licenses/by/3.0 Key Abstractions in Game Maker Foundations of Interactive Game Design Prof. Jim Whitehead.
CHAPTER 4 Images XNA Game Studio 4.0. Objectives Find out how the Content Manager lets you add pictures to Microsoft XNA games. Discover how pictures.
Rob Miles Microsoft MVP University of Hull Fun Programming with Visual Studio.
Introduction to Scratch!
To download PhotoStory: Go to On the left side under Product Resources, click on Downloads.
COMPUTER PROGRAMMING 2 Timers. Game Idea: Mob Reaction Timer Use a timer variable to keep track of time and a variable for each player to measure the.
11 A First Game Program Session Session Overview  Begin the creation of an arcade game  Learn software design techniques that apply to any form.
Getting Started. XNA Game Studio 4.0 To download XNA Game Studio 4.0 itself, go to XNA Game.
We will be creating a spaceship that simulates real movements in space. The spaceship will fire a laser beam that can destroy targets. The spaceship will.
Developing the Game User Interface (UI) Lesson 5.
11 Adding Sounds Session 7.1. Session Overview  Find out how to capture and manipulate sound on a Windows PC  Show how sound is managed as an item of.
11 Using the Keyboard Session Session Overview  Introduce the keyboard device  Show how keys on a keyboard can be represented by enumerated types.
Rob Miles. Creating a Working MoodLight We know that colours in XNA are stored as values which represent the amount of red, blue, green and transparency.
Genre What types of games are there?. Game Genres ► Action / Adventure Legend of Zelda Series, Metroid ► Platformers Super Mario 64, Megaman ► Shooters.
11 Working with Images Session Session Overview  Find out more about image manipulation and scaling when drawing using XNA  Start to implement.
XNA An Introduction. What XNA is… Microsoft® XNA™ is composed of industry- leading software, services, resources, and communities focused on enabling.
11 Making a Sprite Session 4.2. Session Overview  Describe the principle of a game sprite, and see how to create a sprite in an XNA game  Learn more.
Rob Miles. How does an XNA game program work? Programs tell computers what to do A program is written in a programming language – C# is a programming.
Game Maker – Getting Started What is Game Maker?.
11 Getting Player Input Using a Gamepad Session 3.1.
Aaron Yuen 1 Outline 9.1Storyboarding & Charting Method for Game Design 9.2Game State in Game Development 9.3Game State Management 9.4GUI Assets for Gameplay.
CHAPTER 3 Getting Player Input XNA Game Studio 4.0.
CHAPTER 6 Multiplayer XNA Game Studio 4.0. Objectives Discover how to detect and use individual button-press events in a game. Learn how to create and.
Create a Halloween Computer Game in Scratch Stephanie Smullen and Dawn Ellis Barb Ericson October 2008.
Tutorial for Arrays and Lists. Description This presentation will cover the basics of using Arrays and Lists in an Alice world It uses a set of chickens.
Genre Computer Games: Digital Games Design F1R2 11 © 2012 West Lothian CollegeAugust 2012/Review date August 2015 Genre.
Scratch Creative Computing. INTRODUCTION TO SCRATCH Section 1.
Photo Story. How to use Photo Story Photo Story 3 can be located in the Accessories folder on school computers. You will need to have your pictures already.
CHAPTER 2 The Game Loop - Variables, Types, Classes and Objects in XNA XNA Game Studio 4.0.
11 Computers, C#, XNA, and You Session 1.1. Session Overview  Find out what computers are all about ...and what makes a great programmer  Discover.
Game Maker Evil Clutches.
Scratch for Interactivity Dr. Ben Schafer Department of Computer Science University of Northern Iowa.
11 Using the Keyboard in XNA Session 9.1. Session Overview  Discover more detail on how the XNA keyboard is implemented  Find out how to use arrays.
XNA Tutorial 1 For CS134 Lecture. Overview Some of the hard work has already been done for you. If you build and run your game now, the GraphicsDeviceManager.
Rob Miles. Using data in an XNA game program An XNA game program Draw and Update methods that are called to run the game Colours are held in XNA as four.
11 Adding Vibration Effects Session Session Overview  Describe how the vibration feature of the gamepad works  Show how an XNA program can control.
Rob Miles. Creating a Broken MoodLight An XNA game contains game data which is used by the Draw and Update methods – Update updates the game data – Draw.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech May 2009.
11 Making Decisions in a Program Session 2.3. Session Overview  Introduce the idea of an algorithm  Show how a program can make logical decisions based.
Scratch Programming Cards
Create a Halloween Computer Game in Scratch
Scratch for Interactivity
Using and Creating Sprites
Creating a Multi-Player Game
Android Game Devlopment
A way to formally define the “playable” parameter of a game.
Creating a Simple Game in Scratch
Presentation transcript:

CS PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 2: DRAWING, DATA AND CONTROLS

TABLE OF CONTENTS Final Project Guidelines XNA Programming: - Data Storage - Basic Graphics - Player Input Game Design Notes: Game Genres (Expanded)

FINAL PROJECT GUIDELINES BREAKING IT DOWN

PROGRAMMING PROJECT This programming project is targeted for CS Major Student groups Create a game that consists of the following requirements: a.) Genre: Any Genre will fit b.) Game Length: Trial Length (10-20 minutes long / 1 – 2 stages) and will automatically show top score, and go back to main title c.) Graphics: 2D or 3D (no bonus points for high level 3D) d.) Sound: No profanities or anything similar e.) Content: Basic story, not epic. A kid – adult game.

PROGRAMMING PROJECT Grade Breakdown: Graphics: 30% Sound: 10% Story / Content: 40% Controls / Ease of use: 20% Total 100% (or A)

GAME DESIGN PROJECT This project is targeted for non CS Major groups The premise of this project is to have the groups create a game concept from the ground up until marketing the game, without having programming the game. The game will need to have the following elements: a.) Game Concept: Genre and Theme and Elements b.) Character/s - background of the character and their designs c.) Game Story – Major events of the game in detail d.) Availability – which platform will it be? e.) Marketing – Market the created Design and Concept of the Game.

GAME DESIGN PROJECT Grade Breakdown: Game Concept: 20% Character Design: 15% Game’s Story: 25% Marketing: 20% Appeal: 20% Total: 100% (or A)

XNA PROGRAMMING DRAWING,DATA AND CONTROLS

DRAWING OBJECTS IN XNA In this section, we will learn more about the creation of drawings in XNA, how data is saved We will create a sample program called MoodLight to simulate the various drawing or coloring the application can do. It will for now, be without controls and will change colors using combinations of if statements.

DRAWING IN XNA Basic Programing Diagram: Data Computer Program Data

DRAWING IN XNA To begin programming, we open up our previous sample file we’ve created. Else, we open up a new Project and save it as MoodLight. We open up the file called Game1.cs Look at the following method: Protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); //TODO: Add your drawing code here base.Draw(gameTime); }

DRAWING IN XNA The method contains instructions to draw something on the screen. GraphicsDevice.Clear(Color.CornflowerBlue); This method implies to clear the screen of the device with the color called CornflowerBlue. The method Clear (it’s already a premade method like Draw without the need to change the code) is one of the built in methods belonging in the XNA Framework. We can change it to another color if we want it to. We will modify this method to provide our own color. We will be declaring variables to set the new color. ColorbackgroundColor;

DRAWING IN XNA Assigning a color value to the variable backgroundColor: We now replace the previous value in the Clear method with backgroundColor. GraphicsDevice.Clear(backgroundColor); =new Color (0,0,0);backgroundColor

DRAWING IN XNA The resulting updated method will now have: Protected override void Draw(GameTime gameTime) { Color backgroundColor; backgroundColor = New Color (0,0,0); GraphicsDevice.Clear(backgroundColor); base.Draw(gameTime); }

DRAWING IN XNA The behavior of the graphic depends on the update method being run. We will now manipulate the colors using conditions inside the Update method of the code. Later in the next part, manual controls shall be used to update the colors. Firstly, we will need to create several variables for the colors Red, Green and Blue. They are named redIntensity, greenIntensity, and blueIntensity. They are declared as type byte (smallest unit of memory used in a game). We will use byte as it saves up on memory, especially in this case that we might end up creating a game for XBOX or even a phone or Zune device which has very limited memory (512MB for XBOX). // The Game World - our color values byte redIntensity; byte greenIntensity; byte blueIntensity;

DRAWING IN XNA In order to make the colors change, we will have to add in logic that will make the values change. We will be using IF statements to control the change when we update the colors. The simple diagram above shows the basic IF statement that if the redCountingUP value is still counting up (TRUE) then the value of redIntensity is increased by 1. If ( redCountingUP ) redIntensity++; condition statement

DRAWING IN XNA However, there are cases where we may need to do an alternative step if the statement is false. If ( redCountingUP ) redIntensity++ else redIntensity--; condition statement Statement done if false

DRAWING XNA Open the folder 04 MoodLight in the samples folder of XNA development to see the final product. Another variation is found in 05 MoodLight folder, which has a different behavior in changing lights.

CONTROLS IN XNA In video games, there are several ways to control it. a.) Joysticks b.) Control Pads c.) Keyboard and Mouse d.) Touch e.) Motion

CONTROLS IN XNA To make games work in XNA, we need to understand the basic control statement when coding We use the GamePad class to reference our controls to a game pad. We use the method GetState to read the state of our game pad. Here’s an example GamePadState Buttons Green AButtonState.Pressed Red BButtonState.Released Blue XButtonState.Released Yellow YButtonState.Released StartButtonState.Released BackButtonState.Released

CONTROLS IN XNA To read a specific gamepad, we implement this line inside the game code: GamepadState pad1 = GamePad. GetState ( PlayerIndex.One ); GamepadState called pad1 GamePad class that looks after gamepads Method that gets the state of a gamepad GamePad being read

CONTROLS IN XNA We can test out the controls in XNA by modifying the previous exercise (MoodLight) code to allow controls. If ( pad1.Buttons.B == ButtonState.Pressed ) redIntensity++ ; Button pressed Statement done if trueValue we’re looking for

CONTROLS IN XNA We modify the Moodlight code with the following: We also modify the MoodLight code to remove the previous exercise of automating the color change Protected override void Update(GameTime gameTime) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) this.Exit(); GamePadState pad1 = GamePad.GetState(PlayerIndex.One); if(pad1.Buttons.B == ButtonState.Pressed) redIntensity++; if(pad1.Buttons.X == ButtonState.Pressed) blueIntensity++; if(pad1.Buttons.A == ButtonState.Pressed) greenIntensity++; base.Update(gameTime); }

CONTROLS IN XNA To find out more on Game Controller Input. Get this file from:

GAME DESIGN NOTES GAME GENRES

Action / Adventure Games -Objective: to get to the other side of the map, exploration, earn treasure/points, use tools to defeat enemies -Graphics: early years are in 2D, current generation of games moving into open world (3D). -Early sample of action/adventure games: Pitfall! -Notable existing works: Super Mario, Sonic the Hedgehog, Prince of Persia, Megaman, Metroid, Assassins Creed, Metal Gear, Grand Theft Auto, Devil May Cry, Resident Evil

GAME GENRES Rhythm Games Objective: Time the button presses correctly to stay in rhythm and earn more points. Try to perfect a round without missing a beat/step Graphics: 3D or 2D Music: Driven by either Japanese pop music, Pop Music, Rock Music Early sample of Rhythm Games: Pa Rappa the Rapper, Beatmania Notable Existing Works: Dance Dance Revolution, Guitar Hero, Rockband, Guitar Mania, Drum Mania

GAME GENRES Real Time Strategy Games Objective: Beat your enemy/enemies by building structures, training units and gathering resources Graphics: 2D Grid or 3D 2/3 Isometric View Early Sample: Dune I and Dune II Notable Existing works: StarCraft series, Command and Conquer series, Age of Empire Series, Company of Heroes series, Sins of a Solar Empire, Star Control series

GAME GENRES Racing Games Objective: earn the highest score until time runs out / beat all opponents to the finish line / earn the highest points in drifting / get to the finish line before time runs out / get the fastest time in a race / Out Drag everyone Graphics: Overhead 2D, Rearview 2D, 3D (various angles) Early Sample: Pole Position, Out Run, Road Blasters Notable Existing works: Need for Speed, Gran Turismo, Grid, F1, Midnight Club, GTR, Burnout, Auto Modellista

GAME GENRES Shooting Games Objective: Shoot down as many ships as possible and beat the final boss. Earn the most number of points in a game. Graphics: 2D overhead, sideways, front facing, 3D first person, third person Early Samples: Battle City, Wolfenstein, SpaceWar, Space Invaders, Macross, Operation Wolf Notable Existing Works: Ace Combat, Gears of War, Counter Strike, Medal of Honor, Call of Duty, Halo, Unreal Tournament, Time Crisis, Rainbow Six, Ghost Recon, ARMA, Bioshock

GAME GENRES Role Playing Games Objective: Be the strongest possible to beat the final boss, save the world and get the girl Graphics: 2D side scrolling, overhead, isometric / 3D Early Samples: Dungeons and Dragons, Phantasy Star, Final Fantasy Notable Existing works: Final Fantasy, Xenogears, Fallout, Kingdom Hearts, Suikoden, Fable, Dragon Age, Diablo