This is the first couple lines of my new (will be) 8-bit co-op horror game. This is just the code for the first player text-based adventure storyline for the console game. Please critique.

//Andrew Tew
First EVER Co-Op Horror Game!

#include <iostream>
#include <string>
using namespace std;

int main()
//Declared Variables
string Answer;

//Title Screen and Custom Letter Output
system ("title Until Death We Part");
system ("color 0f");
system ("mode 1000");
cout << "\t\t\t\t\t\t'------------------------------'\n";
cout << "\t\t\t\t\t\t|------------------------------|\n";
cout << "\t\t\t\t\t\t|--------The first ever--------|\n";
cout << "\t\t\t\t\t\t|----8-bit Horror Game Co-Op---|\n";
cout << "\t\t\t\t\t\t|--------Survival Game---------|\n";
cout << "\t\t\t\t\t\t|--------By: Andrew Tew--------|\n";
cout << "\t\t\t\t\t\t|\"The Backstory/Text Adventure\"|\n";
cout << "\t\t\t\t\t\t|------------------------------|\n";
cout << "\t\t\t\t\t\t'------------------------------'\n";
cout << "\n\n\t\t\t\tPlay in Full Screen Mode/Maximized Mode for the Best Experience!\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";

/*End Start Screen

Begin Help Screen (Refrain from using Gotos)*/

system ("pause");
system ("cls");

cout << "\tHELP SCREEN:\n";
cout << "\t-----------\n\n\n";
cout << "\tAnswers:\n";
cout << "\tyes (ALWAYS LOWERCASE)\n";
cout << "\tno (ALWAYS LOWERCASE)\n\n";
cout << "\tWHO ARE YOU:\n";
cout << "\twhite\n";
cout << "\tblack\n";
cout << "\tasian\n";
cout << "\tlatino\n\n";
cout << "\tblond (male)\n";
cout << "\tblonde (female)\n";
cout << "\tbrown\n";
cout << "\tblack\n";
cout << "\twhite\n";
cout << "\tgray\n\n\n\n\n\n";
cout << "Cont. Next Page\n";

system ("pause");//Next Page Help Screen
system ("cls");

cout << "\tmale\n";
cout << "\tfemale\n";
cout << "\tit\n\n";
cout << "\tblue\n";
cout << "\tbrown\n";
cout << "\tgreen\n";
cout << "\tgray\n\n";
cout << "\tNames must contain at LEAST 3 letters.\n";
cout << "\tNames must contain at MOST 10 letters.\n";
cout << "\tNames must NOT contain spaces.\n\n\n\n\n\n";

system ("pause");
system ("cls");

cout << "\t\t\t\t\t\tTinyBit Games Presents to you:\n";
cout << "\n\t\t\t\t\t\t           Torn\n";
In the future code a "Load" Option and a "New Game" Option
Also code a "Save" option that can be done at any time
Remember this is a TEXT ADVENTURE not any other game

system ("pause");//Game Begins Here Still Refrain from goto statements
system ("cls");

cout << "\tIt's Dark... Pitch Black. A throbbing headache bursts into the front of your head.\n";
cout << "As you begin to get up from where you are you realize that you are bound by strong\n";
cout << "rope.\n\n";
cin >> Answer;
if (Answer == "wait"){
    cout << "You wait... the time is unknown\n\n";
}else {
    cout << "\n\n\nThat answer is not a usable answer in this situation\n\n\n";
    goto One; //I didn't know what else to use please critique!
cout << "\tYou hear footsteps faintly, distant but audible. They are getting louder and they\n";
cout << "suddenly stop. A door creaks open and you hear it touch a wall\n\n\n";

system ("pause");
return 0;
  • 1
    \$\begingroup\$ This is a little biased, but I'd highly recommend that you check out my library for creating text-based adventure games, Cactus. It's written in Python, but it shouldn't be to difficult to translate. \$\endgroup\$ Oct 10 '15 at 1:57
  • \$\begingroup\$ @EthanBierlein I downloaded your file, but I don't know how to install the python language and I'm not sure what translates to what and I am using Microsoft Visual Studio 2012. \$\endgroup\$
    – Andrew Tew
    Oct 10 '15 at 2:37
  • \$\begingroup\$ You need to add Cactus to your PYTHONPATH so it's importable. You can then either install Python 3.5 or the Python tools for Visual Studio. \$\endgroup\$ Oct 10 '15 at 2:39
  • \$\begingroup\$ If you're looking for a system other than C, you should know that players like well established systems over homebrew parsers. You should look into Inform 7. \$\endgroup\$ Oct 10 '15 at 3:13

I see you've ignored the advice from your previous question. To avoid duplication, I'm going to quote them:

From this answer:


At a first approximation, never use goto. It makes it more or less impossible to follow code. Without goto, you also don't need labels. Instead, just call different functions. Or keep an internal state machine. Or really any possible other solution. Code with goto like this is incredibly brittle - what if you want to add more states somewhere in between? Good luck keeping track of everything.

From this answer:

There many things here that can be improved. First off, let's tackle some best practices. Generally, doing stuff like this with system isn't very good:


To start off, system("pause"); is a bad way of "pausing" for user input. First off, there's a decently sized overhead just to execute a shell command, and doing this is rather insecure. If you really need to pause on user input, and ignore it, then just do something like this:


Secondly, putting anything like this at the top of your file is a bad idea:

using namespace std;

This pollutes your local namespace with everything in std, and it can lead to some name conflicts, especially if you're using a library like boost. There's a good reason it's named std and not standard. It's easier to prefix everything with std:: rather than standard::.

Now for some advice specific to this question:

First, all the newlines and tabs are quite noisy. You can consider putting it in a variable:

std::string tab(6, '\t');
std::cout << tab << "...";

Secondly, instead of your goto approach, it's more likely that you want a while loop instead. Some users insist that the while loop is a glorified goto, but without the negatives.

std::string answer;
while (std::cin >> answer)
    // ...
  • \$\begingroup\$ Thank you for this! The suggestion on creating a variable for tab was great! Could you please clarify the loop answer in a "cout" coding fashion? I'm not great with std:: etc. \$\endgroup\$
    – Andrew Tew
    Oct 10 '15 at 1:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.