Programming Assignment 1: Adventure Game
Contents
Overview
In the early days of gaming, text-based adventure games were pretty typical. In many of the classics, like Zork (you can see some other examples here), the game begins with a description of your character's current surroundings in whatever fictional world the story takes place. Then you are prompted to do something by entering some free text. You aren't given any options; you have to wing it and type in something like "go south" or "pick up [object]" and see if the command is interpreted. Through these free-text commands, you can navigate through and interact with the world.
A more recent example is Stephen Colbert's Escape from the Man-Sized Cabinet [this is off-line now :( See this example instead: Display of Weakness]. This
version is more user friendly as it gives the player options of what to do next,
rather than force them to discover which commands will work.
The main gist of a text-based adventure game is that there is a story line consisting of a series of situations in which you can change the story's path—just like a choose-your-own-adventure book. While many of the old games used free-text to interact with the world, you will be providing a menu listing possible choices.
For this assignment, you'll create your own adventure game in which the player's character must navigate a world, deal with obstacles, fight off opponents, and make it to the end (whatever that might mean). You will need to come up with a theme and a plot. In the past, students have done SciFy themes (wizards, space, etc.), as well as current-day themes (one student did a mall shopping fighting game, where the main character has to battle it out with other shoppers for sales and haggle for prices). What you choose is up to you, as long as it's appropriate. I'll give you feedback on your first milestone so you know you're on the right track.
(Back to top)Specifications
Your completed submission must have at least the following components (you're welcome add additional features to the game!):
- an interesting, fun storyline that holds together well
- some way of winning (should display a "YOU WON!" message)
- some way of loosing (should display a "GAME OVER" message)
- some notion of the following player attributes (which should be given
reasonable starting values):
- first name (one word, prompt user for this)
- last initial (one character, prompt user for this)
- health level (whole number)
- alive/dead status (boolean)
- score (whole number)
- gold collected (or similar energy/power/money source, whole number)
- battles fought (whole number)
- battles won (whole number)
- fraction of battles won (decimal from 0 to 1)
- all player attributes should be printed in an easy to read format:
- at the start of the game
- after each scene
- at the end of the game
=========================================================================== Name: Hank F Health: 90 Alive: yes Score: 130 Gold: 5 Battles fought: 4 Battles won: 3 Win rate: 0.75 ===========================================================================
- at least three different scenes, each with a set of two or more options
that each affect at least two of the player's attributes; scenes can be
battling enemies, interacting with objects, picking up gold or other items,
etc.
Example event:You walk down the path through a dark forest. A goblin pops out from behind a tree! You have three options, which will it be? * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * (a) fight the goblin (b) turn and run (c) try and trick the goblin to let you pass * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Your choice: _
Example consequence: picking (a) causes the player to win a battle and win points, but lose 50% health, (b) causes the player to trip and fall to their death (loosing all health and dying), and (c) not only works but the player gets 50 gold coins the goblin handed over and an increase in points - if the player enters an invalid option, tell them so and then quit the game (we'll learn how to deal with this in PA2)
Extra credit
If you have programmed before an you feel that you'd like to try something more challenging, than try out one or more of the extra credit components below.
EC 1: Save game state (3pts on completed project)
Make it so that the player can save the game and exit, then pick back up right where they left off. You should use files to store the game state. The player should also be given the option to start a new game or load a game from the a specified file.
EC 2: Load scenes from a file (5pts on completed project)
Rather than hard-coding all of the scenes, write code that can load and process a file with all the scene descriptions, choices, and actions to take based on a choice. This is a pretty challenging task, but something that would be great for anyone who has a class or more of prior programming experience.
(Back to top)Milestones
Milestone 1: Design sketch
For this first milestone, you should submit a design for your program. For this,
you will use Twine, an open-source tool
for telling interactive stories. We'll go over in class how to use it.
You'll need to create a new store, then add one passage for each scene. The
first passage should include the theme and back story for your game. The others
should include the basic text for your scene (this can be rough right now). They
should also include choices for the player to make and links to other scenes (to
make a link, it looks like: [[
Publish your story to a file (it should have a .html extension) and uploaded it here. You can view the rubric here.
Milestone 2: Skeleton + Pseudo code
Pick one of your scenes with two choices. You will write a C++ program that will handle this scene and the two scenes it leads to (so three scenes total).
Create a well documented code skeleton. You should have a header at the top with all relevant information (see the Style Guidelines), comments above main explaining what it does, and pseudo code comments inside of main describing the steps in your program. For example, one chunk of pseudo code might look like this (this is incomplete!):
// Declare and initialize player stats variables. // Prompt player for their name and initial. // Print the back story of the game. ... // Print the description for the Lit Forrest scene: // You can see the two paths that lead from the the spot where you've been // working. The eastern path is long and winding, while the northern path // leads directly back to home. While longer, the eastern path avoids most // of the most dangerous parts of the forest. The norther path, on the // other hand, goes right through the heart of the worst part...but it's an // hour faster. // // Prompt the player to enter the two choices: // 1. take the longer but safer southern path // 2. take the shorter but riskier northern path // // Read the response in from the player (1 or 2) // // If the players's response is 1: // Increase the player's time score by 10 // Increase the player's exhaustion score by 10 // Print the player's stats // Print the description for the Southern Path scene ... // Otherwise, if the players's response is 2: // Decrease the player's time score by 10 // Decrease the player's health by 10 // Print the player's stats // Print the description for the Northern Path scene ...
Submit your .cpp file here. You can view the rubric here.
Milestone 3: Completed assignment
Complete your program in an incremental fashion. Ensure that it compiles and runs after each feature you add.
Submit your .cpp file here. You can view the rubric here (it's a different rubric from the previous milestones).
(Back to top)