Intro1

240-492
Games Programming with Java
Montri Karnjanadecha
Andrew Davison
240-492 Games Programming with Java
::: Introduction :::
1
Chapter 1
Introduction to
Game Programming
240-492 Games Programming with Java
::: Introduction :::
2
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
240-492 Games Programming with Java
::: Introduction :::
3
What is a Game?
•
•
•
•
•
Board games
Card games
Athletic games
Children’s games
Computer games
240-492 Games Programming with Java
::: Introduction :::
4
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.
240-492 Games Programming with Java
::: Introduction :::
5
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
240-492 Games Programming with Java
::: Introduction :::
6
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
interaction between players.
240-492 Games Programming with Java
::: Introduction :::
7
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
240-492 Games Programming with Java
::: Introduction :::
8
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)
240-492 Games Programming with Java
::: Introduction :::
9
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
240-492 Games Programming with Java
::: Introduction :::
10
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
240-492 Games Programming with Java
::: Introduction :::
11
Games vs Simulations
• Simulation
– serious attempt to accurately represent a real
phenomenon
– 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
240-492 Games Programming with Java
::: Introduction :::
12
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
effort
• Basket ball & Tic Tac Toe: opposing player
acknowledge and respond to the player’s action
240-492 Games Programming with Java
::: Introduction :::
13
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
240-492 Games Programming with Java
::: Introduction :::
14
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
240-492 Games Programming with Java
::: Introduction :::
15
Enjoyment Factors
•
•
•
•
•
Game play
Graphics
Color
Animation
Sound
}
240-492 Games Programming with Java
::: Introduction :::
Reality
16
A Taxonomy of Computer Games
Skill&Action Games
Strategy Games
(emphasize motor skills)
(emphasize cognition skills)
– Combat games
– Adventures
– Maze games
– D&D games
– Sport games
– War games
– Paddle games
– Games of chance
– Race games
– Educational games
– Miscellaneous games
– Children’s games
– Interpersonal games
240-492 Games Programming with Java
::: Introduction :::
17
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
240-492 Games Programming with Java
::: Introduction :::
18
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
240-492 Games Programming with Java
::: Introduction :::
19
Sport Games
• Model popular sport games
• Examples
– football
– basket ball
– snooker
240-492 Games Programming with Java
::: Introduction :::
20
Paddle Games
• Intercepting a projectile with a paddlecontrolled piece
• Easy to develop
• Examples
–
–
–
–
Pong
Breakout
Warlords
Chicken
240-492 Games Programming with Java
::: Introduction :::
21
Race Games
• Examples
–
–
–
–
–
Downhill
Match Racer
Night Driver
Test Drive
Dog Daze
240-492 Games Programming with Java
::: Introduction :::
22
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
240-492 Games Programming with Java
::: Introduction :::
23
Game of Chance
• Easy to Program
• Example
– Blackjack
240-492 Games Programming with Java
::: Introduction :::
24
Educational and Children’s Games
• Designed with explicit educational goals
• Examples
–
–
–
–
Hang Man
Mammurabi
Lunar Lander
Rockey’s Boots
240-492 Games Programming with Java
::: Introduction :::
25
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
240-492 Games Programming with Java
::: Introduction :::
26
Design Concepts
• Go with the grain
– Don’t force the machine to do perform tasks for which
it is not well-suited
– Recgrids vs Hexgrids
• Don’t transplant
– A game that succeeds in one technology may not
succeed in other technologies
• Design around the I/O
– carefully consider what can and cannot be display and
what can and cannot be inputted
240-492 Games Programming with Java
::: Introduction :::
27
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
240-492 Games Programming with Java
::: Introduction :::
28
Design Concepts (cont’d)
• Maintain unity of design effort
– Game must be designed, but computer must be
programmed
– Conflicts between artists and programmer
240-492 Games Programming with Java
::: Introduction :::
29
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
240-492 Games Programming with Java
::: Introduction :::
30
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
240-492 Games Programming with Java
::: Introduction :::
31
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
240-492 Games Programming with Java
::: Introduction :::
32
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!
240-492 Games Programming with Java
::: Introduction :::
33
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
240-492 Games Programming with Java
::: Introduction :::
34
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
240-492 Games Programming with Java
::: Introduction :::
35
Game Structure
• Internal architecture of causal relationships
that define the obstacles the player must
overcome
• Main problem is with realizing possibilities
• How to distill the fantasy of the goal and topic
into a workable system
• The designed must identify some “key” element
from the topic (eg. movement)
240-492 Games Programming with Java
::: Introduction :::
36
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
240-492 Games Programming with Java
::: Introduction :::
37
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
240-492 Games Programming with Java
::: Introduction :::
38
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
240-492 Games Programming with Java
::: Introduction :::
39
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
240-492 Games Programming with Java
::: Introduction :::
40
Playtesting Phase
• To check for some design and programming
problems
• Have courage to trash a fatal-flawed game
• test the game yourself to find programming
bugs, then let other playtesters to check for
bugs in game structure
• polish the game
• write the game manual
240-492 Games Programming with Java
::: Introduction :::
41
Design Techniques and Ideas
• Balancing solitaire games
– human vs computer
• Relationships between opponents
• Smooth learning curve
• The illusion of winnability
240-492 Games Programming with Java
::: Introduction :::
42
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)
240-492 Games Programming with Java
::: Introduction :::
43
Limited Information
• To limit the amount of information available to
the human player
240-492 Games Programming with Java
::: Introduction :::
44
Pace
• Make the game fast so that the human player
does not have much time to think
240-492 Games Programming with Java
::: Introduction :::
45
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
240-492 Games Programming with Java
::: Introduction :::
46
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
240-492 Games Programming with Java
::: Introduction :::
47
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?
240-492 Games Programming with Java
::: Introduction :::
48