An image of the adventuron text adventure editor & game preview panel

Video Tutorial — Create A Text Adventure Game In 30 Minutes

Chris Ainsley
5 min readJul 28, 2019

A text adventure game is a game in which a scenario (or story) is presented to the player in the form of text, and the player interacts with the scenario (or story) by using issuing textual commands (usually via keyboard).

After following the video (approx 30 minutes) below, you should be able to rapidly prototype and build text adventures of your own in the browser, using the code completion features of Adventuron.

Note — the “game” in question in this tutorial is a tiny game — designed for tutorial purposes only.

You can play the “game” created using this tutorial here, if you want to see the end goods first.

Source is available lower in this blog post.

This particular video assumes a familiarity with keyboard shortcuts, and moves quickly so will not be suitable for very young children. Coders should have no trouble following the tutorial, but if you are a non-coder, mileage may vary.

An image of a text adventure, showing a path through a forest leading to a cave opening

Source Code

start_at                 = lakeside

loading_screen = loading_screen

game_information {
game_name = The Cave of Magic
game_shortname = Magic Cave
written_by = Chris Ainsley
year = 2019
short_synopsis = Find the treasure
game_version = 1.0.0
}

locations {
forest : location "You are on the forest path.\nTall <TREES<4>> tower over you on both sides." ;
outside_cave : location "You are standing outside <THE CAVE OF MAGIC<5>>" ;
inside_cave : location "You are inside <THE CAVE OF MAGIC<5>>" ;
lakeside : location "You are by the side of a <BEAUTIFUL LAKE<2>>." ;
}
objects {
troll : scenery "an enormous troll" start_at = "outside_cave" ;
sleeping_troll : scenery "an enormous troll (sleeping)" ;
apple : object "an apple" ;
treasure : object "a pile of treasure" start_at = "inside_cave" ;
}
connections {
from, direction, to = [
lakeside, north, forest,
forest, north, outside_cave,
outside_cave, north, inside_cave,
]
}
on_startup {

: print_graphic "outside_cave" ;

: print "^c^THE MAGIC CAVE AWAITS YOU" ;
: beep millis = "100" pitch = "0" ;
: beep millis = "100" pitch = "2" ;
: beep millis = "100" pitch = "4" ;
: beep millis = "100" pitch = "6" ;

: press_any_key ;
: beep millis = "100" pitch = "6" ;
: beep millis = "100" pitch = "4" ;
: beep millis = "100" pitch = "2" ;
: beep millis = "100" pitch = "0" ;
}
on_command {
: match "pick apple;get apple" {
: if (is_at "forest" && has_not_created "apple") {
: create "apple" ;
: redescribe;
}
}
: match "examine trees" {
: if (is_at "forest") {
: print "Apple trees." ;
}
}
: match "examine troll;talk troll" {
: print "<\"I'm so hungry\"<3>>, says the enormous TROLL in the deepest possible voice." ;
}
: match "give apple" {
: if (is_present "troll" && is_carried "apple") {
: print "The troll grabs the apple from you hungrily. Unfortunately (for the troll), the apple is an <ENCHANTED APPLE<12>>, and sends the troll directly to sleep." ;
: destroy "apple" ;
: swap o1 = "troll" o2 = "sleeping_troll" ;
: press_any_key ;
: redescribe;
}
}

: match "eat apple" {
: if (is_present "apple") {
: print "Unfortunately, the apple was an <ENCHANTED APPLE<12>>, and you will now go to sleep - forever." ;
: print "^r^<GAME OVER<2>>" ;
: end_game ;
}
}

}

######################################
# On Describe #
######################################

on_describe {

: if (is_present "troll") {
: beep millis = "100" pitch = "-2" ;
: beep millis = "100" pitch = "-4" ;
: beep millis = "300" pitch = "-8" ;
: print "The troll says, <\"THE CAVE IS MINE, GO AWAY\"<2>>." ;
}

}

on_tick {
: if (is_at "inside_cave" ) {
: beep millis = "200" pitch = "0" ;
: beep millis = "400" pitch = "10" ;
: print "^r^CONGRATULATIONS !" ;
: print "^r^YOU WON THE GAME !" ;
: print "^r^YOUR RANKING IS : JUNIOR ADVENTURER !" ;
: press_any_key ;
: clear_screen;
: print_graphic "logo" ;

: print "This tiny adventure was written using Adventuron." ;
: print "Adventuron is a free text adventure creation language and development system." ;
: print "Visit the website, and make a world of your own." ;
: print "^r^<www.adventuron.io<12>>" ;
: end_game ;
}
}

barriers {
block_cave : block {
location = inside_cave
message = THE TROLL IS GUARDING THE CAVE.
block_when_exists = troll
show_blocked_exit = true
}
}
// Base 64 Graphics omitted for brevity ...
// Full source including base 64 encoded graphics available here .... https://adventuron.blogspot.com/2019/07/video-tutorial-beginners-guide-to.html
An image of a text adventure game, showing a location that describes a beautiful lake and an exit to the north.

All Major OSs Supported

An image of THE CAVE OF MAGIC running on an Android mobile phone

After creating a game with Adventuron, it is simple to export the game as a standalone HTML file, which will then run on mobile, tablet, and desktop class devices.

Playable on Classic Hardware (48 Kilobytes, 3.5Mhz)

Simple games written in Adventuron can be (tool assisted) ported to older text adventure engines, the first of which is PAW, allowing games written with Adventuron to run on ZX Spectrum computer hardware from 1982, a computer with just 48 kilobytes of memory, and a Z80 CPU clocked at just 3.5Mhz.

A guide for achieving this is here.

The results of the conversion tool is found on the itch page in the downloads section.

An image of the ZX Spectrum port of THE CAVE OF MAGIC (ported from Adventuron to PAW source code via tooling)
Cave of Magic — ZX Spectrum 48K Edition (Font by Damien Guard)

Links

--

--