øAslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&topic=2128.0e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index3e48-2.htmlslickproductions.org/forum/index.php?PHPSESSID=5f0fck550j2m4m2fpbtkj2vkm1&board=17.40e:/My Web Sites/Slick Productions - FFIV Message Board/slickproductions.org/forum/index3e48-2.html.zxT9h^ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÈ °VJ5OKtext/htmlISO-8859-1gzip0|ÖJ5ÿÿÿÿÿÿÿÿWed, 11 Mar 2020 01:21:48 GMT0ó°° ®0®P®€§²ð®S9h^ÿÿÿÿÿÿÿÿÊ2J5 New kid on the blocks

Author Topic: New kid on the blocks  (Read 4634 times)

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
New kid on the blocks
« on: October 15, 2015, 03:28:57 AM »
Hi guys,

I just registered. Its good to see some names that I've seen only by reading Game FAQ's documents.
I have played pretty much all FF titles except online ones.

The reason I'm here is Final Fantasy V that I currently play (PC version). I'm software developer (primary Delphi) and its been my long dream to implement a FF title battle mechanics.

The project that I'm working is 'simple': Predict a damage that a char do vs selected monster. By prediction I understand calculating min..max. Damage could be from attack, magic, summon,.. I want to experiment with different weapons, levels, jobs, abilities,... All this must be easy (interactive) so I can check impact of changing things.

Behind the scene I want in every prediction to see calculated values of A, D, M before calculating damage ( (A-D)/M) and check how they are impacted in changing setup.
In the project I want an user to sets a char (with all his base attributes, equipment, classes, level,..) and calculate his derived stats.

Well I don't know did I describe clearly what I have in mind, but internally I will need to implement one big chunk of FFV battle mechanics. So any help is appreciate. Currently I'm using mainly Tseng' document for SNES version. So far calculating derived stats works fine (tested in the game).

Jorgur

  • Moderator
  • *
  • Posts: 437
  • Gender: Male
    • View Profile
Re: New kid on the blocks
« Reply #1 on: October 15, 2015, 03:01:41 PM »
Greetings! I know very little about the PC (Steam) version, so I am afraid I will not be much help.

Anyways, good luck with your project!  :cycle:

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: New kid on the blocks
« Reply #2 on: October 16, 2015, 02:28:54 AM »
Thank you Jorgur!

Actually PC (Steam) version is pretty much iOS/Android port ... as many people may say - 'a bad port':
- almost impossible to play on laptops/slow non game PCs,
- frame-rate drop on good game PC,
- not contemporary graphics, ...
but I don't care - in my experience it is not worst then playing in emulator.
The truth is, this is the best version of FFV as graphic quality, extras and some neat in game features like Auto-Battle - o boy I wish I had that in all FF titles, grinding will be a breeze. The sad part is that Sega had implemented it in their oldest titles (Phantasy Star) and Square did it like 20 years after :D

Anyway the only reason I joined is because you guys are skilled and know FFV well - how the game works from inside. PC version is pretty much SNES version with the new jobs from GBA, so all the knowledge that you have from SNES or GBA applies almost 1:1 - I'm talking about the game mechanics, not ROM maps/hacks.
Of course there are some differences:
- I think they use the 'right' knife version, because I had situation where a knife weapons deal more damage them more powerful sword, which inspired my project
- Kick don't get row penalty and is really awesome even in mid game
- Vampire gets only half of your missing HP
To the best of my knowledge, pretty much - things that was stated as intended but not implemented (bugs?) in Tseng's document are done in PC version
« Last Edit: October 16, 2015, 07:23:19 AM by Squall »

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: New kid on the blocks
« Reply #3 on: October 16, 2015, 03:17:08 AM »
O boy, I wanted to write a sentence, but somehow got emotional and wrote a novel :)

Lets get to the business - currently there are 2 things that I need help with:
- a place to host the program, so whoever want to test or experiment can download it
- a text file with weapon/armor property: name, Strength, Agility, Magic, Stamina, Weight, ...
« Last Edit: October 16, 2015, 07:21:44 AM by Squall »

Jorgur

  • Moderator
  • *
  • Posts: 437
  • Gender: Male
    • View Profile
Re: New kid on the blocks
« Reply #4 on: October 16, 2015, 02:33:30 PM »
Quote
- I think they use the 'right' knife version, because I had situation where a knife weapons deal more damage them more powerful sword, which inspired my project
How much more powerful? Slightly more, or twice as much as normal? Also, what do you mean by "right"?
Quote
- Vampire gets only half of your missing HP
That is the same as the SNES version.
Quote
- a text file with weapon/armor property: name, Strength, Agility, Magic, Stamina, Weight, ...
Is this what you mean?

samurai goroh

  • FF5 Hacker
  • *
  • Posts: 221
  • Gender: Male
    • View Profile
    • My page
Re: New kid on the blocks
« Reply #5 on: October 17, 2015, 08:37:50 PM »
There's a damage calculator, albeit it's in Japanese:
http://www.ric.hi-ho.ne.jp/cheap_restaurant/GAME/FF5/damage.html

I've never used it, only found it was mentioned on a wiki, so I don't know what it can calculate...


As for the PC version, I pre-ordered it & while it has some nice animations and what not, I completely disliked that it had no effort put into making it friendly to use. It still has the tablet layout, which doesn't work that well in here. They could had easily implement the use of a mouse, but didn't.

You can play with a controller but buttons are not the same as playing other versions, which makes damn confusing to do some things (I spent +5 minutes trying to land at the start after getting the boat that I though my game was bugged, also had problems when naming the hero & had to restart a couple of times because I was expecting a screen with the characters instead of changing to the keyboard...).

There are other issues mentioned in a thread on Steam that must be fixed & until then I sadly wouldn't recommend playing this particular version. Don't get me wrong, this version has the potential to be the greatest of all, but currently it has several urgent issues that need to be addresses first.
I'm the best in the universe! Just remember! [F-zero X]

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: New kid on the blocks
« Reply #6 on: October 19, 2015, 03:37:27 AM »
Quote
How much more powerful? Slightly more, or twice as much as normal? Also, what do you mean by "right"?
Its hard to quantize, but definitely a noticeable difference. By 'right' I mean the speculation of Tseng that Square made a bug and they calculate high byte wrong(Level*Agility). As people had reported if you correct that a knife may be overpowered ... so definitely there is a correction but I can claim what exactly :)
Quote
Vampire ... That is the same as the SNES version.
hmm it seems you are right ... I think I read somewhere that it was intended to get the half, but it gets all ... sorry my bad!

Thank you for the link its great resource, but I need just a simple plain file, something like:
Name Atk Str Agi Sta Mag, Weight..
Knife    7    0    0    0    0
Dagger 14  0   0    0    0
...

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: New kid on the blocks
« Reply #7 on: October 21, 2015, 01:56:21 AM »
Hey Jorgur, I checked carefully your link and compared with FFV Editor and used Final Fantasy V Enhanced by Dark Knight Kain [h1] ROM.

Everything 'clicked', I understood how Square had stored the item info. The only problem I had was with the 3 parameters: Parameter 1, Parameter 2, Parameter 3. May somebody explain in details?


P.S. If I have a GBA ROM, can you tell me at what address I can get the same info? Also I want to extract item names from ROM a (SNES or GBA). Can you tell me how to do it? I have a feeling they are crypted, because a regular hex search don't find them.

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: New kid on the blocks
« Reply #8 on: October 21, 2015, 06:48:11 AM »
Sorry I forgot that ... in this 12 bytes of info, where I can find is the weapon work normal from back row, and Strong vs ?

Jorgur

  • Moderator
  • *
  • Posts: 437
  • Gender: Male
    • View Profile
Re: New kid on the blocks
« Reply #9 on: October 21, 2015, 06:52:13 PM »
Hmm, I thought it should be self explanatory, but the parameters are different depending on the attack formula. They are described in detail here. The list of attack formulae can be found here. I don't know how and where the GBA version stores this.

Item names are actually not encrypted in the SNES version. More info here. You will need a table file which can be found here.

As for the rest... give me a moment.  :happy:

 :edit:
Quote from: Algorithm guide
**************************************************************
6.5.18) CREATURE TYPE CRITICAL MODIFIERS TO ATTACK AND DEFENSE
**************************************************************

If the Target's Creature type matches the Attacker's "STRONG VS." parameter,
Attack = Attack * 2 and Defense = 0
This modifier is used for Magic types 72h and 73h (Bows and Spears Strong vs.
Creature type)
http://slickproductions.org/slickwiki/index.php/Jorgur:FF5_Actions#72:_Bows_strong_vs._monster_type
Strong VS. is parameter #1.

Back row OK is hard coded, I believe. You need to look at the ASM code in the C2 bank. Here is one example:
Code: [Select]
Attack Type 31 (Swords)
C2/6EE1: 20 47 7C     JSR $7C47  (Hit = 100%, Evade = Evade%)
C2/6EE4: 20 BE 7E     JSR $7EBE  Hit% Determination for physical
C2/6EE7: A5 56        LDA $56
C2/6EE9: D0 2E        BNE $6F19
C2/6EEB: 20 FC 7F     JSR $7FFC  (Sword Damage Formula)
C2/6EEE: 20 9B 83     JSR $839B  (Check Back Row Modifications)
C2/6EF1: 20 BD 83     JSR $83BD  (Check for Command Modifiers)
C2/6EF4: 20 30 84     JSR $8430  (Check Double Grip Modifier)
C2/6EF7: 20 12 85     JSR $8512  (Check Target Status Effect Modifiers to Physical Damage)
C2/6EFA: 20 33 85     JSR $8533  (Check Attacker Status Effect Modifiers to Physical Damage)
C2/6EFD: 20 84 86     JSR $8684  (Check Magic Sword Modifiers)
C2/6F00: A5 61        LDA $61
C2/6F02: D0 19        BNE $6F1D
C2/6F04: A5 56        LDA $56
C2/6F06: D0 11        BNE $6F19
C2/6F08: A5 57        LDA $57
C2/6F0A: 85 4D        STA $4D   
C2/6F0C: 20 34 87     JSR $8734  (Check Attack Element Modifiers)
C2/6F0F: A5 56        LDA $56
C2/6F11: D0 06        BNE $6F19
C2/6F13: 20 11 88     JSR $8811  (Calculate Final Damage)
C2/6F16: 4C CF 8B     JMP $8BCF  (Check for Magic Sword Status Effects)
C2/6F19: A9 80        LDA #$80
C2/6F1B: 85 56        STA $56    (Attack Misses, Set $56 to 128)
C2/6F1D: 60           RTS
« Last Edit: October 21, 2015, 07:06:14 PM by Jorgur »

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: New kid on the blocks
« Reply #10 on: October 22, 2015, 02:41:22 AM »
Thank you, thank you very much Jorgur, *deep respect* !!!
I understood what you said and even the assembly code (I dont know the SNES one, but I'm familiar with x86 and old motorola 6502 (Apple II)). Now I know I'm in the right place!

So let me state what I understood and please correct me if something is wrong: Parameter meaning depend on the damage formula. 'Back row OK' is hard-coded in that formula. 'Strong vs' too.
So pretty much all 3 are hard-coded. There are unused bits ... they could just use them for back row and strong vs   :omg: :lame:

 :edit:
BTW how to 'translate' the addresses you use in offset in the ROM (.smc) file? For example: D1/1380-1C7F: Item names (menu), at what offset in the file is?
What 128 hit% on Excalipoor mean? Is 128 so called 'A' - always hit?
« Last Edit: October 22, 2015, 05:27:47 AM by Squall »

Jorgur

  • Moderator
  • *
  • Posts: 437
  • Gender: Male
    • View Profile
Re: New kid on the blocks
« Reply #11 on: October 22, 2015, 06:00:43 PM »
Quote
So let me state what I understood and please correct me if something is wrong: Parameter meaning depend on the damage formula. 'Back row OK' is hard-coded in that formula. 'Strong vs' too.
So pretty much all 3 are hard-coded.
You are correct, but Strong VS isn't exactly hard coded, as it uses Parameter 1.
Quote
BTW how to 'translate' the addresses you use in offset in the ROM (.smc) file? For example: D1/1380-1C7F: Item names (menu), at what offset in the file is?
The offsets are in SNES HiROM format, meaning you have to subtract 0xC00000 to get the file offset. D11380-C00000=111380. You can also set up the hex editor to work with the SNES HiROM format (I use Windhex).
Quote
What 128 hit% on Excalipoor mean? Is 128 so called 'A' - always hit?
Maybe? Let me check.

 :edit:
Code: [Select]
Attack Type 28 (Ignore Defense)
C2/6DED: 20 F6 7E     JSR $7EF6  (Hit Determination for Magic)
C2/6DF0: A5 56        LDA $56
C2/6DF2: D0 1D        BNE $6E11
C2/6DF4: A5 58        LDA $58
C2/6DF6: AA           TAX
C2/6DF7: 86 0E        STX $0E
C2/6DF9: A5 59        LDA $59
C2/6DFB: C2 20        REP #$20
C2/6DFD: 20 B1 01     JSR $01B1
C2/6E00: 18           CLC
C2/6E01: 65 0E        ADC $0E     (Damage = Parameter 3 & Parameter 2)
C2/6E03: C9 0F 27     CMP #$270F
C2/6E06: 90 03        BCC $6E0B
C2/6E08: A9 0F 27     LDA #$270F
C2/6E0B: 8D 6D 7B     STA $7B6D    (Max Damage = 9999)
C2/6E0E: 7B           TDC
C2/6E0F: E2 20        SEP #$20
C2/6E11: 60           RTS

Hit% Determination for Magic
C2/7EF6: A5 57        LDA $57
C2/7EF8: 30 20        BMI $7F1A    (Check for Autohit)
C2/7EFA: A5 39        LDA $39
C2/7EFC: AA           TAX
C2/7EFD: BD FD 79     LDA $79FD,X
C2/7F00: A6 49        LDX $49
C2/7F02: 3D 64 20     AND $2064,X  (Check Target Can't Evade vs. Attack type)
C2/7F05: D0 13        BNE $7F1A
C2/7F07: 20 0D 7C     JSR $7C0D    (Hit = Hit + Attacker Level - Target Level, Evade = Magic Evade)
C2/7F0A: 20 97 7C     JSR $7C97    (Aegis Shield Check)
C2/7F0D: A5 56        LDA $56
C2/7F0F: D0 09        BNE $7F1A
C2/7F11: 20 C3 7C     JSR $7CC3    (Multitargetting effect on Hit%)
C2/7F14: 20 8B 7D     JSR $7D8B    (Target Status Effect Modifiers to Magical Hit%)
C2/7F17: 20 12 7E     JSR $7E12    (Check for Status Hit)
C2/7F1A: 60           RTS
I think $57 refers to Parameter 1 which is Hit%. This is the code in question:
C2/7EF6: A5 57        LDA $57
C2/7EF8: 30 20        BMI $7F1A    (Check for Autohit)

I'm guessing the "BMI" statement checks the highest bit of the Hit%. In other words, it checks if Hit% is 128 or more. instructrtrepe/Tseng calls this "Autohit". This seems to only apply to magic (Excailber/Excalipoor is technically a magical weapon), as there does not seem to be a similar check for physical attacks:
Code: [Select]
Hit% Determination for physical
C2/7EBE: A6 49        LDX $49
C2/7EC0: BD 1B 20     LDA $201B,X
C2/7EC3: 1D 71 20     ORA $2071,X
C2/7EC6: 29 70        AND #$70      (Target Status = Sleep, Paralyze or Charm)
C2/7EC8: D0 28        BNE $7EF2
C2/7ECA: A6 32        LDX $32
C2/7ECC: BD 1F 20     LDA $201F,X   (Check for Autohit abilities)
C2/7ECF: 30 21        BMI $7EF2
C2/7ED1: A5 39        LDA $39
C2/7ED3: AA           TAX
C2/7ED4: BD FD 79     LDA $79FD,X
C2/7ED7: A6 49        LDX $49
C2/7ED9: 3D 64 20     AND $2064,X  (Check Target Can't Evade vs. Attack type)
C2/7EDC: D0 14        BNE $7EF2
C2/7EDE: 20 FC 7C     JSR $7CFC    (Check for Evade, Weapon Block or Elf Cape)
C2/7EE1: A5 56        LDA $56
C2/7EE3: D0 10        BNE $7EF5
C2/7EE5: 20 AC 7D     JSR $7DAC    (Target Status Effect Modifiers to Hit%)
C2/7EE8: 20 D1 7D     JSR $7DD1    (Attacker Status Effect Modifiers to Physical Hit)
C2/7EEB: 20 23 7E     JSR $7E23    (Check for Physical Hit)
C2/7EEE: A5 56        LDA $56
C2/7EF0: D0 03        BNE $7EF5
C2/7EF2: 20 E2 7D     JSR $7DE2    (Check for Target Image)
C2/7EF5: 60           RTS
This code probably checks for Aim, Jump, etc:
C2/7ECC: BD 1F 20     LDA $201F,X   (Check for Autohit abilities)
C2/7ECF: 30 21        BMI $7EF2
« Last Edit: October 22, 2015, 06:47:30 PM by Jorgur »

Squall

  • Dark Dragon
  • *
  • Posts: 486
    • View Profile
Re: New kid on the blocks
« Reply #12 on: October 23, 2015, 02:55:22 AM »
 :omg: I was wondering why I read the ASM code so easy ... I did a little bit digging (research) and it turns out that SNES uses a processor that is pretty much 16 bit extension of 6502 ... I cant believe that after so many years I could use it again :D

Thank you Jorgur, your answers are pleasure to read and use!!!

Jorgur

  • Moderator
  • *
  • Posts: 437
  • Gender: Male
    • View Profile
Re: New kid on the blocks
« Reply #13 on: October 23, 2015, 05:26:15 AM »
No problem!  :wink:

LightPhoenix

  • FF5 Hacker
  • *
  • Posts: 130
    • View Profile
Re: New kid on the blocks
« Reply #14 on: October 29, 2015, 09:52:53 PM »
Quote
I think $57 refers to Parameter 1 which is Hit%. This is the code in question:
C2/7EF6: A5 57        LDA $57
C2/7EF8: 30 20        BMI $7F1A    (Check for Autohit)

I'm guessing the "BMI" statement checks the highest bit of the Hit%. In other words, it checks if Hit% is 128 or more. instructrtrepe/Tseng calls this "Autohit". This seems to only apply to magic (Excailber/Excalipoor is technically a magical weapon), as there does not seem to be a similar check for physical attacks:

You're correct, the three parameters are $57, $58, and $59 respectively.

There are several Hit% determinations - the magic ones (magic, physical magic, autohit party) all check for autohit, the melee one doesn't.  There's no reason it couldn't be coded in, however several weapons (Fists, Swords, Knives, Spears, Katanas, Bells, Brave Blade, Chicken Knife, "Creature" Bows, and "Creature" Spears) automatically use 100% for Hit% and use P1 for other uses (Crit%, Element, Bonus Dmg to Creatures, or in some cases nothing).

If there is a hit determination, $56 is set on a miss (I personally call it the Miss Flag).

:edit: Also, as an aside: a long time ago I went through each damage formula and the instructrtrepe/Tseng document is not 100% correct.  Some things that they say none for are technically used but never set.  Perhaps I'll write it up this weekend and stick it in the wiki now that I have a little more free time.