Friday, September 27, 2019

Zork II: Won!

Remember how in Adventure, you have to kill a dragon with your bare hands?

Zork II remembers, and I'll be damned if this isn't a deliberate reference.

>kill dragon
With your bare hands? I doubt the dragon even noticed.


I had to resort to a walkthrough to find out what to do next, and found that you deal with the dragon by stabbing it with your sword.

That’s just the first part, though. Attacking it with your sword once merely annoys it. Attacking it a second time provokes its immolating retaliation. But attack once, then leave, and the dragon will follow. If you could figure that out on your own – and I’m slightly ashamed I couldn’t, then you can probably figure the rest out.

I led the dragon into the nearby ice room, where it melted the ice and extinguished its own flame in the deluge, solving two of my problems from the last session.

I returned to the dragon’s lair and entered. Inside were a rotting old chest and a maiden, who left the lair. I followed, and she led me to the garden, where she gave me a rose and the unicorn’s golden key. I returned to the dragon’s lair and opened the chest, finding a golden dragon statuette inside.

Past the ice room was the lava room and volcano, exactly as they were in MDL Zork. I took with me the brick, string, newspaper, and matchbook, and proceeded to solve this area as I had before, with few differences in the process or results.

One difference is that one of the books in the library can be read.

>read white book

This book is written in a tongue with which I am barely familiar. It details the use of various magical objects, chiefly the so-called "magic wand." Apparently these devices work by directing them at the object to be ensorcelled, and then chanting the appropriate magic words. (It's truly amazing how credulous these ancients were, isn't it?)


Kind of like what the Wizard is doing to bother me!

Returning to the carousel room with a crown and ruby, I was stuck again. I still didn’t know how to pass the menhir, lizard head door, or Cerberus, and my new treasures and rose didn’t offer any obvious means of passing them.

A walkthrough told me that I’m near the end of the game, and that I'd need to give the lizard head some candy. Right.

Because it was described as “rare” candy, it hadn’t occurred to me at all that it might be useful. I had assumed that, like the “rare” spices, this was just another treasure that had to be collected.

I tried looking at the candy to see if it offered any clues that could have reasonably signposted this solution.

       Frobozz Magic Candy Company
         >>Special Assortment <<
          Candied Grasshoppers
             Chocolated Ants
              Worms Glacee
(By Appointment to His Majesty, Dimwit I)


Fair enough, I guess.

Past the lizard head door was the wizard’s workshop, with these rooms:
  • A trophy room with a cabinet, a bunch of wizardly paraphernalia, and a sign warning me not to touch anything.
  • A laboratory with more supplies and three pedestals of ruby, diamond, and sapphire
  • A room with a black chalk pentagram drawn on the floor
  • An aquarium room with a baby sea serpent
  • The wizard’s bedroom, whose room description changed from opulent to ascetic and back each time I looked.

I put my red and blue spheres in the ruby and sapphire stands, and tried throwing the golden statuette at the aquarium, which just bounced off. Then I tried smashing it with my sword, which worked, but the sea serpent then chewed me up. Reloading, I tried throwing the sword, which did the trick, and revealed a clear sphere inside. I put it in the diamond pedestal, and they magically merged into a black sphere.

I placed the black sphere inside the pentagram’s inner circle, and a demon emerged, who obsequiously offered power in exchange for wealth. The wizard entered the room, alarmed, and the demon laughed, and declared his wizardly powers were useless.

I offered him my gold statuette, and he thanked me and asked for more. Bit by bit, I retrieved and offered the rest of my treasures, until he was satisfied, and then asked him to kill the wizard in exchange.

I took the wand, and tried waving it at the wizard’s trophy cabinet, and aside from feeling a surge of power, nothing productive happened. I couldn’t think of any F-words that could open it. I tried a couple of spells on Cerberus – Freeze, Float, Feeble, even Fry, and none of them did anything (Feeble was recognized, but he still wouldn’t let me pass). I went back to the menhir room, cast Float on the biggest one, revealing a passage to a kennel, where I found a gargantuan dog collar.

I put the collar on Cerberus, who happily accepted it and became tame. Past him was a crypt containing the twelve heads of the Flatheads, placed on spiked poles. With nothing else to do, I closed the door and extinguished the lamp, as I had in MDL Zork. This revealed a secret F-emblazoned door, which I entered, into a statue-lined hall reminiscent of MDL Zork’s endgame.

This concluded Zork II, with 400/400 points, and a teaser for the next game, referred to as “Zork: The Great Underground Empire, Part III.”

Out of curiosity, I reloaded a save at the demon to see what else he could do for me. Killing the wizard was the obvious request, but he was also happy to just give me the wizard’s wand. Cerberus was really the only thing standing between me and victory, so I asked the demon to kill him.

"This may prove taxing, but we'll see. Perhaps I'll tame him for a pup instead." The demon disappears for an instant, then reappears. He looks rather gnawed and scratched. He winces. "Too much for me. Puppy dog, indeed. You're welcome to him. Never did like dogs anyway... Any other orders, oh beneficent one?"

Backing up one step, all I really needed the wand for was to move the menhir, so I tried asking the demon to move it for me, which he did with his little finger. But you can’t win the game this way; without the wand, you die on entering the final room.

Landing

Beyond the door is a roughly hewn staircase leading down into the darkness past the range of your vision. The landing on which you stand is covered with carefully drawn magical runes much like those you saw sketched upon the workbench of the Wizard of Frobozz. These have been overlaid with sweepingly drawn green lines of enormous power, which undulate back and forth across the landing. The green curves begin to vibrate, and close on you as if searching for something. One by one your possessions vibrate and then glow bright green. Finally, you are attacked by these magical wardens, and destroyed!


This game consists mostly of rooms, puzzles, and set-pieces that were cut from MDL Zork. The old Carousel Room returns and serves as the central hub of the game, and the connected riddle room, well, and region with the cakes and robot are mostly unchanged. The volcano area and Bank of Zork are the other major cut areas that return, the tiny room with the huge locked door puzzle is recycled, and the crystal spheres are straight from MDL Zork, though they serve a different purpose, and the part from MDL Zork where you peer into one sphere to reveal a hint about a secret room in the coal chute has no analog here.

But there are brand new areas as well. The starting rooms leading to the hub and garden area are unique to this game, as is the dragon’s lair and its puzzle which you must solve to access the volcano. There’s also the wizard’s domain and the oddly-angled room.

In spite of this cobbled-together approach, assembling a game from a mix of discarded pieces with some new ones to fill in the gaps, Zork II feels more cohesive and its layout more coherent than Zork I, which was designed through subtraction.

We can also see Infocom taking baby steps in shifting from open treasure hunt gameplay a la Adventure to a more narrative-based design. It’s still mostly about exploring, solving puzzles, and finding treasure, but there’s an inkling of character interaction beyond what existed in MDL Zork and Zork I. In those games, there were only a few characters, and most only served as obstacles. Only the dungeon master exclusive to MDL Zork and the thief did anything more interesting. The wizard takes the place of the thief, a free agent that moves about the map and occasionally becomes a nuisance. But the demon, which provides an in-universe explanation for why you need to find treasure, is the more interesting character.  His presence suggests a history of indentured servitude to the wizard, and a yearning for revenge. He’s clearly malevolent, and will take sadistic pleasure in watching you fail, and yet behaves subserviently until your business is concluded. He will fulfill his end of the bargain honestly, and although he’ll do you no favors beyond that, he also will never take any action against you (unless you deliberately ask for it).

The dragon and princess also demonstrate a feature of the Z-Machine that was underused in Zork I, the ability for characters to walk around the map on their own. Zork I’s thief moved around rooms seemingly by teleporting at random. The dragon has a small domain, and will follow you around this domain if provoked, taking the same passages that you do. You must study this domain to get past him and rescue the princess. The princess, likewise, will walk to the garden by herself when freed, taking the same naturally occurring passages as available to you, and even opens up a secret shortcut to get around the spinning Carousel room, which you can use yourself afterward.

These are all minor things, and are primitive compared to the games to come, but still show an inkling of narrative complexity not seen in any previous title.

I checked out Digital Antiquarian’s thoughts on Zork II, and he spends a lot of words discussing the worst puzzles, namely, the Bank of Zork and the oddly-angled room.

No disagreement from me on the Bank of Zork, a holdover from MDL Zork. They did add a bit of signposting toward the solution, but it’s not enough. The first big problem is parser-related. The security room has a “shimmering curtain of light” on the north side in place of a wall… what does that even look like? There’s a clue that you can walk through walls, but if you type “enter north wall,” you bump your head, suggesting a solid wall. And yet, “enter curtain” takes you through it. In the secret rooms on the other side, you have to leave by entering a wall, but you have to enter the correct wall, and if you guess wrong too many times, the curtain door closes, leaving you stuck there.

The second problem is trying to figure out just how the curtain works. It teleports you, and the destination depends on which room you were in last. Trial and error is the only way to figure this out, and there’s really no good explanation for why the curtain would work that way. It just does, and if you’ve only entered the curtain after being in the chairman’s office from stealing the portrait, you might not even realize that it has multiple destinations.

The problems he has with the oddly-angled room, on the other hand, I think are overblown. The game gives a LOT of clues that this is a baseball-themed room. It was obvious to me, and I don’t even like baseball. The wizard’s remarks about “first base” are a dead giveaway, but there’s also the diamond imagery, the long club, and if you look at the club it is ingrained with a “Babe Flathead” signature.

Suppose, to be fair to non-American English speakers, that Infocom had bundled a leaflet in their international releases with a disclaimer reading “Warning: This contains information which may spoil the solution to a puzzle originally intended for U.S. audiences. Read at your own risk!” This hypothetical leaflet would simply explain the basic rules of baseball, show a diagram of the field, an illustration of a bat, and list facts, including but not limited to who Babe Ruth was, all without specifically mentioning the diamond maze puzzle. This, I think, would have been perfectly fair to English speakers around the world. I’ve considered the reverse, a UK-based studio explaining a brief history of the royal family in a leaflet to help US audiences solve a puzzle assuming knowledge of their genealogy, or perhaps explaining what the word “football” means in Europe, and I wouldn’t find that to be patronizing. Taking such puzzles out or “localizing” away a game’s sense of cultural identity (e.g. Phoenix Wright), on the other hand, would seem patronizing.

So, I don’t have an issue with the assumed domain knowledge here. But I do have a big issue with a different aspect of this puzzle; you can stumble upon the bat and deduce that this room is the home plate, but how are you supposed to know which way to go to reach first base? The maze is impossible to map before you’ve solved the puzzle, and I don’t see a good reason for this to be so. If they had just left the maze coherent, and maybe stripped away some superfluous rooms, then the mapped out maze would look like this:



And that, I think, would have made this a good puzzle. The layout alone would suggest a baseball diamond, with the pitcher’s mound in the middle, home plate to the west, first base to the south, and so on. The wizard’s remark about first base would be totally unnecessary; the layout would be a subtler and yet more useful hint.

I think Zork II, though not as good as Zork I, is slightly underrated. In some ways it’s a bit more polished and sophisticated, but it suffers from second book syndrome, and there’s no getting around the fact that Zork I consists of the best parts of MDL Zork, while Zork II consists of a mishmash of the worst parts of MDL Zork and some original content.

Since I couldn’t find one anywhere, here’s a points list:

Answer riddle 5
Get necklace 15
Enter Top of Well 10
Get candy 15
Get red sphere 20
Get violin 20
Solve Oddly-angled room 5
Get blue sphere 20
Slay dragon 5
Get statuette 20
Get gold key 15
Get portrait 20
Get bills 25
Get Zorkmid 20
Get stamp 10
Get crown 20
Get ruby 15
Enter wizard's workshop 10
Get clear sphere 20
Get black sphere 30
Give gold key 2
Give bills 2
Give portrait 2
Give ruby 2
Give crown 2
Give necklace 2
Give violin 2
Give statuette 2
Give stamp 2
Give zorkmid 2
Get wand 30
Get collar 15
Enter Cerberus room 10
Enter Crypt Anteroom 3
Enter Crypt 2

My Trizbort map:

Wednesday, September 25, 2019

Game 91: Zork II

Download a story file of the earliest release here:
https://drive.google.com/uc?authuser=0&id=1SLy7lNaV36AXyBjfStdricrE__H-WEcf&export=download

Read the manual here:
https://www.mocagh.org/loadpage.php?getgame=zork2folio-alt2

Get Frotz (if native Windows execution is your wish) here:
http://www.davidkinder.co.uk/frotz.html


Zork II was the first and only game that Infocom developed for their Z-Machine version 2, and this early version was only available for a limited time. The very next year, Infocom developed Deadline and Zork III for their longer-lived Z-Machine 3, and soon retrofitted Zork I & II to run on it as well.

Initial releases of Zork II, designated “release 7,” were for TRS-80 and Apple II computers, as Zork I had been. I had hoped to locate disk images for the original TRS-80 release, but the earliest I could find were of release 23. I did find release 7 for the Apple II, but as it only supports uppercase output in 40-column text mode, this wasn’t acceptable. So I extracted the storyfile, and would just have to put up with Frotz and all of its Windows-friendly anachronisms. The horror.

Zork II picks up exactly where Zork I left off, inside the barrow, with the iconic lamp and equally iconic but less useful Elvish sword at our feet, and are otherwise empty-handed.

Step 1: Mapping!

By a linear southbound passage, through a narrow tunnel lit by phosphorescent moss and across a bridge over a ravine is a great cavern that tapers off into dark tunnel, splitting into two directions. One leads to an impossibly lush subterranean garden, complete with a topiary, gazebo and unicorn. The other leads to the disorienting Carousel Room, one of the many areas left out of Zork I.

It wasn’t long before the Wizard showed up, and started to mess with me. He incanted “fence,” temporarily sealing off egress from the garden.

Inside the gazebo were a number of items, including two from MDL Zork; the newspaper and placemat.

Reading the newspaper:
** U.S. News and Dungeon Report **

FAMED ADVENTURER TO EXPLORE GREAT UNDERGROUND EMPIRE

Our correspondents report that a world-famous and battle-hardened adventurer has been seen in the vicinity of the Great Underground Empire. Local grues have been reported sharpening their (slavering) fangs....

"Zork: The Wizard of Frobozz" was written by Dave Lebling and Marc Blank, and is (c) Copyright 1981 by Infocom, Inc.


The topiary led back to the Carousel Room, which, as in MDL Zork, sends you off in random directions.

One direction led to a marble hall, which had a clay-like brick, which I know to be C4 from playing MDL Zork. Passages north and upward led to a familiar Tiny Room with a recycled puzzle involving a massive wooden door locked from the other side.

Another direction led to a Riddle Room, with a familiar riddle:
Above the stone, the following words are written: "No man shall enter this room without solving this riddle:

  What is tall as a house,
    round as a cup,
      and all the king's horses
        can't draw it up?"


I knew this one! “Well.”

The door opened, and led to a broom closet storing a pearl necklace, and to the bottom of a well. I left my magic bottle of water behind in Zork I, though, so I’d need something different to progress here. I went back to the Carousel Room.

Another direction leads to a Cool Room, filled with a damp mist emanating from a westward passage. Across a stone bridge to the north, my sword started to glow blue.

In another direction was a “Cobwebby Corridor,” where the fuse for the C4 was placed. Through this corridor was a “Guarded Room,” not actually guarded, but the vestibule door to the next area had a live lizard head embedded in it, which kept me away from the door. My sword did not glow blue, suggesting no danger, but also had no effect on the lizard head.

Climbing upward led to a “Lava Tube,” suggesting the volcano from MDL Zork. Sure enough, further up the tube was a “Volcano View” room. The wizard popped up again and incanted “fireproof,” to no obvious effect on either of us.

Climbing down from the Lava Tube brought me to the old “Ice Room” with the impassable wall of ice filling the left half, but the east side looped back to the cool room.

I went back to the stone bridge and crossed, arriving at a dragon’s lair! My sword glowed brightly, but the dragon didn’t attack unprovoked, and I could continue eastward or westward. Eastward led to a series of ledges between the marble room and tiny room. Westward led to the Bank of Zork and no doubt to its infuriating puzzle that Zork I had been better off without.

The wizard continued pestering me during this time, casting these spells, with these effects:
  • Feeble – Made me drop items and temporarily unable to pick them up again.
  • Fantasize – Unknown.
  • Freeze / Float – Couldn’t move for a while.
  • Ferment – Directions got confused.
  • Fumble – Dropped something.
  • [Inaudible F-word] – Random effect.

Unlike MDL Zork, there were two viewing rooms, on the east and west. The safety depository had a discarded piece of paper with a clue to the bank’s bizarre puzzle.
The paper is barely readable except for an area near the bottom. I can make out only "... valuables are completely safe ... advanced magic technology ... impossible to take valuables from the depository ... either teller's ... Many customers faint ... teller pops in ... seems to walk through ... walls ..."

Also, every now and then, a voice whispered “Curtain Door Closed.”

Either the rules of the bank changed, or I got them wrong the first time around. In playing MDL Zork, I had assumed that a silent bank alarm controls where you are sent to when you walk through the curtain of light in the safety deposit room. But this isn’t the case in Zork II, and possibly never was.  There is no silent alarm at all, and your destination when walking through the curtain of light depends on which room you were previously in before entering the depository. The fact that Zork II has two different viewing rooms was key to helping me understand this rule.
  • West Teller’s Room -> West Viewing Room
  • East Teller’s Room -> East Viewing Room
  • Chairman’s Office -> Small Room
  • Small Room -> Vault
  • Vault -> Small Room

Possessing either of the bank’s valuables still prevents you from leaving the safety depository by any means other than the curtain, and the solution is the same. Get the bills from the vault, drop both the bills and portrait in the safety depository, then exit into either teller’s room. Come right back, collect the valuables, and enter the curtain to be teleported to a viewing room.

Another exit from the Carousel Room led to a quarry full of limestone menhirs, the biggest of which had a mysterious “F” carved into it. Past this quarry were some downward stairs to an “Oddly-angled Room,” which at first glance seemed like a MOTLP, a network of interconnected rooms, each with a diamond-shaped window in the floor, glowing with varying brightness. One room had a long club with a burned thick end. But this room resisted my attempts to map it. Sometimes moving in a direction would succeed, even when immediately before, moving in the same direction produced a “there’s no way to go in that direction” message. The windowed floors had no discernible pattern. Even dropping items as breadcrumbs didn’t help. Exits between rooms seemed to be random with every move I made.

Eventually, the wizard taunted me.
As you thrash about in the maze, the mirthful voice of the Wizard taunts you: "Fool! You'll never get past first base at this rate!"

And then the meaning of the diamond window and club became obvious. This maze is supposed to represent a baseball diamond! I stumbled around until I found the club, presumably on the home plate, and by trial and error, found that when I walked southeast, the window went from flickering to glowing. This suggests that home plate is in the west, and first base is to the south.

Next, I walked northeast to second base, where the window glowed. Northwest to third base, and the window glowed brightly. Southwest back to home plate, and the window glowed “serenely.” The puzzle solved, this maze re-arranged itself and became mappable, and a staircase leading down from the pitcher’s mound led to a crypt guarded by Cerberus.

I figured that the GUE 2.0 was about as well mapped out as it could get without solving some more puzzles, so I restarted to recharge my lantern and did precisely that. I went to the tiny room, and unlocked the door by using the letter opener to dislodge the key onto the mat. Behind it, as in MDL Zork, was a dreary room with a blue sphere, which I peered into and saw a murky room with a sandy floor and stone walls.

I hadn’t found any magical bottles of water to use to float the bucket in the well, but I did have a teapot. So I tried filling it with water from the stream, pouring it into the well, and sure enough, this made the bucket float to the top. The Tea Room awaited, with its old cake puzzle. This time, though, they had words written in icing. Only the green cake’s lettering was legible, and it said “Eat Me,” so I did, and shrank down small enough to enter the pool room.

The pool room was unchanged, and still contained a pool of sludge and flask of poison. Zork II, unlike MDL Zork, straight up told me that something hazy was submerged in the pool. There was also the flask of poison, which was useless in MDL Zork, but here I could use it to read the lettering on the rest of the cakes.
  • Blue – Enlarge
  • Red – Evaporate
  • Orange – Explode

These additional clues were much appreciated! I threw the red cake in the pool, which evaporated, leaving a package of candy rather than rare spices.

The Low Room was in this area too, along with its robot puzzle, which I well-remembered how to solve. A red sphere in a booby-trapped closet was linked to the blue sphere already in my pocket. I stopped the carousel room, and returned, where a dented box with a violin awaited me, and I was able to traverse west to a new room containing a can of grue repellant.

Here, I was stuck, and decided to end my session, using the now stationary carousel room as a base of operations. My Trizbort map feels pretty fleshed out, but there are a number of tasks remaining to be done.
  • Where is the last sphere?
  • What do I do about the dragon?
  • How do I melt the ice wall? Presumably this leads to the volcano area.
  • How do I pass the big menhir?
  • How do I pass the lizard head?
  • How do I pass Cerberus?

My collection of junk:
  • Stradivarius
  • Portrait
  • Zorkmid bills
  • Bank brochure
  • Grue repellant
  • Iron key
  • String
  • Brick
  • Letter opener
  • Sword
  • Pearl necklace
  • Teapot
  • Blue sphere
  • Flask
  • Candies
  • Red sphere
  • Newspaper
  • Matchbook
  • Steel box

My Trizbort map (so far):

Monday, September 23, 2019

Game 90: Stargate

Was there anyone, in 1981, who played Defender and thought, “gee, there ought to be more stuff going on in this game?”

That’s Stargate in a nutshell. Defender with even more stuff in it.

The basics are all there and work as they did before, but now there are more types of enemies, mostly intended to harass you while you fight off the landers, or to provide a fiercer opposition during the mop-up phase. Every five rounds is a dogfight, where you contend against an overwhelming force of new baddies, although none are as nigh-impossible as the swarm of mutants that you’ll have to face if you lose your last humanoid.

To aid you, you’ve got one new weapon; an “Inviso” cloak device, which also makes you invulnerable for a few precious seconds. In fact, the invisibility part is really just a liability, as it prevents you from seeing your ship, but the enemies don’t seem to behave any differently. I had a hard time getting accustomed to using it, much like hyperspace, by the time I knew it could save my hide, it was too late for me to react, and it was difficult to find situations where it could be used proactively.

In addition, the levels have a “Stargate,” which teleports you to any humans in trouble, but also sometimes dumps you right in the path of an oncoming foe.  Advanced players can also use the stargate as a level warp by bringing four humans into it, which triggers a hyperspace jump and a big score boost.




During the title screen, you can press a button to view a “secrets” screen with some ingame pointers.



Stargate also allows you to “reinforce” your fleet by inserting two coins before play, which grants 4 additional ships, smart bombs, and seconds of Inviso. I took this option, naturally. There’s no further reinforcing once the game starts, except for the periodic 10,000 point award, carried over from Defender and with the additional bonus of Inviso time.

All of the old enemies return and are as nasty as before. The new ones are:
  • Space Guppies – Kind of like swarmers, but less aggressive and evasive. But they don’t wait in pods, so they are a more immediate threat to you while hunting landers.
  • Dynamos – Relatively tame, they regularly spawn slow-moving “Space Hums.” Like bombers, a low priority target, but a bit more threatening as the Space Hums do target you rather than just float around.
  • Phred and Big Red – Crude Pac-Man parodies, these will sometimes spawn if you are taking too long to finish a level, and will chase you around and spawn smaller “munchies” which also chase you around. I’d rather deal with them than deal with baiters (though Stargate has those too), and Inviso makes short work of them.
  • Firebombers – The worst new enemy. Big enough targets, but they tend to dodge shots, often move too high for your ship to reach them, and then wrap around to the bottom where they put humanoids in your line of fire. But they can be “pushed” into the middle of the screen by exploiting this behavior, where you have a better chance of gunning them down. They fire rarely, so they aren’t much of a threat when hunting landers, but their projectile is fast and accurate enough to make engaging them risky, and their death explosion sends a shower of particles across the screen, obscuring things like enemy bullets.



In my best attempt I made it to wave 10, where I had to face off against swarms of firebombers, and depleted most of my special weapons in doing so. Wave 11 was just too much; without having multiple bombs or much Inviso, I couldn’t stop the landers from destroying the planet, and then fell to the onslaught of mutants, ending with a score of over 149,000 points, just a few hundred short of a modest reinforcement.

Tuesday, September 17, 2019

Game 89: Tempest

Buy Tempest and about 90 other Atari games in the Atari Vault on Steam:
http://store.steampowered.com/app/400020/Atari_Vault/

There are two things that make all the difference in the world when emulating Tempest.

First, you need a spinner controller. I’ve tried playing with a keyboard, mouse, joystick, trackpad, and was utterly hopeless. But the first time I played with a proper spinner, my score improved by an order of magnitude, and only got better with practice.

Second, you need a big monitor, and preferably one that can be rotated vertically. You’ve got to be able to see all the tiny objects coming at you, and without as much vertical real estate as you can get, this will be a struggle.

My SlikStik Tornado seems to have been made specifically with Tempest in mind. I don’t know what a genuine Atari spinner felt like, but the Tornado is weighty, has amazingly low friction, feels really precise in MAME, can spin for minutes on a single twist and yet stops easily. And I have a 4:3 20” rotatable monitor, which made an enormous difference. For comparison, I tried playing Tempest on my 13.3” laptop, and could barely see my targets in the distance until they were too close, and had poor control over my blaster with the touchpad.

There are 16 levels in Tempest, and when you finish the last, a Möbius strip, the levels change color and loop at a higher difficulty. I wasn’t able to get that far.



It’s a really chaotic game, with so much happening on the screen that it’s overwhelming. Flippers, the red things that rise to the top of the well and try to grab you, caused most of my demises. It doesn’t take long before they move REALLY fast, and with enemies firing at you, and it’s hard to get a chance to shoot them before they reach your level and start moving around the edge of the well. You fire rapidly, but there’s a limit to how many of your bullets may be on screen, so it’s easy to inadvertently waste time by firing lots of shots down an alley that your target just moves away from. It’s better to move constantly and fire a bunch of shots down adjacent alleys, moving just fast enough that your shots don’t skip any of them. When flippers do reach the top of the well, sometimes you can kill them with your zapper weapon, but this doesn’t always work. And sometimes you can kill them by moving through them while shooting, but this also sometimes doesn’t work, and it if doesn’t, you die.

Sunday, September 15, 2019

The Basic mechanics of Ultima

Ultima, like Akalabeth, was coded mostly in BASIC, and the code is right on the disk, in the same format as Richard Garriott had typed it so long ago.

Compared to Wizardry, whose Pascal source code I spent most of last August analyzing, Ultima has generally simpler gameplay mechanics to decipher, and BASIC is more of a beginner’s language. So this ought to be a cake walk in comparison, right?

Well, no. First of all, most of the work in understanding Wizardry had already been done for me, as it had been originally distributed in compiled P-code format. Thomas William Ewers had reverse-engineered it into human-readable source, and picked his own names for the variables and functions. They weren’t always the most sensible names, such as LUCKSKIL[0] for “Save Vs. Death,” but were much preferable to Garriott’s arbitrary two-letter names, such as AM for “Index of the monster currently being fought in the overworld” (or “alertness status of the guards/Mondain”).

Secondly, BASIC, in my opinion, was never intended to be used for a game as big in scope as Ultima, but it was the best tool available to most developers of the time, and like so many other developers, Garriott had to horrifically abuse the BASIC syntax to get things done with it, not least because having comments and meaningful variable names eats up precious memory. Observe this line from the Dungeon routine:
2075  PRINT "HIT! DAMAGE=   ";D:MN(MB + ZX,2) = MN(MB + ZX,2) - D: IF MN(MB + ZX,2) < 0 THEN MN(MB + ZX,0) = 1: PRINT MN$(MB + ZX);" KILLED!   ":X = ZX:DN%(PX + DX * ZZ,PY + DY * ZZ) = DN%(PX + DX * ZZ,PY + DY * ZZ) - 100 * ZX: GOTO 2293

This example isn’t especially an especially bad one – I could have picked plenty that are far less comprehensible. Here one can probably figure out the gist of what the line is trying to do, but I think in its partial comprehensibility, it illustrates the difficulty of my task better than gibberish like this does:
95 TN = T1:DR = 0: POKE  - 16301,0: POKE  - 16297,0: POKE  - 16300,0: POKE  - 16304,0: SCALE= 1: ROT= 0: HCOLOR= 3: POKE 232,116: POKE 233,14:AM = 0: DEF  FN PN(T2) =  PEEK (2816 + (PX + DX) * 22 + PY + DY): DEF  FN MX(T4) =  PEEK (2816 + (MX(X) + DX) * 22 + MY(X)): DEF  FN MY(T4) =  PEEK (2816 + MX(X) * 22 + MY(X) + DY)

Pascal was designed to encourage structured coding, largely as a reaction to BASIC’s shortcomings, but Apple Pascal was bleeding edge technology when Ultima was under development. Take this sample routine from Wizardry, which is fairly understandable thanks to the structure and meaningful variable names.

          BEGIN
            TOTAL := MINADD;
            WHILE TRIES > 0 DO
              BEGIN
                TOTAL := TOTAL + (RANDOM MOD AVEAMT) + 1;
                TRIES := TRIES - 1
              END;
            CALCULAT := TOTAL
          END;


So, comprehending Ultima’s BASIC code is in some ways more difficult than Wizardry’s Pascal, but I’ve tried my best. It's a smaller task, since there's a lot less of it. There's also not all that much data - most of the tables I've made are based on formulas and hard-coded BASIC, rather than actual on-disk tables as seen so extensively in Wizardry.

Ultima is neatly divided into a number of separate BASIC programs, each one small enough to fit into the computer’s memory one at a time, leaving room for a few variables that get shared between programs. The programs are:
  • Castle
  • Dungeon
  • Initialize Display
  • Outside
  • Player Disk
  • Space
  • Time Machine
  • Town
  • Ultima

Not all of these are interesting to me. Ultima is the title screen. Initialize Display is the self-explanatory character creator, some variable initializations, and various low-level routines that I don’t care to decipher. Space is a pretty basic action game that doesn’t lend itself well to data obsession. Player Disk is the looping demo and disk copying utility. In addition, not all of the game code appears to be present in the readable files. For instance, I couldn’t find any data representing monster’s internal stats, including their names (but I’ve assembled most of it through observation), but it has to be there somewhere.

Throughout this post, I will refer to some BASIC functions. One of the most important is:
RND(X)

This returns a random floating point number smaller than X, with an even distribution. For instance, RND(20) may return 19.99999, and may return 0, but it will not return 20 or any negative. Values that need to be used as integers will always be rounded down, so if I say, for instance, that weapon damage is RND(20) + 1, this means it can be anywhere from 1 to 20, since weapon damage is always an integer.

Occasionally, the RND function is used in this manner:
RND(1)^2

This will return a random number smaller than 1, but distribution will be more frequent on low values. So for example, this formula:
RND(1)^2 * 5 + 1
will return anything from 1 to 5, but 1’s will be returned almost half of the time.

Common tables

 

Weapons:


Index Weapon Town/Castle Dungeon/Mondain Outdoors
0 Hands
1 Dagger
2 Mace
3 Axe
4 Rope and spikes No attack, saves vs. traps
5 Sword
6 Great sword
7 Bow and arrows Ranged Ranged Ranged
8 Amulet Ranged No attack No attack, +16 magic missile damage
9 Wand Ranged No attack No attack, +18 magic missile damage
10 Staff Ranged No attack No attack, +20 magic missile damage
11 Triangle Ranged +22 magic missile damage
12 Pistol Ranged Ranged Ranged
13 Light sword
14 Phazor Ranged Ranged Ranged
15 Blaster Ranged Ranged Ranged

The wild differences in ranged capability for some weapons are likely due to Garriott forgetting to code the rules consistently across the various BASIC modules. The amulet, wand, and staff are all over the place, being non-weapon magic enhancers outdoors, completely useless in dungeons, and ranged weapons in towns and castles.

The index serves as the base stat from which all other weapon stats – price, accuracy, and damage – are calculated.

In the towns and castles, weapon damage is:
RND(Strength + Index/2) + 1

In the dungeons and against Mondain, weapon damage is:
RND(Strength/5 + Index*3) + Strength/5

In the overworld, weapon damage is:
RND(Strength + Index) + 1


Armor


Index Armor
0 Nothing
1 Leather
2 Chain
3 Plate
4 Vacuum
5 Reflect


Armor reduces likelihood of getting hit, but does not reduce damage when you do.

In the towns, your odds of getting hit are:
22.5/(Agility + Index*4)

In the castles, your odds of getting hit are:
40/(Agility + Index*4)

Outdoors and dungeons use their own convoluted rules. I’ll get to them later.


Spells


Index Spell Use
0 Prayer Outdoors
1 Open Dungeon
2 Unlock Dungeon
3 Magic Missile Outdoors + dungeon + Mondain
4 Steal Nowhere
5 Ladder Down Dungeon
6 Ladder Up Dungeon
7 Blink Dungeon + Mondain
8 Create Dungeon + Mondain
9 Destroy Dungeon + Mondain
10 Kill Outdoors + dungeon + Mondain

The Steal spell seems to be completely useless. You can’t cast spells in town or the castle, and there’s nothing to steal anywhere else.

Blink, create, destroy, and kill are for wizards only.


Vehicles


Index Vehicle Food rate Time rate Notes
0 Nothing 0.5 1.6
1 Horse 0.43 1.46
2 Cart 0.36 1.31 Improves carrying capacity
3 Raft 0.29 1.17 Water only
4 Frigate 0.21 1.03 Water only, has guns
5 Air car 0.14 0.89 Can't enter woods, has guns
6 Shuttle Goes to space


On experience and leveling

Leveling in Ultima does not work as you might expect. Experience points have nothing to do with it; they are just a currency used to purchase spells. Nor does your level have anything to do with your strength in combat.

Levels are determined entirely by how much “time” has passed in-game. And there are only three things that levels do. First, the shops in town will stock better items as you gain levels, with the best items only available at level 7. Second, monsters in the overworld gain more HP as you gain levels. Third, you must be level 8 or higher to use the time machine and win the game.

Each level represents 1000 passed time units. Time is advanced in the following ways:
  • Passing anywhere by idling consumes 0.05 food and advances time 0.5 units.
  • Passing in the town, castle, or dungeon by pressing space consumes 0.01 food and advances time 0.1 units.
  • Moving in the town or castle consumes 0.01 food and advances time 0.1 units.
  • Moving in the dungeon consumes 0.1 food and advances time 1 unit.
  • Moving outdoors consumes up to 0.5 food and advances time up to 1.6 units.

But most efficiently of all is:
  • Each parsed command while outdoors advances time 0.6 units.

So if you want to level quickly, just go outdoors and rapidly press a key that doesn’t do anything, like ‘W’. You won’t even consume food! Though you will have to contend with monsters. Or you can do what I did and put the emulator into warp speed and keep your finger on the ‘A’ key for a few minutes.

Town + Castle common rules

In both the towns and castles, it’s possible to steal armor, weapons, or food. Thieves have an easier time overall, but castles are more difficult than towns for thieves, and towns are more difficult than castles for non-thieves.

Successfully stealing armor performs this calculation:
RND(1)^2 * 5 + 1
And then you receive the armor with the corresponding index value.

Successfully stealing a weapon performs this calculation:
RND(1)^3 * 15 + 1
And then you receive the weapon with the corresponding index value.

Successfully stealing food gets you RND(30) + 1 units.

Ranged weapons can hit at up to 5 tiles away.

Alerted guards will approach if their range is within 9 tiles. Distance is calculated by the Pythagorean Theorem.

I’ve had trouble figuring out the odds that Iolo/Gwino will steal something, but when they do, it will be your worst unequipped weapon, and the odds that you notice are Wisdom/50.

Town

Towns with odd indices stock these weapons, based on your level.

Weapon Power Min level Base price
Dagger 1 1 6
Axe 3 1 14
Sword 5 1 30
Bow and Arrows 7 4 54
Wand 9 4 86
Triangle 11 7 126
Light sword 13 7 174
Blaster 15 7 230

Towns with even indices stock these weapons, based on your level.

Weapon Power Min level Base price
Mace 2 1 9
Rope and spikes 4 1 21
Great sword 6 4 41
Amulet 8 4 69
Staff 10 4 105
Pistol 12 7 149
Phazor 14 7 201

The base price is subject to a percentage discount of Intelligence/200. The final purchase price is determined by this formula:
(1 – Intelligence/200) * (WeaponPower ^ 2) + 5

Selling weapons gets you a percentage rate on the buying price of Charisma/50.

Armor is also stocked according to your level, and doesn’t vary between towns.

Armor Power Min level Base price
Leather 1 1 50
Chain 2 1 100
Plate 3 1 150
Vacuum 4 3 200
Reflect 5 3 250

The base price is subject to a percentage discount of Intelligence/200. The final purchase price is determined by this formula:
(1 – Intelligence/200) * (ArmorPower * 50)

Selling armor gets you a percentage rate on the buying price of Charisma/50.

Your carrying capacity is equal to (Strength * 4) + (Carts * 20). Your carrying load is (Gold/100) + Armor + Weapons. Each armor or weapon counts for 1 unit, regardless of type. Capacity vs. load is checked only when buying weapons or armor.

Vehicles are stocked according to your level.

Vehicle Power Min level Base price
Horse 1 1 40
Cart 2 1 160
Raft 3 1 360
Frigate 4 1 640
Air car 5 4 1000
Shuttle 6 4 1440

The base price is subject to a percentage discount of Intelligence/200. The final purchase price is equivalent to this formula:
(40 - Intelligence/5)* (VehicleIndex^2)

Spells are always fully stocked.

Base price Index Base price
Open 1 5
Unlock 2 10
Magic Missile 3 15
Steal 4 20
Ladder Down 5 25
Ladder Up 6 30
Blink 7 35
Create 8 40
Destroy 9 45
Kill 10 50

Spells cost both gold and experience, in equal amounts. The base price of each spell is [Spell index] * 5. It is then subject to a percentage discount of Wisdom/200. Algebraically, the price can be expressed as:
[Spell index] * (5 – Wisdom/40)

Food packs cost 5 – Intelligence/20.

If you consume a total number of drinks greater than Stamina/5 or Wisdom/5, and are standing near the wench, you will be seduced. You’ll lose all of your gold and one point of Wisdom if you have 6 or more.

When you buy a drink and are not seduced, there is a 70% chance of hearing a randomly chosen tip. All tips have a 10% chance unless otherwise noted.

BUB, YOU BEST KNOW
  • ABOUT SPACE TRAVEL! AND THAT YOU MUST DESTROY AT LEAST 20 ENEMY VESSELS TO BECOME AN ACE!
  • TO WATCH THE WENCH?
  • THE PRINCESS WILL GIVE GREAT REWARD TO THE ONE WHO SAVES HER, AND AN EXTRA GIFT IF THE PLAYER IS 8TH LEVEL OR GREATER!
  • YOU SHOULD GO BACK IN TIME! (20% odds)
  • YOU SHOULD DESTROY THE EVIL GEM!
  • THAT MANY, IF NOT MOST LAKES AND PONDS HAVE STRONG MAGICAL POWERS!
  • THIS IS A GREAT GAME! (20% odds)
  • THAT OVER 1000 YEARS AGO MONDAIN THE WIZARD CREATED AN EVIL GEM. WITH THIS GEM, HE IS IMMORTAL AND CANNOT BE DEFEATED.    THE QUEST OF --ULTIMA--   IS TO TRAVERSE THE LANDS IN SEARCH OF A TIME MACHINE. UPON FINDING SUCH A DEVICE, YOU SHOULD GO BACK IN TIME TO THE DAYS BEFORE MONDAIN CREATED THE EVIL GEM AND DESTROY HIM BEFORE IT'S CREATION.    IF YOU DO THIS, YOU WILL SAVE THE UNIVERSE, AND WIN THE GAME!!!

Targets have the following values:

Target AC HP EXP
Guard 1 (left of the entrance) -8 20 50
Guard 2 (right of the entrance) -7 20 50
Guard 3 (near the food shop) -6 20 50
Guard 4 (near the armour shop) -5 20 50
Guard 5 (near the pub) -4 20 50
Guard 6 (near the magic shop) -3 20 50
Bard -2 0 20
Thief -1 0 40
Merchant 0 0 25
Wench 1 0 10

Your odds of missing an attack are:
50/(75 + Agility + WeaponPower + [TargetAC *3])

A guard’s attack has these odds of hitting you:
22.5/(Agility + ArmorPower*4)

Guard attacks inflict damage of 1% of your HP, plus RND(10).

Dropping gold into the lake grants you (1.5 * gold) HP. You will also receive 4 daggers the first time per visit.

Stealing has a 15% chance of failure if you are a thief, and a 40.5% chance of failure otherwise. It always fails if the guards are alerted.

Castle

Dropping gold into the west fountain grants (Gold/10) points to a randomly chosen stat, up to a maximum of 99 points. Possible stats are:
  • HP
  • Strength
  • Agility
  • Stamina
  • Charisma
  • Wisdom
  • Intelligence

If “HP” is selected, odds are you’ll wind up reducing it to 99 points.

Dropping 10 or more gold into the center-north fountain grants a random weapon.

Dropping gold into the center-south fountain grants (Gold*5) food.

When you receive the white gem from Shamino for killing a Balron, you are also permitted nine rewards from the armour store, weapon store, or food store.

Armour store rewards grant you a randomly chosen armor, with even distribution.

Weapon store rewards grant you a randomly chosen weapon, by this formula:
RND(1)^2 * 15 + 1

Food rewards gives you RND(30) + 1 food units.

You may also steal from the stores, which has a 20% chance of failure if you are a thief, and a 36% chance of failure otherwise. It always fails if the guards are alerted. Looting odds are not as good as the reward odds, and match the odds of stealing from merchants.

Your reward for completing landmark quests is more strength, in the amount of:
9.9 – OldStrength/10

Gold may be donated in increments of 10, to a maximum of 90. The reward is higher if you donate a larger portion of your gold.

The reward is HP by this formula:
3 * Donation^2 / Gold

So, if you have 10 gold and donate all of it, you receive
3 * 100/10 = 30 HP

A special case is made for donating 90 gold. It guarantees at least 135 HP, even if you are so rich that the formula says it should buy you less than that.

Targets have the following values:

Target AC HP EXP
Guard 1 (by the entrance) -8 500 50
Guard 2 (by the gate, north) -7 500 50
Guard 3 (by the gate, south) -6 500 50
Guard 4 (center-north fountain) -5 500 50
Guard 5 (center-south fountain) -4 500 50
Guard 6 (throne room) -3 500 50
Jester -2 0 30
King -1 Infinite 1000
Merchant 0 0 25
Princess 1 0 10

Your approximate odds of missing an attack are:
50/(50 + Agility + WeaponPower + [TargetAC *3])

Killing the jester gives you a key to a random cell. Your inventory will show you whether it is cell 1 or cell 2.

Attacking the king performs this calculation:
Agility * RND(1)^3

If the result is greater than 50, then the king dies.

A guard’s attack has these odds of hitting you:
40/(Agility + ArmorPower*4)

Guard attacks inflict damage of 1/75th of your HP, plus RND(20).

Dungeon

Every mention of “level” here refers to the dungeon level, unless otherwise noted.

Ultima’s dungeons, unsurprisingly, have quite a bit of code from Akalabeth. The dungeon routine does involve a bit more data than Akalabeth, but not much. Monster stats are all derived from two hard-coded stats.

One big difference from Akalabeth is that dungeons always have ten levels, and the monsters are divided into five groups of ascending difficulty. Every two dungeon levels corresponds to one monster group, and may spawn any monster in that group.

First, here is a table of all monsters and their root stats. Four of the monsters, thieves, gelatinous cubes, gremlins, and mind whippers, will do special things when they hit you in lieu of doing damage if they can, and will damage you normally if they cannot.

Name Set MB MN Notes
Ranger 1 20 1
Skeleton 1 20 2
Thief 1 20 3 Steals your worst unequipped weapon
Giant Rat 1 20 4
Bat 1 20 5
Spider 2 25 1
Viper 2 25 2
Orc 2 25 3
Cyclops 2 25 4
Gelatinous Cube 2 25 5 Destroys your equipped armor
Ettin 3 30 1
Mimic 3 30 2 Looks like a chest
Lizard Man 3 30 3
Minotaur 3 30 4
Carrion Creeper 3 30 5
Tangler 4 35 1
Gremlin 4 35 2 Steals half of your food
Wandering Eyes 4 35 3
Wraith 4 35 4
Liche 4 35 5
Invisible Seeker 5 40 1 Invisible, but battle console works normally
Mind Whipper 5 40 2 50% chance of setting your intelligence to (Intelligence * 0.6 + 5)
Zorn 5 40 3
Daemon 5 40 4
Balron 5 40 5

Monsters of set X may spawn on level (X*2 – 1) or (X*2).

MB is a calculated value representing the difficulty of the monster group. It is equal to:
Set * 5 + 15

MN represents the monster’s toughness relative to other monsters in its group. Quest monsters are always MN=5.

MB and MN are used for a variety of calculations.

For the rest of the stats, I’ve split the tables up by level, since monsters have different stats on different levels. All stats here are presented as ranges.

Level 1

Name HP1 HP2 Att Dam Def EXP G
Ranger 10-10 15-16 3-12 2-2 1-2 1-5 9-17
Skeleton 10-11 15-18 3-12 2-3 1-3 1-10 9-17
Thief 10-12 15-20 3-12 2-4 1-4 1-15 9-17
Giant Rat 10-13 15-22 3-12 2-5 1-5 1-20 9-17
Bat 10-14 15-24 3-12 2-6 1-6 1-25 9-17

Level 2

Name HP1 HP2 Att Dam Def EXP G
Ranger 10-13 15-22 6-15 4-7 2-3 2-11 9-44
Skeleton 10-17 15-30 6-15 4-11 2-4 2-21 9-44
Thief 10-21 15-38 6-15 4-15 2-5 2-31 9-44
Giant Rat 10-25 15-46 6-15 4-19 2-6 2-41 9-44
Bat 10-29 15-54 6-15 4-23 2-7 2-51 9-44

Level 3

Name HP1 HP2 Att Dam Def EXP G
Spider 10-18 15-32 9-18 6-14 3-5.67 3-17 9-89
Viper 10-27 15-50 9-18 6-23 3-6.67 3-32 9-89
Orc 10-36 15-68 9-18 6-32 3-7.67 3-47 9-89
Cyclops 10-45 15-86 9-18 6-41 3-8.67 3-62 9-89
Gelatinous Cube 10-54 15-104 9-18 6-50 3-9.67 3-77 9-89

Level 4

Name HP1 HP2 Att Dam Def EXP G
Spider 10-25 15-46 12-20 8-23 4-6.67 4-23 9-152
Viper 10-41 15-78 12-20 8-39 4-7.67 4-43 9-152
Orc 10-57 15-110 12-20 8-55 4-8.67 4-63 9-152
Cyclops 10-73 15-142 12-20 8-71 4-9.67 4-83 9-152
Gelatinous Cube 10-89 15-174 12-20 8-87 4-10.67 4-103 9-152

Level 5

Name HP1 HP2 Att Dam Def EXP G
Ettin 10-34 15-64 15-20 10-34 5-9.33 5-29 9-233
Mimic 10-59 15-114 15-20 10-59 5-10.33 5-54 9-233
Lizard Man 10-84 15-164 15-20 10-84 5-11.33 5-79 9-233
Minotaur 10-109 15-214 15-20 10-109 5-12.33 5-104 9-233
Carrion Creeper 10-134 15-264 15-20 10-134 5-13.33 5-129 9-233

Level 6

Name HP1 HP2 Att Dam Def EXP G
Ettin 10-45 15-86 18-20 12-47 6-10.33 6-35 9-332
Mimic 10-81 15-158 18-20 12-83 6-11.33 6-65 9-332
Lizard Man 10-117 15-230 18-20 12-119 6-12.33 6-95 9-332
Minotaur 10-153 15-302 18-20 12-155 6-13.33 6-125 9-332
Carrion Creeper 10-189 15-374 18-20 12-191 6-14.33 6-155 9-332

Level 7

Name HP1 HP2 Att Dam Def EXP G
Tangler 10-58 15-112 20-20 14-62 7-13 7-41 9-449
Gremlin 10-107 15-210 20-20 14-111 7-14 7-76 9-449
Wandering Eyes 10-156 15-308 20-20 14-160 7-15 7-111 9-449
Wraith 10-205 15-406 20-20 14-209 7-16 7-146 9-449
Liche 10-254 15-504 20-20 14-258 7-17 7-181 9-449

Level 8

Name HP1 HP2 Att Dam Def EXP G
Tangler 10-73 15-142 20-20 16-79 8-14 8-47 9-584
Gremlin 10-137 15-270 20-20 16-143 8-15 8-87 9-584
Wandering Eyes 10-201 15-398 20-20 16-207 8-16 8-127 9-584
Wraith 10-265 15-526 20-20 16-271 8-17 8-167 9-584
Liche 10-329 15-654 20-20 16-335 8-18 8-207 9-584

Level 9

Name HP1 HP2 Att Dam Def EXP G
Invisible Seeker 10-90 15-176 20-20 18-98 9-16.67 9-53 9-737
Mind Whipper 10-171 15-338 20-20 18-179 9-17.67 9-98 9-737
Zorn 10-252 15-500 20-20 18-260 9-18.67 9-143 9-737
Daemon 10-333 15-662 20-20 18-341 9-19.67 9-188 9-737
Balron 10-414 15-824 20-20 18-422 9-20 9-233 9-737

Level 10

Name HP1 HP2 Att Dam Def EXP G
Invisible Seeker 10-109 15-214 20-20 20-119 10-17.67 10-59 9-908
Mind Whipper 10-209 15-414 20-20 20-219 10-18.67 10-109 9-908
Zorn 10-309 15-614 20-20 20-319 10-19.67 10-159 9-908
Daemon 10-409 15-814 20-20 20-419 10-20 10-209 9-908
Balron 10-509 15-1014 20-20 20-519 10-20 10-259 9-908

HP1 is the monster’s maximum HP if it is one of the initially spawning monsters when you enter. Minimum HP1 is always 10. The formula is:
RND(MN*Level^2) + 10

HP2 is the monster’s maximum HP if it spawned after you killed another monster. Minimum HP2 is always 15. The formula is:
RND(2*MN*Level^2) + 15

Att is the range for attack rolls. Minimum is always 3 * Level. The formula for attack rolls is:
RND(10) + 3*Level
But it will never exceed 20.

Your defense roll will be:
RND(Stamina/3) + 3*ArmorPower
There is no upper limit, but a 20 or higher is a guaranteed miss.

If the monster’s attack roll beats your defense roll, you take damage, or the monster uses its special attack move if it has one.

Dam is the range of damage the monster may do to you. The formula is:
RND(MN*Level^2) + (2*Level)

Def is the range for defense rolls. The formula for defense rolls is:
RND(MN + (MB – 20)/3) + Level
But it will never exceed 20.

When attacking, your attack accuracy is:
RND(Agility/4 + WeaponPower)

The monster’s defense is then rolled. If your accuracy beats it, then you hit.

Damage from your hits will be:
RND(Strength/5 + WeaponPower*3) + Strength/5

Ranged weapons have unlimited range, but don’t pass through traps, doors, or false walls.

If you kill a monster, another one, not necessarily of the same type, but always one of a type not currently in the dungeon, will spawn in a random unoccupied space, and will have HP in the range of the HP2 column.

XP is the immediate experience reward for defeating the monster. Minimum is always equal to Level. When you leave the dungeon, you will be granted HP equal to double all of the experience accumulated in the trip. The formula for XP is:
RND(Level * MN * 5) + Level

G is the gold reward. The formula is:
RND(Level^2 * 9) + 9

Each dungeon follows this template:



On level 1, the Up ladder will be in the top-left corner instead. You enter facing south.

On all even levels, the Up and Down ladders switch places.

On level 10, there will be no Down ladder.

When a level is generated, each yellow and orange spot will be a randomly chosen feature, according to these odds:
  • 10% nothing
  • 30% false wall
  • 50% door
  • 5% pit
  • 5% trap

Level 10 will not have pits or traps, but I don’t really follow the logic that replaces them with something else.

Then, chests, coffins, and fields will be placed. The total number of them will be equal to the level number, and they will be placed in random orange spots, or one spot below an orange spot. They will override any features already present, except for ladders.

Then, three monsters spawn, always of different types. They will be placed in random unoccupied squares.

Falling into a trap without possessing any rope & spikes descends you a level and inflicts RND(Level*10) + Level damage.

Pressing I when facing a trap will turn it into a pit.

Pressing I when facing a false wall will turn it into a door.

Opening a coffin will always be successful if the space in front of you is occupied.

Otherwise, there is a 60% chance of success. If it fails, then this logic follows:
  • Pick a random monster to spawn
  • If the monster type is not already present, then spawn it.
  • If it is already present, then there’s an 80% chance of repeating from the top, and a 20% chance of just opening the coffin.

Monsters spawned from coffins will die in one hit, but this will cause another monster to spawn somewhere in the dungeon with its HP2 hitpoints.

Non-thieves have a (50% + Agility * 1%) chance to unlock chests. Thieves are always successful.

A failed unlock does [Level] damage.

Gold from coffins and chests pays the same as any monster on the level.

Casting spells has a (50% + Intelligence * 1%) chance of success for non-clerics. Clerics never fail.

Prayer always fails in dungeons. It looks as though prayer was once meant to invoke a random spell effect, but Garriott may have intentionally disabled this. Or it could just be a bug.

Magic Missile has a range of 5 spaces, and always hits for (Wisdom/2 + 11) damage, rounded down. It won’t pass through traps, doors, or false walls.

Steal does nothing.

Ladder Down doesn’t work on level 10.

Blink takes you to a random unoccupied spot in the dungeon.

Create and destroy have a range of 1 square, and create only works if the square is unoccupied.

Kill has a range of 1 square, and just kills. Doesn’t matter what kind of monster it is.

Outside

Time passes 0.6 units with each keyboard command.

Moving consumes (0.5 – VehiclePower/14) food and advances time (1 – VehiclePower/7) units, plus the 0.6 time units for the keyboard command.

Each step on land has a 5% chance of spawning a monster group.

Each step in the woods or at sea has a 10% chance of spawning a monster group.

I haven’t been able determine the monster group size ranges, but each monster type has a fixed maximum group size, and the formula for group size is:
RND(1)^2 * MaxGroup

If walking away from an encounter, odds of escaping are:
1/7 + Strength*3/1400 + Agility*3/1400 + VehiclePower*(1/14 – Strength/5600 – Agility/5600)

If you fail, then you are stuck in place for a turn and the enemy gets a free round of attacks on you.


Monsters


Name Index Type Base HP EXP Def G
Ness creature 6 Sea 30-69 20 20 10-89
Giant squid 7 Sea 30-89 30 20 10-129
Dragon turtle 8 Sea 30-109 40 20 10-169
Giant octopus 9 Sea 30-129 50 20 10-209
Hood 10 Woods 30-49 5 15 10-29
Bear 11 Woods 30-69 10 20 10-49
Hidden Archer 12 Woods 30-89 20 20 10-89
Dark Knight 13 Woods 30-109 30 20 10-129
Evil Trent 14 Woods 30-129 40 20 10-169
Thief 15 Land 10-19 10 20 10-49
Orc 16 Land 10-29 20 20 10-89
Knight 17 Land 10-39 30 20 10-129
Necromancer 18 Land 10-49 40 20 10-169
Evil Ranger 19 Land 10-59 45 20 10-189
Wandering Warlock 20 Land 10-69 50 20 10-209


Sea creatures and archers may only be hit with ranged weapons.

Index is used for HP calculations.

Base HP represents the range of HP that the first monster in the group might have. This only applies to the first in the group; the rest will have much less.

The formula for sea monsters is:
RND(20*Index – 80)) + 30

The formula for woods monsters is:
RND(20*Index – 180) + 30

The formula for land monsters is:
RND(10*Index – 140) + 10

In addition, the first monster in the group will receive additional HP based on the amount of time passed.
+ RND(1)^2 * Time/100

That is Time/100, and not Time/1000, so the maximum bonus is roughly ten times your level.

Exp is a fixed amount, and I couldn't find where it is defined in the code, but it wasn't hard to determine from observation.

Defense is strangely coded. It’s programmed to be equal to EXP + 10, capped at 20. But Hoods are the only monsters weak enough not to hit that cap.

When attacking, your attack accuracy will be:
RND(20) + Strength/5 + Agility/5 + WeaponPower

If this beats the monster’s defense, you hit and do this much damage:
RND(WeaponPower + Strength) + 1

Firing vehicle guns always has an 80% chance to hit. Damage done is:
RND(10 * VehiclePower) + 30

If you kill a monster, and there are more in the group, the next one’s HP will be:
RND(1)^2 * PlayerLevel + RND(20)

When monsters attack, their attack accuracy, per monster, will be:
RND(15)^2

For your defense, variable ‘D’ will be set to ArmorPower/5, but not greater than 0.5. Your defense value per attack will be:
(D + 1.5) * Agility
But it will not exceed 80.

If the attack exceeds your defense, then you take a random amount of damage not greater than the monster’s EXP value. If you take multiple hits during a turn, you won’t see the damage per-hit, only the total number of times you were hit, and your overall decrease in HP.

Visiting landmarks that grant stat boosts will grant the following amount:
INT(9.9 – OldStat/10)

Spells do not have any random chance of failure outdoors.

Prayer has a 33% chance of each of the following effects:
  • If there are monsters present, kill them all (no reward). If not, lose 20 food if you have more than 20, and the next effect happens.
  • If you have fewer than 10 HP, set HP to 10. If not, the next effect happens.
  • If you have fewer than 10 food, set food to 10. If not, no effect.

To be clear, there is both random chance and conditional logic involved. There are three steps, but there's a 33% chance of starting on each step. Let's say there are no monsters, you have less than 10 HP, and you have 21 food. There's a 33% chance that we start on step 1, you lose 20 food, and then step 2 happens and your HP is set to 10. There's a 33% chance that we start on step 2 and you just gain HP. And there's a 33% chance that we start on step 3 and nothing at all happens.

Magic missile does Wisdom/2 damage. If you have an amulet, wand, staff, or triangle equipped, it does an additional WeaponPower*2 damage. This weapon bonus only applies outdoors.

The Kill spell kills one monster in a group.

Time Machine

Getting burned does 10% damage to your HP.

Ranged weapons have a range of 4 tiles. Distance is calculated with the Pythagorean Theorem.

Mondain spawns with 1000 HP. He will be alerted if you attack him or stand near him.

Mondain periodically gains 10 HP. I think this happens every round, but am not sure.

If Mondain is unconscious and the gem is still intact, he will at some point gain 25 HP and regain consciousness. Again, I think this happens every round after he is unconscious, but am not sure.

Your attack accuracy roll is:
RND(Strength/2 + Agility/2) + 3*WeaponPower

Mondain’s defense roll is:
RND(100) + 50
But it will not exceed 70.

If your attack roll beats his defense roll, then you hit for this much damage:
RND(Strength/5) + WeaponPower*3 + Strength/5

When Mondain’s HP drops to 500, he turns into a bat.

Mondain’s melee attack has a roll of:
RND(300)

Your defense will be:
Strength/3 + Agility/3 + Stamina/3 + ArmorPower*2

If his attack beats your defense, then he inflicts damage of 1/25th of your HP, plus RND(20).

If Mondain is outside of melee range, but less than 7 tiles away from you, then there is a 50% chance of a magical attack. He has three possible spells:
  • Magic Missile
  • Mind Blaster
  • Psyonic Shock

Magic Missile’s odds of hitting you are:
(1 – Agility/100)*(1 – Intelligence/100)

If it hits, it does damage to 1/500th of your HP, plus RND(100).

Mind Blaster has a 30% chance of reducing all of your stats by 10%. Otherwise it misses.

Psyonic Shock has a 30% chance of doing up to 5% damage. Otherwise it misses. Kind of a pathetic spell.

Your own spells have a 30% chance of failure if you are not a cleric. Clerics never fail. In this light, I think Mondain's spells were meant to have a 30% chance of failure too, but instead have a 30% success rate thanks to Garriott using the wrong comparison operator.

Your spells fail if you are more than 6 tiles away from Mondain.

Your magic Missile does this much damage:
RND(Wisdom + Intelligence)

The Kill spell doubles Mondain’s HP!

Taking the gem does 75% damage to your HP.

Thursday, September 12, 2019

Breaking Ultima

Having just beaten Ultima, I started reviewing the BASIC code, and came to realize that by not playing as a Wizard, I had missed out on some game content, as only wizards can cast the four most powerful spells in the game; blink, create, destroy, and kill.

So I decided to replay concurrently with reviewing the BASIC code. I had two goals here; explore the options available to a wizard, and use the inside knowledge of the game to break it as badly as possible. I called my wizard “Woz.”

Starting off, my playthrough was much like the previous one, since spells cost both money and EXP, and I didn’t have any quick ways to make either. I went to town, bought a mace, ropes and spikes, and a horse, and journeyed into the Unholy Hole to farm HP, EXP, and gold. The closer dungeon Montor had too many traps to be good for early farming.

One of the useful things I discovered about dungeons, through the code, is that you can press “I” to search for traps and hidden doors. And every wall that isn’t part of the basic dungeon template is, in fact, a hidden door.

Once I had accrued a bit of HP and gold, I returned to town to buy things. Then I discovered something very useful. You can throw gold into the ponds to get some good stuff!
  • The pond in town grants HP equal to 150% of the gold you toss in, plus 4 daggers
  • The large fountain in the castle grants points to a random stat for each 10 gold, to a maximum of 99.
  • The northern fountain in the middle of the castle grants a random weapon if you throw in at least 10 gold.
  • The southern fountain in the middle of the castle grants 5 food per gold, which is a way better deal than the 10 food per 4 gold that the towns were offering me.

I threw gold into the weapons fountain and eventually got a blaster. I think it took five tries.

Another thing I learned is that when donating gold to the kings, your HP reward depends not just on how much you donated, but on how little you had to begin with. The best possible reward comes from having exactly 90 gold in your pocket and donating all of it, which grants 270 HP, a pretty good amount for a newbie character.

But 270 HP is nothing compared to the 3000 you get for rescuing the princess, and all you really need for that is enough HP to survive the guard’s attacks (and to know how to outmaneuver them). With about 400 total HP, I was just barely able to pull this off, and was rewarded with an early game-breaking bounty of 3000 HP, 3000 EXP, and 3000 gold.

And even better, once you pull it off, you can go right back into the castle, and everything will be reset and ready for you to do it again. So I did it again.

One issue here is that when you murder Gwino the jester, you don’t always get the key to the princess’s cell. But you can check your inventory (you want the key to cell #2), and if it’s the wrong one, you can leave the castle and try again. 3000 HP is enough for plenty of tries!

Once I had succeeded three times, I dumped most of my 9,000 gold into the stat fountain. This maxed out my strength, charisma, and intelligence, but also set my HP to 99. Apparently HP is one of the stats you can “boost,” and it’s also subject to a 99 point limit should you exceed that through fountain donations. Not a big deal, I just bribed Lord British to boost it up with the gold I had left over. And then shot his jester right in front of his face and made a mad dash to the jail, guards closely behind, to rescue the princess again for more gold.

Another three successes and I was able to max out the rest of my stats with the 9,000 gold accumulated. It’s frustrating since it’s so random – once you’ve maxed out all but one stat, each donation only has a 1/7 chance to boost that last lousy stat, but it beats going back and forth between landmarks for hours.



I rescued one more princess for some spending money, and then went to town to buy a frigate, more rope & spike sets, plate mail, lots of magic spells (including the Wizard-only spells), and some food, which thanks to my high IQ, had dropped down in price to 10 rations per gold, now a better deal than the food fountain’s rates.

My first quest, to kill a gelatinous cube, was very easy thanks to my high stats and blaster. It still ate my armor.

I replaced it and sailed west to Shamino’s castle for the Balron quest, the most difficult of the king’s quests. It, too, was easy. I entered the first dungeon I saw, and used ladder magic to reach level 9. The kill spell worked as advertised, killing everything that I had to deal with.

I don’t think it’s necessary to describe the next stretch of gameplay in much detail. I did the two intermediate monster kill quests next and got the gem rewards, and didn’t bother seeking out landmarks or taking the associated quests. I was limited to using the frigate to sail between continents, because the air car and shuttle aren’t sold until you reach level 4, and one of the stranger gameplay features of Ultima is that levels are not attained through experience points, but by how much time has passed in-game. Equally strangely, levelling up grants no player benefits except for access to better items in the shops.

Right around the time that I completed the last king’s quest and got the fourth gem, I reached level 3, which is high enough to buy the best armor in the game (which I did), but not high enough to buy the shuttle. So I had to kill time, walking around the overworld on foot.

While walking around, I did experiment a bit with wizard spells. The kill spell kills one monster, but since monsters often attack in groups, it didn’t seem to be worth using, and besides, my blaster was making short work of them anyway. Magic Missile consistently did 49 points of damage, but my blaster usually did more than that, and even if it missed sometimes, having unlimited ammo seemed a better perk than never missing.

I reached level 5 this way, but then thought, why not reach level 8 even faster? Time passes outdoors with every keystroke command. So I maxed out the emulator’s CPU speed and kept my finger on the ‘A’ button, and watched as time passed and Woz effortlessly blew away monster after monster at warp speed. In a few minutes, periodically checking my stats, I had reached level 8.

Then I went back to town to buy a shuttle and do the Space Ace quest. I don’t think source diving could have helped much here, but this is a pretty easy gameplay segment. I made a map as I explored this time, so that I could avoid the trouble I had last playthrough of finding my way back home.

And back home, I rescued the princess yet again, and used the time machine.

Against Mondain, the Kill spell is a bad idea. It doubles his HP, which starts out at 1000.



Mondain’s melee attack will hurt, doing a little over 4% of your total HP. The “create” spell prevents this by putting a barrier between you and Mondain.



It’s not really necessary though, because the gemstone already provides a natural barrier that he won’t walk around, as long as it’s directly in his path toward you. “Destroy” will remove your own barrier if you want to for some reason.

Magic Missile did a lot more damage to Mondain than my blaster. Being a mage doesn’t boost the damage, but your stats do.



And I beat Ultima again, as a mage. In retrospect, the mage is the best class in the game, but only for the Kill spell, best used in dungeons. Create, Destroy, and Blink are all kind of pointless, and the mage gains no real advantage in casting the other spells except for a slightly higher starting intelligence, which is easily boosted with quests and the ponds.

Speaking of which, the ponds are a neat little secret, whose purpose is hinted at by the pubs, and it does feel like cheating, as it’s by far the better way of maxing out your stats and will get you the best weapons very early on.

On my next post, I’ll show the results of my dive into the Ultima code, with tables, formulas, and all that stuff.