Author Topic: Developing FF4kster: a comprehensive editor for FF4  (Read 235610 times)

LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #900 on: August 16, 2014, 11:40:10 PM »
Zyrthofar's can do some serious sh*t to your ROM, but only if you save. Still very useful for graphics previews.

That's good to know - I didn't save; and don't to intend to so that works for me.  :wink:

I've seen what you're talking about happen before, and near as I can tell it's just a byproduct of natural limitations of the "perform actions simultaneously" command.

Well that too is good to know - very good to know. Thanks chillyfeez!
"Now I know; and knowing makes it even more confusing..."

Pinkpuff

  • Flan Princess
  • *
  • Posts: 923
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #901 on: August 17, 2014, 07:29:39 AM »
1) Would it be possible to set something up where a user preference can be stored? Particularly I'm thinking about the toggle for indexing. I used to turn it on occasionally - but then more and more and now all the time. I don't know how hard that would be to implement at this stage but I just wanted to throw it out there.

User preferences isn't really a planned feature per se besides the config files. In particular, the indexing thing I consider a little dodgy to begin with since the indexes don't actually look at what data is there, they just number the items in the menu from 1 all the way up. So if the menu has, say a "(none)" thrown in there at the beginning, they'll all be off by 1. Or if the menu only shows a certain subsection of the list (like I think the actor starting equipment menus do) then the indexes will definitely be incorrect.

That said, you can accomplish what you're attempting with the config files (and a lot of patience). What you would do is replace each entry of the form

###: Data

with something of the form

###: ###: Data

So for example instead of

25: Explosion sound

you'd have

25: 25: Explosion sound

The program will understand that the first 25: is a numerical index and that the rest is just text, but you'll have your item indexed! Sadly this technique won't work for things that are read directly from the rom like item names, but it will help for things like events, placements, npcs, etc. whatever has a config file for you to change in such a manner.

At the moment I am removing my shortcuts to all editors beside yours; but if you know any offhand that will/will not work let me know. :)

Honestly I haven't had much success with any of the other editors that are out there for one reason or another (part of the motivation for working on this to begin with) so I'm probably not the one to ask, sorry.

- Also, keep up the great work!!  :childish:

Of course! Although I'm taking a small breather and it may be some time before the next update due to now having to convert back over from using those image files to actually reading the tile sprites from the rom. On the up side though the file size should be quite a bit smaller in future due to that.

Note:   I just came on this :  http://slickproductions.org/forum/index.php?topic=144.msg1059#msg1059   
                  - Congrats on having made it so far!  :terrydia:

There's a blast from the past! Boy what a journey it's been...
Let's dance!

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,682
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #902 on: August 27, 2014, 01:45:45 AM »
Hello PinkPuff, not sure if you're currently busy with school (back to that time for me on top of a job...)  but I might have located the information on what is special about the Mist tiles in the Misty Cave from Phoenix's old notes. (These would probably be good to have in the editor as well down the line.)



Location Map Tile Properties are located from A1000 to A1FFF.
Tiles are 2 bytes each, using the following format:

Byte 0:
   bit 0:      Layer 1
   bit 1:      Layer 2
   bit 2:      Same layer on opposite side (Transition or Bridge Layer)
   bit 3:      ?
   bit 4:      Closed door tile
   bits 5-7:   ?
Byte 1:
   bits 0-2:   ?
   bit 3:      Bottom half is in front of the character
   bit 4:      Load previous map at previous location (Location Trigger)
   bit 5:      ?
   bit 6:      Enemy encounters possible
   bit 7:      Check tile’s location in [Location Trigger Data]

Pinkpuff

  • Flan Princess
  • *
  • Posts: 923
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #903 on: August 27, 2014, 05:03:12 AM »
Oh yeah I found that out when I was collecting info together for the tile editor (which I'm still technically working on even though I've been procrastinating). Hopefully having all those mystery bits incorporated into the editor it will make it easier to play around with them and figure out what they do!

And yeah it is getting close to that time so I'll probably have quite a bit less spare time from here on out, but I think it was quite a productive summer overall!  :childish:
Let's dance!

Pinkpuff

  • Flan Princess
  • *
  • Posts: 923
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #904 on: December 19, 2014, 06:34:22 AM »
School is out, the board is back up, and I'm back to work on FF4kster!

Have a look at the current version at the timecave link to see what I have done of the tileset editor so far. It's previewing the tilesets that it's reading from the ROM, and overlaying the red box/arrow/etc notations dynamically based on the tile properties, and you can press enter to switch to the palette selector to see what each tileset looks like under each palette index. There are some tilesets which, under the default airship palette, look like they're missing large chunks of graphics, but that's only because the palette sections those graphics are using are all black in that palette index. Changing the palette index will cause the graphics to show up.

However, despite that, there are some graphics that just aren't showing up correctly, almost like it's reading the right set of sprites for part of the tileset, but the wrong set of sprites for another part. To see what I mean, check out how it displays f.ex. the Lunar Core tileset. Most of it is fine, but the teleporters look messed up. If anyone has any insight or ideas on why this might be the case or some ideas of where to look for an answer they would be greatly appreciated!
« Last Edit: December 19, 2014, 06:43:16 AM by Pinkpuff »
Let's dance!

avalanche

  • Mom Bomb
  • *
  • Posts: 122
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #905 on: December 19, 2014, 11:42:57 AM »
However, despite that, there are some graphics that just aren't showing up correctly, almost like it's reading the right set of sprites for part of the tileset, but the wrong set of sprites for another part. To see what I mean, check out how it displays f.ex. the Lunar Core tileset. Most of it is fine, but the teleporters look messed up. If anyone has any insight or ideas on why this might be the case or some ideas of where to look for an answer they would be greatly appreciated!

Hey Pinkpuff.  I finally got an account to say thanks to you and others here who have helped me with my project so much.   I hope I can contribute back.  I can't fully answer your question, but I think I can give some insight to part of it.

There is a bit or two in the 2-byte tile assembly data at play here.  The usual documentation here says the first byte is the 8x8 tile index and the second byte has extra flags.  I found that if bit 0 (least significant) is on in the second byte, that it often means that 8x8 tile is animated, which causes it to be pulled from a different location entirely (I'll leave the animated tiles for a different post).  In the case of the Lunar Core tiles you are working on, that didn't work.  So then I realized that if bit 0 is on BUT the first byte does not have the 0x20 bit on, then it is not animated but you have to add 256 to the tile index and then you can pull that as normal.  It's basically a way to add a 9th bit to the tile index for 32 more tiles until that 0x20 bit is reached.  The teleport and several other tiles in the Lunar Core are examples of this case.  I guess another way to describe it is that it's a 9-bit index, and it is animated if it is >= 288 (120 hex).

That will fix a bunch of those tiles, but not all of those ones that look like duplicates.  The good news is that I don't think those are actually used in the maps.

Let me know if that makes sense.  I'll have to work on making my descriptions a little more clear in the future.
« Last Edit: December 19, 2014, 11:53:52 AM by avalanche »

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,682
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #906 on: December 19, 2014, 03:46:49 PM »
Always glad to see FF4kster get an update, now seems the best time to report a bug.

You know how you made it possible to edit the Mystery Bit in Spells and Items? Well unfortunately it seems you didn't actually allow us to edit them for Spells. They work fine for Items, but when you go to change them in Spells they'll revert back to their original setting when you press escape on that menu.

Also the palettes that the program is using for the Tile Editor doesn't quite seem accurate. For instance Palette 4 should be Town, but in the "select palette" option it appears to be Palette 16.

LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #907 on: December 19, 2014, 04:30:40 PM »
School is out, the board is back up, and I'm back to work on FF4kster!

Always great to see you Pinkpuff; glad your back!  :childish:

Though I've got a bug to report too, but probably nothing too serious. I was cycling through the Command List and FF4kster crashed when I got to Kick.  No thoughts on a cause or cure for that one; but I'm sure you'll nail it.  :wink:
"Now I know; and knowing makes it even more confusing..."

Pinkpuff

  • Flan Princess
  • *
  • Posts: 923
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #908 on: December 20, 2014, 06:09:11 AM »
Always great to see you Pinkpuff; glad your back!  :childish:

And you as well  :wink:

Though I've got a bug to report too, but probably nothing too serious. I was cycling through the Command List and FF4kster crashed when I got to Kick.  No thoughts on a cause or cure for that one; but I'm sure you'll nail it.  :wink:

Can't duplicate this issue... are you using a ROM that's been modified by something else?
P.S. Program crashing upon doing something normal/routine (such as highlighting a command) counts as a very serious bug...

Always glad to see FF4kster get an update, now seems the best time to report a bug.

The best time to report a bug is once you notice it. Sometimes a bug can be easy to find and fix so even if I'm busy with school work I will still investigate bug reports. If it becomes time consuming to track down and/or repair then it may have to wait, but if it's an easy fix I don't mind fixing it on the fly.

You know how you made it possible to edit the Mystery Bit in Spells and Items? Well unfortunately it seems you didn't actually allow us to edit them for Spells. They work fine for Items, but when you go to change them in Spells they'll revert back to their original setting when you press escape on that menu.

Confirmed and fixed.

Also the palettes that the program is using for the Tile Editor doesn't quite seem accurate. For instance Palette 4 should be Town, but in the "select palette" option it appears to be Palette 16.

Confirmed and fixed. :banonsmash:

I'm on a roll  :cycle:

Hey Pinkpuff.  I finally got an account to say thanks to you and others here who have helped me with my project so much.

Glad to hear my program is being used productively!

I hope I can contribute back.  I can't fully answer your question, but I think I can give some insight to part of it.

Your answer was very enlightening indeed!! I will get to work on it right away and see what happens. I kept meaning to re-code the method that's reading the graphics into something more efficient anyways but now I have a good excuse to finally get to it. While I'm in an ambitious mood I might try to get the animated tiles to actually animate! (But we'll see if that actually materializes or not.)

That will fix a bunch of those tiles, but not all of those ones that look like duplicates.  The good news is that I don't think those are actually used in the maps.

Pretty sure you're right. Once the tile editor is done though we can use it to mess around with them and see if we're able to make them into new usable tiles! Wouldn't that be awesome?

Let me know if that makes sense.  I'll have to work on making my descriptions a little more clear in the future.

I think I get it! I've certainly worked successfully with less clear descriptions of things. In any case I certainly won't hesitate to ask questions as they arise.
Let's dance!

Grimoire LD

  • FF4 Hacker
  • *
  • Posts: 1,682
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #909 on: December 20, 2014, 10:21:11 AM »
Wow, that was fast. I am finally glad to have that fixed.

Are you aware of what that Mystery Bit does now?

It is how the game decides whether it is going to be a damage (or healing) attack or non damage attack.  Hence when it is given damage it produces screwy results. That means I can Finally fix Gale and Sky Rave to work properly with actual amounts, rather than high 1000 period.

So a proper name tag would be "Non-damaging: YES/NO"

This incidentally also fixes my Sword Skills so they aren't dealing ridiculously low damage, but now I'm wondering if the damage it's dealing is too high now.

avalanche

  • Mom Bomb
  • *
  • Posts: 122
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #910 on: December 20, 2014, 11:31:01 AM »
Some or all of this may be known, but here's what I know about the animated tiles.  There are at least two kinds: those that are animated with 4 graphics tiles (e.g. torches, clocks, waterfalls), and those with some kind of palette trick (e.g. glowing effect in Tower/Giant and palette cycling effect in the Whale).  I haven't deciphered the latter kind.

As I mentioned last time, if bit 0 of byte 1 is on AND bit 5 of byte 0 is on, then it is animated.  Then byte 0 which is normally the graphics tile index becomes instead:
Code: [Select]
byte 0: tt1MMMnn
        tt:  I think this may be speed or type of palette effect?
        1:   Indicates it is animated
        MMM: Major index
        nn:  Minor index

I need to re-investigate the "tt" bits to see if that is what indicates the difference, I didn't take enough notes, but I seem to remember the palette effects might be indicated here.
Assuming it is of the 4-frame variety, the base graphics tile offset is major_index * 16 + minor_index.  Each has 4 frames, which are always 4 tiles in stride no matter how many sub tiles of the 16x16 are animated.  See the attached image for an example of the candle, clock, and torch tiles and note the green/blue arrows show the interleave.  Those are simple in that all four subtiles of the 16x16 tiles are animated, so they are just packed together intuitively.  In some other tilesets, only 1 or 2 of the subtiles of a tile are animated, and so they can interleave with totally unrelated tiles where there is room.

I wasn't able to determine how to correctly calculate the base address for these animated tiles, but they don't seem to be in the same place as the non-animated graphics.  Now that I think of it, a read breakpoint in Geiger's might help.  I manually located a few, so I'll just list them here.

#3 Castle Exterior: FBEC0
#4 Town: FC040
#5 House FC4C0
#6 Castle Interior: FC640
#14 Cave:  FCF40

avalanche

  • Mom Bomb
  • *
  • Posts: 122
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #911 on: December 20, 2014, 01:12:44 PM »
Byte 0:
   bit 0:      Layer 1
   bit 1:      Layer 2
   bit 2:      Same layer on opposite side (Transition or Bridge Layer)
   bit 3:      ?
   bit 4:      Closed door tile
   bits 5-7:   ?
Byte 1:
   bits 0-2:   ?
   bit 3:      Bottom half is in front of the character
   bit 4:      Load previous map at previous location (Location Trigger)
   bit 5:      ?
   bit 6:      Enemy encounters possible
   bit 7:      Check tile’s location in [Location Trigger Data]

I have ideas on two of these mystery bits, if it helps anyone.
Byte 0, bit 3:  Save tile
Byte 1, bit 5:  Use alternate battle background (e.g.: Water instead of Cave), or talk-through-able?

For the second one, it is on watery tiles in the Cave tileset.  But in the House tileset, it is on things like desks which makes me wonder if it is how the game lets you talk to NPCs "through" them like the vendors.  Fair warning, I have not tested these theories via patching the game, just noticed patterns.


LordGarmonde

  • Baigan
  • *
  • Posts: 271
  • Gender: Male
  • "Power only breeds war..."
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #912 on: December 20, 2014, 03:35:42 PM »
Always great to see you Pinkpuff; glad your back!  :childish:

And you as well  :wink:

It's nice of you to say that - but clearly that sentiment is bound to change if I can't guard myself against SLO2...

Though I've got a bug to report too, but probably nothing too serious. I was cycling through the Command List and FF4kster crashed when I got to Kick.  No thoughts on a cause or cure for that one; but I'm sure you'll nail it.  :wink:
Can't duplicate this issue... are you using a ROM that's been modified by something else?
P.S. Program crashing upon doing something normal/routine (such as highlighting a command) counts as a very serious bug...

Probably because it's not a real error - it's one of them fake-outs that end up being a sign of a bigger problem. It was a bad ROM - unfortunately it's a copy of the never allowed to open FF_II_US_MASTER_v1.1_DNA - the file I always copy and then start from. I never played it - I never looked at the hex code - I never ran it through an editor...it's been with me since the original hacking days and has the unaltered date of 04/29/1999 (4:52 AM)...and next to it a copy marked FF_II_US_MASTER_v1.1_DNA+DSL marked appropriately at 04/29/1999 (5:52 AM) - It was the first ROM I ever got - before even I even had emulators - I just knew I wanted to have it - and I wanted to change it.

They got corrupted in a backup/computer upgrade...that whole directory tree. Anyway, sorry for the false alarm; I'll try to be more careful next time. I'm sure (knowing me) that I'll have at least one other copy somewhere - probably in multiple places. I thought I was doing something big-time illegal - instead of tiny-time :P - What can I say: I was 14 and didn't have regular access to the internet.

Quick request. I don't want to ask for another copy from anyone here. But could somebody post the file information...specifically the CRC32 and the exact size as reported by Windows; which should read as something like:
    Size:  1.00 MB (1,049,088 Bytes)  Size on Disk:  1.00 MB  (1,052,672 Bytes)

Meanwhile I'll look around and see what other data I have that I need to call into question...  :angry:
"Now I know; and knowing makes it even more confusing..."

chillyfeez

  • FF4 Hacker
  • *
  • Posts: 1,234
  • Gender: Male
  • Go ahead, ask me about Angel Feathers!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #913 on: December 20, 2014, 07:40:53 PM »
Byte 0:
   bit 0:      Layer 1
   bit 1:      Layer 2
   bit 2:      Same layer on opposite side (Transition or Bridge Layer)
   bit 3:      ?
   bit 4:      Closed door tile
   bits 5-7:   ?
Byte 1:
   bits 0-2:   ?
   bit 3:      Bottom half is in front of the character
   bit 4:      Load previous map at previous location (Location Trigger)
   bit 5:      ?
   bit 6:      Enemy encounters possible
   bit 7:      Check tile’s location in [Location Trigger Data]

I have ideas on two of these mystery bits, if it helps anyone.
Byte 0, bit 3:  Save tile
Byte 1, bit 5:  Use alternate battle background (e.g.: Water instead of Cave), or talk-through-able?

For the second one, it is on watery tiles in the Cave tileset.  But in the House tileset, it is on things like desks which makes me wonder if it is how the game lets you talk to NPCs "through" them like the vendors.  Fair warning, I have not tested these theories via patching the game, just noticed patterns.

Good call on those, avalanche. It occurred to me recently that there must be a tile property for "talk through-able," but I forgot to investigate it. I never considered the "alternate battle background," but that absolutely must exist now that you mention it.
... And I don't know how we have gone so long without considering that theatre must be a tile property for save tiles.
Something to consider in light of your observations: talk throughable and alternate background might be the same bit, since no tile would ever need both. They do that in the world map tiles with "chocobo can travel on this tile" and "cannot fly over unless the 'mystic silver' flag is set."

Pinkpuff

  • Flan Princess
  • *
  • Posts: 923
  • Find a Megalixir in Unprecedented Crisis!
    • View Profile
Re: Developing a comprehensive editor for FF4
« Reply #914 on: December 21, 2014, 02:17:45 PM »
Ok I uploaded the current WIP version.

The "extended" tiles now seem to work; however, although I did my best to implement the sprites for the animated tiles, they're still not showing up correctly. They're showing up differently from how they used to, but still not right. I think I know what might be wrong though and I'll try it again soon.

As well, I implemented a new algorithm for reading and displaying the tiles in general, which ought to be much more efficient, and no longer requires the image files ripped from FF4Tools. Therefore I have removed them from the zip. Let me know if you find any problems or odd behaviours (other than the tiles that should be animated looking strange), particularly if you install in a fresh directory without the image folder.

Also I renamed the "mystery flag" for spells "damage" (and switched the YES/NO display) but it seems like the "damage flag" is on more than just damage spells...

Inching ever closer to success!  :childish:
Let's dance!