News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Zelda II Editor - Sword II - Work in Progress  (Read 7546 times)

Trax

  • Hero Member
  • *****
  • Posts: 517
    • View Profile
    • Trax ROM Hacking
Zelda II Editor - Sword II - Work in Progress
« on: June 12, 2016, 07:20:59 pm »
Once again, I got my Zelda II editor out of the mothballs, renamed it Sword II (to be logical with Sword I, Zelda 1 editor), and added a bunch of new features, including the essential Side View Editor. The XCode project has been updated to compile for Mavericks (10.9) and above. The last working version (1.14) was older than I thought. Not everything is completely functional, but at least the major foundations are now in place...

The Overworld has pretty much every major feature needed for a thorough hack. Key Areas can be moved, and all attributes can be modified. You can see connections between areas, when applicable, even when an area has more than one connection, like in Death Mountain...

You can select from the 4 major regions, and from the 62 areas in each region. When you select an individual Key Area, you can go directly to the corresponding Side View in the Side View Editor window...

The Brackets tool, which is used to cut a terrain strip short (essential for correct placement of the Hidden Palace and Hidden Town), has been corrected, as it didn't show brackets on the far right side of the map...

Palettes can be modified. You can change individual colors on the 4 background palettes, and assign any palette code to the 16 types of tiles...

Little bonus things to add to the Overworld Editor would be:

- A graphics editor, for the 16 tiles (although a regular tile editor is enough)
- Demons configurations (if I can understand how they work)
- Option to change the height and/or the width of the map
- Option to change the height of the limit between "north" and "south" in each region (this makes enemy sets different in random battles)
- Sprite palette editor (meh)

The Side View Editor is now in place and shows all background tiles correctly. You can choose from the 8 great regions in the game. You can assign any "data sets" to any area index, as well as enemy sets. All objects can be changed. including collectable objects. You can also switch between the 2 possible objects sets. Enemies are fully editable...

You can move between connected Side Areas with the arrows in the lower left corner of the Side View Editor window. The numbers there are the destinations for each direction. Most areas in the Overworld are singletons, so they have the value 3F, which means "return to Overworld"...

At the bottom of the window, you can control all the necessary attributes, like tile set, palette code, background map, etc. You can change the area's width and whether it has a ceiling...

Enemy Sets can be selected and individually modified in the Enemy Sets window. The tricky thing is that an enemy set can be assigned to more than one area, just like map data. This means if you edit an enemy set, it will appear modified in any area linked to it. The Side View Editor lets you edit enemy sets with all the precision needed for enemy position...

Individual enemies can be modified in another window. Here you can change its color, HP, experience, damage, and many other attributes. The gray box is supposed to show the enemy sprite. The universal experience table can be modified as well...

Other things to do:

- Background Map editor
- Option to change the area indexes of random battles

The Game Data Editor is in a redesign process. Link's stats for Attack power, magic and experience levels were moved into the same window.

The dialog editor now shows a replica of the dialog box, so you can see exactly what you see in the game.

Things to do:

- Add other text data, like intro text and ending credits
- Include enemy AI variables (a truck load of them)
- HUD editor, maybe

Any questions ?

SunGodPortal

  • Hero Member
  • *****
  • Posts: 2921
  • 2 + 2 = 5
    • View Profile
Re: Zelda II Editor - Sword II - Work in Progress
« Reply #1 on: June 12, 2016, 07:34:45 pm »
This looks pretty damn awesome.
War is Peace. Freedom is Slavery. Ignorance is Strength.

IcePenguin

  • RHDN Patreon Supporter!
  • Sr. Member
  • *****
  • Posts: 275
    • View Profile
Re: Zelda II Editor - Sword II - Work in Progress
« Reply #2 on: June 12, 2016, 08:42:06 pm »
This is the most amazing thing ever!  Very cool Trax!   :thumbsup:  Can't wait to try it out!

shadow501

  • Full Member
  • ***
  • Posts: 185
  • Pro Hex Editor
    • View Profile
Re: Zelda II Editor - Sword II - Work in Progress
« Reply #3 on: June 12, 2016, 08:45:56 pm »
Nice work man  :thumbsup:

Disch

  • Hero Member
  • *****
  • Posts: 2743
  • NES Junkie
    • View Profile
Re: Zelda II Editor - Sword II - Work in Progress
« Reply #4 on: June 13, 2016, 12:09:20 am »
OSX?  Coolio -- there's not enough tools for non-Windows platforms.

Is it strictly OSX or will it be cross platform?

Grimlock

  • Sr. Member
  • ****
  • Posts: 361
  • Graphics Artist, Level Designer
    • View Profile
Re: Zelda II Editor - Sword II - Work in Progress
« Reply #5 on: June 13, 2016, 01:58:37 am »
Looking pretty slick Trax!  I wish there were a way to run your apps on Windows.  Anyone know of an emulator for OSX on Windows?

Here's my (copy/paste) wish list from a post I did at Board 2 about a year ago (njosro's project thread) (might give some ideas for you):

Palette editor
Over world editor (allow modification of tile properties (what's solid, water and such) would be a nice bonus)
Side scroll editor (tile properties modification? (same idea)) (Allow placement of enemies + add/delete)
Item location editor (where found, allow start with items)
Magic editor (names, locations found, and usage cost, start with)
Enemy damage values (and other similar values)

The fancy stuff Santa probably won't bring:
Incorporate ROM expansion in editor to allow greater design freedom (new mapper?)
 (A built in .ips patch is applied to a vanilla ROM)
Split dungeons into separate graphics and music (so each can be unique)
Modify over world to allow additional tiles to be created/used by the user
Modify dungeons to allow additional tiles, combos (16x16) to be created/used
Music editor (even a simple text based like Metroid Tuner would work great)



PresidentLeever

  • Hero Member
  • *****
  • Posts: 639
    • View Profile
    • Mini-Revver
Re: Zelda II Editor - Sword II - Work in Progress
« Reply #6 on: June 13, 2016, 09:29:54 am »
Looks great. Are you planning to add a physics/controls editor for Link or the enemies?

Edit: Yeah I'm also wondering about Windows functionality, and when there will be a download link?  :)
Mini-reviews, retro sound chip tribute, romhacks and general listage at my site: Mini-Revver.

snarfblam

  • Submission Reviewer
  • Hero Member
  • *****
  • Posts: 590
  • CANT HACK METROID
    • View Profile
    • snarfblam
Re: Zelda II Editor - Sword II - Work in Progress
« Reply #7 on: June 13, 2016, 04:43:13 pm »
Hot damn. One of these days Trax I gotta dig into your documentation so we can have Windows equivalents of your utilities.

njosro

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Re: Zelda II Editor - Sword II - Work in Progress
« Reply #8 on: June 13, 2016, 07:01:04 pm »
I'm glad your back at it again!! So I can ask you technical questions without it being irrelevant to you :P

How do you handle the automatic backgrounds? Can your sideview editor modify them? I've been struggling a bit with this on mine...

itemdrop

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
Re: Zelda II Editor - Sword II - Work in Progress
« Reply #9 on: June 13, 2016, 09:58:52 pm »
Very very cool thanks for this trax  :) cant wait to try it out.

Seeeeph

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Re: Zelda II Editor - Sword II - Work in Progress
« Reply #10 on: June 14, 2016, 12:21:34 am »
.
« Last Edit: August 22, 2016, 04:06:48 pm by Seeeeph »

Trax

  • Hero Member
  • *****
  • Posts: 517
    • View Profile
    • Trax ROM Hacking
Re: Zelda II Editor - Sword II - Work in Progress
« Reply #11 on: June 16, 2016, 01:25:57 am »
Thanks for you comments, guys...

As I said before, I wish I could make my software cross-platform at the drop of a hat. I tried a few times, without success. I prefer to use my time perfecting what I master. However, there seem to be a few avenues that could make the jump between platforms easier. And of course, the most obvious solution is to get a Mac...

I'm always open to any questions or explanations you may ask on any aspect of the game. I try to make information freely accessible to anyone interested, and if you want to see my source code, I'll send you a copy and explain anything you'd need to know. Keep in mind that the screenshots I posted precedently represent a work in progress, so the contents will change regularly...

When I find the time, I'll make a exhaustive guide of Zelda II, where I explain everything I know, like I did with Contra. In the meantime, there's always my disassemblies of the game, that contain many instructive comments. These documents are also changing frequently, so make sure you download the most recent version on my web site...

For now, the Overworld saves correctly, including the pointers that are used to turn the Palaces into rock. The Game Data section also saves correctly, although I'm rewriting the code to make it more clean and ready to be upgraded if needed. The Side View and Enemies don't save yet, but they display correctly...

Now, to answer some of your questions...

As for regular tile properties on the Overworld, the way the game handles it is simple, but also arbitrary. It first checks if it's walkable water (code D) and if you have boots, and then any tile code >= B is blocked. That's it. The code starts at 070F in Bank 0 and is 18 bytes long. This could be completely rewritten and replaced with a table where each tile has its own attributes byte...

The Side View Editor already allows enemy placement, and you can add or delete any enemy. Items are also modifiable. If you refer to items in Palaces, that's another story. The game uses a unique index (index 01) for any item in any Palace. It's the Palace Code that determines what item is there, which means you can't have the Candle in Palace 2, for example. Some bosses also share enemy indexes, and it's the Palace Code that makes the distinction. Starting with any of these items is already in the editor, as another part of the Game Data section. You can choose the following starting stuff: the 8 items (6 Palace Items, plus Hammer and Magic Key), 8 magic spells, upward and downward stab techs, magic containers, heart containers, crystals, lives...

About area tiles, I don't know a lot about them, actually. In this case, a "tile" is what objects are made up of: a 2x2 matrix of 8x8 pixels tiles. Each object of the background has a pointer for its building "recipe". Most of them are regular or variable rectangle areas, sometimes 1x1 tile, sometimes 1x2, some of them have variable width and/or height between 1 and 16, and some of them are just unique and have their own construction routine. Each screen of a side-scrolling area is 16 wide x 13 high, and each area can be 1 to 4 screens wide...

I don't know exactly what makes a tile solid or transparent. I presume there are very few types of tiles: solid, transparent, instant death (like water or lava), crumbling bridge, breakable block. It doesn't seem to be 8x8 tile-based, but it could be. I'll have to look into it...

The magic editor is pretty much all functional, which includes magic usage, magic names and magic effects for each spell, like in the screenshot. And yes, this means a single spell can have multiple effects. The magic spells you start with can be set in the Game Data part of the editor...

I've seen the code for damage values, but I didn't take the time to fully understand the machanisms, yet. As far as I know, each enemy has a damage code (editable in the enemy attributes window), typically between 1 and 4. Damage code 5 is very rare, but does exist, I think the Blue Fokka in Great Palace has damage code 5. Any higher value can be set (up to F), but I don't think the original game uses them, and the effects are unknown. As far as I know, the calculation involves the damage code and Link's Life level...

Grimlock, Santa may very well bring you some surprises in the near future, because I did make a breakthrough on my quest to have more than 16 tile types on the Overworld. According to my theory, we could have access to more than 60 tile types, assuming we can cram the corresponding graphics into the CHR banks, but swapping between two of them is also a possibility. Of course, there are a few other obstacles to overcome, like tile attributes (free, blocked, water, swamp, other?), palettes, demons behavior and corresponding side view areas. But it's promising...

ROM expansion is certainly possible, but the big obstacle is the space needed to keep track of the potential new stuff. Using the Cartridge RAM may be the key to all the caveats involved with having more areas, more palaces, more towns, etc. When you take an item in any area, you have to set this item as "taken", unless it's an item that regenerates between saves, like the Red Jars. Other than that, it can be keys, heart/magic containers, special items like the Trophy, experience bags, dolls, etc. Each area can have 1 item "slot" per screen. Each item's "presence" is a 1 bit flag, so there are 4 bits per area, for a total of 0x20 bytes (32 decimal) per region. All these items must never reappear after they are taken, else you break the game. And you have to store their state between saves. The game uses memory range 600-6FF to store all this data for all regions of the game. If we want to, say, double the amount of data stored in memory, the CPU memory is not enough, so we could use Cartridge RAM instead. It would involve heavy ASM, but I'm sure it's feasible...

Having different graphics within the same palace could be done, assuming we swap CHR banks at the time the the next area loads. A weird thing I discovered while dissasembling the game is that palaces, like any other major region, should have access to a set of 8 palette groups, but for some reason, the loading code overwrites the selected palette by a single, arbitrary palette group (according to palace code, probably), and that means palette changes have no effect once you try the game and enter the palace. This could be easily reverted. I just don't know why it was coded that way. This has the effect of having palaces use all the same color palette from beginning to end...

As for music, that would be cool to have some variety. Even slight variations on the same theme would be a great improvement. I did decode some of the music, so having a text based music editor is a possibility...

For tile combos (I presume it refers to the 2x2 blocks), I'm sure there are ways to expand what's already in the original game. Some tile codes are unused and set to an arbitrary value (usually the background code 0x40). Also, some major regions, like the palaces, don't even use Tile Set 1, only Tile Set 0. This mean you can almost double the variety of tiles that can be used in any area...

Background maps save a lot of space, because they are used in many places. They follow the exact same rules as the area data proper. The editor, like the game engine, makes 2 passes and the second pass simply draws over the other. I could add a special editing mode that shows only the background map's objects. You can have up to 7 different background maps per region (1-7), background map code 0 means "no background map". One of the most used in the Overworld is the clouds background...

That's a long message. I'll post more screenshots when I get the time. If you have any other questions or suggestions, throw them...

Grimlock

  • Sr. Member
  • ****
  • Posts: 361
  • Graphics Artist, Level Designer
    • View Profile
Re: Zelda II Editor - Sword II - Work in Progress
« Reply #12 on: June 16, 2016, 08:30:41 am »
Fantastic, it looks like your editor has the potential to allow a tremendous amount of creative freedom! 

PresidentLeever

  • Hero Member
  • *****
  • Posts: 639
    • View Profile
    • Mini-Revver
Re: Zelda II Editor - Sword II - Work in Progress
« Reply #13 on: June 16, 2016, 09:27:58 am »
If you have any other questions or suggestions, throw them...

I didn't see a reply in there so to clarify, I meant like the one in KiddEd, letting you change walking speed, jump height, recoil and so on. The other question was when you think the first release will happen.


Mini-reviews, retro sound chip tribute, romhacks and general listage at my site: Mini-Revver.

itemdrop

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
Re: Zelda II Editor - Sword II - Work in Progress
« Reply #14 on: June 16, 2016, 11:21:23 pm »
One thing I think I get is the candle has to stay in palace 1 as I have tested this and when you put candle in another palace or place (cave). when you beat palace 1 without getting the new item (and have candle in your possession) it still turns to stone. Would there be a way that you could simply not have the palaces turn to stone and place new items in different palaces and still be able to get the gem xp upgrade?


Anyways sounds like there's going to be an insane amount of options more then I had dreamed of. i hope a test / beta release comes soon XD either way i hope you stick with it and pull this amazing tool off.
« Last Edit: June 17, 2016, 07:07:33 pm by itemdrop »

snarfblam

  • Submission Reviewer
  • Hero Member
  • *****
  • Posts: 590
  • CANT HACK METROID
    • View Profile
    • snarfblam
Re: Zelda II Editor - Sword II - Work in Progress
« Reply #15 on: June 17, 2016, 06:09:08 pm »
Huh... there must be hard-coded checks for which items are in which palaces. I'm guessing with a little debugging, you could work out single-byte changes that would fix that.

Trax

  • Hero Member
  • *****
  • Posts: 517
    • View Profile
    • Trax ROM Hacking
Re: Zelda II Editor - Sword II - Work in Progress
« Reply #16 on: June 18, 2016, 02:43:13 am »
I intend to add more data for Link, including stuff related to physics, both for Link and enemies. Among these are walking velocities, jumping velocities standing and walking, plus Jump spell modifier, sword slash delays, recoil velocities, for sword hits on shield or wall and hit taken. All things related to Link's movements and attacks are in Bank 0. For example, at 1470, a table of 4 bytes that sets the gravity values for Link's jump...

As for a release date, I don't know. I can't predict anything because my free time is not constant. I'll release version 1.2 (the last version was 1.14) when the Side View Editor works without glitch, and after I make sure that saving doesn't overwrite important data. A data manager will be essential if we want to do any kind of expansion...

If someone wants to test any kind of compatibility avenues for non-Mac platforms, like those suggested by Seeeeph, I could compile an ad hoc alpha version of the software, without any guarantee of anything properly working. That could serve the sole purpose of trying to make it run on emulators. Let me know by email if any of you are interested in this kind of testing. If you have a Mac, make sure you run at least Mavericks (10.9)...

If it's about source code, the same applies. Send me an email and I will send you the current state of my code. So keep in mind that some of the code, right now, is being rewritten. The code base for the Overworld is quite simple for the average programmer. In about one hour, I even made a PHP page that decodes the Zelda II ROM and displays the Overworld in a table, using arbitrary tile images. You can see the page here, and download the source. Keep in mind that it's just a proof of concept. Once the base is done, it becomes a little more complex when you want to add support for key areas (with all the bitfields), the bracket tool, the palettes, etc...

About the Palace Items, I don't think there is any trivial way of circumventing the original mechanism. There is no such thing as a "Candle Item" that you can place in the Side View data. You only place a "Palace Item" (index 01), and the game sets the item attributes (its graphic tiles) according to the Palace Code. Consequently, you can't have any Palace Item in the Overworld. And you can't have more than one item in any Palace. In terms of RAM, each Palace Item has a byte that is set to 1 when you possess that item. CPU RAM 785 is for Candle, and it goes sequential from there, up to 78A for Cross. Hammer is 78B and Magic Key is 78C. So when the Overworld tests for Palaces that are turned to stone, it always checks two things: the Palace's item is taken and the crystal is placed. The 6 crystals also have their own byte, from 78D to 792, inclusive. So, for the first Palace (offset 0), the game checks if 785 equals 1, and then checks if 78D equals 1. If both conditions are met, the Palace tile is set to 0B (a single unit of Mountain)...

It's easy to bypass the code that makes the check, and make sure palaces never turn to stone. The code is in bank 1 (West Hyrule/Death Mountain), at 479B, and bank 2 (East Hyrule/Maze Island), at 879B. The two routines are slightly different, because there are not the same number of palaces in each region. In a hex editor, go to 479B, and replace 0xA2 with 0x60, and that's it...

itemdrop

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
Re: Zelda II Editor - Sword II - Work in Progress
« Reply #17 on: June 29, 2016, 07:54:24 pm »
any updates any road blocks hope everything is going great with the program :)

Grimlock

  • Sr. Member
  • ****
  • Posts: 361
  • Graphics Artist, Level Designer
    • View Profile
Re: Zelda II Editor - Sword II - Work in Progress
« Reply #18 on: June 30, 2016, 08:58:50 am »


If someone wants to test any kind of compatibility avenues for non-Mac platforms, like those suggested by Seeeeph, I could compile an ad hoc alpha version of the software, without any guarantee of anything properly working. That could serve the sole purpose of trying to make it run on emulators. Let me know by email if any of you are interested in this kind of testing. If you have a Mac, make sure you run at least Mavericks (10.9)...


I'm going to look into VirtualBox and see if my system is compatible.  I'll email you if I have any success. 

releasethedogs

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: Zelda II Editor - Sword II - Work in Progress
« Reply #19 on: July 01, 2016, 11:49:42 am »
This is amazing. I so, so, so want to remake Dragon Warrior with this.