DUNGEON

by Alan Davis

from ZX Computing Apr/May.1985



A full adventure specially written for ZXC by Alan Davis,

author of Temptation Software's "The Journey".





Anyone familiar with that marvellous program "The Hobbit"

will be aware of the features that set it apart from

traditional adventure games. Even setting aside the

graphics, and the fact that it is based upon a masterpiece

of imaginative fiction, one finds a curious vitality in the

game due to the independence of the characters in it, and

one's ability to communicate with them. "Dungeon" is an

attempt to introduce (in a limited way) independent action

into a short text adventure. The game is written entirely in

BASIC, but in practice has a fairly respectable response

time - largely because the vocabulary is fairly small, but

also because the most commonly used subroutines are placed

early in the program. The most important of these are

described below.



Movement routine (Lines 200-290). Permitted moves are stored

in the array r(13,6) - 13 locations, and 6 possible

directions of movement. Lines 205 to 230 check the

legitimacy of a move and execute it. The following lines

print the description of the new location, any visible

objects, and the new set of permitted movements.



Decode input routine (lines 500-540). This decodes the input

string z$ into a maximum of four separate words and stores

these as the strings a$, b$, c$, and d$. Four word decoding

is necessary for instructions such as "tell jailer drop

spoon", or "give spoon to jailer".



Main input routine (lines 100-190). The input is tested

against the program's vocabulary. Note that the vocabulary

is listed in data statements: verbs at line 25, portable

objects at line 30, characters at line 35, and non- portable

objects at line 40. a$ is tested against the verbs; and b$

against the nouns, and the appropriate subroutine called for

that verb (line 160). If a$ = "tell", and b$ corresponds to

a character present at that location, then the strings c$

and d$ are called and the test procedure repeated on the

character's behalf.



Independent action routine (lines 700-900). Lines 700 to 722

select a character at random and check to determine whether

he is in the present location. (This is in fact done twice

in order to make action more likely.) The following lines

then select the appropriate action, governed mostly by the

RND function, but also in some cases by the charm of the

player, or the strength of the character.



Charm and strength. The player's strength is registered in

the variable t, and the strength of the 3 characters in the

array t(3). His charm varies from one character to another,

and is held in the array k(3). Note the effect of this on

the likelihood of a character co-operating with the player

(line 330, called at line 1117).





The game



You may tell the characters to do anything you can do,

except move between locations. The hobbit will in any case

tend to follow you around, once released. The jailer moves

of his own accord between the dungeons and the guardroom.

There are a number of ways of increasing a character's

affection for you - you could, for example, give him

something he wants. The response of the character (or lack

of it!) to your actions will usually indicate whether you're

on the right track. Combat is inadvisable unless your

strength is high and/or you are properly equipped. Most of

the objects that turn up are useful. Assuming that you don't

cheat by reading the listing too carefully, you may require

clues. These may be had by typing "help" - most of the hints

are helpful ...



Finally - there is no single solution to the game, since the

behaviour of the other characters may either help or hinder

you at any time. This can become rather frustrating ...





--

Another Fine Product transcribed by:

Jim Grimwood (jimg@globalnet.co.uk), Weardale, England

--

