The Lurker Lounge Forums
Durability - Printable Version

+- The Lurker Lounge Forums (https://www.lurkerlounge.com/forums)
+-- Forum: Lurker Games (https://www.lurkerlounge.com/forums/forum-6.html)
+--- Forum: Diablo II (https://www.lurkerlounge.com/forums/forum-8.html)
+--- Thread: Durability (/thread-11836.html)

Pages: 1 2


Durability - Archon_Wing - 03-14-2003

How do they calculate items losing durability?
If i smite with a shield, does it lose durability?
God, those repair costs for a paladin shield are killing me. :)

as another question, how are repair costs calculated?


Durability - Isolde - 03-15-2003

when you score a hit, there's a 4% chance of your weapon you attacked with losing durability (5% if it's a throwable item).

smite is bugged in that it reduces the durability of your weapon (not your shield).

when you're hit it picks a random armor piece to damage: helm = 3, torso = 2, right hand = 2, left hand = 2, belt = 4, boots = 4, gloves = 3
it won't pick a piece you don't have.

that piece will have a 10% chance of losing durability.

you don't lose durability when you block.

you don't lose durability from non-melee attacks.

screwy huh?

repair costs are really complicated, you might want to search if maybe jarulf has a write-up on it.

i can say that your cheapest repair costs are going to be with items with full charges (or no charges) and replenish durability... if an item has replenish durability, it calculates the repair cost as if it had full durability - 1 no matter what the actual durability is.


Durability - Archon_Wing - 03-15-2003

Ok, cool, I can smite away then. And blocking doesn't ruin durability. That's just weird. :) Thanks for the info. To preserve my shield, i need to block more :D


Durability - Conner Macleod - 03-15-2003

Wow Isolde, that is amazing info. :) Which guide did you get that from? I wanna reference that in the future.


Durability - Isolde - 03-16-2003

Actually, most of the time I get my info from jarulf ;)


Durability - Elric of Grans - 03-16-2003

Hail Conner,

I recall Jarulf posting this a while back: run a search on an old forum, and you've decent chances. I know he linked me to it all when I was researching the workings of Fend, so if you cannot find it searching for Durability, try searching for that ;)


Durability - Jarulf - 03-16-2003

Elric of Grans,Mar 16 2003, 07:04 AM Wrote:Hail Conner,

I recall Jarulf posting this a while back: run a search on an old forum, and you've decent chances. I know he linked me to it all when I was researching the workings of Fend, so if you cannot find it searching for Durability, try searching for that ;)


Here is the link to my post long ago about durability losses.


EDIT: Bah, forgot to paste the actual linkl :)

http://www.network54.com/Hide/Forum/messag...ageid=973533135


It will also explain some what those numbers Isolde wrote for various armor types actually mean. Ther is basically a 1 in *number* chance that that item is picked. So a higher value means less chance to be picked. It doesn't transform into an exact probability relation though, well see my post for exact percentages :)

Either I goofed horribly on the percentag chance for a wqeapon when you attack or they changed it since then (I think I wrote my stuff arround 1.04).

Finally, I have no idea if it still applies that some attacj types such as LA will never end up checking for durability losses. Unless they have messaed arround and moved the check, it SHOULD still apply. That is, any attack that does not trigger Amp Damage or Thorns, will not trigger durability loss either Since appearantly Smite take durability from the wepaon now, it might have been changed though. What do I know.

Have fun!


Edit: One way to find all such old posts of "information" or discovery" is to go through the news archieve. Start arround june or july 2000 and work yourself forward. The above one was linked from the April 2001 news.

Bolty did a VERY good summary of all such information posts/threads in the news each month so most such posts will be mentioned in those news pages. I simply wne through each month searching for "durability" until I found this one mentioned. Going through them also gives a nice summary of the time and order stuff in the game was figured out so to speak. Can be an interesting reading at times.

The news archieve can be found here (or from the menu on the left on the D2 page):

http://www.lurkerlounge.com/diablo2/news/

I use it all the time when I want to find my old posts
:D


Durability - Jarulf - 03-16-2003

This has nothing to do with Diablo 2 really but about random pick. So it is in part Off Topic.


One thing that always intrigue me, is how programmers end up solving a situation of picking a random "thing" out of a list of possible picks. Especially if that list is of variable size and as in the case here, each entry should have a varying probability. There are good and there are bad solutions of course. For a bad one, look at how the Diablo 1 game picked a random spell for a book for example (check my guide, I have it there). here, when picking an item to lose a durability, I would claim they have a semi good solution.

Just to recap. The game picks an item slot at random (looping until the slot actuall has an item that can lose durabilty). Then make a random number (Rnd [x] where x is the number Isolde posted), if the random value is not 0, it loops and pick a new item slot.

Now, we don't have THAT many item slots and the x value is small so practically we should not have to roll THAT many random values and not loop THAT many times. Still, theoretically, the game could get stuck for a noticable length of time.

One solution that is used (at least last time I checked) for picking affixes, which is a similar situation, is to built a table holding only the available choises (if applied to the durability loss, holding each slot that has an item that CAN lose durability). One sum up each of those entries in the table x value and then make a random call that generate a value in the 0 to sum_x -1 range and then start from the start of the tabel subtracting each entries probability value until one get to the picked random value. The current slot is the one picked.

As I mentioned in my other, old, post. The actual probability of being picked would differ some but that is just a matter of picking the probability values to match the final result one want.

So, is there another solution? Yes, there is. It works in all the above situations and even in a situation were you don't really know how many available entries there is.

Basically this is how it works. I will first giev an example were each possible entry has an equal chance of getting picked.


You start with the first item, it has a 1 in 1 chance of getting picked as the current "winner". next, we get the second item, it has a 1 in 2 chance of replacing the current winner as a new winner. The third item has a 1 in 3 chance to replace the current winner (which ever it happens to be out of the two first items) and so on were each item has a 1 in item_number chance to be replace the current winner. When we reach the final item, whatever happens to be the current winner is the item to be picked.

Feel free to verify this yourself and see that it actually create an equal chance for each item to be picked.

For a situation were we have a variable chance to be picked, we will make a slight adjustment. Instead of a 1 in item_number chance to replace the winner we make it a 1 in sum_of_probabilites_so_far chance. That is, for the third item we sum up the relative probability of an item to be picked for the items number 1, 2 and 3 and make a 1 in that value chance. That is the actual probability for an item to be picked is its own probability value divided by the sum of all items probability.

Again, feel free to verify this works.

So, what is the drawbacks and advantages. Well, some that I can think of is that a good thing is that you will have a predetermined number of "loops" and calls for rando number to pick your item. That is, you don't "loop until we get a result we are happy with). It also does not need to build a table which in itself also means you need to loop through all items at least once, possibly in part twice (see above). However, you DO need to llop through all items, that is, there is no "1 random call to pick it". If your random number generator's code is long and time consuming, it might time wise be worse than building a table for example, however with a good random number generator it is not really much code each time and you can even inline it.

Oh well. Just though I should mention it. I have seen several places were such a method would actually have been good in D2 (and also several places were it would not have been a good choice). However, I have not seen anywere were it (or something similar) have actually been used. I have seen several "not so good" other solutions though.

Comments? Flames? Complains? Just had some time to kill making a post :)


Durability - Isolde - 03-16-2003

hi hi, i talked about this with you earlier but never gave you an answer!

in the end i prefer building the table if i know that there is going to be some maximum number of entries because, although picking a random dword is pretty fast (using the PRNG algorithm which d2 uses), doing a non-power of 2 division at each point is very slow (to get a number 1-n). so looping through the list once to get the total and (on average) half a time (actually usually much less than half, see below) to get the actual pick without calling rand(n) is better in many cases than looping through just once but doing a mod each time.

actually the half a time is often less than that as well, for on the first loop you are often culling out many of the entries. the main drawback being that you have to know ahead of time the maximum number of entries or have very fast memory allocation if you are being streamed the items from a remote source.

{edit} oh and regarding your post about durability: i think you must have done your research pre 1.08? I think the probabilities for durability loss changed with the expansion. re: smite, i put a breakpoint in, and it is indeed reducing the dur for your weapon (not your shield) when you smite.


Durability - Jarulf - 03-16-2003

Hmm, true, the division might not be the best, but many times, I would say it is probably still faster then all the work needed to build a table. Although I must admit my timing knowledge, especially in recent processors, is limited.

And yes, you must know in advance :) That is perhaps the biggest thing though. "My" method (I did not invent it, don't remember were I read it though), has the advantage that one do not need to actually "save" the info somewere. One can for example calculate the probabiloity on the fly so to speak. One can also stream unknown info (well, of known format) without having to save it and so on.

I have to test that divsion thing some day to see how much "time" and thus code one can have and still be faster than it. There is less shuffling of data for sure when one don't need to build a table for example.

By the way, my post was not primarilly for you (I had a faint idea I discussed it with you but was not sure), but just in general. I personally like the method, especially when one isn't in a time critical situation since it is much "simpler" than to have to build a table, and I don't like the "loop until it works" solution.

Thanks for the comments though.


Durability - Isolde - 03-16-2003

heh. actually building the table is really fast.

well, it was pretty easy for me to test. I'll call building a table method A and picking as you go method B.

ITER is how many times to run the test for average results
LIST is how long the pick list is (assume all items in list are selectable)
release build, rand function completely inline (multiply with carry), times given in msec (so smaller is better)

for (ITER = 500,000, LIST = 200)
A = 451
B = 2644

for (ITER = 200, LIST = 500,000)
A = 2244
B = 2483

for (ITER = 20, LIST = 5,000,000)
A = 4967
B = 5498

so interestingly enough, it looks a lot like B is catching up to A as list sizes increase somewhat anyway.

{edit} hmm, come to think of it, i'm not entirely sure why in the third run, it takes longer for method B than in the previous two runs. you'd think that in all three cases, B is doing exactly 100M things, but I suppose at some point just iterating the list imposes some sort of overhead.

so i would say that with more items, method B is definitely better as the memory requirements for A become prohibitive and their run times become closer. B is actually more elegant as well, so I like it for that :) but in terms of actual implementation, A is probably more applicable to what D2 is doing.

actually this sort of computation isn't computationally expensive anyway. show me a faster way to do the pathfinding & collision detection and you'll really have my attention ;)


Durability - Jarulf - 03-16-2003

Well, I have actually no knowledge in the path finding algorithm area (or collision detection) so can't help you out there :( I once through of taking some classes in AI (they even had a special subtheme that was game AI, never took that though nor anything else computer algorithm related like pathfinding and such. So I ended up in chemical engineering instead. Oh well.


Durability - Loschonorg - 03-17-2003

Quote:when you score a hit, there's a 4% chance of your weapon you attacked with losing durability (5% if it's a throwable item).

smite is bugged in that it reduces the durability of your weapon (not your shield).

when you're hit it picks a random armor piece to damage: helm = 3, torso = 2, right hand = 2, left hand = 2, belt = 4, boots = 4, gloves = 3
it won't pick a piece you don't have.

that piece will have a 10% chance of losing durability.
hmm but by gut feel, the gloves are the prioritised slot to deduct durability when werewolves use buriza fury.

Quote:Finally, I have no idea if it still applies that some attacj types such as LA will never end up checking for durability losses. Unless they have messaed arround and moved the check, it SHOULD still apply. That is, any attack that does not trigger Amp Damage or Thorns, will not trigger durability loss
thx for the headsup on leap attack! woot i think 20k dmg is possible now. aside, blade shield can trigger amp dmg (not sure about thorns) but it deducts durability from weapon held. not sure when there's no weapons. please enlighten on this one.

thanks!


Durability - myrdinn - 03-18-2003

Archon_Wing,Mar 14 2003, 03:49 AM Wrote:as another question, how are repair costs calculated?
The repair cost will be
item-value * (dur/max_dur) * (Repair_value_in_NPC.txt / 1024), IIRC.


Durability - Archon_Wing - 03-18-2003

myrdinn,Mar 18 2003, 05:33 AM Wrote:The repair cost will be
item-value * (dur/max_dur) * (Repair_value_in_NPC.txt / 1024), IIRC.
Well, I knew about the dur/max dur part ;) But I sorta wanna know the values behind Repiar Value :D


Durability - dectgap - 03-23-2003

Archon_Wing,Mar 18 2003, 10:40 PM Wrote:
myrdinn,Mar 18 2003, 05:33 AM Wrote:The repair cost will be
item-value * (dur/max_dur) * (Repair_value_in_NPC.txt / 1024), IIRC.
Well, I knew about the dur/max dur part ;) But I sorta wanna know the values behind Repiar Value :D
Have a look at this post then:
http://forums.rpgforums.net/showthread.php...threadid=158174


Durability - Archon_Wing - 03-23-2003

!!

You linked to a link? Thanks anyways. :)


Durability - Bolty - 03-23-2003

Conner Macleod,Mar 15 2003, 04:58 PM Wrote:Wow Isolde, that is amazing info.  :)  Which guide did you get that from?  I wanna reference that in the future.
Let's just say that Isolde has access to some private "guides" that we don't. :lol:

But as has been pointed out later in this thread, there is a wealth of information (hundreds of posts) by Jarulf that have never been archived - searching for them is half the fun sometimes!

-Bolty


Durability - dectgap - 03-23-2003

Archon_Wing,Mar 23 2003, 09:53 PM Wrote:!!

You linked to a link? Thanks anyways. :)
Call me lazy, but I didn't want to link to my servers new address again ;)


Durability - Sheep - 03-24-2003

Wait... If blocking doesn't reduce the durability of a shield, does the Assassin skill, Weapon Block, reduce the durability of her blades?