I'm very bad at math, ridiculously so. I'm making attributes that work as multipliers.

1 Agility means : animation speed * agility, movement speed * agility and dodge skill cooldowns are divided by agility

Which means that 1 point in agility grants you the basic and default movement and cooldowns for evasive and dodging skills.

1 Strength means :

Your bodyweight is multiplied by Strength since in real life weight is the base of strength.

So how much weight you can lift, push, throw, carry and hold is literally just your mass multiplied by strength.

A character of 60kg with strength of 1 can only lift 60kg at most, which is representative of light skinny and weak people in real life.

And also since pulling and holding applies, a character with a strength less than 1 will not be able to climb or hold themselves onto ledges, because 1 means you can lift up to your own bodyweight minimum.

Math question here

I want attributes to be increased by spending points. Each point at first increases the value of an attribute from let's say 1.0 to 1.1.... and then each subsequent point loses value and being less effective, let's say 70% as effective as the previously spent point.

So the first point will be 0.1 and the second 0.07 and so on just as an example...

How can I tell a software to do that?


2 Answers 2


It sounds like you're looking for the pow function, that raises a number to a power.

If we've already spent n points to increase this attribute, the increment the next point will add is 0.1 * pow(0.7, n)

Calling your first 0.1 increment a, and calling 0.7 r for the "ratio" between consecutive increments, that means that spending n points will bring you to a total attribute value of:

$$1 + a + a r^1 + a r^2 + ... + a r^{n-1} = 1 + \sum^{n-1}_{k = 0}ar^k$$

This gives us a geometric series, which we can express in closed form as:

totalAttribute = 1.0 + a * (1.0 - pow(r, n)) / (1.0 - r)

Here's the table of stats that gives us:

Points Spent Total Attribute
0 1
1 1.1
2 1.17
3 1.219
4 1.2533
5 1.27731
6 1.294117
7 1.3058819
8 1.31411733
9 1.319882131
10 1.323917492
11 1.326742244
12 1.328719571
13 1.3301037
14 1.33107259
15 1.331750813
16 1.332225569
17 1.332557898
18 1.332790529
19 1.33295337
20 1.333067359

We can also get the maximum possible attribute value this converges toward:

maxAttribute = 1.0 + a / (1.0 - r)

For a = 0.1 and r = 0.7 that gives 1⅓, so your strongest character will only ever be able to lift 33% more than your weakest character. As you can see, we're already pretty much there after spending 12 points, and the rest is just whittling down that rounding error. So this diminishing return schedule might be a bit aggressively tapered if you want to keep players feeling value in each point after dozens of upgrades.


You need a distinction between primary stats and secondary stats.

Primary stats do nothing by themselves in the game world, they just influence secondary stats. For example, raising your Strength (primary stat) increases your Melee Attack (secondary stat).

The player will distribute points between primary stats. For example, he can choose to put 1 point in Strength, raising it from 15 to 16.

You then define Melee Attack as follow:

Melee Attack = Strength ^ (1/2)

enter image description here

The X axis represents Strength here, while the Y axis represents Melee Attack. As you can see:

  • going from 0 to 4 Strength raise Melee Attack from 0 to 2.
  • going from 4 to 16 Strength raise Melee Attack from 2 to 4.

So that's an example of diminishing returns. Obviously, you need to tweak the formula for your own needs.

  • \$\begingroup\$ This does not seem to answer the question, "How do I make it so the fist point increases strength by 0.1, the next point by 0.07, and so on, multiplying by 0.7 each time?" \$\endgroup\$
    – DMGregory
    Jun 18, 2023 at 13:52
  • \$\begingroup\$ I assumed that this specific point in the question was just an example, and that the question was about diminishing returns in general. \$\endgroup\$
    – Eldy
    Jun 18, 2023 at 13:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .