ID:2468739
 
(See the best response by FKI.)
Problem description:
To be honest I'm fairly capable at doing most things, I can pixel, program, map, host, basically everything required to make a game... My one and only downfall is working out damage calculations... I've spent my fair share of time attempting it but it seems like it'll work fine but once a new mob is introduced the damage shows issues, for example I use this damage for my "Mana Blast" attack:

                    usercontrol = round((M.GetStatBonus("Control"))+M.Control.Level,0.1)
targetdurability = round((target.GetStatBonus("Durability"))+target.Durability.Level,0.1)
leveldifference = M.Level.Level - target.Level.Level
totaldamage = round(S.Power+((usercontrol+leveldifference)-(targetdurability*0.25))*0.85,0.1)
r = rand(1,5)
totaldamage = totaldamage+r


I tried to just keep it basic just so it's easier to manage and it worked fine, at level 1 with 250 health, 5 control, 5 durability the attack would do around 17 to 21 damage however I created a turret like AI that fires consecutive mana blasts to test my shield coding and it seems like the control stat has absolutely no influence in this ... I'm confused, originally I set the AIs control to 10 it was doing around 21 to 26 damage I was like okay that's only a slight increase from 5 control, I decided to try setting the AIs control to 100 to test the shields health properties... I still recieve 21 to 26 damage so I increased to 1000 and the same problem... I honestly don't know whats going on but I could use some help, I'm more than happy to start my damage calculations from scratch I would just appreciate if someone could help me understand how to better my damage calcs
Best response
I don't think there is a science to this sort of thing.
  • Decide on a damage range you want for your attack, incorporating factors such as cooldown, cost, etc.
  • Play around with the numbers and what make up said numbers (i.e. stats, static damage, etc.) until you get close to your desired damage range.


I mean, in short... Tinker with the numbers until it's right at a baseline and maximized level/strength. I'm certain that's all most developers do.
this is not enough information, we need to see the associated procs and values you are using. we don't know what GetStatBonus() does. We don't know the var values. we have no way to calculate what's going on.


GetStatBonus is self explanitory, it works out whether there's any buffs or nerfs done to your characters stat, and if you read it properly I said players have 5 control, 5 durability at level 1, all of this is working out from level 1, power varies depending on the attack, different attack, different power outage I'm more looking for someone to guide me through their way of thinking with damage calculations my code above is more to show that I'm useless at it lol
either way, just create output to tell you the total after each time its changed until you see the output is wrong.
                    usercontrol = round((M.GetStatBonus("Control"))+M.Control.Level,0.1)
world << "usercontrol [usercontrol]"
targetdurability = round((target.GetStatBonus("Durability"))+target.Durability.Level,0.1)
world << "targetdurability [targetdurability]"
leveldifference = M.Level.Level - target.Level.Level

world << "leveldifference [leveldifference]"
totaldamage = round(S.Power+((usercontrol+leveldifference)-(targetdurability*0.25))*0.85,0.1)
world << "totaldamage [totaldamage]"
r = rand(1,5)
world << "r [r]"
totaldamage = totaldamage+r
world << "totaldamage [totaldamage]"


it should pin point where things are not going as planned.
r 4
usercontrol 5
targetdurability 5
leveldifference 0
totaldamage 13.2
totaldamage 17.2
-------------------------
Me to it:
r 5
usercontrol 5
targetdurability 14
leveldifference -4
totaldamage 7.9
totaldamage 12.9
-------------------------
It to me:
r 2
usercontrol 21
targetdurability 5
leveldifference 4
totaldamage 30.2
totaldamage 32.2

So the results aren't too disturbing, I suppose, could probably use a little tinkering seeing as level 1s start with 250 health but the scaling isn't overly awful
Yeah, I done some testing and the level difference var makes a big difference in the outcome, 21 control vs my 5 durability hitting 1s just because I was 40 levels higher, I mean yeah it shouldn't do much damage to me but 1s is ridiculous lmao