# A small formula for the effect of difficulty on game.

Can somebody help me with it. What I want is difficulty (1=easy, 2=normal, 3=hard) to have an affect on Variable Like “Attack-power”, let’s say if it is 40 and difficulty is easy(1) it should stay 40, for Difficulty = 2 it should turn 40 into 36 or something near and for 3 into 32 or something near. and there is also this number 3 (difficulty = 2) which i wanna change to if easy to 4.5 or something near and for hard 2.0 or something. You can give any opinion, might be helpful.

You should setup all your base stats for one of the difficulties (i.e. set all your stats for “easy” difficulty for example). Otherwise you can’t “functionalize” the values easily
Now each stat reacts different to the difficulty, your “Attack-power” stat could be computed as:

``Do =  40 - 4*Variable(difficulty) to variable "Attack-power"``

So each difficulty increase the amount to subtract.
There are some thing to note:
The difficulty “easy” (= 1) will subtract some amount too, to avoid it set the difficulty variables to “easy” = 0, “normal” = 1, “hard” = 2, or use 4*(Variable(difficulty) - 1) instead.
This is a linear dependency, but you can use other math functions to make interesting difficulty curves.

As I said before, each stat is modified in a different way because the difficulty, for your number 3, again, please use the same difficulty for every base stat, so it should be 4.5 (because I’m using “easy” as base), then modify it with the “difficulty” variable. As you can see, this relation is not linear (if it were, the values would be (4.5, 3, 1.5) or (4, 3, 2)). But this curve seems to fit perfect (using polynomial regression): 0.25x^2 - 1.75x + 4.5

``Do = 0.25*Variable(difficulty)*Variable(difficulty) - 1.75*Variable(difficulty) + 4.5   to variable "that 3"``

It’s just an example so you can see how to “functionalize”(?) the values
Again, assuming the difficulty variable as “easy” = 0, “normal” = 1, “hard” = 2. You can replace every “Variable(difficuty)” ocurrence by “(Variable(difficulty) -1)” instead.
Instead 0.25*Variable(difficulty)Variable(difficulty), you can use 0.25pow(Variable(difficulty), 2)

Thank you!

I love this software and it’s community. I am proud to b a part of it’s community!!!
Thank you all for the software and the help!!! <3

It depends on the type of game, but usually, decreasing attack-power is a bad idea.
It means that your player will have to take more attacks to kill enemies.

To make it more clear, imagine classic Super Mario. But instead of killing a goomba with one jump, the player needs to jump on him three times. For every encounter, the player will “stop” to kill each one of them, instead of combo’ing in a flash.
The game will feel slugier, more repetitive, and overall … boring.

I would advise you to increase your enemies’ attack power, or their speed or their numbers. Punish more your player for his mistakes. Don’t stall him with mandatory grind.

Extra Credits has a good video on difficulty.