Text based Adventure Game

 

Summary:

A text based Adventure game written in C++ that I created as part of a semester long project in my Programming languages class.

 

Quick Notes:

  • Developed in C++
  • A simple Text based adventure game designed to work around a lack of graphics
  • Main focus was on building the engine and learning C++ at the same time

 

Download Link:

 

Personal Growth:

In my programming languages class, we were supposed to study one language in depth. Since C++ is preventative in the game industry, I chose it as my language. We also needed to do a semester long project. I wanted to do something game related to add things to my portfolio of work. Since C++ does not have much native support for graphics, and having to work with third party libraries for graphics would add more headaches and hassle to the already extensive task of learning the language, I decide on something text based, a simple text-based adventure game. This was the first major game I did that I build from the ground up and it helped me to get a good insight into the low level structure of games, such as the basic loop of gameplay. These simple base things are handled already when using an engine and this let me examine and implement that low level functionality. It also taught me C++ and some of its interesting nuances, such as its lack of garbage collection, a lack of initializer lists (until recently), and its use of pointer and reliance on the programmer to understand pointer intricately to avoid pointer errors like dangling pointers. My focus was manly on getting the engine done and, although any content can be added to it, it is tedious to do so and thus the adventure part did not get finished during the semester. The engine however is done.

This was an extensive project and one that served to show me how tenacious and dedicated developers need to be in order to get things done. This let go go thorugh the motions of building a game in a basic language from start to finish and was en excellent learning experience.

 

Features:

  • Text based game, programmed in C++ from the ground up and focusing on the engine
  • Test parser that takes in user input
  • Expandable and able to programmed with any adventure

 

Code Samples:

The main loop of the program: It gets user input, breaks it into a a verb value and some objects to act on, then decodes the value to call a function which then handles the result using the objects, usually by calling a function in the object or by calling special functions to handle corner cases SelectShow
String parsing functions: The parser attempts to divide the input into key sections based on words it recognizes and assuming that the first word defines a verb and the following words correspond to either garbage or objects in the game world SelectShow
In-game Object hierarchy: The structure of all intractable objects in the game world. Each has its own function for each type of interaction and handles the response and affect of an action on it itself. SelectShow