# Stat Curves

### » Fri Sep 09, 2011 5:09 am

So I'm trying to work out some stat formulas for my game. I'm incorporating a level up system where the maximum HP is going to be 999, and the maximum level 99. I'm trying to get a healthy curve to the stat growth, but I can't seem to make it a smooth curve. I've played around a bit with lerp, qarp, and cube, but no dice. My biggest problem is I'm rubbish at math.

Basically, I'm trying to do this:

but I'm not much of an Ian Malcolm.

Help me Obi-Wan Kenobi! You're my only hope!
B
52
S
17
G
7
Posts: 305
Reputation: 8,354

### » Fri Sep 09, 2011 5:21 am

Theres a 4 billion ways to do this, one way: "BaseHP +((lvl^2)*X)"

Just change the 2 to 1.1 to be less dramatic or to 8 to be more dramatic.alspal2011-09-09 05:22:32
B
126
S
63
G
16
Posts: 1,763
Reputation: 18,772

### » Fri Sep 09, 2011 6:59 am

[QUOTE=alspal] Theres a 4 billion ways to do this, one way: "BaseHP +((lvl^2)*X)"

Just change the 2 to 1.1 to be less dramatic or to 8 to be more dramatic.[/QUOTE]
Whats baseHp? Is it start or end? And whats x?
B
160
S
48
G
79
Posts: 7,226
Reputation: 60,980

### » Fri Sep 09, 2011 8:06 am

Base stats are level 1 stats.

If your BaseHP is 45. The formula would be 45 + ((lvl^2)*X) I'm assuming X is your current HP.
B
11
S
3
G
8
Posts: 473
Reputation: 4,569

### » Fri Sep 09, 2011 9:31 am

I dunno why I put x there
B
126
S
63
G
16
Posts: 1,763
Reputation: 18,772

### » Fri Sep 09, 2011 9:53 am

You've put 'x' there, because you need a factor to reach the right cap.

Your formula would output 9821 (99^2 = 9801 + baseHP = 20) for level 99, but TL22 wants 999 as the max value. To reach 999, the factor 'x' would need to be (rounded) 0.0998877665544332211, that's calculated by 979 / 9801

This by the way is a parabola, the image looks more like a quarter circle.
With a parabola, the value increase per step will be higher and higher, while level increases.
With a quarter circle, the increase will be flatter towards beginning and end, and steeper towards the middle.
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

### » Fri Sep 09, 2011 4:08 pm

Even a quarter ellipse will do.

I have put a name to my pain!

Bias
This module calculates Ken Perlin's Bias function. Given an input value between 0 and 1, it calculates an output value which is also between 0 and 1 according to:

y(x) = x^(log(B)/log(0.5))

where the input value x and bias B correspond to the two input ports. If B=0.5, then y(x)=x. Values of B less than 0.5 push the output toward smaller values, while values of B greater than 0.5 push the output toward larger values.

Source: http://www.artofillusion.org/docs/texedtut/chapter4

So I played around a bit with it and came up with:

ceil(18 + (("level" / 99)^(log(0.15) / log(0.5))) * 881 + "level")

Essentially what this does is force Level 1 to be 20HP, and upon every level up you gain at the very least 1 HP, and the amount grows with each level up, until Level 99, at which it will end on 999 HP. I'm not huge into the ugly fix making it a 1 HP stat growth in the beginning, but it only lasts until around Level 10 or so.

Here's the cap with an example!
http://dl.dropbox.com/u/20459682/levelhp.cap

It feels a bit convoluted though, so of course, I'm still open to suggestions! TL222011-09-09 17:31:46
B
52
S
17
G
7
Posts: 305
Reputation: 8,354

### » Sat Sep 10, 2011 1:40 pm

Damn, I worked on a cap to play around with PerlinBias to find the right values. Was too late :(

Anyway. I am posting it, if you don't mind, in case someone else might need it:
http://www.mediafire.com/file/d7iwraufey7v6nw/PerlinBias.cap
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

### » Sat Sep 10, 2011 4:05 pm

My wow, that's really cool. Looking at your formula also makes me want to rework mine a bit to make it look a bit nicer. Like how you threw the base HP outside of the whole bias calculations so that it added it after. Makes it look cleaner and helps with modifying it more easily on a character by character basis. Also what'll help me on a per character basis is being able to quickly see stat values and curves so that I can use it as a reference for coming up with character growth stats. You've given me a calculator I can use!

Plus, it's better to have an example cap by someone who knows what they're doing than someone massacring a sweet calculation. So thanks! TL222011-09-10 16:11:10
B
52
S
17
G
7
Posts: 305
Reputation: 8,354

### » Sun Sep 11, 2011 1:19 pm

Thank you.
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Next