øAslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=2248.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index5a70-2.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&board=17.20e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index5a70-2.html.zx9h^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ °VYOKtext/htmlISO-8859-1gzip8:ÖYÿÿÿÿÿÿÿÿWed, 11 Mar 2020 01:20:42 GMT0ó°° ®0®P®€§²ð®9h^ÿÿÿÿÿÿÿÿ³)Y FF5e Map Editor

Author Topic: FF5e Map Editor  (Read 5656 times)

noisecross

  • FF5 Hacker
  • *
  • Posts: 146
    • View Profile
FF5e Map Editor
« on: July 19, 2016, 03:37:06 AM »
Working to fix some maps issues in the game, I have ended writing a tool with a limited capability to edit the location maps.

I share it here just in case someone finds it useful.

Edit:
It is not able so far to edit the world maps, but still is a work in progress.

Features to implement:
  • Allow edition of monster-in-a-box encounters.
  • Allow edition of Map encounters.
  • Research of Events and Extended Events.
  • Research and development of NPC Actions.
« Last Edit: October 18, 2016, 12:48:40 PM by noisecross »

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: FF5e Map Editor
« Reply #1 on: July 19, 2016, 07:23:35 AM »
Finally :D

Its a great tool and must have to these that do mods/hacks. When the first time I used it I was: WOOAH. Excellent work noisecross!

Jorgur

  • Moderator
  • *
  • Posts: 437
  • Gender: Male
    • View Profile
Re: FF5e Map Editor
« Reply #2 on: July 19, 2016, 07:49:12 AM »
Very neat program! I would like to see some more features though, such as click-and-drag to scroll the maps.
- I get unhandled exception errors on map 0x0D
- Transparent water is not displayed properly

samurai goroh

  • FF5 Hacker
  • *
  • Posts: 221
  • Gender: Male
    • View Profile
    • My page
Re: FF5e Map Editor
« Reply #3 on: July 19, 2016, 04:00:45 PM »
I can see it can load all maps w/o problems (well, I did got an error in map id: D, but not a crash like it used to). Great work noisecross  :childish:

To bad that it seems that even in a resolution of 1920x1080 is still not good enough to see everything w/o having to scroll :(
I'm the best in the universe! Just remember! [F-zero X]

noisecross

  • FF5 Hacker
  • *
  • Posts: 146
    • View Profile
Re: FF5e Map Editor
« Reply #4 on: July 20, 2016, 01:47:19 PM »
I'll fix some of theese issues in the next release.

Just for let you know:
- The map 00D seems to be empty. All it's "map descriptors" are 00 so there is no tilemap at all.
- The way the transparent backgrounds are drawn is my best effort (water, in particular). I don't fully understand how transparent layers work.
- Moreover the "floor" tiles just below water usualy are displayed using some kind of creative HDMA to "shake" their pixels. Without the shake, the tiles are just three ugly big brown squares. I did my best to simulate that "shake" but the result is not accurate at all.

I don't think I'll be able to fix the tranparencies.
On the other hand, if anybody knows how the sprite data is loaded in every map and how to read the NPC (non playable characters) graphics it would be very helpful  :happy:
I can say the same about the Events and about the NPC Actions.

By the way, if you are curious, you can use the editor to see the bugs in some maps:
Guido's Cave (read the properties): Map 002, (Sub 5) Tile (30, 25)
Mountain (display the walls): Map 03B, Tiles (17, 0F) and (18, 0F)
Pyramid (display the walls): Map 17E, Tiles (2C, 27) and (2C, 28)
« Last Edit: July 20, 2016, 02:13:15 PM by noisecross »

x0_000

  • Siren
  • *
  • Posts: 72
    • View Profile
Re: FF5e Map Editor
« Reply #5 on: July 20, 2016, 02:27:59 PM »
This is how NPCs are stored in the Advance version, the data structures should be similar enough to reverse engineer.
Code: [Select]
ffva npc setup
NPC data is stored at:
083B6514 - table starting points (NPCs/room)
values are relative to this pointer
083B695C - data points
7 bytes per NPC
@ 0x0 (2) - identifier
@ 0x2 (1) - sprite ID
@ 0x3 (1) - X position
@ 0x4 (1) - Y position
@ 0x5 (1) - Walking parameter (affects how the NPC moves)
@ 0x6 (1) - extra parameters (1-3 affect palette, 0x10 determines layer, 0x20, 0x40, 0x60 determines direction)

the first few bytes of the NPC data are
Code: [Select]
f2 00 47 28 0a 0e 40 f4 00 47 28 0a 08 40 9a 00
47 00 00 0f 40 9a 00 47 00 00 0f 40 f3 00 48 27
...

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: FF5e Map Editor
« Reply #6 on: July 21, 2016, 06:10:16 AM »
Code: [Select]
7 bytes per NPC strange ... so far what I have seen in GBA it always align data on word boundaries (2 bites) ...

noisecross

  • FF5 Hacker
  • *
  • Posts: 146
    • View Profile
Re: FF5e Map Editor
« Reply #7 on: July 22, 2016, 06:25:08 AM »
This is how NPCs are stored in the Advance version, the data structures should be similar enough to reverse engineer.

Right. The snes structure is the same. My question is if someone knows how to transform the "sprite ID" into an actual sprite.

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: FF5e Map Editor
« Reply #8 on: July 22, 2016, 06:28:36 AM »
Hey noisecross, I'm currently working on Encounters. As we talked earlier there are at least 4 kinds. They are tightly connected to maps ... so I was wondering: from where we have that info: http://slickproductions.org/slickwiki/index.php/FF5_Table:Map If it is from ROM could you point out the table that holds Map names?

As a suggestion to your editor:
- Show the name of the map;
- When resizing the main window on the right side, there is a point after which the map is not resized, just the right panel (with info)
- There is similar problem with maximizing the main window.
* I guess you dont want to make map window larger then its max. You may put MinMax info on main window, so it doesnt get larger then your desired size.

On WorldMaps there is 'Sub' section. Is that how maps are internally stored or thats your logical slicing of the map?
Also I noticed that many map are shown in groups - for example 13, 14, 15 they all share the same picture. What is the reason the be shown together?

noisecross

  • FF5 Hacker
  • *
  • Posts: 146
    • View Profile
Re: FF5e Map Editor
« Reply #9 on: July 22, 2016, 06:58:38 AM »
Thank you for the suggestions.
At this time I haven't found yet how the game link every map with every Location Name.

Let me try to answer your questions:
Quote
Hey noisecross, I'm currently working on Encounters. As we talked earlier there are at least 4 kinds.
I have been only able to see these 4 kinds in the world map Encounters and not in the "Locations". My last post in the thread "FF5 Bugs & Glitches" talks about this. See the bits labeled as "Enemy encounter".
You can also use this Map Editor in the world map to see what kind of encounter you can have in every tile. The tab "tileset" can help you also.

Quote
On WorldMaps there is 'Sub' section. Is that how maps are internally stored or thats your logical slicing of the map?
My logical. The 5 world maps are stored as 256 pointers to compressed tilemaps of 256 horizontal record.
That means a world map is a 256x256 matrix of 16x16px tiles.

Quote
Also I noticed that many map are shown in groups - for example 13, 14, 15 they all share the same picture. What is the reason the be shown together?
Usually, every Location is a "room". That means there are diferent locations which share the same VRAM (see bytes 09 0A 0B of the "Map Descriptor") and tilemap (see Location tilemaps (bytes 0C 0D 0E 0F)) but have diferent Events, Chests, NPC and Exits.

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: FF5e Map Editor
« Reply #10 on: July 22, 2016, 07:40:58 AM »
Quote
Hey noisecross, I'm currently working on Encounters. As we talked earlier there are at least 4 kinds.
I was referring to WorldMap, Dungeon, Event & Monster-in-a-box encounters, not the 4 zones as samurai goroh calls them :D

Quote
That means a world map is a 256x256 matrix of 16x16px tiles
So the world maps are really 4096x4096 pixels ... as I have seen some on the net.

Quote
Usually, every Location is a "room". That means there are diferent locations which share the same VRAM (see bytes 09 0A 0B of the "Map Descriptor") and tilemap (see Location tilemaps (bytes 0C 0D 0E 0F)) but have diferent Events, Chests, NPC and Exits.
OK then there must be extra info, that points out which part of the 'room' to show on the screen ...

noisecross

  • FF5 Hacker
  • *
  • Posts: 146
    • View Profile
Re: FF5e Map Editor
« Reply #11 on: July 22, 2016, 07:34:39 PM »
Quote
I was referring to WorldMap, Dungeon, Event & Monster-in-a-box encounters, not the 4 zones as samurai goroh calls them :D
Oh, sorry.
Well, I think you have understood the WorldMap and the Dungeon encounters.
The Event encounters are out of my scope at this moment but if you found anything interesting I'll be very happy to add it to this Map Editor.
The Monster-in-a-box encounters are mentioned in the wiki.

By the way I think you asked me before about where are the Location names.
The names are stored as 164 records with no fixed length:
Code: [Select]
D0/7000-D0/71FF Data Location names offsets (2 bytes * 164)
E7/0000-E7/08FF Text Location names

Quote
OK then there must be extra info, that points out which part of the 'room' to show on the screen ...
I think there isn't. You can see in this video how the room is actually fully displayed. The only limitation is that the "camera" always follows the player so the walls are enough to prevent display anything out of the room.
Do you know any Location where the scroll is fixed? It is a nice posibility to explore.

x0_000

  • Siren
  • *
  • Posts: 72
    • View Profile
Re: FF5e Map Editor
« Reply #12 on: July 24, 2016, 03:25:53 AM »
This is how NPCs are stored in the Advance version, the data structures should be similar enough to reverse engineer.

Right. The snes structure is the same. My question is if someone knows how to transform the "sprite ID" into an actual sprite.
Looking into the GBA version this is the set of sheets the game uses (note that I rearranged it for clarity, this is not the actual in-game arrangement):

Each column corresponds to an ID, starting at ID 0x0. The rows are to separate the different sheets since they're different sizes. The first 4 frames are always the directional frames (Down/Up/Side Frame 1/Side Frame 2), the game just flips the bottom half of the up/down sprites for walking. As you can see some NPCs share the same ID and the game just uses directions to figure out which one to use. The number of frames for a specific ID is partially hardcoded (the game uses a bunch of indices to separate which range has which sprites.)

Syldra/Magissa are constructed piecewise apparently, because using their ID only makes part of the sprite. Hiryuu is the only sprite that's "large", which uses ID 0x67. Note that most of the time using Hiryuu will be glitchy and the head will usually be another NPC piece.

In total there's 103 (0x0-0x66) possible single tile sprites that can be used. This is how the sprites look in the other palettes:



Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: FF5e Map Editor
« Reply #13 on: July 25, 2016, 02:10:50 AM »
Quote
By the way I think you asked me before about where are the Location names.
The names are stored as 164 records with no fixed length:
Code: [Select]
D0/7000-D0/71FF Data Location names offsets (2 bytes * 164)
E7/0000-E7/08FF Text Location names
Yes. Unfortunately these names dont match mapIDs. So there must be a byte in Map structure or separate array that points out the name of the map. Do you know it?

noisecross

  • FF5 Hacker
  • *
  • Posts: 146
    • View Profile
Re: FF5e Map Editor
« Reply #14 on: July 25, 2016, 06:23:06 AM »
Each column corresponds to an ID, starting at ID 0x0. The rows are to separate the different sheets since they're different sizes. The first 4 frames are always the directional frames (Down/Up/Side Frame 1/Side Frame 2), the game just flips the bottom half of the up/down sprites for walking. As you can see some NPCs share the same ID and the game just uses directions to figure out which one to use. The number of frames for a specific ID is partially hardcoded (the game uses a bunch of indices to separate which range has which sprites.)

Thank you x0_000. I think this information is going to be useful.  :happy:

Yes. Unfortunately these names dont match mapIDs. So there must be a byte in Map structure or separate array that points out the name of the map. Do you know it?

You are right. I have not discovered yet how to match the Locations with the names.
Probably there are a separate array of pointers as you point or maybe one of the "map descriptors" is the pointer to the name.