Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "CS 179.14 PC/CONSOLE GAME PROGRAMMING/DEVELOPMENT CHAPTER 2: DRAWING, DATA AND CONTROLS."— Presentation transcript:

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

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

3 FINAL PROJECT GUIDELINES BREAKING IT DOWN

4 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.

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

6 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.

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

8 XNA PROGRAMMING DRAWING,DATA AND CONTROLS

9 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.

10 DRAWING IN XNA Basic Programing Diagram: Data Computer Program Data

11 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); }

12 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;

13 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

14 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); }

15 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;

16 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

17 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

18 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.

19 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

20 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

21 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

22 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

23 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); }

24 CONTROLS IN XNA To find out more on Game Controller Input. Get this file from: http://create.msdn.com/en-US/education/catalog/utility/input_reporter

25 GAME DESIGN NOTES GAME GENRES

26 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

27 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

28 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

29 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

30 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

31 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


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

Similar presentations


Ads by Google