Sunday, May 31, 2020

The Hobbit: Back again



The Hobbit is a tough nut to crack. Despite what's been written about it, I don't believe it is especially complex or sophisticated internally. I haven't seen it do anything that couldn't have been done in an Infocom game of the era. In fact, I believe Zork's object-oriented design would have been perfect for what The Hobbit was trying to achieve, if only the Z-Machine ran on the poor old 48KB Speccy with no disk drive. Everything that you can interact with is represented as a data record, and "actors" such as the warg and wood elf have tables of performable actions, and a script of sorts to help them select one.

Reading the data records is easy, thanks to Wilderland. Each object has a name, a starting location, a number of copies (for instance, Bilbo's round green door has two copies, one in the tunnel-like hall and one on the lonelands, and manipulating one also manipulates the other), a volume, mass, and strength, a few additional variables that nobody has yet been able to decipher, and eight boolean properties such as emitting light, being opened, being locked, and being alive. Understanding the full extent of what all of these properties do, on the other hand, is very difficult. Amazingly, someone managed create a detailed analysis of the code. It's mostly in Spanish, which I can understand more or less, but I still couldn't glean nearly as much about this game as I had hoped to. For instance, one can clearly see where the routine for combat resolution starts and ends, but I have no idea what's going on during this routine, and gained little appreciation for how combat works here.

Here's a list of immobile objects found in The Hobbit:

Name Start location(s) Volume Mass Strength Notes
Heavy rock door Trolls path, trolls cave Infinite Infinite 0 Locked
Small curious key Goblins cache 0 0 0
Curious map Gandalf 2 0 0
Large key Hideous troll 1 1 0
Round green door Tunnel-like hall, lonelands Infinite Infinite 0
Small insignificant crack Large dry cave, dark stuffy passage Infinite Infinite Infinite
Spider web Spider threads place, smothering forest,
levelled elvish clearing, deep bog,
green forest
160 80 64
Red door Dark dungeon, elvenkings great halls,
elvenkings cellar
Infinite Infinite 0 Locked
Fast black river West bank, east bank,
bewitched gloomy place
Infinite Infinite 0 Full, fluid
Goblins back door Inside goblins gate, outside goblins gate 64 Infinite 80
Mountains side door Side door, smooth straight passage Infinite Infinite 0 Locked, invisible,
turns visible by waiting at side door
Large trap door Elvenkings cellar, forest-river (2) Infinite Infinite 0
Magic door Elvenkings great halls,
levelled elvish clearing
Infinite Infinite 0
Short strong sword Trolls cave 3 4 64 Emits light, full
Red key Butler 2 2 2
Valuable golden ring Dark stuffy passage 0 0 Infinite Wearing turns you and it invisible
Goblins door Goblins dungeon, big goblins cavern Infinite Infinite Infinite
Rope Trolls cave 2 2 32
Barrel Elvenkings cellar 32 3 32 Full, respawns
Wine Barrel 31 5 0 Fluid
Water Running river, 7 other locations 0 5 0 Fluid
Black water Bewitched gloomy place,
2 other locations
31 5 0 Fluid
Bow Bard 5 3 16
Strong arrow Bard 2 1 16
Window Goblins dungeon, dark winding passage 96 Infinite 112
Torch Big goblins cavern, inside goblins gate 5 5 128 Emits light, full
Sand Goblins dungeon 101 101 0
Trap door Sand Infinite Infinite 128 Locked
Goblins cache Trap door Infinite Infinite 0 Open
Heavy curtain Beorn's house Infinite Infinite 0
Large cupboard Wall Infinite Infinite 0
Food Large cupboard 5 5 1
Valuable treasure Lower halls 32 32 5
Wall Heavy curtain Infinite Infinite 0 Open
Wooden chest Tunnel-like hall 64 Infinite 0
Lunch 5 5 1 Spawned by Elrond
Strong portcullis Forest-river (2) and long lake 144 Infinite 0
Stone Empty place 254 254 Infinite
Wooden boat East bank 64 Infinite 0
Fast river Forest-river (1) Infinite Infinite 0 Full, fluid
Golden key Deep misty valley 0 0 0


And a list of characters:

Name Start location(s) Volume Mass Strength
You Tunnel-like hall 16 64 64
Red golden dragon Lower halls 192 96 192
Nasty goblin Dark stuffy passage beneath large dry cave 64 48 72
Gandalf Tunnel-like hall 21 96 112
Thorin Tunnel-like hall 29 80 104
Wood elf Levelled elvish clearing 112 Infinite 64
Elrond Rivendell 32 48 64
Butler Elvenkings cellar 48 48 32
Vicious warg Treeless opening 48 48 55
Gollum Deep dark lake 5 5 32
Hideous goblin Dark stuffy passage 64 48 72
Bard Lake town 48 16 96
Hideous troll Trolls clearing 144 144 160
Vicious troll Trolls clearing 144 144 160
Horrible goblin Dark winding passage 64 48 72
Mean goblin Dark stuffy passage 64 48 72
Vicious goblin Dark stuffy passage 64 48 72
Disgusting goblin Dark stuffy passage 64 48 72


One of Wilderland's tools is a game script window showing you all ingame events, including ones that occur outside Bilbo's observation. We can see, for instance, the Warg wander around for several turns, unsuccessfully following people, until it eventually gets captured by the wood elf and can't leave the dungeon. I have noticed that there tend to be some problem areas where characters often get stuck, moving back and forth between two or three rooms indefinitely, and yet not necessarily forever. Very rarely they break this cycle and go somewhere else. I don't know if this is by design, or due to a quirk in the random number generator, or if passages are weighted, or if there's some other reason entirely.

Between these tools, the game map, and the list of objects and properties, I have compiled some observations on the characters after several playthroughs.


You

Eating food increases your strength, initially 64 points, by 10. Wearing the ring quarters it, rounded down. When the effect wears off, it quadruples, though may not be quite what it was before if it had rounded down when using it. Try eating food while invisible for a 40 point increase! Just don't overdo it - you die of gluttony if your strength goes past 255.

Contrary to what the manual states, fighting does not decrease your strength.

I don't know what strength does exactly, but I'm sure it has some bearing on the odds of successfully killing enemies / breaking objects. The round green door, with 0 strength, is broken immediately on the first try. On the other hand, the heavy rock door with the same stats is never broken, so again, I'm not sure how anything works.


Red Golden Dragon

In v1.0 of The Hobbit, Smaug doesn't perform any actions until you reach the elvenking's cellar. Once you do, he starts wandering around his territory. His wandering seems to be random, but I have never seen him go past the dragons desolation room, or north from the side door.


Goblins

The nasty goblin, hideous goblin, and vicious goblin have rigid three-room patrol patrol patterns that I've never seen them break. The rest of them just seem to move randomly, though the mean goblin does appear to have a disinclination to wander far from his starting dark stuffy passage. The nasty goblin is special, as he's the only one who ever leaves the dungeon, and is able to to this because he can open and close the crack beneath the large dry cave. I have never seen a goblin leave through the back door, even if you open it yourself.

From what I can tell, the three goblins on predefined routes will capture any non-goblin that they see, while the others will fight. The nasty goblin may capture the warg if it enters the large dry cave.

If you walk into a room where a capturing goblin is, it will capture you immediately. But if a goblin walks into a room where you are, you can deal with it by fighting, leaving, or wearing the ring.

Killing goblins causes them to respawn.

Here's a map of the dungeon (not all passages are present), marked with the goblins' patrol routes and their starting locations, plus Gollum:




Gandalf

Oh, Gandalf. Truly the most inexplicable character here. He mostly wanders around. Wilderland's event window shows that he talks to himself a lot, whether Bilbo can hear him or not, and his dialogue consists of "hello," "hurry up," and "you are doing a great job." He'll pick up items that he himself dropped and muse "what's this?" He occasionally tries to drop items he doesn't have. Sometimes he attempts impossible actions like taking doors and lifting rivers. Sometimes he tries things so ridiculous that even the engine doesn't know what he was trying to do, only that it can't be done.

During one playthrough that I recorded, he started off by giving me a map. Then he opened my door and walked east to the lonelands. He tried taking the door, could not, and went north to the trolls clearing. Then there were various "Gandalf is not carrying it" warnings, and he went southeast to Rivendell. Then he got lost in the misty mountains for a long time, going mad as he muttered to himself every 3-4 steps he took. Eventually he found his way out and reached Beorn's house, where he tried to do something impossible, couldn't, and instead just opened the curtains and left for the great river. From there, he went to the mountains, to the forest-river, and the engine spat out "I cannot do that" several times. Then he tried to lift the river, and to drop another item that he didn't have. He then walked back and forth between the mountains and forest-river for awhile. Toward the end of the game, he backtracked and entered the forest path, where he and Bilbo briefly saw each other as they passed each other. Gandalf then spent the rest of the game wandering around the three rooms in the waterfall area.


Thorin

If Thorin isn't given any orders, he will follow you whenever possible. If he's already with you, he may wait, may say "hurry up," and may just sit down and sing about gold. He will take the small curious key from the goblin's cache if he can see it. If he can't see you, then he may just wander around.


Wood elf

The wood elf does nothing until you enter the lonelands, and then he starts wandering. He seems to get stuck in patrols easily, but again, I'm not sure what determines this. During one game, he spent the entire time walking back and forth between the bewitched gloomy place and the west bank, though this may have been because of disabled passages - see Elrond's section for more on that. During another, he got stuck in the waterfall-forest-running river area. I can't tell what his boundaries are, but the odds of running into him are pretty good, which means you can skip the spider's thread maze entirely.


Elrond

Elrond has the power to change the world geography! At the start of the game, one of these passages is randomly disabled:
  • Long lake to Lake town
  • Forest gate to Bewitched gloomy place
  • Beorn's house to Great river
  • Misty mountain to Narrow place
  • Treeless opening to Outside goblins gate

Asking him to read your map will enable the chosen passage. I am fairly certain that the closed passage is also closed to wandering characters, and don't know for sure if having Elrond read the map opens it to them as well.


Butler

The butler does nothing until you enter Beorn's house. Curiously, he's also invisible until this time. When you enter Beorn's house, he turns visible and says "thank you." Then he follows a rigid routine:
  • Unlock the red door
  • Open the red door
  • Close the red door
  • Lock the red door
  • Open a barrel
  • Drink wine
  • Close the barrel
  • Open the trapdoor
  • Get the barrel
  • Throw the barrel through the trapdoor
  • Close the trapdoor


The butler gains one point of strength every time he drinks wine.

If there's anyone in the cellar when he acts, he will capture them and put them in the dungeon on the other side of the red door that he keeps locking and unlocking.


Vicious warg

The Vicious warg likes following people, especially you. Each turn, the script window spits out "the vicious warg cannot follow <character>" for every single character in the game, starting with you. If it can't follow or attack anyone, then it wanders. There's a good chance it will get captured by the nasty goblin or wood elf, in which case it's stuck there. If the wood elf captures it, then most likely the butler will open the door and be mauled to death, leaving the warg to roam around the halls with no way out.


Gollum

Wanders the goblin caves. I've never seen him do anything except say "what has it got in its pockets?" and take the ring from me when I answer.

2 comments:

  1. That's a fascinating look behind the scenes.

    I have just one more question: Did you ever figure out why that one room was too full to enter?

    ReplyDelete
    Replies
    1. I think so. The "stone" object, which has 254 volume and 254 mass, occupies that room. I don't know if there's any way to manipulate the stone; objects can typically only be manipulated when you're in the same room as them. Things like doors technically occupy two rooms, but the stone only occupies one. The one exception I know of is the boat, which occupies the east bank but can be manipulated from the west bank by throwing the rope across.

      If you could move it, though, then you'd have an easy passage to Smaug's back door, and skip the whole barrels out of bond section.

      Delete