thiết kế
Trang 1Adventure Game Engine Proof of Concept
Overview
A game engine is the core software component of a computer-based game In this
assignment, we will create a simple game engine for creating Adventure games An Adventure game is a game in which a player traverses a territory collecting useful
objects; solving puzzles and engaging foes that bar progress (see http://en.wikipedia.org/wiki/Adventure_game)
Problem: Proof of Concept Adventure Game Engine
The goal of the assignment is to create an API that will allow a programmer to quickly and efficiently implement an Adventure game Game engines include a variety of subsystems including those for AI, graphics and animation, and UI This proof-of-concept project focuses on the architecture of the classes involved in 1) creating and interacting with characters; 2) creating and using weapons; and 3) executing a duel between the player and a character A flexible architecture is needed so that the engine can support a game where pirates traverse the South Seas dueling with pistols and rapiers as easily as it is can support extraterrestrials traversing the galaxy dueling with lasers and photon torpedoes
How the proof-of-concept game should work:
1) Maze The player starts the game in a “maze.” A maze is the territory the player
explores in playing the game which maybe filled with various traps and pitfalls In the final game, graphics will allow the player to “see” the territory In this proof of concept, a simple one sentence description of the player’s current position will print on the console The maze has a starting node where the player begins and an ending node which when reached results in victory for the player
2) Navigation Player can move around in the maze collecting useful items in an
inventory and engaging a variety of foes In the final game, mouse operations will allow
the player to navigate In this project, a console prompt will be used to get player input
on where to move:
n,s,e,w,i,q >
A user response of n moves north in the maze, s moves the player south, e east, and
w west Entering an i displays the contents of a player’s inventory and entering q quits the game
3) Inventory At each node in the maze, the player may discover a useful item This
item may be a weapon, a special token that enhances weapon performance or anything else that may (or may not be) important in the game Upon arriving at a location in the maze, a player is given a description of the location Following the description, the
Trang 2player is given a description of any items that are present and is prompted the pick up the item to add it to the inventory, e.g.:
You are on the edge of a deep and mysterious forest
A bow and quiver of arrows lies on the ground
Pick up? y,n,i,q >
A user response of y puts the item in the player’s inventory for later use Entering an
n ignores the item Entering an i displays the contents of a player’s inventory and entering q quits the game
4) Weapons Certain items in the game can be used as weapons Each weapon has
the following characteristics:
Weapon Description Text description of the weapon (e.g., “sword and
shield”) Activation Graphic In this project, a text description of the character
activating the weapon (e.g., “fires cannon”, “swings frying pan”, “launches missile”)
Activation Sound In this project, a text description of the sound of the
weapon (e.g., “swoosh!” “bang!”)
Probability of hit Probability that when the weapon is activated it
impacts the opponent (.01-1.0)
Probability of block Probability that the weapon can block the activation of
an opponent’s weapon (.00-1.0) Not all weapons have a blocking capability
Hit count The number of times this weapon must impact an
opponent in order to subdue that opponent (1-999)
Example:
Weapon Description: Fly Swatter
Activation Graphic: swings swatter
Activation Sound: Smack!
Probability of hit: 0.9
Probability of block: 0.1
Hit count: 500
5) Weapon Enhancement Related to weapons are special tokens that can be found in
the maze that enhance weapon performance These tokens affect the probability of hit, probability of block, or hit count of all weapons in the player’s inventory Any number of
these tokens may be placed in the maze by the game designer The effects of the tokens are cumulative Example:
Trang 3A shiny coin with the letter “A” lies on the ground.
Pick up? y/n/q > y
The accuracy of all your weapons has been increased by 2!
n,s,e,w,i,q >
5) Foe At any point in the maze the player may encounter a foe A foe is a character
that has a weapon A description of a foe the foe’s weapon is given to a player upon arriving at a location in the maze (after the description of the location and after the description of any items at the location) A foe bars the player’s progress in the maze The player must engage and subdue the foe, or retreat and find a different path through the maze If a player engages a foe and the player is subdued the game is over and the player is prompted to play the same game again or quit
6) Duel When a player decides to engage a foe, the player must first select a weapon.
Not all items in the maze can be used as weapons After the player selects a weapon, the system randomly selects the character for the first weapon activation in the duel (foe
or player) The system activates the weapon by displaying the activation graphic and activation sound The system uses a pseudo random number generator to determine if
the activation results in a hit on the opponent based on the probability of hit for the
weapon If the activation results in a hit, the system uses a pseudo random number
generator to determine if the opponent blocks the hit based on the probability of block
for the opponent’s weapon The result of the activation is displayed to the user The duel continues with each character taking alternating turns Characters use their current weapon for the entire duel The duel ends when one of the characters hits an
opponent a number of times greater than or equal to the hit count of the character’s
weapon
Example:
You are in the corner of a dimly lit Wal-Mart parking lot
A disgruntled employee with a train of flaming shopping carts blocks your way
flaming shopping cart:
Probability of hit: 0.68
Probability of block: 0.38
Hit count: 3
Engage? y,n,q > y
Inventory includes:
1) Bic pen
2) Swiss Army Knife
3) Butane Lighter
4) Potato cannon
Select weapon 1-4,c,q > 1
Bic pen is not a weapon!
Select weapon 1-4,c,q > 4
You selected potato cannon:
Probability of hit: 0.76
Probability of block: 0.01
Trang 4Hit count: 1
disgruntled employee rolls flaming shopping cart
Grrrr! Pfffzt!
Hit!
You’ve been hit by a flaming shopping cart
2 more hits will do you in!
Player fires potato cannon
Fuwomp!
Miss!
disgruntled employee rolls flaming shopping cart
Grrrr! Pfffzt!
Miss!
Player fires potato cannon
Fuwomp!
Hit!
You have subdued disgruntled employee!
Your path is now clear
n,s,e,w,i,q >
Use Cases:
UC 01 Player navigates maze.
1 System describes current location, including available items and foes
2 System prompts for player action
3 Player selects a direction to move (e,g., North)
4 System move player to new location in maze
Extensions:
3a User selects Quit; game terminates
UC 02 Player picks up item in maze
1 System describes current location, including an available item (e.g., “Frying pan”)
2 System prompts for player action (e.g., “Pick up?”)
3 Player responds affirmatively
4 System adds item to player’s inventory and displays message about the item (including any special powers)
Extensions:
3a User selects Quit; game terminates
3b User response is negative; item not added to inventory; terminate use case
UC 03 Player encounters a foe in maze.
1 System describes current location, including a foe and foe’s weapon
Trang 52 System prompts for player action (e.g., “Would you like to engage the foe?”)
3 Player responds affirmatively
4 System places player in duel setup (UC 04)
Extensions:
3a User selects Quit; game terminates
3b User response is negative; player does not engage in a duel with the foe; the player’s path is blocked; player must move backwards to continue the game
UC 04 Player enters duel setup.
1 System displays player’s inventory
2 System prompts player to select weapon for use in duel (e.g., “Which weapon would you like to use?”)
3 Player selects inventory item that is a weapon
4 System describes attributes of the weapon
5 System places player and foe in a duel (UC 05)
Extensions:
3a User selects Quit; game terminates
3b User selects Cancel; terminate use case
3c User response is negative; player does not engage in a duel with the foe; the player’s path is blocked; player must move backwards to continue the game
UC 05 Player and foe duel.
1 System randomly chooses among player and foe for first action (assume player goes first)
2 System activates player’s weapon; a description and sound of activation is displayed (e.g., cannon fired, frying pan swung)
3 System determines if weapon activation affects foe (i.e., “hit” or “miss”); if it is a hit, the system determines in the foe blocks the hit; results are displayed (e.g.,
“Missed!”, “Hit!”, “Blocked!”)
4 If activation results in a hit that is not blocked, the foe’s hit count is incremented; else the foe’s hit count is not incremented
5 The foe’s hit count is below the hit count threshold for the player’s weapon
6 The system activates the foe’s weapon; a description and sound of activation is displayed (e.g., cannon fired, frying pan swung)
7 System determines if weapon activation affects foe (i.e., “hit” or “miss”); if it is a hit, the system determines in the foe blocks the hit; results are displayed (e.g.,
“Missed!”, “Hit!”, “Blocked!”)
8 The player’s hit count is below the hit count threshold for the selected weapon
9 Continue at step 2
Extensions:
5a The foe’s hit count has been exceeded; the player continues the game; end of use case
Trang 68a The player’s hit count has been exceeded; the player is subdued; condolences are expressed; the player is prompted to play the game again; end of use case
UC 06 Player wins this level of the game.
1 Player navigates in the maze
2 Player arrives at final destination
3 System displays details of location, congratulatory banner, contents of inventory, names of foes conquered, and prompts user to play again
Assignment:
1) Create a flexible API for the Adventure game engine This API must address the creation of characters, the creation and behavior of weapons (including weapon enhancement) These aspects of the game are expected to vary wildly from designer to designer You must also address the process of the duel This process is expected to remain the same across all adventure games
2) When complete, use your API to create two simple adventure games with environments and characters of your choice These games should have mazes that contain 7-10 nodes as proof-of-concept
Notes:
1 Your adventure games must use console input and output
2 The maze portion of the engine has been given to another team that is creating a
“maze maker.” The mazes in your simple adventure games can be hard coded