Author Topic: Need Primary Stat Level Up Increase Formula (FF7)  (Read 14175 times)

vardahoth

  • *
  • Posts: 8
    • View Profile
Greetings, I'm working on a stat level up calculator (98% done until I started doing in game testing):


For the formula, I was referring to the guide written by Terence Fergusson here - https://www.gamefaqs.com/pc/130791-final-fantasy-vii/faqs/36775

I'm using the playstation 1 and the old game for it I got for Christmas sometime before the year 2000.

The issue is I have cloud leveling from 69 to 70. And his str is increasing anywhere between 0-2 (when it should increase 0 (meaning not at all) even with a maxRandomNumberRoll(8) according to his guide). Here is the formula...
Character Name = Cloud
Character Current Level = 69
Character Current Strength = 97
Materia equipped = None
Not wearing any weapon/armor that affects strength
Accessory = None

Random Number Max = 8
Level Bracket = 62-81
Rank Curve = 1
Base = 53 (decided by rank curve and level bracket, table in guide)
Gradient = 55 (decided by rank curve and level bracket, table in guide)
Baseline = Base + ((Gradient * nextLevel) / 100)
Baseline = 53 + ((55 * 70) / 100) -------> 91.5 (Truncate to 91)
Difference = (randomNumber) + (baseline) - (current stat value)
Difference = 8 + 91 - 97 -------> 2

Difference | Stat Gain
    0 - 3     |      0
    4 - 6     |      1
    7 - 9     |      2
  10 - 11   |      3

Increase result = 0

As we can see, according to the formula from his guide, the increase result even at the maximum roll should be 0. However in the game, I see the increase of strength happening anywhere between 0 - 2. Can anyone please elaborate on why this is happening?
Note: no cheat codes were entered during the entire gameplay that could have resulted in possible corruption. The only thing I used was a couple power sources I picked up along the way up to nibelhelm (maybe this activated an in-game bug?)
Note2: Hp/Mp formula seems to be working fine, as well as the luck formula (with it's own curve and base/gradient table). I'm guessing it has something to do with the numbers being wrong on the curve, or the base/gradient charts for primary stats.
« Last Edit: 2017-05-08 09:44:42 by vardahoth »

nfitc1

  • *
  • Posts: 3010
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Need Primary Stat Level Up Increase Formula (FF7)
« Reply #1 on: 2017-05-08 11:55:25 »
Wall Market already does this, but this interface looks cleaner.

Stats of equipped items don't factor in to this equation. Neither do sources.
« Last Edit: 2017-05-08 11:57:17 by NFITC1 »

vardahoth

  • *
  • Posts: 8
    • View Profile
Re: Need Primary Stat Level Up Increase Formula (FF7)
« Reply #2 on: 2017-05-08 13:08:49 »
Wall Market already does this, but this interface looks cleaner.

Stats of equipped items don't factor in to this equation. Neither do sources.

Can you provide a link for the "Wall Market already does this"?

Stats of equipped items don't factor in to this equation because the level up of increased stats goes off of base stats (not current stats modified after equipment). when testing the stat increase (in the actual game), all I had equipped on cloud was bronze armor and buster sword (with no materia). So I was testing the real stat of strength (being 97 and having it go to 99 when instead it should have always stayed at 97 everytime he leveled to 70). I hit the reset button 40x to get these results.

As for the program/gui, you can ignore that (I just threw up an example image of why having the formula correct is important as to what I'm working on). I simply wrote out the equation on paper (as I presented the formula on the OP). According to the equation done on paper, the increase value is 0. According to the game, it's increasing it between 0-2 (might even be 3, haven't run enough resets maybe...).
« Last Edit: 2017-05-08 13:18:11 by vardahoth »

vardahoth

  • *
  • Posts: 8
    • View Profile
Re: Need Primary Stat Level Up Increase Formula (FF7)
« Reply #3 on: 2017-05-08 14:18:44 »
Here I'll reproduce the error with screen shots...

Before level up (in game):


After level up Result One (in game):


After level up Result Two (in game):


Results shown in program (what stat increase chances really should be):


Formula breakdown (of why increase should only be 0 and not allow 1 or higher):

Tables (from guide - https://www.gamefaqs.com/pc/130791-final-fantasy-vii/faqs/36775)...


1. get character name (used to get character rank curve)
2. get character level up number (used in level bracket and calculating baseline)
3. get character current primary stat (used to calculate difference)
4. select random number 1 through 8 (here we use 8 as it provides the max possible increase of the stat)
5. select level bracket (used to get base and gradient)
6. select character rank curve (used to get base and gradient)
7. get base
8. get gradient
9. get baseline = Base + ((Gradient * nextLevel) / 100)
10. get difference = (randomNumber) + (baseline) - (current stat value)
11. use difference number 0-11 capped to get possible stat increase
Difference | Stat Gain
    0 - 3     |      0
    4 - 6     |      1
    7 - 9     |      2
  10 - 11   |      3
12. stat gain = the corresponding difference on the row above...

So again...
1. Cloud
2. 62
3. 94 strength
4. 8
5. 62-81
6. 1
7. 53
8. 55
9. 87.1 (Truncate to 87)
10. 1
11.     0 - 3     |      0
12. 0 stat increase change with a random roll number 8( 1..8 ).

Hopefully this has made the question more clear.

vardahoth

  • *
  • Posts: 8
    • View Profile
Re: Need Primary Stat Level Up Increase Formula (FF7)
« Reply #4 on: 2017-05-08 14:35:54 »
Found the wall market tool here > http://forums.qhimm.com/index.php?topic=7928.0

However, when I tried to open it, it immediately closes (windows 7 says program has stopped working).

Kaldarasha

  • *
  • Posts: 2449
  • Prince of Model Editing
    • View Profile
Re: Need Primary Stat Level Up Increase Formula (FF7)
« Reply #5 on: 2017-05-08 15:13:41 »
Install the .net Framework and the visual basic power pack of what ever the first page of WM does say.

vardahoth

  • *
  • Posts: 8
    • View Profile
Re: Need Primary Stat Level Up Increase Formula (FF7)
« Reply #6 on: 2017-05-08 15:42:21 »
K, downloaded both support tools (both links are dead btw). The program is looking to open a kernel.bin file. Where would I get this?

nfitc1

  • *
  • Posts: 3010
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Need Primary Stat Level Up Increase Formula (FF7)
« Reply #7 on: 2017-05-08 15:55:21 »
Do you have the game? The KERNEL.BIN is in your %installation directory%/data/kernel folder.

It reads the curve data and initial stat values from in the file and projects a range of possible values for each stat at each level in the Inital Data -> Character Growth tab. Select a character and a stat and it will show you a graph that is reasonably accurate.

Sega Chief

  • *
  • Posts: 4098
  • These guys is sick
    • View Profile
Re: Need Primary Stat Level Up Increase Formula (FF7)
« Reply #8 on: 2017-05-08 15:56:53 »
The kernel.bin is in the lang-en/kernel folder (or just kernel folder if it's the older 1998 PC version). The PSX kernel can be found in the INIT folder and extracted using CDMage or a similar tool (both PSX and PC kernels are near identical, fortunately, and can both be read/altered by Wall Market). Open the CD using M2/2352 option, rather than M1/2352.

It displays the data like this:



vardahoth

  • *
  • Posts: 8
    • View Profile
Re: Need Primary Stat Level Up Increase Formula (FF7)
« Reply #9 on: 2017-05-08 16:10:08 »
As I explained the game I have is on a playstation 1 disc. I don't have the tools to burn a disc copy (has a shaded color protection). I don't have the pc version either (assuming this is where I would get the kernel.bin file from).

Sega Chief

  • *
  • Posts: 4098
  • These guys is sick
    • View Profile
Re: Need Primary Stat Level Up Increase Formula (FF7)
« Reply #10 on: 2017-05-08 16:18:05 »
As I explained the game I have is on a playstation 1 disc. I don't have the tools to burn a disc copy (has a shaded color protection). I don't have the pc version either (assuming this is where I would get the kernel.bin file from).

If you have a CD drive you can just pop the PS1 disc in and CDMage can extract the file, no burning required; I did this with my PS1 disc (PAL) a while back and it worked.

nfitc1

  • *
  • Posts: 3010
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Need Primary Stat Level Up Increase Formula (FF7)
« Reply #11 on: 2017-05-08 16:27:04 »
And the Wall Market I'm currently working on will display the values a little more prominently. As it is you have to hunt for the values you want.

vardahoth

  • *
  • Posts: 8
    • View Profile
Re: Need Primary Stat Level Up Increase Formula (FF7)
« Reply #12 on: 2017-05-08 17:03:24 »
I ended up buying the pc version off steam (it's only $11).

I got it up and running, and it looks like the curve numbers are exactly the same as the ones I displayed in reply#3.

It also looks like it's calculating correctly...



This leads me to believe the possibility is when I used those 2-3 power sources (can't remember exactly how many, it's however many you get up until you get the keystone). That is why I am seeing the stat still rise from 94-95 even though the end at level 62 level up, is 91 (actually it's 92, I think you have an off-by-one error in your program). This means using power sources only affects increasing your strength and not your base strength.

Therefor, if you use 20 power sources and go from 10 strength to 30 strength, your base strength will still only be 10, and this number 10 is what will be used on the curve for leveling up. That being said, I understand why now it was calculating differently in the game.

As for my gui, I will share it later when I'm done with it. I still have to put in the code for hp/mp switch materia, the reset button, and how to handle the border lines during resizing.

The program will just be an exe, and only java required to run it (no external game files needed). I'll also throw up the source code too (in case any devs want to add stuff to it). Personally I'm thinking of adding another tab to calculate the path range of levels stat results to get best results per level while staying max natural stat path at 99. My main reason for this was to learn Java Swing, and I also wanted to do the perfect game challenge. So this sounded like a fun project for me.

Anyway, thanks for the help and allowing me to see why the game was doing that. Cheers!

vardahoth

  • *
  • Posts: 8
    • View Profile
Re: Need Primary Stat Level Up Increase Formula (FF7)
« Reply #13 on: 2017-05-08 17:06:13 »
Also, it's confirmed...

You have an off-by-one error in wall market:

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: Need Primary Stat Level Up Increase Formula (FF7)
« Reply #14 on: 2017-05-08 17:18:06 »
Sources don't affect the base amount, but they do get added to the total strengths used in the calculations. Get Ochu from tools and you can see this clearly.  It will tell you how many sources you have per char and allow you to edit it. In my difficulty mod I limited the total number you can collect per character to 10 (edited exe).  Not only that, but weapons themselves also have hidden bonus attributes, which are non base (you can see that with Wallmarket).

nfitc1

  • *
  • Posts: 3010
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Need Primary Stat Level Up Increase Formula (FF7)
« Reply #15 on: 2017-05-08 17:51:54 »
Also, it's confirmed...

You have an off-by-one error in wall market:
[img]
This is known. It's a floating point error when the graph gets high. I've corrected it in the not-yet-released version.

kerihobo

  • *
  • Posts: 7
    • View Profile
Re: Need Primary Stat Level Up Increase Formula (FF7)
« Reply #16 on: 2019-05-29 12:03:18 »
I see the OP mentions he struggled with Primary stats, but that he had HP/MP working fine... I have the opposite problem. Anyone able to elaborate on a successful HP/MP algorithm? Section 1.4 here is really confusing me... I'd even appreciate some help understanding it...

https://gamefaqs.gamespot.com/pc/130791-final-fantasy-vii/faqs/36775

Here is my specific C# code as I try to replicate it, the main part I am stuck on is the last line I show where I replicate how the guide says to cap the difference to 0-11%... I'm like... 11% of what?

Code: [Select]
int lv = 7;     // The level we JUST achieved.
int hp = 314;   // Our unchanged HP from level 6.
int b = 200;    // Base from the current rank curve.
int g = 19;     // Gradient from the current rank curve.

void IncrementPointsBase() {
    int baseline = b + ((lv - 1) * g);
    int difference = Random.Range(1, 8) + (100 * baseline / hp) - 100;

    // The guide says to cap the difference between 0% & 11%... of what? The difference? The current HP?
    // I really don't understand this particular step.
    int cappedDifference = (int)Mathf.Clamp(difference, 0, hp * 0.11f);
« Last Edit: 2019-05-30 02:11:33 by kerihobo »

nfitc1

  • *
  • Posts: 3010
  • I just don't know what went wrong.
    • View Profile
    • WM/PrC Blog
Re: Need Primary Stat Level Up Increase Formula (FF7)
« Reply #17 on: 2019-05-29 17:31:51 »
First of all, that's a two-year old necro. I guess it's relevant so it's acceptable.

Second, don't do any floating point calculations. I'm not sure how it works in C#, but by default in VB.NET it seems to want to do floating point divisions. I have to explicitly state I'm doing integer divisions. This can introduce rounding errors that will build up as you increase the level.

As for the difference, you already have it.

Code: [Select]
  int difference = Random.Range(1, 8) + (100 * baseline / hp) - 100;That value will tell you what you need to know. It should be between 0 and 11, not whatever the .11 you're multiplying it as. Truncate the decimal points from this value and cap it at 11. Then use the HP Stat Gain table to get the HP gain for that level. The calculated percentage multiplied by whatever the curve's gradient is at the level you're moving to.

Code: [Select]
  int increaseHP = Math.Floor((bonusHP[cappedDifference] * g) / 100);
  int newHP = hp + increaseHP;
Any particular reason you're using Unity to calculate this?

kerihobo

  • *
  • Posts: 7
    • View Profile
Re: Need Primary Stat Level Up Increase Formula (FF7)
« Reply #18 on: 2024-07-20 13:16:03 »
Any particular reason you're using Unity to calculate this?

I was just going over a bunch of my notes from years back and found myself here again. Sorry to reply in a very old thread but I just realized I rudely forgot to reply back then, despite the fact that I made use of what you told me. Thanks! The reason I'm using Unity is cos I'm not working on a mod, I'm slowly rebuilding FF7 in Unity for purely selfish reasons. 5 years and still haven't given up