Blog Info: I wrote a short hack for Super Mario World a while ago using Lunar Magic. Like most hacks, it was unfairly difficult, gimmicky, and had rather long levels. That’s when I really appreciated the challenge of game design. Years, later, playing Portal, I was impressed by the impact of small, well-designed levels. And unlike my hack, the small levels had multiple solutions, so that lazy skilled players could innovate with some complex procedure while newbies had fun just figuring out the basic puzzle. And that’s when I turned my attention back to ROM hacking.

Back-story: ROM hacking really constrains your options. Zelda 3 has a fully-featured map editor, so you’d think that you have the power to re-arrange and re-create rooms like a giant jigsaw puzzle… except that some of the pieces must be in one place, and some of them will automatically re-write themselves with something else. So today, we’ll just take a very shallow dip into the waters of Hyrule Magic, and end with an extra-long discussion section in preparation for next week.

Normally I’d just post the valid file, but I’m not allowed to distribute it unless you also own Zelda3. Sorry for the inconvenience. By the way, if your checksum fails, you can still try editing the ROM in Hyrule Magic, with some chance of success. (For example, your ROM may be headerless).

Please note that Hyrule Magic can royally screw up your ROM. Sometimes this is your fault (i.e., loading an expanded ROM), sometimes it is a bug in the editor, and sometimes it’s a feature of the Zelda3 ROM (e.g., “whoops, that tile can only be used for doors”) and you have no idea how to undo such changes. For this reason, it is highly recommended that you keep rolling backups of your project files, even moreso than you would normally. I’m still looking for a VCS that handles binary files well, so for now I’d just recommend daily backups to USB and server-side backups every time you accomplish anything time-consuming.

A Note About Linux

As you might have guessed, we’ll be using Linux for this tutorial. Why, you ask? Well, first of all, because we can, and I want to be fair to all homebrew developers. Secondly, I’ve got a grand goal of making a totally portable, OS-included thumb drive, and that requires me to learn Linux. Don’t worry, you can follow this tutorial on Windows (I’ve tested it on both). Here we go! Moving Objects, Changing Message Text

Our goal today is a simple, shallow proof-of-concept hack. Copy the Zelda3 ROM to a new directory, then open Hyrule Magic, click “File -> Open”, and browse to the new copy. Once you open the ROM, a whole list of menu items will appear.

Tree-List of Options Available to You in Hyrule Magic

This list is a categorical view of all the data from the Zelda3 ROM that Hyrule Magic understands. Click on “Dungeons” and then double click on “Entrance 00”. Zelda3’s dungeons are set up in a grid-like fashion, and the first one just happens to be your Uncle’s house. You can click and drag various objects –try dragging the table in front of the door:

Dragging the Table in Front of the Door

Hit “Ctrl+S” to save your ROM and “Ctrl+F4” to close the dungeon editor window. Double-click on “Dungeons” to compress the list, then double-click on “Monologue” to edit the game’s text. Double-click on the line which reads:

[Name], I'm going out for a[2]while. I'll be back by morning.[3]Don't leave the house.

This is the first thing your Uncle says to you after Zelda’s message arrives in your head. The [Name] will be replaced by your character’s name. The [2] and [3] indicate where the second and third lines begin. Change the text to read:

[Window 02][Speed 03]Help me...[2]I am in the dungeon of the[3]castle.[Waitkey][Scroll]I know there is a hidden path[Scroll]from outside of the castle to [Scroll]the garden inside.

…to:

[Window 02][Speed 03][2]Zelda here... [3]didn't you learn how to jump?

Save your ROM (Ctrl+S) and close Hyrule Magic. You can now test the Zelda3 ROM you just hacked. Zsnes works on most Linux boxes:

zsnes /media/Windows/myProject/Zelda3.smc

…or just open Zsnes and browse to the ROM. Go through the opening sequence; boy you’re stuck now!

Link's Uncle Can Walk Over the Table, But Link Cannot

Palette Hacking

Well, that was fun; let’s do one more quick hack and call it a day. Open your ROM in Hyrule Magic, and expand “Palettes”, then “Clothes”, then double-click “Clothes pal 0”. Like most SNES games, Zelda3 stores each pixel it draws by reference to a “palette”. If you were to change, say, the “white” color referenced in the “sword” palette, that would affect every white pixel in Link’s sword. Right now, we’re going to change the color of Link’s clothes. You should see:

A Swath of Colors Used to Paint Link's Character

Count the colors from the left: “1, 2, 3…”. So color “5” is black. You can change a color by single-clicking on it and choosing a new one. Change the following:

You may have noticed that Link’s face gets all messed up if you pull something. This is not a bug; when we changed orange to dark blue, we affected more than just the trim on Link’s hat. If you were serious about changing Link’s color scheme, you’d probably have to edit the pixels which make up Link’s graphics in addition to the palettes.

Go make yourself a sandwich –or a coffee– we’ll be back after a short break.

Required Reading

You can skip this section if you like; it’s about game design, not hacking. But I think you should read it. Yes, you have to. That’s right.

While you eat your sandwich and drink your coffee, think about your target audience. Realistically, the only people who’d want to play your hack are ones who’ve already beaten Zelda3 multiple times. Probably, you’re one of these people too. So how can you cater to their particular needs?

Well, for one thing, the castle gets pretty boring after you’ve played the later dungeons.

We’re going to use a tried-and-true method of Zelda power-questers today: we’ll deny the players use of the sword for the first bit of the game. The lantern, unfortunately, is a pretty lousy weapon, so let’s give the player some arrows; that should allow for some interesting puzzle construction. But what should we do about Link’s uncle? I see two possible solutions:

The Hacker’s Solution: Scan the ROM and determine the code which gives Link the sword. Switch it so that Link’s uncle gives him the bow. Perhaps alter his sprite to be holding the bow, too.

The Storyteller’s Solution: Just give the bow to Link at his house and delete his uncle in the palace basement; the story can be molded to fit around this.

I’m inclined to go with solution number two —it opens up a lot of creative possibilities. Solution 1 is a bit show-offy, and it doesn’t really fit so well into the story for Link’s uncle to give him anything except a sword. At this point, it’s good to brainstorm and consider a few potential trip-ups, and some tentative solutions (lest we back ourselves into a corner).

Will Link Meet His Uncle Later? Maybe, but we won’t be able to have him in his “wounded” state giving Link anything, since this glitches the game after Zelda is rescued. We have his walkabout graphic; maybe we can replace one of the villagers with him. Or, we can have a mutant in the Dark World say he’s him. Or, we can change the ending credits from “Your Uncle Recovers” to “Your Uncle is Found”.

Why Does Link Have a Bow in His House? Maybe he’s a hunter? Actually, it makes a lot more sense for him to have a bow than a sword. Maybe we can change the general feel of Zelda3 to be more “woodsy” and less “running from the law”.

What About the Game Text? Link’s uncle can say anything; even the same message he says now. Zelda’s second message is easy to replace; something like “Half past the hour; all citizens to bed!”. The first message is tricky. We can have Sora Link monologue (“I’ve been having these… weird thoughts lately.”). Or, we can have him dreaming of his Uncle scolding him for playing around with his bow. Be creative.

Will Link Be Able to Get the Sword Later? This is a very good question, especially if your Uncle can never give you the sword. Can you put it in a chest? At the very least, you can get the Master Sword, so that’ll be our backup.

This was a bit of a digression, but I wanted to impress the importance of thinking creatively and creating a world of your own. The hacker’s solution is elegant, but it actually creates a game that “feels” wrong. The lantern was added to your house to make it feel like you were heading out into the rain, to rescue a princess from some unspecific evil. I’ve always felt this was poorly done in the original game. Grabbing your bow and rushing out into the rain is a lot more romantic. (Stumbling upon your uncle and nabbing his bow is… a non sequitor.)

Even if you were the best ASM hacker in the world, you still shouldn’t desire to change everything. At that point, you might as well just develop an entirely new game. Rather, you want to make a game that plays like Zelda3, but feels totally different. I always take the Quest for Calatia as my inspiration. Here are two innovations this developer makes:

He uses different trees and houses to imply that Calatia is a colder country.

Those two simple changes really expand the player’s mind as he is exploring. He feels like the fully-equipped link from Hyrule exploring a place which forces him to adapt his strategy.

Another example of great innovation uses ASM:

Someone modified the game so that you can throw bombs in eight directions, and can throw them either a long distance or a short one.

This mod subtly changes the nature of bombs into something much more utilitarian. I’m sure you could come up with all sorts of puzzles involving bombs and moving platforms, or switches that must be bombed simultaneously.

Credits
My early blog entries on Hyrule Magic owe a lot to Orochimaru’s Perfect Guide to Zelda 3 Editing, an in-depth handbook to using this complex and sometimes non-intuitive editor. Feel free to refer to the Perfect Guide on your own time –it’s got lots of great info.

Post Posting Post: Looking at my dashboard, it seems that a lot of people are finding this post after searching for sprite editing. Like “how do I edit Link’s graphics”? instead of just his palette. Believe me, I understand the frustration of getting no good hits on Google. So, I promise to add some sprite hacking to my next tutorial. I can’t just tell you now, since a lot of the graphics in Zelda are compressed, so it’s more complex than that, and I’m in the middle of another RPG Maker article at the moment.

Hello,
You have to be on the right layer for chests. You might consider reading my other two blog posts, or the Perfect Guide; they explain the process in more detail. (Sorry, I’m on an airport computer at the moment; no time for a full explanation.)

Ok, I’ve got more info now that I’m back:
1) Open Zelda3 in Hyrule Magic.
2) Click on “Dungeons”, then “Entrance 01″.
2.5) Right-click on the chest already there and choose “Remove”.
3) Right-click somewhere and choose “Insert an object”.
4) Browse to F99 and choose “Ok”.
5) Left-click on the chest you just inserted and press +
6) Continue pressing + until the name of the item changes to what you want.