240-492 games programming with java

48
240-492 Games Programming with Java ::: Introduction ::: 1 240-492 Games Programming with Java Montri Karnjanadecha Andrew Davison

Upload: badru

Post on 06-Jan-2016

45 views

Category:

Documents


2 download

DESCRIPTION

240-492 Games Programming with Java. Montri Karnjanadecha Andrew Davison. Chapter 1 Introduction to Game Programming. Outline. What is a game? Why do people play games? Taxonomy of computer games The computer as a game technology The game design sequence Design techniques and ideas - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

1

-240492

Games Programming with Java

Montri Karnjanadecha Andrew Davison

Page 2: 240-492 Games Programming with Java

2 240-492 Games Programming with Java

::: Introduction :::

Chapter 1

Introduction to Game Programming

Page 3: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

3

Outline

• What is a game?• Why do people play games?• Taxonomy of computer games• The computer as a game technology• The game design sequence• Design techniques and ideas• The future of computer games

Reference: http://www.erasmatazz.com/free/AoCGD.pdf

Page 4: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

4

What is a Game?

• Board games• Card games• Athletic games• Children’s games• Computer games

Page 5: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

5

Board Games

• Consists of playing surface divided into sectors populated by a set of movable pieces

• The pieces are directly related to players• Playing surface represents an environment• Players maneuver their pieces across the playing

surface to:– capture other player’s pieces– reach an objective– gain control of territory– etc.

Page 6: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

6

Card Games

• Utilize a set of 52 symbols generated from 2 factors:– Rank (13 values)

– Suit (4 values)

• Revolve around combinations built from these two factors

• Each legal combination is assigned a victory value

• The player’s primary concern is the analysis of combinations

Page 7: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

7

Athletic Games

• Emphasize physical more than mental prowess• Skillful use of the body is the primary concern• Athletic games vs athletic competitions• A race is a competition• An athletic game is a competition with interacti

on between players.

Page 8: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

8

Children’s Games

• Group activities emphasizing simple physical play

• The player’s primary concern is the use of social skills

• Examples– Hide and Seek

– Red Rover

– Tag

– Kick the Can

Page 9: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

9

Computer Games

• Played on 5 types of computers– expensive dedicated machines (arcade)

– inexpensive dedicated machines (handheld)

– multi program home games (Nintendo, Play Station)

– persona; computers

– large mainframe computers

• Computer acts as opponent and referee• Skill & Action (emphasizing hand eye

coordination)

Page 10: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

10

Computer Games (cont’d)

• These S&A games are frequently violent in nature

• Areas of computer games:– adventure games

– fantasy role playing games

– war games

Page 11: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

11

Games’ Common Elements

• Representation– A game subjectively represents a subset of reality

• Interaction– Games provide interactive elements.

• Conflict– Arises naturally from the interaction in a game

– Game agent attempts to block the player to reach his goal

• Safty– Games provide save way to experience reality

Page 12: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

12

Games vs Simulations

• Simulation– serious attempt to accurately represent a real phenomen

on

– created for evaluative purposes

• Game– artistically simplified representation of a phenomenon

– created for entertainment purposes

– small simulation lacking the degree of detail

• Flight Simulator vs RED BARON

Page 13: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

13

Games vs Puzzles

• Cube puzzle vs Tic Tac Toe• High jumping vs Basket ball• Cube puzzle does not respond to the moves• High jump pole does not react to the jumper’s e

ffort• Basket ball & Tic Tac Toe: opposing player ack

nowledge and respond to the player’s action

Page 14: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

14

Games vs Toys vs Stories

• Games– allow player to manipulate facts but rules remain fixed

– indirect contact of audience experience

– to be experienced many times

• Toys– user is free to manipulate the toy

– no control to user experience

• Stories– audiences don’t have control of facts presented

– to be experienced once

Page 15: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

15

Why do People Play Games?

• To learn (need not be conscious)• Fantasy/Exploration (example of Disney Land)• Nose-Thumbing (violent, socially unacceptable)• Proving oneself (high score)• Social lubrication (card games, board games)• exercise (mental and/or physical)• need for acknowledgement

Page 16: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

16

Enjoyment Factors

• Game play• Graphics• Color• Animation• Sound

} Reality

Page 17: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

17

A Taxonomy of Computer Games

Skill&Action Games(emphasize motor skills)

– Combat games

– Maze games

– Sport games

– Paddle games

– Race games

– Miscellaneous games

Strategy Games(emphasize cognition skills)

– Adventures

– D&D games

– War games

– Games of chance

– Educational games

– Children’s games

– Interpersonal games

Page 18: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

18

Combat Games

• Present a direct and violent confrontation• The player must destroy the bad guys• The player must avoid being hit• Examples

– Start Raiders

– Spacewar

– Asteroids

– Missile Command

– Space Invaders

– Battlezone

Page 19: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

19

Maze Games

• Maze of paths through which the player must move

• Avoiding or destroying the bad guys• The player may make his way to an exit• Example

– Pac-Man

Page 20: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

20

Sport Games

• Model popular sport games• Examples

– football

– basket ball

– snooker

Page 21: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

21

Paddle Games

• Intercepting a projectile with a paddle-controlled piece

• Easy to develop• Examples

– Pong

– Breakout

– Warlords

– Chicken

Page 22: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

22

Race Games

• Examples– Downhill

– Match Racer

– Night Driver

– Test Drive

– Dog Daze

Page 23: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

23

Adventures

• Closer to puzzles than games• moving through a complex world• collecting tools• finding treasure or goal• Examples

– Adventure

– The Wizard and the Princes

– Time Zone

– Deadline

Page 24: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

24

Game of Chance

• Easy to Program• Example

– Blackjack

Page 25: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

25

Educational and Children’s Games

• Designed with explicit educational goals• Examples

– Hang Man

– Mammurabi

– Lunar Lander

– Rockey’s Boots

Page 26: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

26

The Computer as Game Technology

• responding to the human player• acting as game referee• providing Real-time play• providing intelligent opponent• limiting information to the player• utilizing data transfer over communication line• Limited I/O capability and single-user

orientation are major weaknesses

Page 27: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

27

Design Concepts

• Go with the grain– Don’t force the machine to do perform tasks for which i

t is not well-suited

– Recgrids vs Hexgrids

• Don’t transplant– A game that succeeds in one technology may not succe

ed in other technologies

• Design around the I/O– carefully consider what can and cannot be display and

what can and cannot be inputted

Page 28: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

28

Design Concepts (cont’d)

• Keep it clean– Sticking close to the theme and eschewing distracting

detail

• Store less and process more– Main role of a computer is to process information not

store information

– Fill your program with active bytes not lazy bytes

– Games with information-rich and process-poor are close to stories

Page 29: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

29

Design Concepts (cont’d)

• Maintain unity of design effort– Game must be designed, but computer must be

programmed

– Conflicts between artists and programmer

Page 30: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

30

Game Design Sequence

• Choose a goal and a topic• Research and preparation• Design phase

– I/O structure– Game structure– Program structure– Evaluation of the design

• Pre-programming phase• Programming phase• Playtesting phase

Page 31: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

31

Choose a Goal and a Topic

• A game must have a clearly defined goal expressed in terms of the effect on the player

• Choose a goal in which you believe

• The goal of STAR RAIDERS concerns the violent resolution of anger through skillful planning and dexterity. The topic is combat is space

Page 32: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

32

Choose a Goal and a Topic

• The goal of EASTERN FRONT 1941 concerns the nature of modern war, the different between fire power and effectiveness. The topic is the war between Russian and Germany

Page 33: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

33

Research and Preparation

• Read everything you can on the topic

• Your game must give the authentic feel

• Concentrate on goal and topic

• Write NO CODE!

Page 34: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

34

Design Phase

• Primary objective is to create the outlines of three interdependent structures:– the I/O structure

– the game structure

– the program structure

• All 3 structures must be created simultaneously

Page 35: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

35

I/O Structure

• Communicating information between computer and player

• the most constraining structure• I/O composed of input (keyboard, joystick,

mouse,etc.) and output (display and sound)• Devote special care to the input structure• How can a player control the game with a

joystick?• Choice of input devices

Page 36: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

36

Game Structure

• Internal architecture of causal relationships tha

t define the obstacles the player must overcome

• Main problem is with realizing possibilities

• How to distill the fantasy of the goal and topic i

nto a workable system

• The designed must identify some “key” element

from the topic (eg. movement)

Page 37: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

37

Program Structure

• Translate I/O structure and game structure into

product

• Organization of mainline code, subroutines,

interrupts and data that make up the entire

program

• Important elements

– Memory map

– variables and subroutines definitions

– document

Page 38: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

38

Evaluation of the Design

• Does this design satisfy my design goal?

• Does it do what I want it to do?

• Will the player really experience what I want him to experience?

• Examine the stability of the game structure– Are there any circumstances in which the game could get

out of control?

• Insure that shortcuts to victory are blocked

• Don’t hesitate to abort the game

Page 39: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

39

Pre-programming Phase

• To prepare complete game document

• The tone of the document should emphasize the player’s experience rather that technical considerations

• Compare first set of document to program structure notes

Page 40: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

40

Programming Phase

• Easiest phase

• Requires attention to detail

• Game failed to live up to their potential because the programmer:– did not expend enough effort

– rushed the job

– didn’t bother to write in assembly language

Page 41: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

41

Playtesting Phase

• To check for some design and programming pr

oblems

• Have courage to trash a fatal-flawed game

• test the game yourself to find programming bu

gs, then let other playtesters to check for bugs i

n game structure

• polish the game

• write the game manual

Page 42: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

42

Design Techniques and Ideas

• Balancing solitaire games– human vs computer

• Relationships between opponents

• Smooth learning curve

• The illusion of winnability

Page 43: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

43

Balancing Solitaire Games

• Vast resources– widely used– the computer is provided with immense resources that it

uses stupidly– easy to implement

• Artificial smarts– ad-hoc artificial intelligent routines– produce reasonable behavior

• the computer should not drive its tanks over a cliff or crash spaceships into each other

– unpredictability (human should not be able to guess)

Page 44: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

44

Limited Information

• To limit the amount of information available to the human player

Page 45: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

45

Pace

• Make the game fast so that the human player does not have much time to think

Page 46: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

46

Relationships between Opponents

• Symmetric relationships– both sides have equals capability

– easy to program

• Asymmetric games– almost all solitaire games

• Triangularity– rock-scissors-paper game

• Actors and Indirect Relationships– not a very successful approach

Page 47: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

47

Smooth Learning Curve

• Flat curve => hard to learn

• Steep curve => easy to learn

• A sharp jump => has one trick

• Many sharp jumps => has many tricks

• Falling curve => something wrong with the game

• Upward smoothly => goo game

• Games without smooth curve frustrates players

Page 48: 240-492 Games Programming with Java

240-492 Games Programming with Java ::: Introduction :::

48

The Illusion of Winnability

• PAC-MAN appears winnable to most players, yet is never quite winnable

• Clean games encourage all players

• Careful analysis of the sources of player failure:– what trips up the player: game flaws or unwinnable or

player mistake?