Saturday, 4 January 2025

"Schatzoeken" or "Treasure Caves" by Unknown Author (198?)

Original Map Playthrough

I ran across a little BASIC CRPG on Jason Dyer's Renga in Blue blog. It was called "Schatzoeken" and was written in Dutch. Jason mentioned it because he was discussing a text adventure by the same name, which he needed to disambiguate as he did his research. His brief mention peaked my interest. The game was for the Sinclair ZX-81 and from the image of the simple semi-graphic "dungeon" screen, it looked like it should be able to be translated to TRS-80 MC-10 fairly easily. I've never had much problems with Sinclair BASIC, which is a good BASIC with some unique features that are fairly easy to work around. Translating to Dutch was made easy by Google translate. It rendered the title from the titlepage/instruction screen as "Treasure Caves".  However, Renga had mentioned that "Schatzoeken" is used in Dutch as something like "Treasure Hunt" and is even used more generically for things like "geocaching" in modern Dutch.

So the move from Sinclair to Microsoft BASIC and from English to Dutch was not too difficult.  However, once I had the game running I noticed that the movement between rooms seemed very odd.  It was extremely difficult to map, and there were all kinds of geographical incongruities. The first oddity was that it didn't matter which of the two differently numbered exits that you took from a room, you always ended up in the same room. But since the exits were numbered, it seemed like you should be able to get to different rooms depending on the numbered exit you selected.  A quick look at the code revealed an obvious cause of this behaviour:

800 REM ROOM CHANGEOVER 

805 CLS

810 LR=PR:IF PR<>21 THEN 815

813 PR=R3:REM INT(RND(0)*19+1)

814 GOTO 825

815 IF N=0 THEN PR=R1

820 IF N=15 THEN PR=R1

The N variable in the above is the Y coordinate of your player location.  0 is the top of the screen where one exit is, and 15 is at the bottom where the other exit is.  Clearly the assignment of PR (present room) needed to be set to different variables depending on which location you exited from.  It seemed obvious that R1 should be for the top and R2 should be for the bottom exit, so I changed those lines to the following:

815 IF N=0 THEN PR=R1
820 IF N=15 THEN PR=R2

This at least made it possible to go to different rooms, but there was still weirdness (see the video at the top of this post). The following spreadsheet shows how the map looked once I could travel in multiple directions and explore a little easier. I also added some test code to turn off the monsters, so I could explore in peace. Doing that made it fairly obvious that the map wasn't a random dungeon, but instead more like a cross, with the "Entrance hall" (Room 0) at the centre. This made sense of the start screen, which prompted you to choose a starting direction/room (1-4). The weird thing was that you could choose start room, 4 for example, but once you did the "exits" for that room would not allow you to go back to room 0 and on to another beyond (down the line), but instead to go sideways to room 3 or on to room 8. This "offset" return direction was echoed for all rooms.

There was also a kind of "tear" in this offset pattern at room 14/15 on the room 3 line, which clearly took you to room 14 that was also a part of the room 4 line. The whole thing was just very confusing.  The physical layout of the rooms with two entrances seemed to indicate that the original programmer wanted to have a cross-shaped dungeon.  Another thing that indicated this was that the game expects you to regularly return to Room 0 to cache your treasure. You can't carry more than 50 points worth at any time, but if you cache it in room 0 you can go back to get more to add to your score. The original map, also seemed to be missing room 15 and 18. If you could get to room 21 you could find a large hoard of treasure, although the treasure carrying limit still applied.  You would then have to navigate back from whichever random room you were sent to after exiting that room (see line 813 above).



Repeated rooms in red

So I examined the string containing the data for the map, which consisted of 3 characters per room.  Two of those characters obviously were meant to symbolize the two rooms that the exits would take you to. There was a special condition where the third character would be substituted for those two exit room numbers:

960 IF R1=LR THEN R1=R3

965 IF R2=LR THEN R2=R3

It seemed obvious that LR meant something like "last room" or "room just left."  But from the data it seemed clear that the numbers being assigned to the 3 characters were out of sink in terms of the pattern being broken at around 14 and 15 in the original map above, and also there was some confusion between the 2nd and 3rd character (R2 and R3).  The IF statements above seemed to be some kind of kluge to fix that confusion. Once I had fixed the break in the data pattern at 14/15, the cross-structure came into better focus. Now you could travel back and fourth on each of the 4 lines of the dungeon.  But there was a sill a problem at the end of each line.

It seemed that the bounty of the special treasure of room 21 was meant to lure the adventurer down each line. As you travel down a line, if you fail to get the single treasure in each room it disappears not to be seen when you return back along the line. This was a normal function of the existing movement routine. It seemed to be an incentive for making regular returns to the Room 0 to cache treasure, and then make new forays to reach the (randomly) large treasure at then end. In the existing rooms routine, you would then be sent to a random location if you managed to escape via the single exit at top of room 21. Once again this seemed geographically confusing. It seemed to me that the R3 value might have been added to each room so that for the last 4 rooms before the treasure room an extra coordinate could be stored to allow the player to return to that specific line after leaving its treasure room. So I changed the data to allow the program to do that instead.

Now, you can play for the max score possible by carefully exploring each line. If you get the single treasure from each of the total of 20 rooms (5 per line) and whatever treasure you can get from returning to the treasure rooms as many times as possible, while making arduous return journeys through the cleared rooms along the line.

New Map Playthrough

Because the MC-10 is so much faster than the ZX-81 I also had to change another feature of the navigation in the game. In the original, the monsters tracked slowly and you had to use the ZX-81's awkward 4567 keys for movement. But because things were so slow the walls kill you instantly if you carelessly run into them. But this game dynamic was impossible to deal with on the speedier MC-10 version. So I just changed the walls to be solid barriers. Also, the monsters normally would just transit right through interior walls. But since they move so much faster, I made it that they couldn't move though the solid block characters of those walls. However, they can still transit through the partial block characters of the "craggy" bits of the walls.  This means you must navigate in ways that take into account the possibilities of the monsters being blocked, while trying to recognize and discount those parts of walls that will not hold them. But even with these changes, I found the monsters were too quick, so I added a level system at the beginning of the game that decreases their speed for the lower levels.

I'm not sure if I have destroyed some unique vision of the original programmer in terms of the "map" and game play, or whether I have fixed some annoying coding knot in the mapping that they simply couldn't fix. They might have got the game to the point where it kind of worked, and allowed enough of "a maze" for adventuring, and then simply have called it a day.  Back in the day, especially on a dangerously unreliable machine like the ZX-81 (long cassette loading, ram pack wobble) and with its horrible keyboard and awkward editing features, I imagine that the programmer might have felt more fixing simply wasn't worth the trouble or risk.

But it is a neat little CRPG, which I hope my tweaks have helped to nudge more towards its original intriguing vision. There were a couple of Youtube walkthrough videos that showed that others had also been intrigued by the unique aesthetic of its dungeon map. However, neither of those walkthoughs went very far.  For example, the following player didn't seem to notice that there is an ability to fire arrows to kill monsters and didn't stick at the game long enough to make it to a treasure room.

Walkthrough

My final edits involved adding to the instruction screen to give a description of the keys used for movement and firing. I also changed the movement keys to the more standard WASD pattern that modern players are used to and added a high score readout. I hope these changes will encourage people to try out this unique type-in game. I'd also like to say "classic game," but there is no date mentioned on archive sites, so it is possible it is not from the early 1980s. However, from the limitations that seem to have been at work in discouraging bug chasing in the code, I strongly suspect that it is. If anyone knows anything about its programmer or timing, please let me know.
New Instructions

Here is the source code for the original game:


Here is a link to my updated code: