Users browsing this thread: 1 Guest(s)
Information about maps

#1
Posts: 149
Threads: 21
Thanks Received: 40
Thanks Given: 3
Joined: Dec 2013
Reputation: 9
Status
Auto-life
Greetings. I want to share information about maps. When a map is loaded, it also loads many things with it. It includes events, npcs, exits and chests. All of them are stored in different structures.

Headers

All mentioned structures have in common a header and their related data. The header structure is probably #$0340 bytes with 416 entries for each map, except the last one, with two bytes by entry. After the header structure, it follows the data structure. They are two different structures. However, in the game code, they are referenced from the header initial address (base). As example, LDA $DFBB00,X can load the first byte of the header structure (2 bytes index) or the first byte of the entrance structure (6 bytes of data). It is necessary to pay attention in the index to determinate the kind of structure which are being loaded. In this case, header structure if X < #$0340 or the entrance structure if X > #$0340.

The header structure is only two bytes for each map. They are actually indexes to search for the data structure. To calculate the header index for a specific map, the function is: header index = (map number * 2) + header base.

As example, the header base for the entrances are $DFBB00. For the map #$0074 (House of Gau's father, indoors), the index for the entrance structure is:
Code:
header index = (map number * 2) + header base
        header index = (#$0074 * 2) + #$DFBB00
        header index = (#$E8) + #$DFBB00
        header index = #$DFBBE8

To calculate the data address: data address = value stored in header index + header base. It is the start of the data structure for the specified map.

The game system checks the difference between the header index and the next header index. The referenced structures have a fixed size but multiple instances of the structure can be stored. As example, the structure size of entrances are six bytes. If the difference is 0, there are no exists for this map. If the difference is 6, there are one exit in this map. If the difference is 12, there are 2 exits in this map. If the difference is 18, there are 3 exits in this map, etc.

C4/0000 Events

Code:
Events header:  C4/0000

00      position x
01      position y
02      event pointer: low
03      event pointer: middle
04      event pointer: high

When the characters steps in the (x,y) position of the map, the designed event is executed.

If the event doesn't move the character or have a conditional branch to null itself after its execution, it will be called repeatedly in a infinite loop.

C4/1A10 Npcs

Code:
NPCs header:    C4/1A10

00      event: low
01      event: middle
02 #$01 event: high
   #$02 event: high
   #$04 palette
   #$08 palette
   #$10 palette
   #$20 intangible
   #$40 ???
   #$80 presence
03      ? id
04      x position
05      y position
06      graphic set
07 #$01 movement type
   #$02 movement type
   #$04 movement type  
   #$08 movement type
   #$10 map layer
   #$20 map layer
   #$40 vehicle
   #$80 vehicle
08 #$01 direction facing
   #$02 direction facing
   #$04 don't turn npc if spoken
   #$08 ???
   #$10 ???
   #$20 ???
   #$40 ? can fix "sliced" graphics?
   #$80 ???

Sets the initial data for the NPCs when a map is loaded.

For the movement type, i only found #$00 (static) or #$03 (movement) as valid values. All other values sets the npc as static or have weird behavior.

DF/BB00 Exits

Code:
Exits header:   DF/BB00

00      x position: old
01      y position: old
02      map id: low
03 #$01 map id: high
   #$02 ???
   #$04 ???
   #$08 display location name        
   #$10 direction facing
   #$20 direction facing
   #$40 ???
   #$80 ???
04      x position: new
05      y position: new

When the character steps in the (x,y) position, warp it for the designed map with the designed coordinates.

It is imperative to have valid coordinates for the setup. If the character can't access the map position, the setup is useless. If the new map position isn't walk able, the character is permanently stuck. If the new map position bypass the map size, the coordinate system is corrupted and all exits are disabled or aren't functional.

ED/82F4 Chests

Code:
Chests header:  ED/82F4

00      x position
01      y position
02      chest id
03      chest type
04      chest content

Sets the chest for the map. Actually, if the character press the A button in front of the designed position, the chest event is executed. If the tile in the position is a chest, the tile changes as a opened chest. Otherwise, the tile isn't changed.

Unlike the other headers, the index of the data structure is relative to $ED/8634 instead of $ED/82F4, the actual header base.

Others?

There are other settings for the map, like the background in battles, the song played, enemy formations used, etc. I don't know where this setup is stored, but i suspect of the $ED/8F00 structure. The structure size is #$021 and doesn't have a header structure.

I don't have enough information about this structure but i will let you know i consider it a good suspect for the low level setting of the maps.
  Find
Quote  
[-] The following 5 users say Thank You to HatZen08 for this post:
  • Catone (09-11-2015), Gi Nattak (09-10-2015), madsiur (09-10-2015), Tenkarider (09-11-2015), Warrax (08-04-2016)

#2
Posts: 1,633
Threads: 56
Thanks Received: 13
Thanks Given: 84
Joined: Apr 2014
Reputation: 12
Status
Atma
Quote:There are other settings for the map, like the background in battles, the song played, enemy formations used, etc. I don't know where this setup is stored

Wouldn't be a good way to know their position, or the position of most things, by picking a fresh rom, changing a single thing that you want to know their position(like changing the battle pack in a map with FF6LE) and then comparing this rom with another fresh rom? that should reveal their address in the rom.


THE GREATEST CHALLENGE OF ALL TIMES AWAITS:
http://www.ff6hacking.com/forums/showthr...p?tid=2593
DO YOU HAVE WHAT IT TAKES TO SLAY A GOD?
------------------------------------------------------------------------
Tenkarider's project #2 is started: FF6 Curse of the Madsiur Joke (CotMJ)
http://www.ff6hacking.com/forums/showthr...p?tid=2755
What happens when Madsiur tweaks your account? This full game hack will show that!
  Find
Quote  

#3
Posts: 149
Threads: 21
Thanks Received: 40
Thanks Given: 3
Joined: Dec 2013
Reputation: 9
Status
Auto-life
Yes, i can use a editor and check the modified rom with the original rom or the last modified rom. However, the editor abstracts the low level management of the rom and can do whatever it wants with the rom. Even if apparently it only changes one single byte of data, it can change everything related, like pointers. If i am unlucky, I can have a huge amount of bytes to check. Still, if i carefully do small modifications in the rom and check with whatever was modified before, i should find good hints of offsets. I can check the code or documentation for them.

Thank you. It was a good advice.
  Find
Quote  

#4
Posts: 212
Threads: 1
Thanks Received: 11
Thanks Given: 2
Joined: Oct 2014
Reputation: 7
Status
None
Quote:the background in battles, the song played, enemy formations used, etc. I don't know where this setup is stored, but i suspect of the $ED/8F00 structure. The structure size is #$020 and doesn't have a header structure.
I have all of this information. See https://github.com/abyssonym/beyondchaos...er.py#L420 for the method in Beyond Chaos that reads data about maps from the rom, starting at 0x2d8f00 (unheadered). According to my notes, the structure size is 0x21 bytes, not 0x20.
  • Background in battles - Third byte of the data structure, lower 7 bits
  • Music - 29th byte
  • Enemy formations - The monster pack used at a given location is elsewhere in the rom, at 0xf5600. The offset from that address is the same as the map's index.

In your exit and NPC documentation, you are missing 2 bits for facing direction in each. Note that this document contains a lot of relevant information about the data structures in FF6, although it is still quite incomplete.




https://github.com/abyssonym/beyondchaos
Beyond Chaos is a full-game randomizer for FF6.
Quote  

#5
Posts: 149
Threads: 21
Thanks Received: 40
Thanks Given: 3
Joined: Dec 2013
Reputation: 9
Status
Auto-life
Thank you very much for the extra information and links. It will be helpful.

Yes, the size of the ED/8F00 structure is actually #$21 bytes, not #$20. The map/destiny field in the exit/entrance structure also have flags on them. I will update the first post to fix it.
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite