1 / 31

CS 179.14 PC/Console Game Programming/development

CS 179.14 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.

goto
Download Presentation

CS 179.14 PC/Console Game Programming/development

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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:

  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(GameTimegameTime) { 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. backgroundColor; Color

  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(GameTimegameTime) { 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. statement condition If ( redCountingUP ) redIntensity++;

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

  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 MoodLightfolder, 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 A ButtonState.Pressed Red B ButtonState.Released Blue X ButtonState.Released Yellow Y ButtonState.Released Start ButtonState.Released Back ButtonState.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 GamePad being read Method that gets the state of a gamepad

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

  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(GameTimegameTime) { // 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. 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

  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

More Related