Computers can be used for different uses, we can use computers for playing games. By hearing the word game we start thinking about great animation and graphics but there is a category of games “text-based games” in which we only use text. Text-based games are fun. In this article we are going to discuss them and how to create them. I am assuming that you have some knowledge of programming. We will be using C++ for programming in this article.
Ideas
Before creating the game we need ideas for the game. Idea is the first step towards the creation of the game. The game should be enjoyable and somehow unique. You can create your own story for the game just imagine and write down your story.
You can tell your story in two ways. First is unfolding at once and the second is unfolding it while you create.
All at once. Write your story then reveal it in a linear or parallel way in your game.
While you create. In this method you let your imagination flow as fire while you write your story bit by bit.
Choosing the method for telling the story is completely your call. In text-based games we have to make the player interact with the game. Start with the simple question or a simple sentence. Remember not to throw random sentences since it will make the player uncomfortable.
Step 1 Taking Text Input
In this step we have to take the input from the player. We have to interact and take input from the user so many times in this game. So it is important to learn how to do that. For example in a game, you are asking the player for his/her name and then you will be returning the name.
#include <iostream>
#include <conio.h>
#include <stdlib.h>
using namespace std;
int main()
{
char name[50];
cout << "What is your name, warrior?" << endl;
cin.getline(name, 50);
cout << "You better move fast, " << name << ". The goblins are attacking the city." << endl;
cout << "\n----------------------Press any key to continue----------------------" << endl;
_getch();
return 0;
}
Top comments (0)