Game Design - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

Game Design

Description:

Strategy: puzzle games, strategic combat ... side-scroller, platformer, first-person shooter, puzzle (Tetris), fighting ... Games will be graded on originality, ... – PowerPoint PPT presentation

Number of Views:513
Avg rating:3.0/5.0
Slides: 17
Provided by: awo4
Category:
Tags: design | fighting | game | games

less

Transcript and Presenter's Notes

Title: Game Design


1
Game Design
  • CSE 203 Lecture 6
  • Annatala Wolf

2
Constructors
  • If you use classes in your design, you may want
    to use constructors. A constructor is an
    operation that automatically runs when an object
    is created.
  • To call a constructor, you use the phrase New
    Type(args go here)
  • You can think of the constructor as a function
    that returns a Type object.

3
Constructor Example
  • Class Dude
  • Private Define name As Text
  • Constructor(name As Text)
  • This.name name
  • End Constructor
  • End Class
  • Method Main()
  • // Make a Dude object and set its name
  • Define fred As Dude New Dude(Fred)
  • End Method

4
Default Constructor
  • In Phrogram, all classes have a default (empty)
    constructor, even if you dont define one. If
    you dont call a constructor, it will call the
    default one for you when you make the object.
  • // Calls default Constructor()
  • // for Sprite class!
  • Define jumper As Sprite

5
New Objects
  • Every time you call a constructor, you get a new
    object. So this resets the objectyoull lose
    anything you did with it before.
  • // Calls Foos Constructor()
  • Define blather As Foo
  • // Overwrites blather
  • blather New Foo(stuff, 12)
  • // Overwrites blather again
  • blather New Foo()

6
Dont Get Lost!
  • If you have difficulty getting classes to
    workremember, you dont need to use them for
    your project.
  • You should, however, understand how to separate
    your code into operations. Your Main() method
    should be relatively clean and short, and most of
    the variables you use should be at the program
    level.

7
Kinds of Projects
  • Your project will probably be a game of some
    sort. This is partly because Phrogram lends
    itself well to game programming.
  • Non-game projects are also possible. You could
    write a simulation, a tool, or an application.
    But it should be tricky to implement, and
    interesting!

8
Game Genres
  • Strategy puzzle games, strategic combat
  • Action side-scroller, platformer, first-person
    shooter, puzzle (Tetris), fighting
  • Roleplay/RPG usually with epic plot, multiple
    characters, character growth
  • Adventure mix of action and RPG
  • Sports sports, card games, driving
  • Simulation usually resource management

9
Planning the Game
  • Game design begins with a concept. What do you
    want the game to be like for the player?
  • Generally, there will be a set of different
    situations a player can be presented with.
  • There may be multiple levels to complete
  • There might be menu windows that pop up
  • There could be different modes of play
  • There might be choices before the game starts

10
Game State
  • With all these different things going on, how can
    you keep track of what the program is supposed to
    do?
  • The idea of game state encompasses not only the
    data the game has access to and where the code is
    running, but also what mode the game is in.
  • We can use variables to remember what state the
    game is in.

11
Constants
  • Sometimes, youll want to use a variable to refer
    to the same value over and over again, without
    ever changing. This kind of variable is called a
    constant.
  • Constants are useful for remembering constant
    values (like PI 3.14159), or state labels
    (NORTH 1, EAST 2, etc.)

12
Defining Constants
  • To define constants, use the keyword Constant
    (instead of Define). You need to assign them
    when you create them.
  • Constant PI As Decimal 3.1416
  • Constant MAIN_MENU As Integer 2
  • Note that constant values are traditionally
    written in ALL_CAPS.

13
Using Constants
  • Constants are used just like variables, but they
    cant be reassigned. (You can even make them
    private class members if you want to use them
    only in that class.)
  • area PI radius radius
  • MAIN_MENU 3 // error! constant

14
Back To State
  • Consider a game that starts with a character
    creation screen, then toggles between a map
    screen and a combat screen. How would we keep
    track of it?
  • At the program level, well make
  • Constant GS_CREATE As Integer 1
  • Constant GS_MAP As Integer 2
  • Constant GS_COMBAT As Integer 3

15
Testing For State
  • We can segregate each mode of the game into a
    separate operation, for simplicity. Well call
    these from the main event loop.
  • While (Not gameOver)
  • If (gameState GS_CREATE) Then
  • charCreation()
  • Else If (gameState GS_MAP) Then
  • mapScreen()
  • Else If (gameState GS_COMBAT) Then
  • combatScreen()
  • End If
  • Delay(refreshRate)
  • RefreshScreen()
  • End While

16
Aiming For The Moon
  • Part of the project proposal process is deciding
    how much you want to tackle.
  • Games will be graded on originality, fun, and
    difficulty. But some things are too difficult to
    complete in four weeks.
  • Solution aim for something hard, that you can
    scale back if necessary. ?
Write a Comment
User Comments (0)
About PowerShow.com