Stat point level up/down formula?

I’m a starting Indie developer, (better artist/game designer than a programmer) and I’m terrible at math… I need a formula to calculate how much stat points to add to a character when the character levels up, I’d also much appreciate some examples of how to implement the code to manage automatic stat point allocation at level up. The actual problem I have is that my game’s design has Levelups and Leveldowns(losing a level), so the formula needs to work when a Character levelsDown, and what I mean is that the points give or taken at that specific level should be the same no matter if the character level’s up or levels down. This feature was also used by Wild Arms 5, where you could sell your levels for specially rare stuff (great way to make players play more). I also need the amount of stats gained (or lost) per level to be reasonable/mild (in a Graph it looks like a slightly rising line, I think, I can’t recall how’s that called in math). In other words I need the increase to not turn ultra crazy high too soon in the level chart (just ultra crazy high when at really crazy high levels :smile:). This is because my game’s design allows plenty of levels (think Disgaea maxlvl:9999), if the increase was too rapid the stats’ amount could get out of hand, I assume (as I said, I’m not good at math…).

At first, I was considering producing a base amount of stat points per level to then give them randomly to the character’s different stats (because that would be easier to calculate, I’m guessing?), but that would probably work awkwardly when decreasing stats… the player would have the stats lowered randomly too, I imagine, and I would prefer if the amount of stats given or lost would be the same always. That’s how they did it in wild arms, but I have no clue how they managed to remember the exact amounts…

Anyway, in case it’s necessary to know it, the game’s battle system will be turn based (RPG style), like DragonQuest or final fantasy. For now I’ve decided on having the common stats. HP, MP, Strength, Mana/magic, Physical Defense, Magical Defense, Dexterity and Speed. As is traditional, HP would get a higher increase than all other stats, MP less, and the others a handful of points (depending on the level). At least that’s how imagine it.

As I mentioned I want a leveling system like the disgaea series, which means level cap is going to be 9999 and the stats should be able to get in the hundreds of thousands or even millions when they reach the highest levels.

By the way I’m also using Disgaea Hour of Darkness’ exp formula, which I picked up in a forum and translated to C# (you can tweak it to your liking by changing formulaBaseExp and difficultyFactor - formulaBaseExp represents the exp required to level up the first time):

//calculating the current EXP required to lvl up, dependent on current lvl
int expToNextLvl = Mathf.RoundToInt(formulaBaseExp * (Mathf.Pow(currentLvl, difficultyFactor)));

Anyway, I’m a one man team, and I’m kind of new to unity and programming, so any help would be immensely appreciated.

Note I edited the question to clarify it

I’d love to help but there is an infinite number of ways to write an equation for random stat gain… Just adding random numbers to a stat means nothing unless you provide information on how the stats behave… I mean you could just use some random equation that doesn’t make much sense like the following…

private int level = 1;
private int strength = 1;

public void Levelup()
{
   int strengthBonus = CalculateStatBonus(strength);
   int previousStrength = strength;
   strength += strengthBonus;
   Debug.Log("Levelup!\r\nStrength: " + previousStrength + "(+" + strengthBonus + ") NewTotal: " + strength);

   ++level;
}

public int CalculateStatBonus(int statValue)
{
   const float MINIMUM_BONUS = 1.75f;
   const float MINIMUM_BONUS_BONUS = 0.05f;
   const float THE_ONE_PERCENT = 0.01f;
   const float MEANING_OF_LIFE = 42f;

   float minimumBonus = MINIMUM_BONUS + (statValue * MINIMUM_BONUS_BONUS);
   float maximumBonus = (((statValue + MEANING_OF_LIFE) * Mathf.PI) * THE_ONE_PERCENT) + minimumBonus;

   return Mathf.CeilToInt(Random.Range(minimumBonus, maximumBonus));
}

How they behave? well, to be honest I’m still in the early stages of designing combat… but it will be a turn based RPG style, like Dragonquest/final fantasy.

For now I’ve decided on having the common stuff. HP, MP, Strength, Mana/magic, Physical Defense, Magical Defense, Dexterity and Speed. HP would get a higher increase than all other stats as it’s common, MP less, and the others a handful of points (depending on the level). I don’t know if that’s what you mean by behavior?

EDIT: I do want to use leveling similar to disgaea, which means level cap is going to be 9999 and the stats should be able to get in the hundreds of thousands or even millions when they reach the highest.

EDIT2: by the way I’m also using Disgaea 1’s exp formula, which I picked up in a forum and translated to C# :sweat_smile::

//calculating the current EXP required to lvl up, dependent on current lvl
int expToNextLvl = Mathf.RoundToInt(formulaBaseExp * (Mathf.Pow(currentLvl, difficultyFactor)));

Bump… (because I heavily edited my question).