Text Based Adventure Games with Node.js2 min read

Coming from a fraternity of GTA and Age of Empires, text based games were a new twist to my gaming world. I was not aware that such a thing as a text based game existed till Sheldon Cooper introduced it (#geek). I Googled and found the emulator online and without much effort, I was hooked to it. I keep playing the game on and off when I get time. 4 years later, I realized why don’t I build one such on my own on Node.js and let the community build more text based games sharpening the imagination of the players.

So, here it is Command Line Interface Adventure Games Engine : cli-adventure-games.

Below is a quick demo of a game in action

Sweet right!

A special thanks to the awesome Anurag Jain for his contribution towards the Game Script JSON and continuous feedback during the initial Game Engine development. And also a big thanks to Jayesh Choudhari for his insights while developing the game engine and suggestions on lexical processing. It was a pleasure working with both of you!

In this post, I will walk you through the process of playing the game as well as how you can contribute by building your own text based adventure game.

So, let us get started.

I am a Game Player

Ah!! So you want play an adventure game. The steps to set up are pretty simple. Make sure you have node.js installed and run

[sudo] npm install -g cli-adventure-games

This will download the game engine and all the games with it. To play, execute


And bam!! The Game engine launches and you can pick from the list of adventure games.

Screen Shot 2014-12-06 at 12.11.34 pm

You will be presented with a set of instructions that you can use while playing the game

Screen Shot 2014-12-06 at 12.13.46 pm

Please do note that the engine is in active development and some of the options might differ from above.

Now you can give 2 word instructions, first word being a verb and second word a object like “go east” or “pick bottle”.

Screen Shot 2014-12-06 at 12.15.54 pm

You can also run the help commands at any point of time.

The game designer will share the intent of the game with you and you need act accordingly crossing all the obstacles and reach the finish.

The game encourages you to be creative and think out of the box to solve the mysteries presented. Have fun playing the game!!

PS : If you find any bugs, issues or suggestions, feel free to raise an issue.

I am a Game Designer

Okay, so you want to challenge the people around you by writing mystery games? You are at the right place. Before you get started off, you need to understand a couple of things on how the engine works.

As a game designer, you would need to develop a JSON file A.K.A. a Game Script. This JSON will consist of the script for your game. The game engine reads this JSON and will present with options to the player.

You can find a sample JSON here.

To design the game, first chalk out how you want the game to proceed. Start off by filling in the meta information

Each state of the game is represented by a room object. A room is typically a scene where thing happen.

All the rooms in the JSON have the above properties. This information will be read by the engine and will act accordingly. Most of the properties are self explanatory.

To exit the game, set  "isExitRoom" : "true" as one of the properties to the room object and the game engine will terminate.

This is pretty much all you need to get started off.

PS : If you find any bugs, issues or suggestions, feel free to raise an issue.

Hope this module encourages you to play/design text based game easily.

Thanks for reading! Do comment.