(Redirected from Text Adventures)
A text adventure is a special type of game which generally has no visual graphics other than text. This tutorial will explain what they are, and how to make one on Scratch.
What is a Text Adventure?
A text adventure is a program where one would type in text to do an action in the game world. They date back to when some of the first ever video games were produced. There are many classic text adventures out there, but they are generally old and incompatible with most computers. However, newer text adventures do exist, some of them on the Scratch website.
Text adventures work by explaining what actions the player can execute, and describe the appearance of objects and locations with text. However, some text adventures do allow the user to visualize their surroundings in the form of images and text. Although it is slightly more complicated to program, it is most certainly possible to create with Scratch.
Making a Text Adventure
What One Will Need to Know
|Note:||At the time this article was published, there were no exact scripts given. Lots of scripts were left for the user to figure out. It is recommended that the coder uses lots of custom blocks.|
Before starting any game, one needs to know what it is going to look like, and what it is going to do. For a text adventure, the following are needed:
- A text engine (also known as a text rendering engine, a tutorial for making one can be found here)
- A logic engine (the brain of the system, the main controller)
- An interface (usually involving the "ask" and "answer" blocks)
- Advanced experience with Scratch (advanced Scratch programming skills may be required)
Piecing Things Together
First off, one will need to make the interface. The interface needs to be able to:
- Prompt the user for text
- Send the text to the brain (the logic engine)
- Wait until the information has been processed, then repeat
An "ask" block will do the trick for the prompt. A forever block connected to a hat block, such as the "flag clicked" hat block, will do the trick. The "answer" block will be required in order to receive the user's input. The input will then have to be sent to the brain.
Now, for the logic engine, or the brain of the system. The brain needs to be able to:
- Split the input into separate words.
- Compare the words with "if else" statements
- Execute the user's command
- Signal back to the interface
This is the hardest part of the text adventure. An enormous amount of "if else" arguments will be required. A user will also need plenty of variables and lists too. When the execution has been made, one needs to tell the text engine to refresh.
The text engine needs to:
- Clear the screen
- Read the input
- Write down the input
Probably the easiest part, but still, quite complicated.
Unfortunately, it would take a very long time to explain how to make every script in this type of project, so this article will not.