Bwa-hahahaha!
Specials in the game (i.e. "Something special is near") include:
- preset encounters (e.g. 69 Wights)
- Anti-magic zones
- Smoke in your eyes!
- Spinner
- Hitpoint leech
- Magic point regeneration
- Teleport to X, Y (on level "Z" for that matter)...
- Custom specials, a la messages on the wall, magic mouth, input, and so on.
Specials can probably be daisy-chained such as having a Magic Mouth ask the party what 5 times 8 is, and then if they answer "40" they teleport to X, Y; if they don't answer "40" they take 500 damage each or whatever.
I guess this answers why there's some specials in the game that don't do anything; the flag is set but there's nothing there.
- preset encounters (e.g. 69 Wights)
- Anti-magic zones
- Smoke in your eyes!
- Spinner
- Hitpoint leech
- Magic point regeneration
- Teleport to X, Y (on level "Z" for that matter)...
- Custom specials, a la messages on the wall, magic mouth, input, and so on.
Specials can probably be daisy-chained such as having a Magic Mouth ask the party what 5 times 8 is, and then if they answer "40" they teleport to X, Y; if they don't answer "40" they take 500 damage each or whatever.
I guess this answers why there's some specials in the game that don't do anything; the flag is set but there's nothing there.
That's more good work.Darendor wrote:Specials in the game (i.e. "Something special is near") include:
- preset encounters (e.g. 69 Wights)
- Anti-magic zones
- Smoke in your eyes!
- Spinner
- Hitpoint leech
- Magic point regeneration
- Teleport to X, Y (on level "Z" for that matter)...
- Custom specials, a la messages on the wall, magic mouth, input, and so on.
There's got to be a combination of "pointers", or indexes somewhere following the map data that explains which special is where on the map. I suggest we start by investigating the simplest of specials, the messages. The Legions of Baron Harkyn is a really complicated special (as you pointed out); studying it is worthwhile, but it might add too many variables to the analysis. We'll be in a better position to figure out that special if we can understand how the simple messages work.
I'm convinced that there's some basic code for handling the most common specials (teleports, spinners, anti-magic, etc.) but that it's set up so that that any arbitrary code can be run from any special. This way, he can dream up anything that the game's model world can support. It also allows him to make coding mistakes, like the Mystery Square.Specials can probably be daisy-chained such as having a Magic Mouth ask the party what 5 times 8 is, and then if they answer "40" they teleport to X, Y; if they don't answer "40" they take 500 damage each or whatever.
I guess this answers why there's some specials in the game that don't do anything; the flag is set but there's nothing there.
Incidentally, I think the map data settles the debate about whether or not there's a "ghost" level 4b in Mangar's tower. There doesn't have to be, because in order to change all the doors to walls, and vice-versa, all that has to happen is that the game loops through those 484 bytes, and twiddles the bits in memory.
The only thing that I haven't figure out is how he managed to code it so that secret doors become nothing. The most obvious implementation (swapping the 2 bits for each direction), leaves secret doors unchanged. MC obviously over-thought this one.

Last edited by Horpner on Wed Jan 28, 2009 2:04 pm, edited 1 time in total.
Death and drek? WTF?
No, they seem to wander everywhere. But when bit 7 is set, you'll definitely have an encounter when you step on that tile for the first time. In this way, MC can make certain areas more dangerous than others. He can also indulge his fetish for getting attacked after you kick in a door.Darendor wrote:Bit 7 indicates whether a random encounter appears? You mean we can make it so monsters only wander in certain areas?

Last edited by Horpner on Wed Jan 28, 2009 2:05 pm, edited 1 time in total.
Death and drek? WTF?
Well maybe we should focus on the Wine Cellar again and examine the square at 1N, 1E.
My examination of the three game disks didn't reveal this (or any other "special") text strings so they must be called using the $FFD2 command somehow.
Watch this space.
SPECIAL LAYOUT MEMORY LOCATION: $fa00 - $fbe3 [WINE CELLAR]
- At 0N, 0E ($fa00) hex value 01 (00000001) is set, meaning stairs up (i.e. back to Skara Brae); there has to be a flag indicating dungeon direction (i.e. whether up or down means advancing further into the dungeon)...
- At 1N, 1E ($fa17) hex value 04 (00001000) is set, meaning a "special" is here. In this case, it's the "welcome to the jungle message".
- At 3N, 15E ($fa51) hex value 80 (1000000) is set, meaning a 'random' encounter is here. It's behind a door.
- At 3N, 17E ($fa53), same as previous.
- At 5N, 2E ($fa70), same as previous.
- At 7N, 15E ($faa9), same as previous.
- At 8N, 2E ($fab2), same as previous.
- At 8N, 3E ($fab3), same as previous.
- At 10N, 18E ($faee), hex value 04 (00001000) is set, meaning a "special" is here. This is the text message reading "Rare wines - 50 years and older. Keep out!"
- At 11N, 10E ($fafb), hex value 04 (00001000) is set, meaning a "special" is here. This is the spinner in the dead centre of the map.
- At 12N, 17E ($fb19), hex value 04 (00001000) is set, meaning a "special" is here. This is the text message reading "Fine wines - 10 years and older. For regular customers only."
- At 13N, 17E ($fb2f), hex value 80 (10000000) is set, meaning a 'random' encounter is here. It's behind the door.
- At 16N, 7E ($fb67), same as previous.
- At 16N, 16E ($fb70), hex value 10 (00010000) is set, meaning a trap is here.
- At 18N, 2E ($fb8e), hex value 80 (10000000) is set, meaning a 'random' encounter is here. It's behind the door.
- At 18N, 3E ($fb8f), same as previous.
- At 18N, 7E ($fb93), hex value 02 (00000010) is set, meaning stairs down (i.e. to level 2).
So there you have it, a total of 17 "specials" in the Wine Cellar. Where do we go from here?
Code: Select all
This is the wine cellar of the Scarlet Bard. The air is musty with old wine.
Watch this space.
SPECIAL LAYOUT MEMORY LOCATION: $fa00 - $fbe3 [WINE CELLAR]
Code: Select all
$fa00: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04
$fa18: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
$fa30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
$fa48: 00 00 00 00 00 00 00 00 00 80 00 80 00 00 00 00 00 00 00 00 00 00 00 00
$fa60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 00 00 00 00 00
$fa78: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
$fa90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
$faa8: 00 80 00 00 00 00 00 00 00 00 80 80 00 00 00 00 00 00 00 00 00 00 00 00
$fac0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
$fad8: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 00
$faf0: 00 00 00 00 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00
$fb08: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00
$fb20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 00 00 00 00 00 00
$fb38: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
$fb50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80
$fb68: 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
$fb80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 80 00 00 00 02 00 00 00 00
$fb98: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
$fbb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
$fbc8: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
$fbe0: 00 00 00 00
- At 1N, 1E ($fa17) hex value 04 (00001000) is set, meaning a "special" is here. In this case, it's the "welcome to the jungle message".
- At 3N, 15E ($fa51) hex value 80 (1000000) is set, meaning a 'random' encounter is here. It's behind a door.
- At 3N, 17E ($fa53), same as previous.
- At 5N, 2E ($fa70), same as previous.
- At 7N, 15E ($faa9), same as previous.
- At 8N, 2E ($fab2), same as previous.
- At 8N, 3E ($fab3), same as previous.
- At 10N, 18E ($faee), hex value 04 (00001000) is set, meaning a "special" is here. This is the text message reading "Rare wines - 50 years and older. Keep out!"
- At 11N, 10E ($fafb), hex value 04 (00001000) is set, meaning a "special" is here. This is the spinner in the dead centre of the map.
- At 12N, 17E ($fb19), hex value 04 (00001000) is set, meaning a "special" is here. This is the text message reading "Fine wines - 10 years and older. For regular customers only."
- At 13N, 17E ($fb2f), hex value 80 (10000000) is set, meaning a 'random' encounter is here. It's behind the door.
- At 16N, 7E ($fb67), same as previous.
- At 16N, 16E ($fb70), hex value 10 (00010000) is set, meaning a trap is here.
- At 18N, 2E ($fb8e), hex value 80 (10000000) is set, meaning a 'random' encounter is here. It's behind the door.
- At 18N, 3E ($fb8f), same as previous.
- At 18N, 7E ($fb93), hex value 02 (00000010) is set, meaning stairs down (i.e. to level 2).
So there you have it, a total of 17 "specials" in the Wine Cellar. Where do we go from here?
Last edited by Darendor on Wed Jan 28, 2009 3:13 pm, edited 2 times in total.
My Python map-drawing program has been updated to include the special features data, and to avoid putting '+' plusses in the middle of nowhere. Unfortunately, that small enhancement has complicated the program quite a bit.
However, the data structure used is now very similar to the one used in the actual game, i.e., an array of 484 tile objects (granted, MC used parallel arrays to implement tile objects, which I didn't bother to do).
Here's The Sewers, level 2, as interpreted by a computer program:
Provision for one-way features is coming next.
However, the data structure used is now very similar to the one used in the actual game, i.e., an array of 484 tile objects (granted, MC used parallel arrays to implement tile objects, which I didn't bother to do).
Here's The Sewers, level 2, as interpreted by a computer program:
Code: Select all
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
+--+--+--+--+--+--+--+--+--+--+--+--+ +--+--+--+--+--+--+--+--+--+
21 |// // // //#. []|// //| |. | | #S | #S.| | | 21
+ +--+--+ + +ss+ + +##+ + +--+ +--+ +##+ +
20 |// X/ // // // // // //| | |. | | | | | 20
+--+ +--+ +--+ +--+ + +--+ +--+ +--+--+ +
19 sS |// // // // // X/ //#. | | | | s 19
+--+ +--+--+--+--+--+--+ +--+ +--+--+--+ + +--+--+ +--+
18 |// // // //| | | | | | | | | | 18
+ + + + +##+ +ss+ +--+ +--+--+ +--+ + +--+ +--+
17 |// // // //| | | | | | |. #. | | | | | 17
+ +--+ +--+ + +--+--+ +--+ + +--+##+--+ +--+ +--+--+ + +
16 |./s |//| | | | | | | |S | 16
+--+ + + +--+--+ +--+ +--+--+--+ +--+ +--+--+--+--+##+ +##+
15 | |//| | | | | | | | | |. | | 15
+ +--+ + + +--+ + + +--+ + +--+ss+ + +--+ +--+ +--+
14 | S | | | | #S | | | | | |^ | | | 14
+ +--+ +##+ +##+--+ + +--+ + +--+ + +--+ +--+ +--+ +
13 | | | | |S | | | | | | | | #S | 13
+ +--+ + +--+ +--+ +--+--+--+ + +--+ +--+--+--+ + +--+--+
12 |. # | | |. #S.| | | # | | 12
+##+--+ +--+ +--+ + +--+##+--+--+--+--+ +--+ +--+ + +--+--+
11 | | | | | | | | |. | | | []| 11
+ +--+--+ + +--+ + + + + +##+ +--+ +--+##+--+ +--+ +
10 | | | | |S # | | | | |. S | | | 10
+ + + +--+ +--+--+ +--+--+ +--+ + +ss+ +--+--+--+ + +
9 | | | | | |// //# |//| | | | | 9
+ + + +--+ +--+--+ +--+ +--+ +--+--+ +--+--+--+ +
8 | | | #. | |// // // // // // //| | | 8
+ +--+ +--+--+--+ + + +--+ +--+ +
7 |. | |// X/ // // // // // //| | 7
+ +--+ +--+ +##+ + +--+ + + +--+--+--+ +
6 | | | | | |// // // // //|. #// //| | | | | 6
+ + +--+ +--+--+ +--+ +--+ +--+ + + + +
5 | | | |// // // // // // // //#. | |S | | | 5
+ + +--+ +--+ + +--+ +--+ +--+ + +
4 |S | |S | |// // // // // X/ // //| | | | | 4
+ + +##+ +--+ + +--+ +--+ + + + +
3 | | |S | | |// // // // // // //| | | | | | | 3
+ +--+--+##+--+ + + +--+--+--+--+--+--+##+--+ + + + + + +
2 | | | | |//| | |. # . | | | | | | | | 2
+ + + + + + + + +--+ + + + + + + + +
1 | | | | |//# . # |S | | | | | | | | | | 1
+ +--+--+--+ +--+ +--+--+--+--+--+--+ +--+ +--+ +--+ +--+ +
0 | | S # . # . # . # S # | 0
+--+--+--+--+--+--+--+--+--+--+--+--+ +--+--+--+--+--+--+--+--+--+
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Legend:
| -- : Walls
# ## : Doors
s ss : Secret doors
^ : Stairs leading up
[] : Portal leading down
S : Special feature
X : Trap
// : Darkness
. : Random Encounter
Death and drek? WTF?
He's using a special encoding of some sort to store most of the text that's printed at the player. Most of the texts you have found are stuff that the player is expected to type in to the game; he must need those for comparison purposes. It's pretty funny that the riddles are hidden, while the answers to the riddles are revealed.Darendor wrote:Well maybe we should focus on the Wine Cellar again and examine the square at 1N, 1E.
My examination of the three game disks didn't reveal this (or any other "special") text strings so they must be called using the $FFD2 command somehow.Code: Select all
This is the wine cellar of the Scarlet Bard. The air is musty with old wine.

Death and drek? WTF?
The message in question is 77 characters long. That's what I'm going to look for first--a string of 77 suspicious bytes amongst the dungeon data.
Unfortunately, he could be storing more than one character per byte if he's nasty and clever, as they do on the Z-machine (the interpreter used by Infocom), which squeezes characters down into five bits.
However, I'm counting on MC not being nearly as good a programmer as those Infocom guys, so I don't expect anything that convoluted.
Assuming there's one byte per character, what we should look for first is a string of 77 bytes that contains identical bytes at position 2 and 3, and 5 and 6, for the text "is".
Unfortunately, he could be storing more than one character per byte if he's nasty and clever, as they do on the Z-machine (the interpreter used by Infocom), which squeezes characters down into five bits.
However, I'm counting on MC not being nearly as good a programmer as those Infocom guys, so I don't expect anything that convoluted.
Assuming there's one byte per character, what we should look for first is a string of 77 bytes that contains identical bytes at position 2 and 3, and 5 and 6, for the text "is".
Death and drek? WTF?
Woo!
Take a gander at memory location $fd20.
His character encoding is simple. If we set e1 as 'a', and c0 as 'A', and assume that the alphabet is encoded in consecutive numbers, we get the following:
This is the wine cellar of the Scarlet Bard. The air is musty with old wine.\Rar
You can see the string terminates with dc, and the beginning of the next message appears: "Rare wines (etc.)".
A text dump of all the disks should be possible, now. It will be fun to see all the game text--we'll possibly see stuff that inadvertently never ended up displayed in the final game.
Take a gander at memory location $fd20.
Code: Select all
000fd20: d4e8 e9f3 a0e9 f3a0 f4e8 e5a0 f7e9 eee5 ................
000fd30: a0e3 e5ec ece1 f2a0 efe6 a0f4 e8e5 a0d3 ................
000fd40: e3e1 f2ec e5f4 a0c2 e1f2 e4ae a0d4 e8e5 ................
000fd50: a0e1 e9f2 a0e9 f3a0 edf5 f3f4 f9a0 f7e9 ................
000fd60: f4e8 a0ef ece4 a0f7 e9ee e5ae dcd2 e1f2 ................
This is the wine cellar of the Scarlet Bard. The air is musty with old wine.\Rar
You can see the string terminates with dc, and the beginning of the next message appears: "Rare wines (etc.)".
A text dump of all the disks should be possible, now. It will be fun to see all the game text--we'll possibly see stuff that inadvertently never ended up displayed in the final game.
Last edited by Horpner on Wed Jan 28, 2009 3:36 pm, edited 1 time in total.
Death and drek? WTF?
I inspected a text dump of the dungeon disk, and unfortunately I didn't find anything at all surprising. It appears there really isn't any text that's not displayed at some point during the game. I did notice that the Keymaster summons 6 friends if you choose to attack him. I'd never tried that before.
The text concerning fiddling with chests is contained only on the dungeon disk, which explains why you never find chests in Skara Brae.
As for the BTCS forum, I hope this work will end up being useful for a new BTCS, but for now I just want to understand as much about ToTU as I can, and continue to fart around with my cheesy ascii-art map maker.
The text concerning fiddling with chests is contained only on the dungeon disk, which explains why you never find chests in Skara Brae.
As for the BTCS forum, I hope this work will end up being useful for a new BTCS, but for now I just want to understand as much about ToTU as I can, and continue to fart around with my cheesy ascii-art map maker.

Death and drek? WTF?
Did you happen to figure out how the game knows when to display a special's text?Horpner wrote:I inspected a text dump of the dungeon disk, and unfortunately I didn't find anything at all surprising. It appears there really isn't any text that's not displayed at some point during the game. I did notice that the Keymaster summons 6 friends if you choose to attack him. I'd never tried that before.
The text concerning fiddling with chests is contained only on the dungeon disk, which explains why you never find chests in Skara Brae.
As for the BTCS forum, I hope this work will end up being useful for a new BTCS, but for now I just want to understand as much about ToTU as I can, and continue to fart around with my cheesy ascii-art map maker.
Here's a partial character keyset based on the text I found in the Wine Cellar.
Code: Select all
Note: cf is used for both captial "O" and zero.
c0=A c2=B c5=K c6=F cf=0/0 d2=R d4=T
a0=_ a1=! ad=- ae=. b1=1 b5=5
e1=a e3=c e4=d e5=e e6=f e7=g e8=h e9=i ec=l ed=m ee=n ef=o
f0=p f2=r f3=s f4=t f5=u f7=w f9=y
dc=[end]
OK, so the scoop is that text data is stored in ASCII + 128.
Not the greatest obfuscation, but good enough to prevent casual inspection.
Aside, pertaining to Darendor's signature, I tried IRKM DESMET DAEM in an anagram finder, and never got anything that made sense. It seems like it really is beyond understanding. That is unless "Ted made me smirk" is some sort of in-joke.
Not the greatest obfuscation, but good enough to prevent casual inspection.
Aside, pertaining to Darendor's signature, I tried IRKM DESMET DAEM in an anagram finder, and never got anything that made sense. It seems like it really is beyond understanding. That is unless "Ted made me smirk" is some sort of in-joke.

Death and drek? WTF?