Learning Languages through Text Adventure Programming

Feb 9, 2016

I love a good text adventure. Some of the first games I played were early 8-bit texties. Like radio vs. television, the pictures were a lot better, even when they consisted of early vector-built forests as well as whatever my imagination could conjure up. When I started programming, the first thing I wrote was a text adventure, and to this day, I think that the best way to get to grips with a new computer language is to do exactly that.


You begin with a ‘Hello World’, then have to build a loop for the main game, and some keyboard handling to take input. The next thing to sort out is string handling, as you begin parsing commands. Simultaneously, you have to learn about the language’s data structures (and possibly object models) as you work to find a way to represent the game world.

Once that’s done, you have a broad sway of options - you could deal with data formats and file IO for saved games, or perhaps introduce a currency, even introduce AI for game characters.

Most importantly, a text adventure gives you the opportunity to quickly see a fun finished product in a new language - you rarely need to use any libraries, which can be a stumbling block with web applications and more complicated games, and the final thing doesn’t even need to be particularly complicated. Just a few locations and puzzles will do.

Recently, I’ve been learning Rust, and I want to learn more about the new features in PHP 7.0 - expect to see a couple of new text adventures posted here soon!