Page 1 of 1

[LEGACY] Damage bonus calculations

Posted: 17 Oct 2022, 20:29
by Wellvin
Damage bonus follow the formula (Dexterity/10)^2 and (Strength/10)^2. The integer division truncates the value before squaring it. The player needs to know about this and set Dex or Str to a multiple of 10 to benefit from the character points he/she invested in Dex or Str.

Most players expect that a higher Dex or Str gives better bonus. We could fulfill that expectation with the formula (Dexterity^2)/100 and (Strength^2)/100. Here, the integer division truncates the value after squaring it.

The graph below shows (Dexterity/10)^2 in red and (Dexterity^2)/100 in blue.

Image
For example, Dex 78 gives:
(78/10)^2 = 7^2 = 49
(78^2)/100 = 6084/100 = 60

Multiples of 10 still give the optimum. For example, Dex 80 gives:
(80/10)^2 = 8^2 = 64
(80^2)/100 = 6400/100 = 64

I've played archer for a long time, using Dex 99.

What do you think about the new formula ?

Re: [LEGACY] Damage bonus calculations

Posted: 17 Oct 2022, 21:58
by jesusalva
That under this new formula, maximum dex is 181 instead of 255 (as it may overflow mid-calculation: So testing is required. I blame tmwa for trying to save processing power at all costs :D ) ─ Unless I'm actually wrong and it overflow when dex goes past 15, depends on how stupidly the types are.

TL;DR I pretty much like the new formula, good idea! But needs testing, because the programming under the hood can be quite sensitive.

(ACK for me as far as I'm concerned ─ provided it somehow work)

Re: [LEGACY] Damage bonus calculations

Posted: 18 Oct 2022, 09:17
by Hello=)
My concern about this change:
1) TMW already too centric to highlevelers making low levels life hard. While it encourages leveling it also makes start quite difficult and ruins co-op. It cuold aggravate this issue, moving player activities even further from co-op, no?
2) Banshee Archers were OP for a while. Its been somewhat toned down recently and as much as bansheers would dislike me, I'd say it improved overall battlefield feeling. But with change like that problem could resurface again since archers are all about dex in the end.
3) It partially jeopardizes longer term evolution like e.g. introducing new items giving useful stats bonuses becomes more painful decision on balancing grounds for rares. TMW haves too much items with really pointless stats where ppl are supposed to spend ton of efforts to get rather useless things.

Re: [LEGACY] Damage bonus calculations

Posted: 18 Oct 2022, 10:00
by WildX
Like everything of this scale I would suggest it spends a long time on the test server before making it to the live one.

Re: [LEGACY] Damage bonus calculations

Posted: 18 Oct 2022, 17:44
by Wellvin
Technical

To prevent any computation issue and save processing power, we could use an array that contains computed values like this one (blue formula rounded to nearest integer, C code):

Code: Select all

const int DamageBonus[256]={0,0,0,0,0,0,0,0,1,1,1,1,1,2,2,2,3,3,3,4,4,4,5,5,6,6,7,7,8,8,9,10,10,11,12,12,13,14,14,15,16,17,18,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,34,35,36,37,38,40,41,42,44,45,46,48,49,50,52,53,55,56,58,59,61,62,64,66,67,69,71,72,74,76,77,79,81,83,85,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,117,119,121,123,125,128,130,132,135,137,139,142,144,146,149,151,154,156,159,161,164,166,169,172,174,177,180,182,185,188,190,193,196,199,202,204,207,210,213,216,219,222,225,228,231,234,237,240,243,246,250,253,256,259,262,266,269,272,276,279,282,286,289,292,296,299,303,306,310,313,317,320,324,328,331,335,339,342,346,350,353,357,361,365,369,372,376,380,384,388,392,396,400,404,408,412,416,420,424,428,433,437,441,445,449,454,458,462,467,471,475,480,484,488,493,497,502,506,511,515,520,524,529,534,538,543,548,552,557,562,566,571,576,581,586,590,595,600,605,610,615,620,625,630,635,640,645,650};
When we need the damage bonus value that corresponds to a dexterity or strength, we simply use:

Code: Select all

DexDamageBonus=DamageBonus[Dex];
StrDamageBonus=DamageBonus[Str];
As dexterity and strength share the same formula, we only need one DamageBonus array. In my small game projects I would typically make this array a global variable and add a lower case g at the beginning of its name: gDamageBonus.


Game design

The new implementation aims to benefit the new players that ignore the "you need a multiple of 10 to benefit from your character points investment" from the old formula.

Re: [LEGACY] Damage bonus calculations

Posted: 18 Oct 2022, 20:31
by jesusalva
I think this, along a ASPD fix as described extensively on Phylactery thread, has a really good chance of improving game balance.

On its own, it may incur in what Hello=) mentioned, but I think together with an ASPD fix it'll have a good harmony.

This one buffs those with non multiple stats, giving more flexibility to players with less stat points to allocate. Meanwhile, the ASPD fix strikes down players at red threshold really hard, and those are all high level players. Together, I think they will even the battle field drastically, having a good harmony. High level players can also take advantage of the new flexibility to priorize agility to recover their ASPD.

Personally, though, instead of declaring the const int, I would have this as a table in db/ folder. Just like statpoints.txt and guild_exp.txt (neither are used in TMWA). But the approach is correct and tmwa already has a bunch of const int arrays in pc.cpp which should be in db/ folder; Adding another one barely breaks anything.

(Also, I did not check the original code. I remember that multiples of 5 and 10 were supposed to give an extra "lift" in addition to the normal bonus, but I don't even think this is important)