Higher Precision of weapon damage calculation

This is the place for people to research themes and ideas for their mods as well as for others to post their suggestions for mod makers to make use of.

Moderator: Nefarius

Post Reply
Pangaea
Junior Member
Paladin
Posts: 240
Joined: Thu Apr 01, 2010 9:05 pm

Higher Precision of weapon damage calculation

Post by Pangaea » Mon May 31, 2010 5:29 pm

Working on my "if(min>max){swap min,max;};" modification i've seen that the
first steps of damage calculation are not very precise as they should be.
For low quality Dagger it goes this way:
1~4 (calculating 3/4 of the values)
0~3 (testing min against lower 1 & max against lower 2)
1~3 (end result)
A high quality Dagger with +15% dmg
1~4 (min/max *115/100;rounded down)
1~4 (still the same values)
As last step the dmg-min dmg-max from magic, rare, runes,...if the weapon haves
them are added
When a hit is done, the game get these values and shift them 8 to the left for the
damage calculation - hp is handled in 1/256th....

The idea is to shift the values immediality 8 left after the min/max value is loaded from
the big weapon/armor/misc table, so dmg-min dmg-max would also be handled in 1/256th
So a low quality dagger would have 0.75~3 as base damage (displayed: 0-3)
A high quality with +15% dmg would have 1,1484375~4,59375 (still displayed 1-4)

It's looks very complex and i don't know if i have the time and the good ideas how to
rewrite the code:

- value shift left by 8
- +dmg-min & +dmg-max needs also a shift left by 8 before they are added (*)
- when the values go to the display routines they have to shifted right by 8
- searching for (possible) other positions where code change is required

(*) this seems to be the biggest prob since the stats haves to identify from the pool
of all stats and they have to go in an own routine
I'm working with v1.13c

User avatar
Necrolis
Senior Admin
Throne
Posts: 9125
Joined: Sat Mar 25, 2006 1:22 pm
Location: The Land of the Dead
Contact:
South Africa

Hand-picked

Re: Higher Precision of weapon damage calculation

Post by Necrolis » Mon May 31, 2010 7:44 pm

In my opinion there is no real point to this, the amounts lost are proportional to the input, and thus become negligable(this excludes the broken percentaging of huge numbers, > 2 ^ 23 - 1, which never happens much in vanilla). On top of that, its a fair bit of work to find and replace everything dealing with this to make it work, your better off fixing some of the real bugs and problems with combat(of which there are tones) or fixing how the shoddy superior item quality works(its all of 1 place to fix, to make it add flat damage instead of a percent for items with less than x damage, same can be done for armors and for the stats that are associated with this)
Image
Netiquette, Do you USE it?!?! | Nefarius' Fixed TXT Files | Terms Of Service
Blackened | Day of Death | D2GFEx
"What was yours is mine. Your land, your people, and now your life." - Lim-Dul, the Necromancer
Judgement is Final, Death is Eternal

Pangaea
Junior Member
Paladin
Posts: 240
Joined: Thu Apr 01, 2010 9:05 pm

Re: Higher Precision of weapon damage calculation

Post by Pangaea » Thu Jun 03, 2010 3:24 pm

>fixing how the shoddy superior item quality works(its all of 1 place to fix, to make it
>add flat damage instead of a percent for items with less than x damage

That would be not neccessary with the higher presicion ;)

>your better off fixing some of the real bugs and problems with combat(of which there are tones)

Is there a list in this forum or can you give examples?
I'm working with v1.13c

User avatar
Necrolis
Senior Admin
Throne
Posts: 9125
Joined: Sat Mar 25, 2006 1:22 pm
Location: The Land of the Dead
Contact:
South Africa

Hand-picked

Re: Higher Precision of weapon damage calculation

Post by Necrolis » Sat Jun 05, 2010 7:41 pm

Pangaea" wrote:>fixing how the shoddy superior item quality works(its all of 1 place to fix, to make it
>add flat damage instead of a percent for items with less than x damage

That would be not neccessary with the higher presicion ;)
its still pretty much useless, unless your planning to take small numbers to an extreme
Pangaea" wrote:>your better off fixing some of the real bugs and problems with combat(of which there are tones)

Is there a list in this forum or can you give examples?
there is a generics bugs list in d2 chatter, but a lot of the bugs(skill/combat/monster wise) are posted in CE(either in full with fixes, or at least pointers on where to begin), other things are not realyl bugs but design flaws, like the A vs D formula etc, which places far too much on level, making ac/ar pretty useless
Image
Netiquette, Do you USE it?!?! | Nefarius' Fixed TXT Files | Terms Of Service
Blackened | Day of Death | D2GFEx
"What was yours is mine. Your land, your people, and now your life." - Lim-Dul, the Necromancer
Judgement is Final, Death is Eternal

Pangaea
Junior Member
Paladin
Posts: 240
Joined: Thu Apr 01, 2010 9:05 pm

Re: Higher Precision of weapon damage calculation

Post by Pangaea » Mon Jun 07, 2010 3:20 pm

>its still pretty much useless, unless your planning to take small numbers to an extreme

I'm not completly through with the code of damage calculation, but it looks like that
+dmg;+dmg-min;+dmg-max;+dmg%;+dmg/time;.....when they are on the weapon
are added to the base min/max values and stored as integer in memory. The adding
og +dmg;... coming from the other equipment is done with 1/256th precise when a
damage occurs and the damage is calculated.

Superior Dagger (+15 dmg%); From Equip +3 dmg +75 dmg%:
Currently the damage goes: 5.25~12.25
With higher precision it would be: 7,2578125~13,29296875

Average damage would be 1.5 higher

>design flaws, like the A vs D formula etc, which places far too much on level,
>making ac/ar pretty useless

I think the designers idea is that the palyer should attack same level monsters
through the whole way from level 1 to 99. So the lower ones should be very easy
and the higher ones very hard. (50% hit chance if levels are the same and hit rate
equals defense rate)
I'm working with v1.13c

Pangaea
Junior Member
Paladin
Posts: 240
Joined: Thu Apr 01, 2010 9:05 pm

Re: Higher Precision of weapon damage calculation

Post by Pangaea » Sat Jan 15, 2011 3:59 am

So.....i'm currently working on it (after a few month break from modding)

What i've done/found so far:

When weapon damge is load from the bin table i shift them left by 8
before storing.
Removing the left shift by 8 when the damage is calculated (i found 2
routines melee & missle)
Removing the left shift by 8 when the damage in the char stat dsiplay
is calculated
Adding right shift by 8 when the weapon information are shown going
over it with the mouse cursor
Setting "ValShift" in ISC for the +dmges to 8 (so the values of magic,
rare, set,... are correct added)

What i'm searching next for is the position, where the monster damage is
stored, because the damage calculation uses also the manipulated routines.

I hope that this is all and i can soon post my hex codes for v1.12
I'm working with v1.13c

Post Reply

Return to “Mod Concepts & Research”