øAslickproductions.org/forum/index.php?PHPSESSID=1a1fn35tn22svp8j2c39ef7t80&action=printpage;topic=1866.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index01ca-2.htmllayedslickproductions.org/forum/index.php?topic=1866.15e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index01ca-2.html.zxaÊh^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ0P.æOKtext/htmlISO-8859-1gzip@øÕæÿÿÿÿÿÿÿÿÑHWed, 11 Mar 2020 11:40:42 GMT0ó°° ®0®P®€§²ð®aÊh^ÿÿÿÿÿÿÿÿæ@æ Print Page - What information is known about the overworld?

Board of Slick

Library of the Ancients => Final Fantasy IV Research & Development => Topic started by: Pinkpuff on August 16, 2013, 01:01:57 PM

Title: What information is known about the overworld?
Post by: Pinkpuff on August 16, 2013, 01:01:57 PM
In this context, I don't just mean the "upper world" but the overworld maps generally, so I'm including the underworld and the moon surface as part of the same kind of object.

I know there exists an overworld editor of some kind, and I can probably reverse engineer some of this from it, but if anyone has any data handy to speed along the process it would be greatly appreciated:
Title: Re: What information is known about the overworld?
Post by: chillyfeez on August 17, 2013, 01:01:12 PM
  • How (and where) are the overworld maps stored?
World Map row pointers are located at B0200-B067F
World Map row data is located at B0680-B6D53. The Data for each row is terminated with FF.
I assume each World map has its own tileset, though I suppose it's possible the Underworld and Moon use the same tileset with different palettes (doubt it, though). I've done some, but not a lot, playing around with the data of the Overworld map (that is, with a hex editor, independently of Yousei's map editor). It seems when a tile's bit 7 is 0 (so, bytes 00-7F), it is an individual tile; but if bit 7 is 1, then the following byte represents a count of how many of that tile will appear.
Thus, the first row of the Overworld reads:
Code: [Select]
99 FF FFWhich means:
Code: [Select]
99 FF - tile 99 (ocean with no shore) 255 times
FF - end row
The 20th row of the overworld (the first that is not all ocean) reads:
Code: [Select]
99 2F 1C 1B 99 CD FFWhich means:
Code: [Select]
99 2F - tile 99 (ocean with no shore) 47 times
1C - tile 1C (ocean with a tiny speck of shore in the lower-right corner, single because bit 7 is 0)
1B - tile 1B (ocean with a tiny speck of shore in the lower-left corner, single because bit 7 is 0)
99 CD - tile 99 (as above) 205 times
FF - end row
I haven't seen documentation of the order of tiles within the tilesets (like an Overworld version of the map editor in Phoenix's FF Tools), but a person with enough time and the proper motivation could do this pretty easily.

  • How are the overworld events handled?
  • How are the overworld teleporters/entrances handled?
my thread on world map triggers is here:
http://slickproductions.org/forum/index.php?topic=1769.msg17690#msg17690
That covers most of the ground for those questions.
Functionally, World map triggers behave like (non-chest) triggers in location maps. That is, they can be set to teleport or activate events however you want, except events in world maps are limited - evoking text will crash the game, and there are no NPCs.
As with location maps, there are specific world map tiles that can/will trigger events and teleportations. Phoenix explained how to edit location map tile properties here: http://slickproductions.org/forum/index.php?topic=1286.0
I imagine that if we knew the location of World Map tile properties, they could be altered in much the same way.
As it stands, triggers can exist on the following types of tiles:
- (Overworld) Town
- (Overworld) Castle (six or eight different tiles, depending on if broken castles use the same bottom tiles)
- (Overworld) Forest
- (Overworld) Cave
- (Overworld) Mountain Path
- (Overworld) Dark Green Grass (trigger for the bombing of Damcyan)
- (Overworld) Bridge (Fabul Port)
- (Underworld) Castle (four tiles)
- (Underworld) Town
- (Underworld) Cave
- (Underworld) Tower of Bab-il Entrance (two tiles)
- (Underworld) Dark-Colored Ground (tanks shooting tower triggers)
- (Moon) Cave
 :edit: I should probably mention that the Dark Green Grass, Bridge, and Dark-Colored Ground tiles that are triggers are different tiles than the identical ones that are not triggers.
  • Are the underworld and moon surface indeed handled the same way as the "upper world" overworld?
I'm not sure I fully understand the question... I think the answer is yes, with the exceptions of all of the ways the Underworld and Moon typically differ from the Overworld.
Title: Re: What information is known about the overworld?
Post by: chillyfeez on August 17, 2013, 08:11:51 PM
Hmm...

There's a curious block of code at A0800-A0AFF.
It's only 50 (hex) lines away from the location map tile properties at A1000, it seems to follow a similar type of structure/pattern as the location map tile properties, and at 30 (hex) lines, it's exactly long enough to represent the properties of three tilesets (Overworld, Underworld, Moon).
Think it may be time for some experimenting!

Also, I have a suspicion that some information about the vehicle travel and landing possibilities of tiles will be contained herein (assuming I'm right about this, which at this point is just a big assumption), so I may learn some things to contribute to the vehicle thread too.
Title: Re: What information is known about the overworld?
Post by: Vehek on August 17, 2013, 08:58:44 PM
These are unheadered offsets.
0A0000: Overworld tile assembly data
0A0200: Underworld tile assembly data
0A0400: Lunar tile assembly data

0A0600: Palette assignment data (overworld)
0A0700: Palette assignment data (underworld)
0A0800: Palette assignment data (lunar)

0A0900: Palette Data (Overworld)
0A0980: Palette Data (Underworld)
0A0A00: Palette Data (Lunar)


0E8000: Overworld subtile graphics
0EA000: Underworld subtile graphics
0EC000: Lunar subtile graphics
(4bpp linear reversed, combined with palette assignment data to make 8bpp subtiles)
Title: Re: What information is known about the overworld?
Post by: chillyfeez on August 18, 2013, 12:00:39 AM
Got it. World map tile properties are at (headered) A0C80-A0F7F.
Two bytes per tile, as with location tile properties, but the bit meanings are of course completely different.
I'll figure it out, but again, I expect this to take a while.
Title: Re: What information is known about the overworld?
Post by: chillyfeez on August 18, 2013, 11:51:31 PM
Well, that actually went very smoothly, thanks to FF4kster, as a matter of fact!
As previously stated, the properties of individual tiles within a world map tileset are located at
A0C80-A0F7F - 2 bytes per tile, FF bytes per world map. I can and will eventually make an image of the tilesets, but that really will take a while because I'll have to jump back and forth between TLP and Paint.
But anyway, here are the data for each tile:
BYTE 0
------
Bit 0: Walkable, ground level
Bit 1: Chocobo can walk (Can only dismount if also walkable)  :edit: Also, airships can fly over only if event flag 57 is set
Bit 2: Black chocobo can fly over
Bit 3: Black chocobo can land (shadow will be partially obscured during flight, bottom half of chocobo is always obscured when it lands, does not have to be coupled with "walkable," but you won't be able to do anything upon landing)
Bit 4: Hovercraft can travel (Can only land if also walkable)
Bit 5: Airship can fly over
Bit 6: Walkable, plateau level
Bit 7: Lunar Whale can fly over

BYTE 1
------
Bit 0-2: Battle Background
 000: Overworld Field
 001: Beach
 010: Forest
 011: Desert
 100: Underworld Field
 101: Moon Surface
 110: Inside moon cave, instant death
 111: Forest
Bit 3: Obscures lower half of body
Bit 4: Airship/Lunar Whale can land (Does not have to be "walkable," but you won't be able to do anything)
Bit 5: (?) Unused
Bit 6: Encounters possible
Bit 7: Trigger tile

A couple of odd things I discovered in this process...
-Tiles 00, 10, 20, 30 in the Overworld tileset make up the 4x4 block of snow-capped mountains. Whereas every other tile is 1x1, these four "tiles" are 1x4.
-The bridge on the world map does not work like the bridge in locations. Its travel-ability is identical to that of the field tiles. I have not been able to figure out how the game knows to make the chocobo run under or over it appropriately.

Given how much data about travel-ability is editable, I've got some exciting ideas about vehicle possibilities, but I will post that to the proper thread. Also, not tonight, I'm going to bed.
Title: Re: What information is known about the overworld?
Post by: Grimoire LD on August 19, 2013, 12:55:50 AM
That is some top notch work there Chillyfeez! It is great to know how all of this works.
Title: Re: What information is known about the overworld?
Post by: chillyfeez on August 23, 2013, 10:04:07 AM
Related to this topic, but only tangentially related to any of Pinkpuff's questions:
Does anybody know/have any insight about the Overworld "objects?"
This is how we generally refer to them in event editing - I mean the mountains that close around Mist, the ship, the mountains/hole by Agart, any others I'm forgetting.
I wonder if it's possible to change their locations and/or functional arrangements.
Is it possible to make the ship appear somewhere else?
What if I want disappearing/reappearing mountains between Mysidia and Mt. Ordeals?
Or disappearing/reappearing other kinds of terraformation?
Yousei's document refers to the routine that handles these depending on events, but doesn't say anything else about it. I don't recall ever seeing anything else besides the flag to turn them on and off within events.
 :hmm:
Title: Re: What information is known about the overworld?
Post by: Grimoire LD on August 28, 2013, 12:28:48 AM
This is an interesting question and one that Yousei regarded in his info a very long time ago.


AC8FA-      (15C6FA-      ) Routine that alters overworld map depending on events

I haven't taken a look at it but this seems like it would be a good place to start.
Title: Re: What information is known about the overworld?
Post by: chillyfeez on August 29, 2013, 10:20:54 PM
Well, that was tedious, but I've figured out how Underworld lava flight works.
It is in fact event flag 57 (the one set at the end of the heat shield event) that toggles the ability to fly over the lava.
Here's the weird part - it turns out the bit that flags "Yellow Chocobo can walk" also flags "can only fly if event flag 57 is set." Makes sense, since there is no Chocobo riding in the Underworld (although they had an extra bit at Byte 1 bit 5, so why didn't they just use that?).
The "Airship can fly over" bit preempts this property, though, which is why airships can always fly everywhere in the Overworld.
While we're sort of on the topic... I never knew this before, but if you force Yellow Chocobo travel in the Underworld, the chocobo will be invisible. Bummer.
Title: Re: What information is known about the overworld?
Post by: Grimoire LD on August 29, 2013, 10:33:19 PM
That is a bit of a shame about the Chocobo in the Underworld. Good work on figuring out how that works. I expected it to be an event flag, but I wasn't sure if it would deal something with the tiles themselves, which it did appear to do, so well done. The Drill I guess works in a similar fashion.
Title: Re: What information is known about the overworld?
Post by: chillyfeez on August 29, 2013, 10:46:59 PM
There are a few weird things about the airships that I don't quite understand how they work (yet?).
Title: Re: What information is known about the overworld?
Post by: Vehek on August 29, 2013, 10:59:13 PM
Here are some generated tilesets for the world maps.
Title: Re: What information is known about the overworld?
Post by: chillyfeez on August 30, 2013, 12:12:32 AM
Vehek, you beat me to it.
I'm in the middle of making tileset maps like this, except I'm separating the tiles by 1 pixel each and labeling them for easy reference.
Anyway, question for you, since you seem to have some insight on this...
Do you know of a program that is capable of editing world map tiles? Tile Layer doesn't seem to be able to view them properly.
Obviously there are quite a few unused tiles in the Underworld and Moon tilesets (and one in the Overworld). It would be great to be able to change the graphics of these tiles and actually put them to use.
Title: Re: What information is known about the overworld?
Post by: Grimoire LD on August 30, 2013, 12:13:55 AM
There are a few weird things about the airships that I don't quite understand how they work (yet?).
  • The Falcon's Drill, which is really just cosmetic, its "function" is all event driven
  • The Highwind's Hovercraft crane
  • The first time the Highwind goes underground
    - there's an automatic event in which you are caught in a crossfire between the Red Wings and the Dwarves' tanks
    - it's unusable until the event in which Cid fixes it

Great work Vehek! That all looks like very malleable parts. It is interesting to see that there are two tops to the Tower of Bab-il which means two of those spaces should be unused.

Now in the Overworld events was there any event for going into the Underground?

The event flag set is 50 after the event completes...

Then when Cid saved the crew with the Airship, Flag 10 is set, but that deals nothing with the Airship, hmm... Can you take the Enterprise (Not Highwind, that's FFVII, heh) into the underground again? I am pretty sure you can't... It may just be that the Enterprise is programmed not to function in the Underworld except in cutscenes where the player has no control.
Title: Re: What information is known about the overworld?
Post by: Dragonsbrethren on August 30, 2013, 12:34:22 AM
Great work Vehek! That all looks like very malleable parts. It is interesting to see that there are two tops to the Tower of Bab-il which means two of those spaces should be unused.
All four tiles are used. The ones with grass behind them are for the tallest tower, the black ones are for the two towers that end "in" the ravine. (The underworld duplicates likely have different blocking properties for the airship, so you can't fly up the tower graphics)

Also, the Enterprise works fine in the underworld.
Title: Re: What information is known about the overworld?
Post by: chillyfeez on August 30, 2013, 01:50:49 AM
Hah - I've been calling it the Highwind this whole time  :isuck:
Once the Agart crater is opened with the drill, you are free to travel underground with the ... er ... yellow airship.
If memory serves, you can even take the hovercraft down there with the crane (but it doesn't do you any good).

Tile 68 in the Overworld tileset is (i'm pretty sure) the only one that is unused.
Title: Re: What information is known about the overworld?
Post by: Vehek on August 30, 2013, 03:36:18 AM
Do you know of a program that is capable of editing world map tiles? Tile Layer doesn't seem to be able to view them properly.
I haven't checked Tile Layer yet, but are you using the correct tile encoding, since it's not in 4BPP SNES? The tile format is called 4BPP GBA in YY-CHR.
Or if you meant the assembled tiles, I don't have a good method for viewing them. The tileset images were made by having a program use the tile assembly data to write out the tile graphics to a file, which I then viewed in a tile viewer.

Quote
Obviously there are quite a few unused tiles in the Underworld and Moon tilesets (and one in the Overworld). It would be great to be able to change the graphics of these tiles and actually put them to use.
I wouldn't say there are really that many available. Keep in mind that each 16x16 tile is made up of 4 8x8 tiles. There are very few unused 8x8 tiles, if any. Except for the moon, which doesn't have a full set of 256 8x8 tiles. While it's possible to turn those unused 16x16 tiles into new combinations of the 8x8 tiles, there probably aren't enough unused 8x8 tiles to insert many new graphics into.

Let's see...

Haven't yet accounted for some of the used blank 8x8 tiles maybe being leftover and not really needing to be used instead of other blank tiles.
Title: Re: What information is known about the overworld?
Post by: chillyfeez on August 30, 2013, 08:49:10 AM
I wouldn't say there are really that many available. Keep in mind that each 16x16 tile is made up of 4 8x8 tiles. There are very few unused 8x8 tiles, if any. Except for the moon, which doesn't have a full set of 256 8x8 tiles. While it's possible to turn those unused 16x16 tiles into new combinations of the 8x8 tiles, there probably aren't enough unused 8x8 tiles to insert many new graphics into.
I was afraid you'd say that  :lame:
Title: Re: What information is known about the overworld?
Post by: chillyfeez on August 31, 2013, 10:48:58 AM
Here are my world map tileset... um, maps.
They're arranged in a style that mimic's Phoenix's FF4Tools map editor. So, tile 34 would be the fifth tile in the fourth row (not vice versa). Also, red dots indicate tiles that (by default) are trigger tiles, so as to give visual distinction between, say, regular forest and chocobo forest entrances.
Each map has a reference to the location of its corresponding tile properties for easy reference. Remember that each tile has two bytes of properties, so to edit the properties of tile 34, you would edit the ninth and tenth bytes of the seventh row of the appropriate range.
Overworld
(http://chillyfeez.webs.com/photos/Images/Overworld%20Tiles.jpg)

Underworld
(http://memberfiles.freewebs.com/22/01/115500122/photos/undefined/Underworld%20Tiles.jpg)

Moon Surface
(http://memberfiles.freewebs.com/22/01/115500122/photos/undefined/Moon%20Surface%20Tiles.jpg)
Title: Re: What information is known about the overworld?
Post by: Pinkpuff on August 31, 2013, 10:59:48 AM
Ok so the 00, 10, 20, and 30 tiles on the upper world are each 4 graphical tiles wide?
Title: Re: What information is known about the overworld?
Post by: chillyfeez on August 31, 2013, 11:04:17 AM
Yeah. I think I mentioned that earlier in the thread. Makes sense, sorta. they're all used exclusively as parts of the snow-capped mountains, so they were able to save on the number of tiles by doing that.
Title: Re: What information is known about the overworld?
Post by: Grimoire LD on December 08, 2014, 03:28:44 PM
With Chillyfeez's directions I've recorded down all of the World Map Triggers, maybe this will help get it into the editor sooner? A little difficult to say...
Location             X, Y,     Map,            New X, New Y,

OVERWORLD

Baron Castle(NW)     65,9C Baron Castle(24)       10,1E
Baron Castle(NE)     66,9C Baron Castle(24)       10,1E
Baron Castle(SW)     65,9D Baron Castle(24)       10,1E
Baron Castle(SE)     66,9D Baron Castle(24)       10,1E


Baron Town(NW)       64,9D Baron Town(00)         10,1E
Baron Town(SW)       64,9E Baron Town(00)         10,1E

Baron Town(NE)       67,9D Baron Town(00)         10,1E
Baron Town(SE)       67,9E Baron Town(00)         10,1E


Mist Cave(S)         4C,84 Mist Cave(6C)          02,1C
Mist Cave(N)         54,77 Mist Cave(6C)          9B,03

Mist Village(W)      60,77 Mist Village(01)       43,10
Mist Village(E)      61,77 Mist Village(01)       DC,10 

Kaipo                7D,68 Kaipo(02)              0F,1E

Watery Pass(S)       8A,53 Watery Pass-South(6F)  1A,1D
Watery Pass(N)       8A,4D Watery Pass-North(73)  98,09

Waterfalls(N)        86,48 Waterfalls(74)         90,09
Waterfalls(S)        7D,42 Waterfall 2F(76)       90,0B

Damcyan Trigger      77,3E Event Call 10(FF)       N/A

Damcyan Castle(NW)   76,3A Damcyan Castle(25)     10,1E
Damcyan Castle(NE)   77,3A Damcyan Castle(25)     10,1E
Damcyan Castle(SW)   76,39 Damcyan Castle(25)     10,1E
Damcyan Castle(SE)   77,39 Damcyan Castle(25)     10,1E

Antlion Cave         88,38 Antlion Cave 1F(77)    8F,04
       
Mt. Hobs(W)          98,31 Mt. Hobs-West(7E)      0F,1C
Mt. Hobs(E)          A0,31 Mt. Hobs-East(80)      15,1E

Fabul Castle(NW)     D6,3A Fabul Castle(26)       0F,1D
Fabul Castle(NE)     D7,3A Fabul Castle(26)       0F,1D
Fabul Castle(SW)     D6,39 Fabul Castle(26)       0F,1D
Fabul Castle(SE)     D7,39 Fabul Castle(26)       0F,1D

Fabul Docks          DD,38 Event Call 2B(FF)       N/A

Mysidia(W)           9A,C7 Mysidia(03)            10,1F
Mysidia(E)           9B,C7 Mysidia(03)            10,1F

Mt. Ordeals          DA,C7 Mt. Ordeals 1F(84)     14,1F

Troia Castle(NW)     22,52 Troia Castle (27)      10,1D
Troia Castle(NE)     23,52 Troia Castle (27)      10,1D
Troia Castle(SW)     22,51 Troia Castle (27)      10,1D
Troia Castle(SE)     23,51 Troia Castle (27)      10,1D

Troia Town(W)        23,53 Troia Town(05)         10,1C
Troia Town(E)        23,54 Troia Town(05)         10,1C
Troia Town(SE)       24,54 Troia Town(05)         10,1C

Cave Magnes          4A,35 Cave Magnes 1F(8C)     85,07

Eblan Castle (NW)    2D,EB Eblan Castle(28)       10,1F
Eblan Castle (NE)    2E,EB Eblan Castle(28)       10,1F
Eblan Castle (SW)    2D,EC Eblan Castle(28)       10,1F
Eblan Castle (SE)    2E,EC Eblan Castle(28)       10,1F

Cave Eblan           18,E7 Eblan Cave(C7)         8A,04

Agart(NW)            68,D7 Agart(06)              10,1F
Agart(SE)            69,D8 Agart(06)              10,1F

Silvera              D2,82 Silver(04)             11,1E

Adamant Grotto       DB,88 Adamant Grotto(A0)     07,14

Giant of Babil      21,DB Giant of Babil Mouth(B5)0C,05

?Airship?         22,DB Airships with Soldiers(C0)8C,11

Fabul Chocobo Forest E4,2F Chocobo Forest(CF)     08,0B

Mt. Ordeals Cho. Frst. D5,D1 Cho. Frst(D1)        08,0B

Baron Chocobo Forest 59,A3 Chocobo Forest(D2)     08,0B

Troia Chocobo Forest 22,65 Chocobo Forest(D3)     08,0B

Island chocobo Forest 56,4F Chocobo Forest(D4)    08,0B

Large Troia Forest   29,35 Chocobo Forest(21)     08,1E

UNDERWORLD


Dwarf Castle(NW)    63,52 Dwarf Castle(07)        0F,1E
Dwarf Castle(SW)    63,52 Dwarf Castle(07)        0F,1E
Dwarf Castle(NE)    63,51 Dwarf Castle(07)        0F,1E
Dwarf Castle(SE)    64,51 Dwarf Castle(07)        0F,1E
Dwarf Base          5B,53 Dwarf Base(0F)          03,0E

Dwarf Tank Trigger1 30,0F Event Call 58(FF)        N/A
Dwarf Tank Trigger2 31,0F Event Call 58(FF)        N/A

Smithy's House      68,7B Smithy's House(00)      06,0B

Tomra(W)            3E,79 Tomra(01)               11,1B
Tomra(E)            3F,79 Tomra(01)               11,1B
Tomra(SE)           3F,7A Tomra(01)               11,1B

Sylvan Cave         0D,0E Sylvan Cave 1F(45)      90,02

Sealed Cave         2E,6D Sealed Cave(44)         04,0A

Land of Monsters    1B,56 Land of Monsters(36)    91,0A

Babil Trigger1      37,14 Event Call 36(FF)        N/A
Babil Trigger2      36,11 Event Call 36(FF)        N/A
Babil Trigger3      33,10 Event Call 36(FF)        N/A

-----------------------------------------------------------

MOON

Bahamut's Cave      3D,17 Bahamut's Cave 1F(5A)   88,07

Lunar Palace        1C,19 Lunar Palace Lobby(60)  10,1C

First Lunar Path(N) 12,14 Lunar Path(63)          0C,1E
First Lunar Path(S) 12,0E Lunar Path(63)          93,05

2nd Lunar Path(S)   29,18 Lunar Path(64)          95,06
2nd Lunar Path(N)   28,1C Lunar Path(64)          09,19

Hummingways         21,27 Hummingways(65)         0A,10

Title: Re: What information is known about the overworld?
Post by: chillyfeez on December 08, 2014, 06:08:13 PM
Are those listed in the order they appear in ROM?
Title: Re: What information is known about the overworld?
Post by: JCE3000GT on December 08, 2014, 07:26:47 PM
Don't know if this will help and I feel bad for not publicly releasing those offsets yet but starting at offset (no header) 74300 is the overworld encounter rate (goes left to right in 32 tile blocks), 74340 is the underworld encounter rate (one byte for entire map), and 74341 is the moon map also one byte for the whole map.  After that is each map encounter rate (74342-744C2). 
Title: Re: What information is known about the overworld?
Post by: Grimoire LD on December 08, 2014, 08:10:21 PM
Yep, that's the exact order they appear in ROM.

Ah? That is rather nice to have JCE! Thanks for that bit of information.
Title: Re: What information is known about the overworld?
Post by: Gedankenschild on February 12, 2015, 09:11:48 PM
I have a question about the way the final map tilesets chillyfeez posted are constructed. Let's say I wanted to sacrifice parts of the tower to gain four 8x8 tiles, in order to reproduce the grass tiles from the remake. (OK, I'm gonna make a screenshot to clear that up...)
The answer would probably lie in the Overworld tile assembly data at 0A0000 that Vehek posted here. I just don't know how to interpret the hex data there. Has this been described before here? I used the search function but couldn't find the answer...  :isuck:
Title: Re: What information is known about the overworld?
Post by: chillyfeez on February 12, 2015, 09:40:52 PM
So your question, if I'm interpreting this right (and - caveat - I'm definitely not the one on this forum with the most knowledge in this area), is how you would take those four tiles and make the game arrange them into a proper 16x16 map tile?
Title: Re: What information is known about the overworld?
Post by: Gedankenschild on February 12, 2015, 10:39:08 PM
Yes, in this example I would like the game to construct the lowest part of the tower (the two 16x16 tiles) from the upper four 8x8 tiles it uses now and then the pitch black tile from the top left corner times four. That would then free up the lowest four tower tiles (8x8). These could then be used to have the grass parts of the map consist of four 8x8 tiles instead of two.
Title: Re: What information is known about the overworld?
Post by: Gedankenschild on February 13, 2015, 10:58:14 AM
Silly me, I think I'm starting to figure it out. It helps to be able to count properly and not be too lazy to do some experimenting...  :blush:
Title: Re: What information is known about the overworld?
Post by: chillyfeez on June 01, 2015, 02:22:42 PM
Annnnnnd we're back.

So I've been working on putting a driveable tank into TfW, and in so doing I learned a bit more about world map tile properties, specifically the first byte, as it relates to vehicle travel.
I'll dig through my copious notes and post the relevant stuff here when I have the chance.
Among what I found was the place in ROM (one byte per vehicle) that corresponds to what type of terrain a vehicle can travel over. Also, by manipulating interpretation of these bytes, apparently, airships travel as "chocobos" when in the underworld (but this can be changed, too).
This is another one of those gray areas that I can't decide if it is better suited here or on the vehicle thread, but seeing as how the concrete info I have involves world map tile properties, I'm putting it here.
Title: Re: What information is known about the overworld?
Post by: chillyfeez on June 05, 2015, 11:07:20 AM
OK, I better get all of this down while it's still fresh(-ish) in my mind...

So as I said, I was working on making a driveable Dwarf Tank for TfW, which worked out splendidly, by the way. Since you can't normally use the Chocobo underground, and the Tank would only be underground, and the chocobo has a motion pattern a lot like what I wanted for the tank (sprites only move when you move, not constantly like all other vehicles, and also travels on land instead of hovering), I decided to make the Tank a special-case exception for the Chocobo.

So first of all, this - you know how if you hack the chocobo into the Underworld, it's invisible? This has nothing to do with the game's lack of ability to display the chocobo underground. No, despite the fact that there is no way in the normal game to ride a Chocobo in the Underworld, the developers decided to put in a special check in the chocobo initialization code that says:
Is the current world Overworld?
If not, skip the following code (which displays the chocobo sprites).

The code looks like this if you're in the Overworld:
Code: [Select]
$15/B3EA AD 01 17    LDA $1701  [$15:1701]; load current map
$15/B3ED D0 06       BNE $06    [$B3F5]   ; if not 00, skip the following three ops
$15/B3EF A5 AD       LDA $AD    [$00:06AD]
$15/B3F1 C9 10       CMP #$10             ; (don't know, but it's irrelevant for this discussion)
$15/B3F3 F0 03       BEQ $03    [$B3F8]   ; jump to sprite loading code (note that this is one of the ops skipped if current map is not 00)
$15/B3F8 AD 04 17    LDA $1704  [$15:1704]; load current mode of transport
$15/B3FB C9 01       CMP #$01             ; is is chocobo?
$15/B3FD F0 27       BEQ $27    [$B426]   ; if so, skip to chocobo sprite loading routine

...And like this if you're in the Underworld/moon:
Code: [Select]
$15/B3EA AD 01 17    LDA $1701  [$15:1701]; load current map
$15/B3ED D0 06       BNE $06    [$B3F5]   ; if not 00, skip to 15b3f5
$15/B3F5 4C B5 B4    JMP $B4B5  [$15:B4B5]; jump to 15b4b5
$15/B4B5 AB          PLB                 
$15/B4B6 6B          RTL                  ; end

for proof of concept, open a vanilla ROM and ride a chocobo (in the Overworld), then open Geiger's hex editor and change 1701 to anything besides 00. the chocobo will disappear. Likewise if you hack a chocobo into the underworld, then change 1701 to 00, the chocobo will appear.

You can also EA out the D0 06 at $15/B3ED in order to permanently make the chocobo visible in any world!



OK, now some stuff about vehicle travel as it relates to world map tile properties...
So we know from Yousei (and expanded on by several, including your humble narrator) that world map tile properties are stored in ROM beginning at A0A80 (ROM w/o header), and that it's 0x100 bytes per world.
Whenever a world map is loaded, those properties are loaded into EDB-FDA in RAM.
Now, the first byte of each of the two-byte tile properties contains all of the "travelability" data. Any time you try to move (press the D-Pad), the game compares the travelability of the terrain of the tile in the indicated direction against the travelability of your current method of transportation. That's right, there is a (small) table of travelability that contains an entry for each vehicle. This table is at 2AE6 (ROM w/o header) through 2AED. One byte per vehicle. 2AE6 (the entry for "no vehicle") is actually a dummy, I think, because there's a special case string of code for "no vehicle." all vehicles, though (including both chocobos), use this table to determine if they can travel on a particular piece of terrain.
By default, the table reads:
Code: [Select]
vehicle index travelability byte default value
-------------- -- ---- --
Yellow Chocobo 01 2AE7 02
Black Chocobo 02 2AE8 04
Hovercraft 03 2AE9 10
Enterprise 04 2AEA 20
Falcon 05 2AEB 20
Big Whale 06 2AEC 80
Ship 07 2AED FF

So, you see, it is possible to make the Enterprise and the Falcon subject to travel over disparate terrain rules... in case that's something you're interested in doing.
Another interesting thing about this information: there's a special case exception for how to proceed if you're in the Underworld and the "mystic silver" flag is not set. And, it can be changed separately for the Enterprise and the Falcon!
For the Enterprise:
Code: [Select]
$00/AA05 AD 04 17    LDA $1704  [$00:1704]; load current method of transportation
$00/AA08 C9 05       CMP #$05             ; is it Falcon?
$00/AA0A D0 0C       BNE $0C    [$AA18]   ; if not, skip to next check
$00/AA18 C9 04       CMP #$04             ; is it Enterprise?
$00/AA1A D0 0C       BNE $0C    [$AA28]   ; if not skip to travelability check
$00/AA1C AD 81 12    LDA $1281  [$00:1281]
$00/AA1F 29 04       AND #$04             ; check if "Yang Destroyed Cannon" flag is set (I guess after this point, the Enterprise is ready to fly underground)
$00/AA21 F0 05       BEQ $05    [$AA28]   ; if not, skip to travelability check
$00/AA23 A9 01       LDA #$01             ; if so, then for the sake of travelability check, pretend we're on a yellow chocobo
$00/AA25 4C 2D AA    JMP $AA2D  [$00:AA2D]; jump to travelability check

For the Falcon:
Code: [Select]
$00/AA05 AD 04 17    LDA $1704  [$00:1704]; Load current method of transportation
$00/AA08 C9 05       CMP #$05             ; is it Falcon?
$00/AA0A D0 0C       BNE $0C    [$AA18]   ; if not, skip to next check
$00/AA0C AD 87 12    LDA $1287  [$00:1287]
$00/AA0F 29 02       AND #$02             ; check if "Heat Shielding the Falcon" flag is set
$00/AA11 F0 15       BEQ $15    [$AA28]   ; if not, skip to travelability check
$00/AA13 A9 01       LDA #$01             ; if so, then for the sake of travelability check, pretend we're on a yellow chocobo
$00/AA15 4C 2D AA    JMP $AA2D  [$00:AA2D]; jump to travelability check

If you study the tile properties of the Underworld, you'll see that most of them are set to "Chocobo can Travel." Because, by default, there are no chocobos in the Underworld, the developers were free to use this bit for "special case airship travelability." So when the right flags are set, the Enterprise and/or Falcon can fly over extra terrain (specifically, magma).
Manipulation of this code enables us to change 1) which flag controls exapanded underworld travel (for each vehicle), as well as 2) Which vehicle to "travel as" when the specified flag is set.

For the purpose of TfW, I changed the latter of each to 04 and 05, respectively, since there will be no "application of mystic silver" in my game, but there will be a chocobo (or, more precisely, a Tank). Then I just changed the Underworld tile properties so that airships have no problem flying anywhere, but chocobos (tanks) can only travel over land.
Title: Re: What information is known about the overworld?
Post by: Bahamut ZERO on June 08, 2015, 01:03:05 PM
I haven't checked Tile Layer yet, but are you using the correct tile encoding, since it's not in 4BPP SNES? The tile format is called 4BPP GBA in YY-CHR.
Or if you meant the assembled tiles, I don't have a good method for viewing them. The tileset images were made by having a program use the tile assembly data to write out the tile graphics to a file, which I then viewed in a tile viewer.

Thank you so much, Vehek! I've been trying to figure out where the hell those were hidden for quite a while!

Also of note, if you make a 4 x 4 horizontal pattern in YYCHR, you can veiw the planet Earth and Moon graphics perfectly! It makes me wonder if they too are in part related to the overworld graphics being that the planet graphic looks like it uses the same palette as the Oceans/Rivers (if so I'm slapping some continents on that badboy!).

I also noticed how the water does it's flowing effect while editing the Ocean tiles. Each  horizontal row of the grapics pixels move right at varying speeds to give it that wavey, flowing effect. Also, if you use any of the brighter blues in it's palette, they show when you're flying an airship, and it's  an eye killer.

With the info Vehek posted, I was able to port a number of world map tiles from FF5, as well as edit the ocean and recolor the castle graphics. I've attached before and after screenshots if anyone's interested.  The water probably looks better in motion, but it's pretty nice being I just did little random patterns. :happy:
Title: Re: What information is known about the overworld?
Post by: Pinkpuff on April 20, 2016, 07:29:22 AM
These are unheadered offsets.
0A0000: Overworld tile assembly data
0A0200: Underworld tile assembly data
0A0400: Lunar tile assembly data

0A0600: Palette assignment data (overworld)
0A0700: Palette assignment data (underworld)
0A0800: Palette assignment data (lunar)

0A0900: Palette Data (Overworld)
0A0980: Palette Data (Underworld)
0A0A00: Palette Data (Lunar)


0E8000: Overworld subtile graphics
0EA000: Underworld subtile graphics
0EC000: Lunar subtile graphics
(4bpp linear reversed, combined with palette assignment data to make 8bpp subtiles)

I'm trying to get FF4kster to read these graphics and I'm having trouble. What does this part mean:

(4bpp linear reversed, combined with palette assignment data to make 8bpp subtiles)

Is this read differently from the graphics for, say, the ship/airship tileset?

Also the "Tile assembly data", does that work the same way as it does for "inner" tilesets?
Title: Re: What information is known about the overworld?
Post by: chillyfeez on April 20, 2016, 11:35:23 AM
I donno, sorry. It's something I'll need to figure out eventually, but haven't  needed the info yet. I have to figure the "tile assembly" works somewhat differently than the location tiles, as those use two bytes per corner and include tile assignment and palette in each of those two bytes. Judging by those offsets, the tile assembly must be 0x80 bytes per corner, thus one byte per tile. Then two bytes per tile for the palette assignment table?
I won't have time to experiment with this for a few days, but I will when I get the chance if nobody swoops in before I do.
Title: Re: What information is known about the overworld?
Post by: Vehek on April 22, 2016, 04:09:13 PM
It's been a long time since I worked on this, but I'll try.

I didn't keep direct notes, but reviewing the scripts I used, it looks like each block of 0x80 bytes defines a set of corners, as in one corner of each 16x16 tile. Top left, top right, bottom left, bottom right.
Quote
Is this read differently from the graphics for, say, the ship/airship tileset?
Very different. Those are planar graphics, where the bits are spread across bytes. Here, the bits are consecutive in one byte. Each nybble (4 bits) is one pixel.

Then two bytes per tile for the palette assignment table?
It's one palette byte for each 8x8 tile. You can't palette-swap mode7 tiles with map data. By the time they're sent to VRAM, they've already been assigned colors on the pixel level.

avalanche also looked into this in the past, and wrote about it in the FF4kster thread.
This probably deserves a longer tech post, but the crux is that each 8x8 graphics tile is stored in the special 4 bpp format and has 1 byte in this "palette pointers" section that you just add (or 'or', either way) to each pixel's value.  That's the final color index for each pixel, which happens to be effectively only 6-bit color index because those bytes only have certain values.  And that matches with the fact that the palettes for each world have 64 entries in them.
Title: Re: What information is known about the overworld?
Post by: chillyfeez on April 22, 2016, 05:06:41 PM
So, to confirm what I think you're saying...

When in a world map, there are 256 (0x100) 8x8 tiles loaded into VRAM (which is different than locations, which only have 128 per tileset), but those tiles are palette-locked per the data at A0600, one byte per tile*

Then the table at A0000 assigns four of those 256 8x8 tiles to each 16x16 tile, one corner at a time (so all the top lefts, then all the top rights, etc). It seems, then, that there would be no way to flip vertically or horizontally, either, and no layering, right?

* I don't really know much about how SNES processes graphics, so forgive my noobiness here... I know the world map tiles use some different variant of 4bpp, wherein the 0x20 byte palettes function sort of like two independent 0x10 byte palettes. I know that bcause of experiences messing with the live RAM data. Do those palette assignment bytes actually assign two 0x10 byte metapalettes, or are there several 0x20 byte palettes that simply have common data?
Title: Re: What information is known about the overworld?
Post by: Pinkpuff on April 22, 2016, 05:21:13 PM
Thank you so much for replying and explaining this! I think I get the gist of it, but I'm not 100% sure on the details, so I'd like to run through some "real" data as an example to make sure I get it:

I'm using a headered rom here, so these will be headered addresses:

So the "pixel" data should begin at E8200, correct? For me, it appears the first 32 bytes are all 00s. So if each byte encodes two pixels, then every two rows of 16 byes are essentially a tile. So the first tile is just a grid of all 00s, so let's ignore that one and move to the next tile, the one starting at E8220. We have:

Code: [Select]
34 34 34 34
43 44 43 43
34 34 44 44
43 43 43 43
34 34 34 44
43 43 43 34
34 34 34 44
44 43 43 43

So each nibble or "half-byte" is a pixel, so we can more or less just separate it out:

Code: [Select]
3 4 3 4 3 4 3 4
4 3 4 4 4 3 4 3
3 4 3 4 4 4 4 4
4 3 4 3 4 3 4 3
3 4 3 4 3 4 4 4
4 3 4 3 4 3 3 4
3 4 3 4 3 4 4 4
4 4 4 3 4 3 4 3

Next, there's a byte that gets added (or "or-ed"?) to each of these pixels? And it comes from A0800? This is the second tile, so it would use the second byte, so 10? So adding 0x10 to all of these would produce

Code: [Select]
13 14 13 14 13 14 13 14
14 13 14 14 14 13 14 13
13 14 13 14 14 14 14 14
14 13 14 13 14 13 14 13
13 14 13 14 13 14 14 14
14 13 14 13 14 13 13 14
13 14 13 14 13 14 14 14
14 14 14 13 14 13 14 13

There seem to be only two colors used in this particular instance, so we can look those up. The palette data is in a table at A0B00, correct? And looking at my code for palette reading, it should be two bytes per color. So color 0x13 would be at A0B26-7, so 52 2B, which would yield (if I did my math right):

12 Red
1A Green
0A Blue

That turns out to be sort of a lime green color. Then there's color 0x14, which would be the next two bytes, 11 23, so:

11 Red
18 Green
08 Blue

That's a similar but more medium green color. So this is I guess part of some kind of grass tile.

Anyway, is my process correct?