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

Author Topic: Dragon Warrior 1, 2 & 3 Hacking Discussion  (Read 168035 times)

Choppasmith

  • Full Member
  • ***
  • Posts: 203
    • View Profile
Re: Dragon Warrior 1, 2 & 3 Hacking Discussion
« Reply #340 on: October 23, 2020, 01:26:58 am »
You wouldn't happen to have a link to that, would you? A quick check for various likely-sounding search phrases with Google doesn't turn up anything that looks interesting within the first few pages of results.

Sure :)
https://w.atwiki.jp/dq_binary/pages/31.html

If you use some kind of webpage translator the site should be more obvious but basically the list starts with hacks and then goes to developer tools underneath that. They have some RAM and ROM values for games on the left side, but it's very incomplete and mostly for the SNES games. They do have config files for BNE2, sort of a multi-game data viewer/editor that uses said config files for rom hacking. There's somewhat of a English explanation and how-to here but I haven't tried it myself:

https://www.southcape.org/2014/12/22/using-bne2-for-rom-analysis/

Oh and abw, I'm really sorry, I'm trying to update my DW2 rom with your latest Menu Upgrades patch (via asar). I must be forgetting something (it's been a while) that's different in my ROM compared to an unchanged ROM but I'm getting a glitch when I try to buy any weapon/armor in a shop (It just skips the party menu and goes straight to the "(Cannock) Can not equip this are you sure?" message and the graphics glitch out,

October 23, 2020, 08:41:18 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
Also, abw, I was hoping to ask if you know how to edit the Redraw Menu text to fix a blink-and-you'll-miss-it glitch when cycling through menus (Sorry to be a pain but I figured maybe you had to touch this up a little bit when doing your Latin translation)



The format is baffling to me

Code: [Select]

AN 
D[top border-77] 
[top border-77][top border-77] 
[top border-77][top-right border] [right border]
Why do you need multiple lines for one line of the window? What are the spaces for?

I tried to simply edit it according to where the letters of the new Command window now line up but that didn't work. ND seems to work a little better than AN but I still get extra lines.
« Last Edit: October 24, 2020, 03:29:33 am by Choppasmith »

abw

  • Hero Member
  • *****
  • Posts: 565
    • View Profile
Re: Dragon Warrior 1, 2 & 3 Hacking Discussion
« Reply #341 on: October 24, 2020, 09:47:14 pm »
https://w.atwiki.jp/dq_binary/pages/31.html
Thanks! Alas, there's not a lot of information on that page, and all the links I tried are giving me 503 errors, so I can't even try it any of it out for myself :(. Assuming they actually do have a (non-Overworld) map editor, I'm curious to see how well it works.

Oh and abw, I'm really sorry, I'm trying to update my DW2 rom with your latest Menu Upgrades patch (via asar). I must be forgetting something (it's been a while) that's different in my ROM compared to an unchanged ROM but I'm getting a glitch when I try to buy any weapon/armor in a shop (It just skips the party menu and goes straight to the "(Cannock) Can not equip this are you sure?" message and the graphics glitch out,
Probably what you're missing are the 2 new menus and their pointers. Basically I just took the 2 BUY/SELL target menus (from pointers #18 and #42), copied them to new menus (creating pointers #75 and #76, which meant shifting the entire block of menu data down by 4 bytes), updated them to include a space and the new optional E control code ($F0-$F2 depending on the hero), and adjusted their size/position to fit the new text.

Why do you need multiple lines for one line of the window? What are the spaces for?
Because it's not one line of the window, it's two lines divided up to match PPU attribute boundaries so that the game can apply the right palette when clearing and drawing the overlapping tiles (of course, the palette doesn't change between the parts of the COMMAND and EQUIP menus that overlap, but it's all part of the same system that handles rolling the EQUIP menu up and down over the map background which almost always does use a different palette, so the overlap section still has to obey the same rules). A tiny bit of experimentation will show you that that "AN  " is the "AN" of the top line and then the 2 spaces on the second line directly under the "AN". The rest of the data works the same way, e.g. "SP  " covers the "SP" on one line and the "  " directly below it.

After updating that section of data, you'll want to test getting into a battle, because despite being completely separate conceptually, the game actually uses one of the strings of 4 consecutive spaces from that block of COMMAND menu replacement text as one of the black backgrounds in battle :P.

And yes, DW2's menu clearing/redrawing is indeed a pain.

Retrolife

  • Restricted Access
  • Jr. Member
  • *
  • Posts: 41
    • View Profile
Re: Dragon Warrior 1, 2 & 3 Hacking Discussion
« Reply #342 on: October 26, 2020, 05:24:04 am »
Next year is 30th anniversary of DW III so a new hack is in order one that brings out the best of the game in every aspect(gameplay,storyline,npcs,graphics)

Chicken Knife

  • Hero Member
  • *****
  • Posts: 513
    • View Profile
Re: Dragon Warrior 1, 2 & 3 Hacking Discussion
« Reply #343 on: October 28, 2020, 04:29:16 pm »
Guess I was a few months too early on our DQ3 NES restoration / retranslation hack.  :P

I intend to eventually work on the SFC version, but even if I started it immediately, (which I don't plan to) it would definitely not get finished in 2021.

joe73ffdq

  • Full Member
  • ***
  • Posts: 198
    • View Profile
Re: Dragon Warrior 1, 2 & 3 Hacking Discussion
« Reply #344 on: December 15, 2020, 06:52:43 pm »
I have been gradually working on my DW2 mod recently, and I was wondering a few things...

In the enemy data, the 2nd byte is for enemy evade. The left nibble specifically is for evade, and the right nibble is supposed to be for HP amounts of 256, but there is no instruction to ram. There is thread on Gamfaqs from 2011, where AlexKC mentions this about enemy byte #2... Is there a way to add an instruction to ram, so specific end game enemies can have over 255 HP...

2nd question... Is there any kind of overworld map editor. There is a utility that works visually while using it, but it doesnt work properly, and screws up much of the data... There is map restoration for Hargons Castle in this thread. Do you guys possibly have a working map editor...

I would really like to add more HP specifically, and map work would just be for cosmetic differences... Right now in my notes for enemy set up, 3 of the last 5 bosses would be spamming healall, which doesnt quite work very well...

Thank you guys  :beer:

Chicken Knife

  • Hero Member
  • *****
  • Posts: 513
    • View Profile
Re: Dragon Warrior 1, 2 & 3 Hacking Discussion
« Reply #345 on: December 27, 2020, 10:39:31 am »
I have been gradually working on my DW2 mod recently, and I was wondering a few things...

In the enemy data, the 2nd byte is for enemy evade. The left nibble specifically is for evade, and the right nibble is supposed to be for HP amounts of 256, but there is no instruction to ram. There is thread on Gamfaqs from 2011, where AlexKC mentions this about enemy byte #2... Is there a way to add an instruction to ram, so specific end game enemies can have over 255 HP...

2nd question... Is there any kind of overworld map editor. There is a utility that works visually while using it, but it doesnt work properly, and screws up much of the data... There is map restoration for Hargons Castle in this thread. Do you guys possibly have a working map editor...

I would really like to add more HP specifically, and map work would just be for cosmetic differences... Right now in my notes for enemy set up, 3 of the last 5 bosses would be spamming healall, which doesnt quite work very well...

Thank you guys  :beer:
For the question about an editor, this tool: http://sonic_death.byethost31.com/DW3Bestiary.txt by abw is the most helpful thing out there. Although it is just a viewer, you can really learn the exact process that the game uses to draw. I was able to use this to do my DQ3 map edits. I didn't get too far with the concept of drawing maps more efficiently in order to create space, but I was lucky enough to have some free space to work with and unused data to eliminate, which just required some moving around of map data and adjusting of pointers in order for me to do the expansion where necessary.

For your first question about expanding enemy HP, I'm afraid I don't have much to offer there. If abw comes out of his sabbatical at some point, I'm sure he could give a helpful pointer or two.

As for me, I continue to poke around with the issue where the Zombie Killer sword sporadically does bonus damage to metal slimes. It's already well documented here: https://gamefaqs.gamespot.com/boards/587249-dragon-warrior-iii/50550773. 1whoistornapart did some valuable disassembly of the issue 11 years ago, but never exactly followed up with a solution.

It's a pretty complex issue created by weakness in a set of subroutines that check whether a monster is vulnerable to Expel/Banishasu. In some cases where a monster has already fled, the subroutines get mixed up as to which monster to be checking for resistance.

I feel like the solution probably has to do with adding a bit of code to that subroutine structure to check the status bytes of the targeted monster and determine if it has fled, and then switch to another monster in the group if it has. But I have a fair amount to learn before getting anywhere with this. Open to advice anyone has to offer.

Chicken Knife

  • Hero Member
  • *****
  • Posts: 513
    • View Profile
Re: Dragon Warrior 1, 2 & 3 Hacking Discussion
« Reply #346 on: March 06, 2021, 10:31:24 pm »
Thought I'd bring this thread back to life with a technical question about Dragon Warrior 2 NES. The game has a few bugs when it comes to monster group assignments for overworld map areas that I'd love to address for my next Delocalized update. For instance:

The far west section of the Rhone/Rondarkia plateau has early game monsters appearing.

A section of tiles northwest of Tuhn/Tepa also has incorrect enemy encounters from much earlier in the game.

Also, when traveling in the river toward Tuhn/Tepa, you have non aquatic enemies attacking you. (I suppose this one could have been intentional--monsters jumping into your ship from the shore perhaps.)

http://datacrystal.romhacking.net/wiki/Dragon_Warrior_II::ROM_map/ASM
I was reading through this partial disassembly by abw here this morning, and I didn't find much about how encounter group tile assignments work, but the notes here can be a little tough to decipher.

Was curious if anyone had any experience or knowledge of this kind of thing. I'll be needing to release an update soon anyway that addresses some text formatting inconsistencies between the three Delocalized games, and I'd absolutely love to include fixes for these bugs.

I'd appreciate any helpful tips.
« Last Edit: March 06, 2021, 10:37:16 pm by Chicken Knife »

abw

  • Hero Member
  • *****
  • Posts: 565
    • View Profile
Re: Dragon Warrior 1, 2 & 3 Hacking Discussion
« Reply #347 on: April 04, 2021, 07:51:57 pm »
In the enemy data, the 2nd byte is for enemy evade. The left nibble specifically is for evade, and the right nibble is supposed to be for HP amounts of 256, but there is no instruction to ram. There is thread on Gamfaqs from 2011, where AlexKC mentions this about enemy byte #2... Is there a way to add an instruction to ram, so specific end game enemies can have over 255 HP...
It looks like an enemy's max HP gets set here, where ($BB) points to the start of the enemy's data within $B7F5:
Code: [Select]
0x0136C3|$04:$B6B3:A0 00    LDY #$00    ; offset for max HP of enemy type
0x0136C5|$04:$B6B5:B1 BB    LDA ($BB),Y
0x0136C7|$04:$B6B7:85 99    STA $99   
0x0136C9|$04:$B6B9:46 99    LSR $99   
0x0136CB|$04:$B6BB:46 99    LSR $99    ; $99 = enemy max HP / 4
0x0136CD|$04:$B6BD:A9 00    LDA #$00   
0x0136CF|$04:$B6BF:85 9A    STA $9A   
; call to code in a different bank ($0F:$C3AB)
0x0136D1|$04:$B6C1:20 AB C3 JSR $C3AB  ; generate a random number and store it in $32-$33 (two passes)
0x0136D4|$04:$B6C4:A5 32    LDA $32    ; RNG byte 0
0x0136D6|$04:$B6C6:85 9B    STA $9B   
0x0136D8|$04:$B6C8:20 5B A0 JSR $A05B  ; 16-bit multiplication: ($99-$9A) = ($99-$9A) * ($9B), overflow in $9E, copy of ($99-$9A) in ($A1-$9D)
0x0136DB|$04:$B6CB:A0 00    LDY #$00    ; offset for max HP of enemy type
0x0136DD|$04:$B6CD:B1 BB    LDA ($BB),Y
0x0136DF|$04:$B6CF:38      SEC       
0x0136E0|$04:$B6D0:E5 9D    SBC $9D    ; enemy's actual HP is max HP - random number between 0 and enemy max HP / 4, so anywhere between 75% and 100% of the enemy type's max HP
0x0136E2|$04:$B6D2:A0 04    LDY #$04    ; offset for enemy's actual HP, low byte
0x0136E4|$04:$B6D4:91 B7    STA ($B7),Y
0x0136E6|$04:$B6D6:C8      INY        ; offset for enemy's actual HP, high byte
0x0136E7|$04:$B6D7:A9 00    LDA #$00    ; always set high byte to 0
0x0136E9|$04:$B6D9:91 B7    STA ($B7),Y
So if you wanted to use the other half of the evade byte for max HP * 256, you'll need to incorporate it into at least three places (determining max HP / 4, calculating max HP - max HP / 4, and storing the actual HP).

We had previously determined that the game actually does use the high byte of enemy HP in many places, but of course you'll need to do lots of testing to make sure there aren't any other places where the game uses 8-bit HP instead of 16-bit HP.

2nd question... Is there any kind of overworld map editor. There is a utility that works visually while using it, but it doesnt work properly, and screws up much of the data... There is map restoration for Hargons Castle in this thread. Do you guys possibly have a working map editor...
I haven't done anything much with the overworld maps, but as Chicken Knife mentioned I do have something that lets you step through the surprisingly complicated building process for the non-overworld maps. I figured I might as well submit it, so take a look at the Dragon Warrior II/III/IV (NES) Map Building Visualizer if you want!

http://datacrystal.romhacking.net/wiki/Dragon_Warrior_II::ROM_map/ASM
I was reading through this partial disassembly by abw here this morning, and I didn't find much about how encounter group tile assignments work, but the notes here can be a little tough to decipher.
Based on joe73ffdq's notes, you'll probably want to start looking around $04:$806E, which appears to be the routine for determining which battle formation you get for overworld encounters.