PDA

View Full Version : Level up data



Imzogelmo
01-16-2013, 05:34 PM
OK, trying to get an idea how to set up a Level Up table.

Different games do different things on level up.

All games have an experience curve. It's not too important how it is stored; it can be a cumulative amount or an increment from previous. (FF6 acttually only stores increments/8). Either way accomplishes the same thing.

FF1 has HP increases (one of two types, chosen by a bit called 'weak/strong'), stat increases (5 bits, if set the stat increases by 1), and MP charge increases (8 bits, if set the corresponding level charge increases by 1). Each class has its own table of size [MAXLEVEL-1]. I'm not 100% sure, but I believe there are only 6 tables, with promotions still using the same table.

FF6 has HP and MP increases. They do not vary from character to character; everyone has the same Exp requirements and gets the same HP and MP increases. However, the amount to increase HP or MP can be affected by an Esper bonus of some percent, and the 4 base stats of FF6 can be incremented by 1 or 2, again based on an Esper bonus (if equipped).

--------

So, now a quick proposal:

A table, size MAXLEVEL-1, for each class.
Each entry would hold the following (4 bytes each):
1. Exp. needed
2. HP increase (0 or 1, weak or strong level up. This could be defined in other games as a straight increase)
3. MP increase (to use for charges, 4 bits each, gives you 8 levels of magic)
4. Stat increase (to use for the 5 base stats... 4 bits each? Could go as high as 6 bits but that's kinda overkill)
5-32. Padding for chunk, could be defined by other games.

Thoughts?

Gleeok
01-16-2013, 06:09 PM
So that's 128 bytes? I can't imagine wanting to map out every stat of every level-up for every character.. though I guess it is possible. It's funny because normally I think that memory is cheap, but it seems like just 74 KB of wasted space. lol. I think even rpg-maker has a formula X 8 stats and that's it (8 * 4bytes * 99 * num_chars)

..there should be something in there though I guess. How about: neededEXP + 1 byte per stat, and then when someone makes a case for why more is better we can add more. ..Plus it's kind of useless having extra without some kind of level up editor thingy. Mmm. Yeah?

[edit] Also, it's not really the the number of bits that is important, but rather what the memory is used for.

Imzogelmo
01-16-2013, 07:31 PM
How about Needed EXP (4 bytes), and 16 1-byte fields for stats?

Gleeok
01-16-2013, 09:20 PM
I did an EXP table already, so I think I can do better with an EXP table index and then data, since those are shared a lot anyway.

Also, while I'm not saying that exact stats per lv-up are bad, It would be difficult to change that data without an editor for it, plus I sorta kinda don't want to go through the hassle of hacking the rom; writing a function to extract stat and charge data; writing another xml conversion; loading it and resaving it again... It's time consuming and I can get more needed things done instead. :\ I've already done Items and cropped a bunch of character sprites..and I'm pretty much tired of doing it by now. (or put it on the todo list when there's a beta version prehaps)

How about writing a simple function that increases stats on lv-up? We have a constant (lv) and we know that every n levels stat x increases somewhat uniformly to this.

Imzogelmo
01-16-2013, 11:24 PM
Yep. I can do that.

EDIT: This is what I came up with for the Fighter class:



void LevelUp()
{
if( lv >= 99 )
return;

bool Strong = false;
bool Str_bonus = false;
bool Agi_bonus = false;
bool Vit_bonus = false;
bool Luc_bonus = false;
bool Int_bonus = false;

if (lv < 12) Strong = true;
else if ((lv < 24) && (lv % 3 != 0)) Strong = true;
else if ((lv >= 24) && (lv % 3 == 2)) Strong = true;
//--------------------------------
Str_bonus = true;
//--------------------------------
if (lv < 21) Agi_bonus = true;
else if ((lv < 30) && (lv % 3 != 0)) Agi_bonus = true;
else if ((lv >= 30) && (lv % 2 == 1)) Agi_bonus = true;
//--------------------------------
if ((lv < 31) && (lv % 3 != 1)) Vit_bonus = true;
else if ((lv >= 31) && (lv < 41) && (lv % 2 == 0)) Vit_bonus = true;
//--------------------------------
if ((lv < 31) && (lv % 3 != 2)) Luc_bonus = true;
else if ((lv >= 31) && (lv < 41) && (lv % 2 == 1)) Luc_bonus = true;
//--------------------------------
if ((lv < 44) && (lv % 3 == 1)) Int_bonus = true;

int hpIncrease = (vitality / 4) + 1;
if(Strong)
hpIncrease = 20 + (vitality / 4) + rand(1, 6);

max_hp += hpIncrease;
//mp
strength += 1;
Agi_bonus ? agility += 1 : if(probability(50) ) agility += 1;
Vit_bonus ? vitality += 1 : if(probability(50) ) vitality += 1;
Luc_bonus ? luck += 1 : if(probability(50) ) luck += 1;
Agi_bonus ? intelligence += 1 : if(probability(50) ) intelligence += 1;
mag_def += 2;
}

Gleeok
01-17-2013, 10:27 AM
Cool. How about simplifying each stat into a function call though;
str += GetStatBonus(lv, 4, 8, 1); ..

Also some of those formulas are not quite as inexact as specified. For instance I figured out the exact exp table here:



for( size_t i(1); i < values.size(); i++ )
{
values[i] = values[i - 1] + fc::iround(39.f * powf((float)fc::min<size_t>(i, 29), (float)2));
}



I imagine most everything else can be summed up simpler than what it says.

Imzogelmo
01-17-2013, 02:23 PM
I guess I'm not quite seeing what you're seeing. Each curve can be broken up into a series of patterns, and I've tried to describe the patterns (for Fighters, and I've also done it for Thieves, the rest not yet). Since the patterns are not constant across the whole curve, I've done it piecewise. The status bonuses (as I've called them) are not the actual bonus, but rather a "guarantee" that it will increase. Even if it's false, there is a 50% chance of increase. So it's actually a series of 50% or 100% chances of increase.

Gleeok
01-17-2013, 03:09 PM
Oh, I see now. ..Wait, White Mages don't gain INT ever after LV 30?? ..WTF?!

..
In the NES I guess anything after LV 25 doesn't matter much.. since it doesn't have bonus dungeons or anything. If you want to fix that (and other) bugs, do it.

[edit] If you want to just stick those in the lv-up data under "stat_flags" be my guest. A text file ( ex; 3096 870 4879 etc..) or a binary file works. The bits should be in a 4-byte integer between 24-28, or 19-23, or 27-31.. (24-28 is how I have right now.) , or, 8-bit byte starting from 0. Either one works. (bin file is easier) ..
then you can just say "stat[x] += game.lv_data[lv].stat_flags[x] ? 1 : rand(0,1);

Imzogelmo
01-18-2013, 01:29 AM
:confused:

I can easily create a binary file with all the bits needed (for all the classes), but I'm not sure where the level up data you're referring to is.
Also, it needs 6 bits, and 14 if we do magic spell curves too.

Gleeok
01-18-2013, 11:52 AM
Translation: Do whatever is easier.:P