Mathematicians of OcUK...

Soldato
Joined
6 Apr 2010
Posts
2,918
Location
Cambridgeshire
...I need help with terms in equations.

Basically, I am trying to write down a formula that would work out the damage a player would take in a game but including bleed damage too. If a player gets damaged, they will initially take 20% of the attack damage off their health, but they bleed the other 80% of the damage over 10seconds. (You with me?) Here is a basic example I think I have right:

(HP - (20% of AP)) - (80% of AP over 10sec) = Health left after Attack

HP = Health, AP = Attack Power

So for example, if the player has 100 health and he is hit for 50, he would loose 10 health upon the hit and then bleed the other 40 health over an additional 10seconds. First of all, does that make sense and is my equation correct?

Now, lets say the player is hit again, but a few seconds later then the previous hit. I believe I have worked it out to be this:

(((HP - (20% of AP1)) - (8% per second of AP1, up to 10seconds or until second attack)) - (20% of AP2)) - ((80% of AP2) + remaining % of damage from AP1) over (10seconds + remaining time of AP1)) = HP left after Attacks

HP = Health, AP1 = First Attacks Power, AP2 = Second Attacks Power

As you can see, I want it so the bleed damage does not speed up but adds to itself. So 10seconds might become 15seconds with 2 hits of damage, the first 5seconds before the other.

On paper they both work out with whatever numbers I use, however as you can see the equations have a lot of text in them, but what formulas, expressions or symbols etc could I replace the text with?

I hope all that makes sense, maths has never been my strong point.

Thanks
 
That's pretty overpowered. You kill a guy in less then 10 seconds assuming you attack him more then once.

If he has no healer then it's gg , all you have to do is kite and stay alive for 10 seconds.
 
Well there is a catch to this, but its not part of this equation. Also, nothing in the game will actually hit for that much, its just to see the equation work. For example, something might only hit for 15-20 damage, so initial is very small and bleed wont be that bad. Its all very up in the air right now, and a lot will come out in testing. Its more the equation I need help on right now whether if its going to be overpowered.
 
If it was two attacks that did not have bleed effects, it would be that simple.

The way you're working it out though that is how it works. You're doing:

HP - 20% AP1 - 10 x 8% of AP1 = new HP

That's the same as HP - AP1 = new HP

Now if you wanted to work out how much health was left at each second after the attack(s), that would need a formula. Let's say attack one does X damage, with Y seconds of bleeding. Inital HP is A, HP after is B.

Health left after S seconds (assuming S<=Y) =

A - (X/5 + SX/1.25Y) = B

X/5 is just the 20% damage initially.
SX/1.25Y means: Take X (the total damage of the attack), divide it by 1.25 (to get 80%), divide by the number of seconds of bleed the attack causes (to get the % damage caused each second), multiply by the number of seconds.

An example:

You have 1000HP, and get hit with an attack that does 650 damage total, with 20% being at once, and the other 80% being part of a 26 second bleed. You want to find out how much health is left after, say, 9 seconds.

1000 - (650/5 + (9*650)/(1.25*26)) = B
1000 - (130 + 5850/32.5) = B
1000 - 310 = B = 690

Of course, it gets more complex with several attacks. Can bleeding cause different rates of damage? e.g. If you do an attack doing 100 damage, and an attack doing 200 damage, both with 10 seconds of bleed. The first bleed will do 8 dmg per second, then when that runs out, the second bleed will kick in doing 16 dmg per second. Or will bleeding be a constant amount of damage? I think, for it to make sense gameplay wise, either the bleeding needs to combine, so 8dps + 16dps = 24dps, at least until each part of bleeding runs out, OR bleeding needs to be a constant amount of damage (so both do 8dps, but the 100dmg attack does it for 10 secs, the 200dmg attack does it for 20 secs)
 
Last edited:
The way you're working it out though that is how it works. You're doing:

HP - 20% AP1 - 10 x 8% of AP1 = new HP

That's the same as HP - AP1 = new HP

Now if you wanted to work out how much health was left at each second after the attack(s), that would need a formula. Let's say attack one does X damage, with Y seconds of bleeding. Inital HP is A, HP after is B.

Health left after S seconds (assuming S<=Y) =

A - (X/5 + SX/1.25Y) = B

X/5 is just the 20% damage initially.
SX/1.25Y means: Take X (the total damage of the attack), divide it by 1.25 (to get 80%), divide by the number of seconds of bleed the attack causes (to get the % damage caused each second), multiply by the number of seconds.

An example:

You have 1000HP, and get hit with an attack that does 650 damage total, with 20% being at once, and the other 80% being part of a 26 second bleed. You want to find out how much health is left after, say, 9 seconds.

1000 - (650/5 + (9*650)/(1.25*26)) = B
1000 - (130 + 5850/32.5) = B
1000 - 310 = B = 690

Of course, it gets more complex with several attacks. Can bleeding cause different rates of damage? e.g. If you do an attack doing 100 damage, and an attack doing 200 damage, both with 10 seconds of bleed. The first bleed will do 8 dmg per second, then when that runs out, the second bleed will kick in doing 16 dmg per second. Or will bleeding be a constant amount of damage? I think, for it to make sense gameplay wise, either the bleeding needs to combine, so 8dps + 16dps = 24dps, at least until each part of bleeding runs out, OR bleeding needs to be a constant amount of damage (so both do 8dps, but the 100dmg attack does it for 10 secs, the 200dmg attack does it for 20 secs)

That was EXACTALLY what I needed to hear. I thank you for explaining all that. It is under discussion if attacks will combine bleeds or if they will just continue one after another. I just need to rewrite some of this up now. God I love writing Game Design Documents lol!
 
Back
Top Bottom