The Let's Play Archive

Wizardry: Proving Grounds of the Mad Overlord

by Chokes McGee

Part 9: Bonus Feature: The Breaking of Wizardry!

Bonus Feature: The Breaking of Wizardry!





Hey, thanks for sticking around! No pithy character banter here, I'm afraid. This'll be almost all technical info. Still, hopefully you'll find it interesting.

There are obviously some things from the LP which didn't really happen in-game. For example, Sternn and Hanover didn't just up and buy Boltac's. (Or did they?  they didn't ) In this update, we'll show you the techniques we used to shatter the game into tiny little pieces. The rest was just weaving an amusing narrative around it. Smoke and mirrors, baby!

(Except for having over 500k gold, that was a real thing that happened. I told you, at some point you just don't need to spend money any more.)


Entry-Level Cheating: Know Thy Enemy

The first step to breaking Wizardry is to learn what version you have. In many cases, this will be stunningly obvious. If you can't tell what computer/OS your emulator is using, you probably ought not to be using it. Where it gets dicey is if you're playing the PC version. There are two versions available for DOS. One is the original, unfiltered code from the 80s. The other is the so-called "Ultimate Archives" (or "gold disk") edition, featuring a new and (so-called) improved codebase. If you're playing it out of Dosbox, you more than likely have the Ultimate Archives version. I'd peg the chances at 95%, but according to Wizardry's RNG, the second one of you to play would immediately have an older version.

Nope, I'm not bitter about that Amulet of Makatino. Why do you ask?

So, why does the version matter? Well, not counting the classic exploits we've been using all LP, there are two main cheats in Wizardry. One requires you to have the old codebase, which isn't available in the Ultimate Archives version. To explain why we need the original codebase, we need to delve into some basic coding. Don't worry, it won't hurt. It may even be fun.


"LOL" -Aristotle to Trebor, 1981

Wizardry was originally written in BASIC (don't laugh, it was still hot stuff back in the 80s). According to Wikipedia, the game was slow as a butt when it was done, so they had to port it to Pascal. I imagine this was a fairly grueling decision, since Pascal was not a common language back then. There's not a whole lot of difference between the two, but Pascal's a lot closer to C than it is to BASIC.

tl;dr: The codebase got rewritten from a simple language to one that's similar but more complex.

Why is this a big deal? Well, for one thing, it helps explain the unfinished feel to the game. I'm not sure if anyone noticed this, but the Key of Gold just kind of ... disappeared halfway through the LP, never to be talked about again. There's a reason for that. You never use it. After jumping through all the hoops to get both statues and fumbling your way around in the dark, you get what is essentially a useless item. Also, after Floor 4, the floor panels never seem to activate. I still have yet to get any of them to do anything. As far as I can tell, they never have done anything. And all that without getting into how uneven Trebor's side quest feels and how you can essentially beat the entire game without ever setting foot in his office... This game definitely had some issues that weren't caught during playtesting.

I am wildly speculating here, but I'm fairly certain the reason for all this is that Greenberg and Woodhead just flat ran out of time and space. Games back then didn't have the fancy "memory" crap the kids are using nowadays. We had a stack space and a heap, which was 640K if we were lucky, and we had to program them uphill both ways in the snow. And don't even get me started on the C64. Do you like POKE and DATA statements? No? Too goddamn bad.

Ahem.

Anyway, the point is, if you run your memory space out, you're done. There's ways around it, but they're all sloppy as hell. (True story: I made a QuickBasic game once that chained across six EXEs. You... had to reboot the computer after you were done playing.) Greenberg and Woodhead were out to deliver a quality product, so I assume they had a hard choice before them—ship it as is, delay the whole thing again (after having delayed it two years already due to the Apple II being a piece of crap), or put in some really unpalletable hackarounds. I know which one I'd pick, and it's apparently the same one they did.

You also have to keep in mind that the content they already had working was fairly impressive by 1981 standards. The first four floors or so are instantly recognizable to anyone who's played Wizardry, and it serves as a teaser to what might have been. (Wizardry II does a lot more with this, but it's also only six floors.) Wizardry was one of the first games to do the things we all take for granted in RPGs. Sure, it's essentially a 2nd Edition D&D handbook with some monster pictures thrown in, but can you imagine a world where dungeon crawling is a new and revolutionary concept? Probably not, but at one point and time, it was. I was lucky enough to be six around that time, and it was fucking magical to discover this game. It's not hyperbole in the slightest to say it set the mold.

But I digress, and that has nothing to do with cheating.

In the process of converting the code from BASIC to Pascal, there was an innocent little statement they didn't get quite right. I imagine it was meant to go something like this:

code:
if (ch >= '1' and ch <= '8') then
begin
...
And what actually happened was something like this:

code:
if (ch >= '1' or ch <= '8') then
begin
...
Do you see the difference there? No? Well, let me highlight it.

The first one limits a character keypress between 1 and 8.
The second one is a botch that accepts any key on the keyboard.

And that leads us directly to our first cheat.


The Bishop Hack

In the final chapter of the LP, The Bishop gains 100,000,000 experience out of nowhere and promptly shoots up to Level 62. Fun fact: Yes, I had to sleep at the Stables 61 times to get that effect. I thought about going further, but the game started to lag badly—hence his comments to Nico about "risking breaking the world." It was getting slower and slower, I couldn't stay at the inn without gaining him another level, and I was pretty sure if it went on long enough it would crash the game and I'd be fucked.

But anyway, where did all that experience come from?

Remember our earlier statement: A check that was meant to keep everything but 1-8 out accidentally let in every key in the game. This wreaks all sorts of havoc on the code contained by the if statement, which apparently shifted bits instead of mathematically changing values. (Makes sense, as they were ultimately going for speed.) I'm not real sure about the details, and I'd need to see the actual code to know what the fuck happened, but somehow this leads to the Bishop Hack.

To do the Bishop Hack, get yourself a bishop. Any bishop will do, though we do recommend Terry Jones if he's available. Now, plop an item into his inventory, go to his (I)nspect screen, and choose to (I)dentify. The game will ask you to pick a number between 1-8.

But fuck that, you're smarter than everyone else, and you know the Bishop needs a challenge. So, try to identify slot #9 instead. You may have to try very hard, but watch what happens when you succeed. That's right—one hundred million XP. *pinkie*

This is such a clever-sounding fourth wall thing ("Holy shit, you identified a key on your player's keyboard! You must be a god among men!") that no one even entertained the notion it was a huge fuckup on the part of the coders. By the time the PC version came out, the Bishop Hack was so well known and loved that the designers flat refused to put in a fix. The best part was the effects weren't limited to just 9. Many neckbeards could (and did) spend time researching what various keys did until they could play the game like an organ.

For some reason unknown to gods and men, the Ultimate Archive version released in the 90s is a huge fucking killjoy that patches out the Bishop Hack. Also, the NES, etc. versions are clearly not written in Pascal and lack the apparatus to do the Bishop Hack, let alone the flawed code. I'd say Wizardry without the Bishop Hack has no right to call itself Wizardry, but then again, I apparently did the entire LP on an Ultimate Archive copy. You have no idea how pissed I was when I hit smugly hit 9 to unleash the hounds and the game merely beeped at me.

What's that? How did the Bishop get all that experience, then? I had to simulate it to the best of my ability.

Hold on to your bowlers, gents, because I'm about to get into the real meat of Wizardry cheating.


Behold the Power of Hex

Yup, that's right. I haxx0red the Gibson.

A quick caveat before I begin: Someone earlier in the LP thread made me promise not to hex edit unless I used DEBUG.COM. This simply isn't possible. DEBUG (MS DOS's built-in assembler and hex editor) was made to work on 64K COM files. Sure, you can load the first page from a random file—but to go beyond that, you actually have to pinpoint the exact sector/track that your data lays on. In this day and age, it's simply not feasible to do that, especially on DOSBox. So, I did try, but it's just not happening. Sorry!

Anyway, it didn't take long after Wizardry came out for curious hackers to start taking it apart. Six years after the game's release, Rob Hall dissected the scenario disk data in issue #40 of Computist magazine. (I'm sure others had done it, but this is the first one that came up when I Googled, so that's the source we're using.) Now, back in the day, hard disks didn't really exist. People still used 5 1/4" old school floppies, which is why you'll see constant references to "scenario disks" while playing the game. If you've never had the pleasure, they look like this:





...quite possibly down to the shitty label in the upper left that says "Documents." You're not fooling anyone, that's stuffed full of that start with hackscreens which say things like "SHOUTOUT TO WEST KOAST KODE KREW AND DRAGONZZZZZZZ" while flashing enough to give any epileptic within five miles a grand mal seizure. Anyhoo, files were handled a bit different on those things, which—and this is awesome because it all ties together—is why DEBUG handles things in sector/track format instead of relative byte format. I'm not really sure how else to describe it, other than the scenario disks for Wizardry had one huge file that took up the entire disk. Essentially, the entire disk was the file.

Ponder that one for a while.

Wizardry Archives, in an attempt to make things more playable for the modern user, simply uses DSK files to simulate a scenario disk. (This is probably why the rewrite was done, though why they didn't artificially preserve the Bishop hack is beyond me.) Since we live in kindler and gentler times, you don't have to worry about sectors, tracks, and fucking up your entire scenario disk by getting something wrong. All you need is a hex editor, a multiple-base calculator, and the information provided by Hall.


Hacking for Dummies

At the time of this writing, Hall's full article is preserved here. In case it goes away, or in case you just want the important stuff, I'm going to give you a rundown. We'll be using XVI32 as our hex editor and Speedcrunch to do our conversions. I'm sure some of you can do them in your head, but some of us are hardwired for decimal. :P

Anyway, to edit a character, launch XVI32 and crack open your scenario disk. (It goes without saying, but if you value your characters at all, back up your fucking disk. Really, it's just a COPY statement, people.) Now, do a Ctrl-F and search for a text string of your character's name in all caps. It must be all caps; that's how Wizardry stores it, and case sensitivity is important with raw bytes.





Once you've found the name, back up one byte, then hit "Address -> Remember Address" from the menu.





The reason you're backing up a byte is that Wizardry stores its strings old school; that is, a one-byte length followed by a fixed allotment of characters. The important thing is that you start from the right space, because we'll be using it to count off bytes.

Now that you've got the starting space, it's a question of what you want to accomplish. Here are some of the more frequent addresses you'll be working with:

code:

$24								Class
$2C								Statistics
$34								Gold
$3A								Equipement
$7C								Experience
There are others, like hit points, spellbook, and even statuses. If you're quick on the draw, you can even get back a LOST character this way. We'll just focus on the above stats, though, since that's what most folk will be interested in.

Once you know the address of the attribute you want to change, it's time to go hunt and peck. You can count it off proper-like, or you can just guess randomly. Either way, to see which address you're at relative to the starting byte, pick "Address -> Display Difference." Important: You want the number for hex.





Here, in the screenshot, we can see we're at $24—the address for character class. Here's the table for corresponding values.

code:

$00								Fighter
$01								Mage
$02								Priest
$03								Thief
$04								Bishop
$05								Samurai
$06								Lord
$07								Ninja
Sure enough, the highlighted value is $06, as Justine is a Lord Lady.

Gold and XP are a little tricker, as they're multibyte values, plus they require some massaging. Wizardry doesn't store its values in straight up sequential format and prefers to scramble them around a bit. (I assume it's to make things harder to hack/exploit, but I don't really know.) Let's say, for instance, we want to read Justine's experience. According to XVI32, it's:

code:
$5221220000
Yeah, I know. The tech geeks in the audience right now are screaming they know what that is. Trust me, you don't. From Hall's column:

code:

$7C						1st Nibble: 16s
									2nd Nibble: 1s
$7D						1st Nibble; 4096s
									2nd Nibble; 256s
$7E						1st Nibble: 160000s
									2nd Nibble: 10000s
$7F						1st Nibble: 40960000s
									2nd Nibble: 2560000s
$80						1st Nibble: 1600000000s
									2nd Nibble: 100000000s


What does that gibberish mean?! Well, don't be too intimidated. All you need to know is that a "nibble" is a single number or letter in hex. So, to get Justine's experience:

code:

$5221220000

5				x 16												=     90
2				x 1													=      2
2				x 4096										=   8192
1				x 256											=    256
2				x 160000								= 320000
2				x 10000									=  20000
0				x 40960000 
0				x 2560000
0				x 1600000000
0				x	100000000

																					SUM:  348540
And if we check in-game:





Not too shabby, huh? Also I have no idea who would ever play this game enough to get 1,600,000,000 experience.

Obviously, you just reverse the process to grant experience; just start with the biggest numbers you can fit into your target and work your way down, then plop in the resulting hex. $0000000001 is 100,000,000 XP, by the way, which is what we gave The Bishop. It's a curious value that points to bitshifting as the culprit behind the Bishop Hack, but that's a discussion way outside the scope of this update.

Statistics are much more fun to tweak, although they're even more complicated. They're diced up at the bit level instead of the nibble level, so it's a major pain without Speedcrunch. To get statistics, lift the four byte value at $2C-2F (again, using Justine's):

code:
$87096C14
Ram it through Speedcrunch's BIN() function to get the binary equivalent:





Strip off the "0b" (it's just Speedcrunch's notation for binary) and add zeros on the left side until it's exactly 32 characters.

code:
10000111000010010110110000010100
This next part is the tricky one. To get the bit breakdown of each stat:

code:

Strength			4-8
IQ									15-16 + 1-3
Piety						10-14
Vitality			20-24
Agility				31-32 + 17-19
Luck							26-30
This is count from the left, starting at 1. Note that there's FIVE bits, not four. (The stats have to go up to 18, after all.) Now combine the indiviual bits as shown above:

code:

Strength			00111
IQ									01100
Piety						00010
Vitality			01100
Agility				00011
Luck							00101
Use DEC() to convert back in Speedcrunch, and you get Str 7, IQ 12, Piety 2, Vit 12, Agi 3, Luck 5, not to mention an explanation as to how Justine was so terrible late game. Checking the screenshot confirms our math.

Again, to put values in, simply reverse the process, convert the resulting binary into a four-byte hexadecimal number, and shove the value in at $2C. You'll note bits 9 and 25 aren't used; therefore, they should always be zero.

Equipment is mercifully straightforward. $3A is the byte that tells you how many things you have, and it'll be $00 to $08. $3B will always be zero. $3C starts your actual inventory; you have eight spaces, and each space takes up 8 bytes. There's bits you can twiddle to equip, de-equip, etc. but we don't really care about those. To give your guy an item, make sure $3A is set to the right amount of items, then drop the following value into the appropriate "slot":

code:
$000000000100xx00
Where "xx" corresponds to one of the following values:

code:

xx			Item
01			Long Sword
02			Short Sword
03			Anointed Mace
04			Anointed Flail
05			Staff
06			Dagger
07			Small Shield
08			Large Shield
09			Robes
0A			Leather Armor
0B			Chain Mail
0C			Breast Plate
0D			Plate Mail
0E			Helm
0F			Potion of Dios
10			Potion of Latumofis
11			Long Sword+1
12			Short Sword+1
13			Mace+1
14			Staff of Mogref
15			Scroll of Katino
16			Leather Armor
17			Chain+1
18			Plate Mail+1
19			Shield+1
1A			Breast Plate+1
1B			Scroll of Badios
1C			Scroll of Halito
20			Staff+2
21			Dragon Slayer
22			Helm+1
27			Jeweled Amulet
28			Scroll of Badios
29			Potion of Sopic
2A			Long Sword+2
2B			Short Sword+2
2C			Mace+2
2D			Scroll of Lomilwa
2E			Scroll of Dilto
2F			Copper Gloves
30			Leather+2
31			Chain+2
32			Plate Mail+2
33			Shield+2
34			Helm+2 (E)
35			Potion of Dial
36			Ring of Porfic
37			Were Slayer
38			Mage Masher
39			Poison Mace
3A			Staff of Montino
3B			Blade Cuisinart'
3C			Amulet of Manifo
3D			Rod of Flame
3E			Chain+2 (E)
3F			Plate Mail+2 (N)
40			Shield+2 (E)
41			Amulet of Makanito
42			Helm of Malor
43			Scroll of Badial
48			[s]Arm Bar[/s] Dagger of Speed
4F			Breast Plate+2
50			Silver Gloves
51			Long Sword+3 (E)
52			Short Sword+3 (E)
53			Dagger of Thieves
54			Breast Plate+3
55			Garb of Lords
56			Murasama Blade!
57			Shuriken
58			Cold Chain Mail
59			Plate Mail+3 (E)
5A			Shield+3
5B			Ring of Healing
5C			Priest's Ring
5D			Ring of Death!
5E			Amulet of Werdna
The above table is not complete, of course. Left out are the cursed items and key items—Ring of Death! not withstanding, because that exclamation point never gets old. Of note is the Mage Masher. This is the original Mage Masher, a good 10+ years before Final Fantasy even got off the ground. Also, notice how much of the top tier equipment is Evil only. Sometimes I wonder if this game has an agenda.

So, once again looking at Justine's stats:





The highlighted byte is $3A. We can see she has 6 pieces of equipment, which are as follows:

code:
$0100000001005500
$0100000001002200
$0100000001005A00
$0100000001005000
$0100000001005B00
All we care about is:

code:
$55
$22
$5A
$50
$5B
Looking it up in our table, she has the Garb of Lords, Helm+1, Shield+3, Silver Gloves, and Ring of Healing. Again, a quick glance at her equipment in previous shots confirms this.

And that's pretty much it! I used a simulation of the Bishop Hack to pump up the Bishop, then used hex editing to give them whatever gear I liked. The rest was just letting the chips fall where they may. I decided not to tweak their stats in the end, because I wanted the game to provide some amount of resistance in order to keep the LP interesting.

Clearly, that did not go as planned.


Conclusion

There's not a whole lot left to say now. As much as I complained the whole way through, I'm going to let you in on a dirty little secret: I really, honestly love this game. It's one of the few of my childhood that just wowed the fuck out of me every time I got my hands on it. At six I was trying to figure out how it worked, at 16 I was finally trying to beat it, and now at 31, I'm hoping to spread the joy.

Let's put this in proper perspective. This game is 30 years old. Thirty. The mechanics were so groundbreaking that it's instantly familiar and comfortable for any retro gamer to play. If you didn't know this was literally the first game ever to do it, you'd take it for just another poorly done dungeon crawl from the mid-90s. This and Bard's Tale were games that tortured me as a kid, not because the degree of difficulty was so damn high—it was, don't get me wrong—but because they were just so fascinating that I had to figure out their innermost secrets.

Now that we have maps and GameFAQs and discussion boards, of course, the whole thing seems a bit flimsy. But when you're bumbling around underground with no sense of where you're going, no clue of what you're supposed to do, and fighting groups of monsters where death is just a few unlucky turns away... it's a different experience than today's games. Not necessarily better, mind, but different.

So, that's my LP. I hope you've enjoyed this big blargh of , in addition to the LP itself. In many ways, Sternn and Wizardry were a perfect marriage, however accidental—Wizardry and the Heavy Metal movie are two of the things that influenced my sensibilities the most as a teenager. If that makes me a comically stereotypical neckbeard, then so be it. In a lot of ways, this was a love letter to one of my favorite RPGs, and I hope it's brought more people's attention to this oft-overlooked classic.



But enough sentimental crap, the LP is over!

LET'S DANCE!



ERRY
DAY
I'M
SHUFFUL
IN







—Fin, for reals.