• Welcome to Final Fantasy Hacktics. Please login or sign up.
 
March 28, 2024, 12:27:06 pm

News:

Don't be hasty to start your own mod; all our FFT modding projects are greatly understaffed! Find out how you can help in the Recruitment section or our Discord!


Terrain/Movement data

Started by pokeytax, March 13, 2011, 06:30:50 pm

pokeytax

March 13, 2011, 06:30:50 pm Last Edit: March 20, 2011, 02:30:24 pm by pokeytax
While picking apart the Movement routine to make it possible to disable Movement abilities, I found some interesting data. I am just going to dump the stuff and make sense of it later; hopefully I will be able to update it with more thorough notes.

These are all RAM values, which can be adjusted by editing SCUS_942_21 at RAM minus $F800.

tl;dr
"Elemental" terrain table: 0x5E9D0
Terrain status inflict table: 0x5EA10 (e.g. Poison swamp)
Default movement cost table: 0x5EA50


Offset 0x5ea50 through 0x5ea8F is the default Movement table. These tables have $40 values, one for each of http://www.ffhacktics.com/wiki/Terrain_Surface_Types.
So offset 0x5ea62 corresponds to 0x12, "Lava".

General terrain is "01" (Natural Surface, Roof, Furniture).
Swamp is "00" (Poisoned marsh, Salt, Water plant).
Water is "02" (River, Sea, Waterfall).
Impassable terrain is "FF" (Obstacle, Darkness, Lava).

There are five more Movement tables. Subject to some shuffling, they correspond to the following:

0x5ea90: Fly/Teleport
0x5ead0: Float
0x5eb10: Walk on Water/Move in Water
0x5eb50: Move Underwater
0x5eb90: Move on Lava

All terrain tables have an "FF" byte in spot 3F and a "00" byte for "Salt" terrain (an oversight?).

Fly/Teleport and Float are "01" elsewhere.
Walk on Water/Move in Water and Move Underwater are elsewhere "01", except impassable terrain.
Move on Lava is identical to base movement, but with "Lava" set to "01".

When the table is read, "00" becomes "02" if there is weather and Any Weather is not equipped, "01" otherwise.
Values other than "FF" are converted to "01" if Any Ground is equipped.

So it seems that this determines the movement cost for different terrain. "Cannot enter water" must be covered later. Looks like a great starting point for implementing aquatic/lava monsters, or barriers that keep out demons, or even a sensible terrain system where mud/rock/furniture are harder to walk over. I will let someone who can hex edit but not ASM hack investigate further, since I have about a billion lines more of this movement mess to sift through.

Offset 0x5e9d0 is the Elemental table. Values correspond to the ability numbers of the associated "Elemental" skills. As long as you add the skill to "Elemental" as well, looks like you can use anything. Might be useful for consolidating Elemental, which as fun as it is probably doesn't need twelve abilities.
Offset 0x5ea10 is the poison-on-movement table. All values are "00" except for "80" at Poisoned swamp.
  • Modding version: PSX

pokeytax

I'm sorely tempted to pause my disabling and rewrite this terrain code, because it's terrible.

- six abilities that solely govern interaction with water, none of which has ever been equipped voluntarily
- four abilities that completely ignore terrain and provide additional benefits, completely obviating any need for terrain abilities
- one ability which interacts with non-water terrain(!!!!) but the terrain is lava and occurs once in the entire game and the ability is a Geomancer innate anyway so why equip it(.)

Unfortunately, not everything is contained in those tables, but I think they serve as the basis for a more interesting terrain system than FFT has, if someone can tie up the loose ends, which are not very fun.
  • Modding version: PSX

philsov

Awesome notes. 

Quote- one ability which interacts with non-water terrain(!!!!) but the terrain is lava and occurs once in the entire game and the ability is a Geomancer innate anyway so why equip it(.)


It's not a geomancer innate by default, for what it's worth. 
Just another rebel plotting rebellion.

pokeytax

Oh, right. I don't even know between 1.3/vanilla/Arena anymore.

Editing the table actually seems to work pretty well. Anything but zero movement cost terrain works fine; I was worried that "02" and "00" were hardcoded as "Water", but all the water movements are coded separately. It also makes your units do these adorable lil' hops and skips around the battlefield to avoid the slow tiles - a terrain system may need to adjust horizontal leap as well.

I'm working this out now, so if anybody has a wish list for movement/terrain, now would be a good time to bring it up!
  • Modding version: PSX

RandMuadDib

Quicksand! like depth 2 water, only sand.

Seriously though, how crazy are you able to get? What about adding status effects (like the swamp poison) or straight damage/healing? I was thinking like a plant or sacred ground that would heal you every turn you start on it, or spiderwebs that cause slow, or panels that boost certain damage types like weather effects do (snow boosts ice, wood or dry brush boosts fire, etc)
I will show you the power of SARDIIIIINES!!!!

pokeytax

Quote from: RandMuadDib on March 19, 2011, 09:20:32 pm
Seriously though, how crazy are you able to get?


That's what I'm trying to figure out. Right now I'm examining movement, but hijacking the poison swamp code should make terrain effects possible. So, yeah, I don't see why you couldn't do Quicksand: depth 2 water with sand graphic that adds Death Sentence, Don't Move.
  • Modding version: PSX

pokeytax

March 20, 2011, 11:34:55 am #6 Last Edit: March 20, 2011, 02:13:10 pm by pokeytax
Okay, here is a quick hack for this while I sort out bigger stuff:


BATTLE_BIN
0x126b58
FF
0x126b6c
00000000

SCUS_942_21
0x4F210
00000000
00000000
00000080
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000


That 80 corresponds to poison for terrain 0B, poison swamp. 40 corresponds to Regen, etc.
  • Modding version: PSX

The Damned

Nice find. That might be useful for what I want to do with Wall (especially given that series of videos I just finished watching).

Wouldn't the Stop one be kind of...problematic, though? Then again, I can't recall if poisonous swamp re-Poisons you if you Wait in the same spot. IIRC it does if you move from one poisonous swamp panel to another, though. Obviously, you can see what I'm getting at if it does the former too.
"Sorrow cannot be abolished. It is meaningless to try." - FFX's Yunalesca

"Good and evil are relative, but being a dick cannot be allowed." - Oglaf's Thaumaturge in "The Abyss"

"Well, see, the real magic isn't believing in yourself. The real magic is manipulating people by telling them to believe in themselves. The more you believe, the less you check facts."  - Oglaf's Vanka in "Conviction"

pokeytax

Quote from: The Damned on March 20, 2011, 01:04:54 pm
Then again, I can't recall if poisonous swamp re-Poisons you if you Wait in the same spot.


It does. However, you only get re-Stopped if you get a chance to Wait, which you won't until the first Stop has worn off and given you a chance to move away. Don't Move is the only one presenting problems, if the routine were tweaked to allow that, and if you're some kind of nicenik who doesn't want a snare that has to be cured and immediately escaped.
  • Modding version: PSX

The Damned

I see. Well, it would still be rather problematic if that unit was forcibly surrounded or couldn't go anywhere else, but that's just throwing out situations.

Regardless, these statuses still only come about when you're in contact with the surface, correct? So they're still all avoided by Float, right? Also, these be liquid mediums/terrain like the swamp? Or could they be "solid" terrain like, say, if some wanted the Haste terrain to be an escalator or motorized walkway?

Regardless, thanks for the swift response. I probably won't see you're next one for a bit since I've some things to do and might possibly fall asleep once I return home (after getting rained on).
"Sorrow cannot be abolished. It is meaningless to try." - FFX's Yunalesca

"Good and evil are relative, but being a dick cannot be allowed." - Oglaf's Thaumaturge in "The Abyss"

"Well, see, the real magic isn't believing in yourself. The real magic is manipulating people by telling them to believe in themselves. The more you believe, the less you check facts."  - Oglaf's Vanka in "Conviction"

pokeytax

March 20, 2011, 01:45:28 pm #10 Last Edit: March 20, 2011, 02:58:58 pm by pokeytax
Yes, Float status/riding will prevent these, and any terrain type can inflict them.

The Elemental table is also nearby at 0x5E9D0: this might actually be handy, because as much as I love Elemental, 12 ability slots is too many. I don't see any issues consolidating these down - this is where Counter Flood looks too.
  • Modding version: PSX

RandMuadDib

I will show you the power of SARDIIIIINES!!!!

The Damned

Indeed on both parts, though as pesky as Elemental can be, I can't think of much to condense beyond Gusty Wind with Kamaitachi and perhaps Carve Model with Local Quake. Only other things that seem "likely" would maybe be just getting rid of Blizzard (since it doesn't show up in any random battles IIRC) or Lava Ball (since there's only two maps that it works on IIRC) entirely and maybe combining Quicksand and Water Ball.

Good to know all that, though. It also somewhat solves question I had with regards to Geomancy and potentially new terrain. (Actually, are you making new terrain or just replacing it?)

Similarly, another question I realized as soon as I left: Are you limited to only one status per terrain? Or could do something like that Quicksand panel that was mused about above, even though it would ultimately be horrible idea due to the Don't Move & Wait thing you pointed out?
"Sorrow cannot be abolished. It is meaningless to try." - FFX's Yunalesca

"Good and evil are relative, but being a dick cannot be allowed." - Oglaf's Thaumaturge in "The Abyss"

"Well, see, the real magic isn't believing in yourself. The real magic is manipulating people by telling them to believe in themselves. The more you believe, the less you check facts."  - Oglaf's Vanka in "Conviction"

pokeytax

March 20, 2011, 08:17:19 pm #13 Last Edit: March 20, 2011, 08:31:31 pm by pokeytax
Quote from: The Damned on March 20, 2011, 07:04:33 pm
(Actually, are you making new terrain or just replacing it?)


There's plenty of room, but I'm more interested in playing with how current terrain works.

Quote
Similarly, another question I realized as soon as I left: Are you limited to only one status per terrain?


No, you can toss on as many as you want. Right now they're limited to the same status byte "Poisoned marsh" already uses, but that's only because I didn't want to go to the trouble of using freespace until I figured out what I was doing with possible other stuff (e.g. a Geomancer support ability that forces a read from a different table full of positive status; damage/healing/stat boosts, etc.).

Currently it writes to a character's 0x1AA byte, which is a temporary byte used to inflict status conditions. I know how the inflict status and remove status bytes work (so you could have an Esuna or Dispel tile) but I'll probably have to comb through FDC's formula work to apply other stuff.
  • Modding version: PSX