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

Author Topic: Dragon Quest 4 DS - classic version  (Read 72495 times)

badinsults

  • Full Member
  • ***
  • Posts: 182
    • View Profile
    • Snes Central
Re: Dragon Quest 4 DS - classic version
« Reply #20 on: September 16, 2012, 03:43:44 am »
I like the larger font. I don't know why they decided to have such a small font on the DS in the first place.

Kosayn

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Re: Dragon Quest 4 DS - classic version
« Reply #21 on: September 18, 2012, 06:09:27 am »
Yeah.  I've standardized the fonts a bit more, and I'm going to go ahead with them.  They work really well for my goal of fitting the box while using shorter dialogue.

Working on the fonts actually led to me figuring out a trick. I took a character that isn't used in the script (~) and changed it to a blank 1-pixel tile.  5 of them together look exactly the same to the player as an ordinary space between words.   It works invisibly and turns 5 unwanted spaces in the script into 1.   There are still some limitations on how much it can remove without it being evident in slower scroll speed or sound, but it's pretty useful nonetheless.  And it's much faster than moving the dialogue pointers would be.

Wish I'd have figured out this trick earlier.  I think it'll make the job a lot easier when I eventually go back to polish and fix typos...

----------

On a different note, I've been thinking about how I'm going to actually reach all the content in Dragon Quest 4 in order to test my changes.  I have late-game saves already.  I know there are a few dialogues that I will only be able to test by walking through walls with a cheat code. There's the immigrant town, which I think I have the necessary save backup methods to sort out.  But I wonder what else the game may have in the way of hidden, unusual, or difficult-to-reach content.   I mean, until I started on this project, I never even knew that a customer sometimes sells Taloon a Sword of Malice.
« Last Edit: September 22, 2012, 02:26:43 pm by Kosayn »

Aeana

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
Re: Dragon Quest 4 DS - classic version
« Reply #22 on: September 18, 2012, 01:43:56 pm »
I mean, until I started on this project, I never even knew that a customer sometimes sells Taloon a Sword of Malice.

That's interesting. It's the basis of the most well-publicized money making scheme in the game. :o  Once the sword is sold to you, it remains in the shop, and then you fill your inventory/bag with them to sell off in chapter 5.

dn

  • Discord Staff
  • Jr. Member
  • *****
  • Posts: 17
    • View Profile
Re: Dragon Quest 4 DS - classic version
« Reply #23 on: September 19, 2012, 02:07:15 am »
Do you have information on the pointer system the game uses? I'm actually wanting to do some work with DQ5 (and probably 6), and something isn't clicking with me. I don't normally work with DS pointers at all, so I might just be missing the obvious.

Kosayn

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Re: Dragon Quest 4 DS - classic version
« Reply #24 on: September 19, 2012, 09:14:35 am »
Sure.  The pointer system looks the same in DQ5.  I hear that the actual dialogue in DQ6 uses some sort of encryption - Huffman, I think people say?  So I have no idea how to deal with that.  Its spell section is clear text though from looking at it, so I'll probably convert those spells somewhere down the road for my own enjoyment of the game, if not necessarily for a public project.  Heh.

I'm self taught and have no programming background, so a lot of this might use sketchy terms.  Anyway, the text is split up into sections.  One might be a certain town at night's dialogue, or the list of items, etc.  I looked at the monster and spell sections first because they're pretty short text, and easier to understand.

Above the list of spells section in DQ5 (starting with Frizz) there is a big list of pointers.  The pointers are pretty noticeable because in your editor, you'll see large vertical lines of 00's in the hex.  If you read through it, you'll start to notice patterns.

If I read from address 047D3E20,
the hex is - 00 00 08 00 00 00
then it's -    01 00 0A 00 02 00
then it's -    02 00 0C 00 05 00

Those 00's on every other number are where overflow goes if the numbers in the pointer are larger than FF. So if I remove those, since they don't matter currently,

those same pointers are:
00 08 00
01 0A 02
02 0C 05


the first number is an index number  (it rises by 1 each entry)
the second number is the length of the text.
the third number is a relative position from the beginning.  each number represents 4 bytes, so an entry of 02 means something is 8 bytes from the beginning.

So these apply to the first three spells in the list below, after all the pointers.

Frizz, Frizzle, and Kafrizzle.

if you look at it in the ASCII text, it's @4Frizz@ = 08 characters long, matching that first pointer.  The positional pointer is 00 because it's at the beginning.

The next is @4Frizzle@ = 10 long, or 0A in hex.
Before the next spell, there's a couple of "þ" looking characters (FE in hex) They are just filler.

The next is @4Kafrizzle@ = 12 long, or OC in hex.


So if I wanted to change Frizzle to Blazemore (and I certainly did), then I just added 2 to the length (middle section) of the pointer, making the whole thing

01 00 0C 00 02 00

Of course that bumps Kafrizzle's text ahead as well.  By two bytes.

I could eliminate the FE ('þ') characters between the two spells, and the Kafrizzle pointer would still be valid. But it's handy to have a bit of buffer between the entries to work with, though, so instead I would add 2 more  þ's (or anything, actually) and then it would be the correct 4 bytes ahead of where it was, and I could increase the relative position pointer for Kafrizzle by 1.

The other thing, overflow.  If say, the relative position section of the pointer gets to be larger than FF, it starts over again at 00.  And there is now an 01 where there was an 00 to the right of it.  I guess it's Little Endian, as they say? You can see this happening in the monster table's pointers.

Finally, if you miscalculate your changes to the pointer and go to test it, Dragon Quest V will spit out a message like "Error:MID 104" which means your pointer is totally off.  If the starting point is right but the length is wrong, you'll get something close to the right text with some fluctuating random characters in the middle.  I found it handy to know that.

----------

As far as the pointers for dialogue text...  each section is obviously way longer than a spell name, so there is much more overflow, and they are harder to understand, but they do seem to somewhat fit the same pointer format.  For some reason the index numbers aren't always sequential in the dialogue pointers.

I had some success in changing dialogue pointers for DQ4, but it was painstaking.  I found there were issues with the next line bleeding into the last if you shortened it by a lot.  Probably a bunch more effort and I could figure out more.  I decided that the length of the script was basically prohibitive to do that much work for each line of dialogue, so I'm using different solutions.   

Each pointered dialogue section starts with something roughly like (in ASCII) @c0@@a@b, where if it's a named character talking, their name can be between the @a and the @b.  So "@c0@@aBianca@bLine of dialogue."  If it has line breaks, there is a hex character 0A between them.  If you're editing dialogue, the 0A is moveable, and what comes after it is all still part of the same pointer.

Hope that mess is of some help to you.  I'm a bit curious what you're working on!  Basically, the main thing to know is the pointer being index#, text length, relative position.
« Last Edit: September 19, 2012, 10:31:42 pm by Kosayn »

dn

  • Discord Staff
  • Jr. Member
  • *****
  • Posts: 17
    • View Profile
Re: Dragon Quest 4 DS - classic version
« Reply #25 on: September 19, 2012, 10:23:25 am »
Ah, just as I thought. They weren't typical pointers, then. Normal pointers would just point at a certain place in the file and that's it.

Think the only thing I'm failing to understand is the relative offset, which does not seem to be from the beginning of the file or even the beginning of the text block. Kafrizzle is most certainly not 5 bytes from the beginning of, well, anything.
« Last Edit: September 19, 2012, 02:06:42 pm by dn »

Kosayn

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Re: Dragon Quest 4 DS - classic version
« Reply #26 on: September 19, 2012, 07:35:18 pm »
Yeah, the last section of the pointer is pretty weird, actually.  It's been a while since I was working on them, and I actually forgot part of how it works.

Each number in that part of the pointer represents 4 bytes.  So each spell's text entry can only start properly at an interval of 4 bytes, otherwise no pointer value can find it.  That's why there are the FE / þ characters in there sometimes between entries... to space the next entry to a multiple of 4.  That's part of how I figured out what was going on.  There were never more than 3 of the þ's in the original entries, apart from some of the messy sections later on in the list.

So Frizzle, which has a pointer of 01... 0A... 02...   multiply the 02 by 4 and you get 8, which is how far it is ahead of the first @ in @4Frizz@.  The same holds true of Kafrizzle, which is 20 bytes ahead.  And so on.

So when you've moved the relative position of a bunch of text forward by say, 40 you divide that by 4, get 10 / 0Ahx, and add that to the initial value of the relative position pointer, to get the new relative position pointer.

I moved some stuff as much as 128 bytes while I was changing the monster names, so if there's any arbitrary limitation on these pointer values, it's more than that.

...I definitely got my money's worth out of Windows calculator's programmer mode while working on that stuff.
« Last Edit: September 19, 2012, 08:48:09 pm by Kosayn »

dn

  • Discord Staff
  • Jr. Member
  • *****
  • Posts: 17
    • View Profile
Re: Dragon Quest 4 DS - classic version
« Reply #27 on: September 19, 2012, 09:09:39 pm »
Ahh, I see now. Not sure why I didn't think to see if it's a multiplier. I don't think I've seen a pointer/header system like this at all in anything. Thanks.

Kosayn

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Re: Dragon Quest 4 DS - classic version
« Reply #28 on: September 25, 2012, 09:36:46 am »


 
 
Finished Chapter 4!  Working on item lists next.

And I had a question to ask, for anyone who knows a bunch about the DS version... is there any substantial difference in the game's content based on the gender of your hero?
« Last Edit: September 27, 2012, 02:04:09 am by Kosayn »

Celice

  • Hero Member
  • *****
  • Posts: 646
    • View Profile
Re: Dragon Quest 4 DS - classic version
« Reply #29 on: September 25, 2012, 03:38:03 pm »
I don't know any differences personally, but usually they expand or insert differences with the added bonus content stuff. Was there a lot of bonus end-game stuff added? I don't remember D:

But these screens are making me want to replay the game again... the font is making me want to go on a nostalgic romp :D

Kosayn

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Re: Dragon Quest 4 DS - classic version
« Reply #30 on: September 27, 2012, 06:37:04 pm »


Now that I'm working through renaming the items, I started looking at graphic editing tutorials for DS.

I wanted to rename the Magical Knife back to the Thorn Whip, and so on with a few other items.  For that to make sense, though, I'd have to change their icons.  I figure I can probably borrow icons from DW5 DS, or even just draw them up myself since they're small.   

This particular game didn't follow any of the file name conventions of the examples I read about, but after poking around I was able to eventually get it to show me at least recognizable, editable tiles. 

For some reason Crystaltile2 is stubbornly refusing to load palette data from the item32.mptp file, which definitely seems to be a palette paired with the item32.mpt tile,  when I look at other such files in Tinke.  Some of them I can get to load perfectly in that program.  I'm going to keep looking at this - it looks possible to do it in a crude way, if not an easy one.  I suppose reconstructing the palette by hand from comparison images is potentially an option.


Anyway, I figured I'd share / solicit advice, as usual. 

« Last Edit: September 08, 2013, 05:01:42 pm by Kosayn »

jjjewel

  • Jr. Member
  • **
  • Posts: 26
    • View Profile
Re: Dragon Quest 4 DS - classic version
« Reply #31 on: September 27, 2012, 07:16:16 pm »

For some reason Crystaltile2 is stubbornly refusing to load palette data from the item32.mptp file, which definitely seems to be a palette paired with the item32.mpt tile,  when I look at other such files in Tinke.  Some of them I can get to load perfectly in that program.  I'm going to keep looking at this - it looks possible to do it in a crude way, if not an easy one.  I suppose reconstructing the palette by hand from comparison images is potentially an option.


Palette for item32.mpt is in the file itself. In Hex Edit view, go to offset 0x2A418, point your mouse (or your cursor) at that address (where it shows 00 00 FF 7F...) and right-click and then DATA>palette conversion. You'll get the palette.


Kosayn

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Re: Dragon Quest 4 DS - classic version
« Reply #32 on: September 27, 2012, 07:41:25 pm »
Excellent, thanks for the help!

Unfortunately, it turns out that editing the item32.mpt file changes nothing in-game, which is weird and unexpected.  I tried out some others, and changing the face48.mpt, for example, definitely affects the game directly.  But in most cases where there are two files like this, editing the larger .mpt file does nothing.

I would assume that the item32.mptp is like a compressed version of the .mpt file, which the game actually relies on.  P for packed?  I tested by filling item32.mptp with 0s and importing it, and running the game... and all the item images were blank.  So at least I know that's the file to be looking at.  Also, it has a completely identical palette section at the end, just like the other file, so they are related somehow.  But the rest seems very random and un-editable, like compressed data would be.

I've tried out compressing it using DSDecmp, but none of the compression formats that I tried seem to match it in code, or work correctly - LZ10, LZ11, Le, Lzovl, huff4.  Most of them do generate a file around 55-65 kb, though, which is approximately the size of the original item32.mptp.

I think I might let this thing sit for a while, as it's getting way over my head...  I can always leave some free space in the items section, and then just come back to modify them later if getting the edited item graphics into the game becomes possible.  I'd only planned to change the icon on 3 weapons out of the whole item list, so it's pretty minor.
« Last Edit: September 28, 2012, 09:46:27 pm by Kosayn »

Kosayn

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Re: Dragon Quest 4 DS - classic version
« Reply #33 on: October 13, 2012, 05:59:17 am »


Finished the item and place names, and plenty of random text.  I can change dialogue pointers reliably now, thanks to some new methods... and I can edit the uncompressed graphic files, thanks to jjjewel's help!

The only item name that's not the same as the NES version is - Sandglass of Regression (Sands of Time in the DS version), which I renamed Sandglass of Reversion.  It's just slightly too long to fit the menus, otherwise.

Getting started on Chapter 5 -  I took some video of the opening.

http://www.youtube.com/watch?v=-XHL20dhGO8
           
This shows about how close I want to keep the dialogue in this hack to the NES script.   It's become a bit of a writing exercise for me, as much as a hacking project.  I hope to produce something others can enjoy as well when I'm finished.  All dialogue is still WIP.
« Last Edit: October 14, 2012, 12:04:45 am by Kosayn »

Shin`

  • Jr. Member
  • **
  • Posts: 32
    • View Profile
Re: Dragon Quest 4 DS - classic version
« Reply #34 on: October 25, 2012, 04:05:33 pm »
Amazing amazing work! Gonna give this a go now, any chance on making a classic skill name patch for DQ8?

Kosayn

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Re: Dragon Quest 4 DS - classic version
« Reply #35 on: October 27, 2012, 03:40:07 am »
Yeah, maybe in the future!

I would be interested in seeing how the PS2 file system and pointer format are different, there's so much stuff on PS2 that would be fun to tinker with. But it took me quite a while to figure it out for DS, and It does seem that there's not a huge amount of completed PS2 hacks going on, so I wonder about how much info is available.
« Last Edit: August 15, 2013, 05:33:46 am by Kosayn »

Kosayn

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Re: Dragon Quest 4 DS - classic version
« Reply #36 on: August 15, 2013, 05:33:02 am »
I'm back to working on this hack after about a year, having now set all my tools up on my Windows 8 system.  I'm enjoying working on it again, and the hard part is done. It's all just dialogue from here on out.  Still kind of blows my mind to look at the original DS game and see how much I managed to change it.

Currently, I'm cleaning up the first two chapters for better spacing with the new font. I think this weekend, I'll see if I can start tackling a new town or two in Chapter V.

Celice

  • Hero Member
  • *****
  • Posts: 646
    • View Profile
Re: Dragon Quest 4 DS - classic version
« Reply #37 on: August 15, 2013, 04:29:57 pm »
Glad to see you pick up the project again--and that you're enjoying the work! That's all that really matters in a fun hobby like this. But please continue to share with us any cool stuff you come up with!

Kosayn

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Re: Dragon Quest 4 DS - classic version
« Reply #38 on: August 19, 2013, 06:22:43 am »
I've been polishing the hell out of the text in the first two chapters, and I'm pretty satisfied with the results.  As expected, the font change has definitely helped with keeping the dialogue short and simple.

Now that I'm back to working on untouched material, I'm reminded of the many reasons I decided to start this project.  It does have excellent battle animations, music, and sound design; all well suited to how much faster it plays than the NES version.  It does feel like a more portable friendly game once the giant script is pared down a bit.

But also, The DS script is just so strange!  Almost to the point of looping back around and being interesting.  The crazy amount of different accents they used is well documented.  But besides that,  I'm constantly running into characters using weird terms like 'heroine,' which is archaic sort of the same way 'actress' is, except much more so.  Mighty heroine this, Chosen heroine that.  Lots of other 10 dollar words as well.

Another thing; every one of the kings and royals have goofy names.  Norman, Humphrey, Shamus, and I won't even get started on the Palais de Leon gang.  Not sure yet which way I'll go with these names and the other newly named NPCs.  They add some flavor just by being there, and a lot of the royals' dialogue badly needs any flavor added, in either original script.  Of course for the characters who were named in the NES script, I'm using the old ones.
 
Anyway, while I get stuck into Chapter 5 in all its strangeness, here's the tower and boss at the end of Chapter 1.

http://www.youtube.com/watch?v=dQJS696t6nM
« Last Edit: August 20, 2013, 07:24:43 am by Kosayn »

cospefogo

  • Full Member
  • ***
  • Posts: 175
  • "Take this silver dagger to save your neck."
    • View Profile
    • Fliperamas
Re: Dragon Quest 4 DS - classic version
« Reply #39 on: August 30, 2013, 05:09:40 pm »
This is awesome!
Completely awesome!

I just bought my DSi XL and for sure I will play DQ4
using this patch when it gets finished.

I will wait until there.
Thank you SO much for your effort on this project!

Regards,
C.
"Replicants are like any other machine - they're either a benefit or a hazard.
If they're a benefit, it's not my problem."