[LZ-1] Very Simple Introduction to Hyrule Magic

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.

Goal: Fiddle with the opening scene of LttP, changing graphics, text, and object placement.

Now, before we get started, let’s verify that we have the same file.

On Windows:

  • Make a file named “Zelda3.hash” in the same directory as your ROM, with the contents:
  •        1a74468291b02729329dd1357afb45af *Zelda3.smc
  • Make sure you switch Zelda3.smc with your ROM’s name. You can download “Checksum” from this link. Install it and double-click on your .hash file. You should get a message that the checksum is valid.

On Linux:

  • Make a file named “Zelda3.hash” in the same directory as your ROM, with the contents:
  •        Jacksum: Meta-Info: version=1.7.0;algorithm=md5;filesep=/;encoding=hex;
           1a74468291b02729329dd1357afb45af Zelda3.smc
  • (Make sure to replace Zelda3.smc with your ROM’s name).
  • Install the “Jacksum” package:
  •        sudo apt-get install jacksum
  • …and run this simple check from the command line:
  •        jacksum -c Zelda3.hash
  • You should get an “Ok” message.

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

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

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:

[Name], you sneak out too much.[2]I've blocked the exit.[3]You can't leave now!

Then click the “Set” button. In the same way, change message 32:

[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.


[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

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

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:

       Color 8 from pink to yellow. (Did anyone else notice Link had pink hair?)
       Color 6 from orange to dark blue.
       Color 11 from green to matte blue.
       Color 12 from lime green to matte yellow.
       Color 2 from yellow to very dark red.
       Color 9 from green to a brighter green.
       Color 10 from green to a slightly lighter green than color 9.

This isn’t scientific; just pick colors you like, really. Now, save and load your ROM. Link’s makeover is complete:

Looks a Bit Like a Nightie...

Looks a Bit Like a Nightie...

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.
  • He allows you to climb onto house rooftops and hookshot between chimneys.

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.

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.



Filed under Uncategorized

15 responses to “[LZ-1] Very Simple Introduction to Hyrule Magic

  1. N00Br

    Hello, I have been reading your info and I find it VERY usefull. I am so happy that I coulod finda site that can tell m how to work this program!

    I am just starting out and I have a few questions.

    1. How do I make a number of torches open a door when lite and make them burn out after a period of time if I do not do light them fast enough.

    2. How do I change were link lands when he falls ina hole to a lower level

    Thats all I hope to hear from you

    P.S The o’s in my email are zero’s : )

    • sorlokreaves

      Hello~ thanks for your comments. First of all, I think torches burn out by themselves, automatically.

      I haven’t got a lot of free time at the moment, so you might want to take a look at the Perfect Guide:

      I’ll have a look myself this weekend, and get back to you. Until then, good luck!

      • N00Br

        Hello, Um sorry to bother you again but..what do I open the guide in I tried notepad, microsoft wordpad, and other programs but it does’nt seem to work or it will just a a whole bunch of numbers?

  2. N00Br

    Ok thanks for your help!!
    Sorry for the typos in the last comment!

  3. sorlokreaves

    You’ll need Adobe’s Acrobat Reader to open the Perfect Guide. I’m surprised you haven’t encountered pdf files before:

    I’ve figured out the answers to your questions. They are somewhat advanced, so I put them at the end of my “Intermediate” post:

    Note that holes always drop you off at the same X,Y position in the room you “fall” to. But you can easily change _which_ room they lead to, which should be powerful enough for your hacking needs.

    Good luck!

  4. N00Br

    Do you know were i can get the euclid’s addons editor thing? so i can edit bosses?

    Please I would be happy as always!

  5. link 7

    how does one make to put a chest? I choose F99 but I can nothing put at l’ interior

  6. Inuyasha0073

    Hi sry for bad endlish i need help how i make monsters stronger (i mean the streange of parallel worlds)