This article is about another adventure game, Werewolves and Wanderer, from the famous book « Creating Adventure games on your computer » by Tim Hartnell.
Well, this game is old-fashioned and not that entertaining. Comments on IFDB are not very appealing. However, it has some historical interests. And to make it fun for the programmer, I’ve added some interesting features:
- A semigraphic introduction;
- A help function providing the vocabulary understood by the programme;
- And the most interesting part: a dynamic map.
As usual I’ve coded in Applesoft BASIC but it is really easy to convert the programme to other BASIC dialects.
Dynamic Map
So what exactly is a « dynamic map » ?
It is another help intented for the player, as it displays a map showing all the rooms he has already visited, but no other rooms. I had the idea to create such a map when I saw the Werewolves & Wanderer map on page 35.
I wanted to include this in the programme. I also thought that the player shouldn’t see the whole map from the beginning, but that it should be revealed progressively as he goes along. The map is displayed in text mode to make it easy to convert the programme to other BASIC dialects.
How does it work?
There is a subroutine from lines 20000 to 20300 that displays a single room. A room is defined by its physical outline (a shape representing the walls / doors / windows / openings surrounding the room), a main title and an optional secondary title. It has the following properties:
Floor | Floor number. Not used by the subroutine but can be helpful when you have several floors. | Integer | / |
XRoom, YRoom | Coordinates of the room. | Integer | XR%, YR% |
Border Description | Describes the outline of the room. See hereafter for more information. | String | SD$ |
DXtitle, DYtitle | Coordinates of the room title (relative to XRoom YRoom). | Integer | MX %,MY% |
Main Title | Main description of the room. | String | M1$ |
Secondary Title | Additional description of the room. If you don’t want to print out a secondary title set M2$="" | String | M2$ |
Current cursor position starts at XRoom, YRoom. Then string SD$
describing the room outline is analysed, using the following syntax:
Cx (x is a single character) | Character Change: sets x as the current character that will be printed. |
N | Sets current direction to North. |
S | Sets current direction to South. |
E | Sets current direction to East. |
W | Sets current direction to West. |
n (positive integer) | Moves toward current direction, printing the current character n times. |
Jn (J followed by a positive integer) | Jumps toward current direction n times, nothing is printed. |
For instance, if the room is square-shaped, with a 8-by-8 size and a limit marked by character #
, the border description is:
SD$="C#E7S7W7N7"
Please note that in order to set an 8-character width or height, you have to move the cursor 7 times only.
Now if you want to add a door marked by the character « -
» located at the south of the room:
SD$="C#E7S7W3C-2C#2N7"
Using this syntax you can draw rooms with complex shapes and several openings. To adjust the position of the room on the screen you have to set XR% YR%
properly.
In the programme map.bas
, rooms properties are stored from line 25001 to 25020. The programmes asks you which floor you want to display, and the « room » subroutine is called from line 210.
Source code
Here is the original « improved » version (refer to chapter 15 page 83):
And this is the programme for Apple II (Applesoft BASIC):
And finally the version with all improvements described in the previous section (semi-graphic introduction, help and dynamic map):
Screenshots
Help page | |
Dynamic map of ground floor | |
Game in progress |