Game Design and Programming - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

Game Design and Programming

Description:

3D mathematics for games may be hard but designing games is even harder ... Strategy/war games. Pure puzzle and board games. Mechanical simulations ... – PowerPoint PPT presentation

Number of Views:70
Avg rating:3.0/5.0
Slides: 24
Provided by: Bel134
Category:

less

Transcript and Presenter's Notes

Title: Game Design and Programming


1
Game Design and Programming
2
Objectives
  • Classify the games
  • How games are design
  • How games are implemented
  • What are the main components of a game engine

3
Designing Games
  • 3D mathematics for games may be hard but
    designing games is even harder
  • Having a fun game is a challenging issue
  • If the game is not well-design, the fancy 3D
    graphics will not do any help
  • Coming up with a game idea is usually not
    difficult
  • The level of Details, final implementation, and
    the look make the difference between professional
    and novice games

4
Types of games
  • The first step for designing a game is to the
    genre of your game
  • Action and Adventure
  • Fighting games
  • Sport games
  • Strategy/war games
  • Pure puzzle and board games
  • Mechanical simulations
  • Flying, boating, racing, etc.
  • Ecosystem simulations
  • Artificial system of some kind such as ant
    colony, city, etc.

5
Action Adventure
Puzzles
Strategy/War
Sports
6
Simulation Racing
Ecosystem simulation
Fighting
7
Brainstorming
  • Once the type of the game is specified, you must
    come up with a fun game
  • Brainstorm and through ideas. Existing games,
    reading science fiction books, and watching 3D
    movies can trigger your creativity.
  • Keep it simple dont bite off more than what you
    can chew!

8
Design document and Storyboard
  • Once the ideas are set in your mind, you need to
    get them on paper
  • A design document outlines the details of the
    game
  • Who are the main characters?
  • What is the main idea of the game?
  • How to win the game?
  • What are the levels of the game?
  • What are the cool features in the game?
  • Making a storyboard is often the best to start
    and understand the game

9
Is it Fun?
  • Reality check
  • Will the game be fun?
  • Will people enjoy it?
  • Are the cool features cool enough to attract
    people?
  • Be objective and see the game from others eyes
  • Remember that the cool features and the attention
    to details make the game fun

10
The big picture!
11
The components of a game
  • A game is a real-time application that includes
  • Interactivity mouse, keyboard, joystick
  • Visual the frames drawn into the display
  • Audio any sound or music playing during playing
  • A video game is
  • A continuous loop that
  • performs logic and
  • draws an image on the screen, usually at a rate
    of 30 frames per second (fps) or more.
  • This is similar to how a movie is displayed,
    except that you are creating the movie as you
    play.

12
Components of a game (2)
The main game loop! while (!gameover)
get input process input simulate
physics and AI redraw Simple!
13
The components of a game (3)
  • Initialization
  • perform the usual operations
  • Memory allocation
  • Graphics device creation and initialization
  • Resource acquisition
  • Loading data from disk.
  • Game Loop
  • This is the main loop of the game.
  • It is where the actions of the game begin and
    continue until the user exists the main game
    loop.

14
The components of a game (4)
  • Interactivity
  • retrieves player inputs
  • Process the inputs or buffer them for later use
    in Artificial Intelligence (AI) and game logic
  • AI and Game Logic
  • The majority of the game code is in here
  • The artificial intelligence, the physics, and the
    logic of the game are executed
  • the results are used to draw the next frame on
    the screen

15
The components of a game (4)
  • Rendering
  • the results of the players input and the
    execution of game AI and logic are used to
    generate the next frame of animation for the
    game.
  • This frame is usually drawn on an off-screen
    (back) buffer area
  • A swapping of the front and the back buffer is
    performed to display the frame.

16
The components of a game (5)
  • Display synchronization
  • To avoid a variable frame rate, you must set the
    frame rate to a fixed value
  • Use timing/waiting functions to hold the frame
    rate to a fixed value
  • Cleaning up
  • When the user exits the game, we have to make
    sure to release the resources and clean up the
    system
  • Delete any pointers
  • Close any files, databases, or connections
  • Return to the window mode if full-screen mode is
    used

17
How to control the main loop?
  • The game main loop is usually a finite state
    machine (FSM) that contains a number of states
    and the transitions between these states

18
Show us the code!
  • // implementation of main game loop
  • while (gameState!GAME_EXIT)
  • // what state is game loop in
  • switch (gameState)
  • case GAME_INIT // the game is initializing
  • // allocate all memory and load the
    resources
  • initialize()
  • // move to menu
    state
  • gameState
    GAME_MENU
  • break
  • case GAME_MENU // the
    game is in the menu mode
  • // call the main
    menu function and let it switch states
  • gameState
    getMenuChoice()
  • // You can force a
    RUN state here if you want.
  • break
  • case GAME_STARTING //
    the game is about to run
  • // this state is
    optional, but usually used to set things up right
  • // before the game
    is run you might do a little more house keeping
    here
  • setupForRun()

19
Show us the code! (2)
  • case GAME_RUN // the game is now running
  • // this section contains the entire
    game logic loop
  • // clear the display
  • clearDisplay()
  • // get the inputs and interact with
    the user
  • getInput()
  • // perform logic and AI
  • doLogicAI()
  • // display the next frame of
    animation
  • renderFrame()
  • // synchronize the display
  • wait()
  • // the only way that state can be
    changed is through user interaction in the input
  • // section or by maybe losing the
    game.
  • break
  • case GAME_RESTART // the game is
    restarting
  • // this section is a cleanup state
    used to put things in order before running again
  • fixUp()
  • // switch states back to the menu

20
Show us the code! (3)
  • case GAME_EXIT // the game is exiting
  • // if the game is in this state,
    then cleanup everything
  • releaseCleanUp()
  • // set the error word to whatever
  • error 0
  • break
  • default
  • break
  • // end switch
  • // end while
  • // return error code to operating system
  • return(error)

21
What is a game engine?
  • Provides the core functionality of the game
  • Allows for reusable software platform and rapid
    development of games
  • Think of the engine of a car!
  • A game engine usually includes
  • A 2D/3D rendering engine
  • A physics/Collision detection engine
  • AI
  • Sound
  • Processing inputs
  • Networking
  • Example, Crystal space is an open source game
    engine

22
Summary
Do you know this? Of course!
23
For Later
  • Algorithms, data structures, and programming
    tricks for games
  • Physics and mathematics for games
  • Artificial intelligence
  • Determinism
  • Randomness
Write a Comment
User Comments (0)
About PowerShow.com