When talking about making higher-level applications like games and business applications, what's more important than the programming language is some concept of how you're going to organize and arrange your data, and more specifically how you're going to model the "world" in which your program will work.
For example, if you're writing PowerPoint, your "world" consists of slides, and the objects that appear on each slide. If you're writing iTunes, your world is a list of media files. If you're writing an e-commerce system, your world consists of lists of products and customer accounts.
In the case of an adventure game, we really mean "world" in the literal sense!
So let's start by looking at some of the basic requirements of a text adventure game like the old Zork games or MUD/MOO type games that used to occupy so much of my time. Well, at its heart, the world consists of rooms. You start in one room, and you can move in the cardinal compass directions, north, east, south, west, up, down. Each move, if one is possible, leads you to another room.
Your game, once complete, will consist of hundreds or thousands of possible rooms, each interconnecting with other rooms. Each room will have its own name and description.
Before you even think about what programming language you're going to use (be it Python, Java, C++, whatever) you need to think about how your data is going to be stored.
You might recognize that "items of data connected to other items of data" sounds like a tree structure or a multiply-linked list. Each room (and its description) could be a node in the tree or list, and the links between nodes represents the available pathways between the rooms.
So now you have a starting point. You can decide to model your world like this, with each node (a room) having the following information:
- The room ID number (as you give this some thought, you realize that every room is going to have to have one)
- The room title ("A Dark Cave")
- The room description ("You step into a dark cave. Boy, it's sure dark!")
- The ID number of the room to the north (if any)
- The ID number of the room to the south (if any)
- The ID number of the room to the east (if any)
- The ID number of the room to the west (if any)
So now you start to design the data structures. Next you will want to ask, what do I DO with those data structures? This will be the game "engine", which is essentially:
Print the description of the current room.
Get instructions from the user.
Process those instructions.
If the instructions are movement, go to the room the user requested (if possible).
If the instructions can't be followed, print an error message.
Repeat these steps until the game is over!
You will eventually add more, such as fighting characters, processing items in inventory, and so on. But this is the starting point.