Introduction: Text-Based Multi-Choice Adventure Game

About: Electronics Tech working with Automation/Instrumentation. I love to invent stuff and play with retro electronics.

Did you ever play those impossibly difficult text-based adventures back in the day?

"You find yourself in a dark room, there is a bed, a trumpet, and a can of oil. You are holding a watermelon. What should you do?"

Errrrm... *stuck*

Anyway, I was playing with a 240x64 pixel lcd display and an Arduino when I had a great Christmas gift idea. How about make a simple adventure game, but use multi-choice options instead of a keyboard. (You always had to get the text instruction phrases perfectly right!)

So that's what I did. The gift was really well received! I recently decided to make another and document the process so I could share it with everyone.

So, this instructable will show how to make a simple text adventure game, along with the arduino code.

I used a 240x64 lcd display which utilises the Toshiba T6963C chipset; quite a common display, however the code could be easily modified to use an alternative display.

Step 1: Gather Your Parts and Tools!

Ok, so we'll need the following parts for our adventure game:

  • Arduino Uno / Mini Pro 5v (or compatible)
  • Push buttons
  • Toggle switch (on/off)
  • Project box
  • 240x64 LCD display (T6963C chipset)
  • Wires including an old IDE ribbon
  • 20kΩ potentiometer or a selection of resistors
  • 4xAA Battery holder
  • Solder, glue etc
  • Coffee

Also we'll need the following tools:

  • Soldering iron
  • Drill & multi-tool (like a Dremel)
  • Glue gun
  • Other basic hand tools, screwdriver etc
  • USB2Serial interface if you use a Mini Pro

Additionally, we'll need the code for the game: See zip-file link at the bottom of this step.

For this adventure game I used a 5v Arduino mini pro, as they are so cheap. A standard Uno would do the job fine though, I built the prototype with one.
I bought some T6963C displays cheap from a manufacturer in China, you can get them in various colours.

Now that you've got everything you need, drink your coffee then move onto step 2.

Step 2: Cutting and Drilling

I used a project box I found in Maplin, it's a bit on the large side and would have preferred a shallower box, but it does the job.

I measured bezel on the LCD and used a pencil to mark where I should cut. If you want a perfect finish, then cut slightly too small and use a file until the display fits nicely. I found that the plastic melts very easily so take your time and don't set the tool to max speed!

The holes for the buttons are easy enough, I used the multi-tool again to drill pilot holes then used a regular drill with metal/plastic bits to make them larger.

I had to trim a little of the top corners of my display so that it would fit in this particular box.

You can fit your buttons and switch now if you like, and use the glue gun to stick your display in position.

Clean up all that mess and bits of plastic in the kitchen before the wife gets home!!

Now grab another coffee and move onto step 3.

Step 3: Soldering

If you're using the Arduino Pro Mini 5v, then solder a little header for the programmer.

The buttons; solder one leg of the buttons to ground. The other leg of the buttons as follows:

Button 1 : Arduino Pin 10
Button 2 : Arduino Pin 11
Button 3 : Arduino Pin 12
Button 4 : Arduino Pin A4

As you can see in the photos, I looped the ground wire across all of the buttons, then to the Arduino. I used a little piece of veroboard for the various ground connections just to make it tidy, but you could just solder them all together and tape it up.

Then the toggle switch; solder one leg to positive on the battery holder, and the other leg (or middle leg if it's an On-On switch) to the 'raw' pin on the Arduino Pro Mini. If you're using an Uno, then you'll have to make a little power adaptor.

On the back of the display, there is an interface header, 22 pins at 2.54mm pitch. I used an old 40-way IDE cable and just cut off the unused 18 wires of the ribbon as you can see in the pictures.

This is where you should connect up the pins from the display:

Display - Arduino

01 - Ground
02 - Ground
03 - 5v VCC
04 - Display pin 20 via resistor (see below)
05 - A0
06 - A1
07 - A2
08 - A3
09 - Not connected
10 - Reset
11 - 2
12 - 3
13 - 4
14 - 5
15 - 6
16 - 7
17 - 8
18 - 9
19 - 5v VCC
20 - Display pin 4 via resistor (see below)
21 - 5v (backlight)
22 - Ground (backlight)

Between display pins 4 and 20 you need to add a resistor to control the contrast of the LCD. Ideally a potentiometer could be used; I didn't have one to hand so I played about with a variety of resistors and finally used 10kΩ and 4.7kΩ resistors in series like you can see in the picture.

It's during this step that any mistakes are going to happen. Just double check each connection.

Time for a break. Get more coffee, and some chocolate too if you fancy a snack.

Step 4: Software and Finishing Up!

Download the Zip file from step one (if you haven't already).

In there you'll find two folders, "libraries" and "TextAdventure_T6963C"

Inside the libraries folder there is the library for the display, pop that in your Arduino libraries folder.

You can save "TextAdventure_T6963C" wherever you usually save your Arduino projects. When you open the project, you will notice that it contains two files, TextAdventure_T6963C.ino (the main program) and Strings.h (the text strings for the game).

Now you should be able to open your Arduino software and upload the code to your Arduino.

Whist programming/testing and playing with the code, it will all run from the programmer/usb power, so you can disconnect the batteries.

Assuming your soldering is all good and it works, you can glue/tape your Arduino into the case and tidy up the wires. I used double sided tape to stick the battery clip to box lid.

That's it. Hope you've enjoyed reading this Instructable, and if you decide to make one of these games, I hope you enjoy it!

The video here is of the game I gave my friend at Christmas, exactly the same but with a blue screen and added a Christmas message when it was turned on.

Possible Improvements:

With only 32k of flash and 2k of sram, I was pretty much at the limit of the Arduino Pro Mini. A few things could be done to remedy this:

Use an Arduino like the Zero (256k flash and 32k sram)
Use a raspberry Pi (overkill?)
Add an SD-card reader and store games on SD cards?

Make It Glow! Contest

Participated in the
Make It Glow! Contest

Epilog Contest VII

Participated in the
Epilog Contest VII