Navigation:Home arrow Information arrow Jarulf's April Fools Day Jokes Saturday, 17 May 2008
Logo pic
Synergies? That's a new paradigm.

 

 
News
Submit News
Community
Strategy
News
Articles
Calculators
Community
Discoveries
Information
One on One
Strategy
Submit News
News
Community
D1 FAQ
Information
Jarulf's Guide
Mods
One on One
Scene
Strategy
Submit News
Home
About Us
Chat
Contact Us
Donate
FAQ
Forum
History
Legal Info
Link to Us
Search
Site News
 
 


 
 
Jarulf's April Fools Day Jokes PDF Print E-mail
Written by Jarulf   

The Black Knight

As Varaya points out in a post below, the Black Knight on dlvl 16 is indeed special in several ways. Some earlier theories suggested that it was there because Sir Gorash was a Black Knight and thus there needed to be a Black Knight on dlvl 16. We now know this is not true as Sir Gorash is a Blood Knight.

When looking at how the game picks out what monsters there should be on a specific dungeon levels I noticed an interesting thing. dlvl 16 is a special case, and the game adds Blood Knights, Advocates and Diablo to the list of monsters to appear on that level (and makes sure graphics for them are loaded) but NOT the Black Knight. I never paid much attention to this but lately I have been looking at how exactly the game then puts the individual monsters on a dungeon level. As you may notice, on dlvl 16, there are a few of the monsters that will always appear at the exact same position. They are specially placed by the game before the random monsters are placed. For those of you that are involved in technical aspects and perhaps if you own mods, you know that normally for all dungeons, the active monster list first has the four golem slots, then each of the bosses and its followers, then comes the normal, randomly placed monsters. Not so on dlvl 16, here Sir Gorash and even Diablo have slots way later in the list. First in the lists are the monsters that are placed on special positions in the dungeon, then comes Sir Gorash and then randomly placed monsters. I will now go into some technical explanations; feel free to skip if you don't grab it.

Technical stuff start here---------------------

What about the Black Knight then? It is placed at a default position, no problem here BUT the game must at this time load the graphics and set up this "new" monster type on the dungeon level (technical note: each monster type on a level has a special entry in a table that holds information about such things as the graphics and sound). As you can see, the game can thus add monster types from the code that actually place the monsters in the level.

Now comes the interesting part, after the placement of a monster and the setup of all the stats for it and so on, the game jumps to the part that updates the stats for nightmare and hell difficulty. This part is divided in several steps. The game first makes a random check but the jump that follows which skips the first part is NOT based on the random call as the result of it is discarded. HOWEVER, if the game has in the previous step, that placed the monster, also loaded the graphics (which as far as I know only happens for the Black Knight) it will not discard the random value (technically the random value is "and:ed" with 0 unless the graphics was loaded in which case the registry holding the value to "and" with will be FFFFFF).

The code in this area has several similarities with other parts; for example, the random number generator. That is, it seems like there have been special test code that is removed from the final version, but one can still see a few leftovers that set up for the test. For example, each call for a random number also pushes a special number; this was no doubt for Blizzard to be able to force a special "random" number in specific situations but not others while testing. It would thus be very interesting to see how this works in a pre release of the game as that may still have more of the code still there.

Anyway, what the normally skipped code (but not for the Black Knight on dlvl 16) does is basically set up the mlvl of both fighting and item drops (note that this code is ONLY used for nightmare and hell difficulty). It goes like this:

1. take current mlvl (this is always the mlvl of normal difficulty as it has not been updated yet)
2. add +15 if nightmare and +30 if hell difficulty
3. add this number to the mlvl for fighting (but not item drops)
4. if some condition is met, goto 9 (I have yet to know what this really tests)
5. x = 60 - mlvl
6. if nightmare, x = x div 2
7. y = rnd[x]+1
8. y = y+mlvl (step 5 - 8 is standard way of archiving a random value between a min and max value and can be seen in for example the calculations for damage of an attack)
8. add y to the mlvl value for item drops
9. Proceed to normal updates of stats on nightmare and hell difficulty

Technical stuff end here--------------------

So what does all this mean? From what I can see, it means that the Black Knight in nightmare difficulty should be able to drop items all the way up to qlvl 24 + (60-24)/2 = 42 and on hell difficulty all the way up to qlvl 60! Do note that it is a random range and thus for qlvl 60, it will only happen 1 in 36 times. Add to it that the game then of course does the normal calculations for item drops (10% chance of dropping an item at all that is not gold, and so on). So the chance for dropping a qlvl 60 item is really near nil.

1/36 ilvl is 60
1/10 item (and not gold or nothing)
1/2 possible to be magical (rough estimate, books, potions, scrolls and so on can't be magical)
64/100 the chance of an item being magical from a mlvl 60 monster
-----
1/1125 so far

possible to be qlvl 60:
only prefix: 5/24*4/18=1/21 (note I assumed all prefixes go on all items; this is of course not true but makes it easy to estimate a number. In practice, it is of course less but probably not by a factor more than 2 or 3)
only suffix: 15/24*3/13=1/7
both prefix and suffix: 4/24*(1-14/18*10/13)=1/15
Total for prefix and suffix: 1/21+1/7+1/15=1/4

Total chance: 1/1125*1/4 = 1/4500

So, I would say that the Black Knight has the possibility to drop an item with a prefix or suffix of qlvl=60 every 5000 to 10000 games. One needs far less games than that to reach level 50 as a comparison.

What is interesting though, is the fact that this seemed to initially have been how it was intended to be. The chance for each individual monster would be less as there is a rnd[100] that jumps right past the routine (see above), but then there are about 200 monsters on each level. Perhaps they did not disable this until after v1.00, that COULD explain the few reports of good finds in version 1.00 (I would still think only Black Knights could have dropped it, even in 1.00).

Any comments?

Bolty's Note: Jarulf then replied to his own post with this:

I think I have figured out what the previous unknown test in the algorithm does. It seems it tests the activation table for the monster slots. As those of you that do mods might know, right after the static monster table, comes an activation table. An entry of 0 means the slot is not active and a value of 1 or 2 means it is active. Up until know, I have seen no difference for the two values, when picking monsters the game does an and 3 and thus tests for both 1 and 2 (and 3). But here the game tests for 2 and if it is 1 it is skipped. This means that if the game did indeed do this in all previous versions, it would only happen for those monsters that have a 2 for activation. Since most monster in church and cats have 1 and others have 2, most likely the effect of better drops was only to happen in caves and hell.

One other thing, I think I have figured out why some bosses gets a +30/60 bonus to their mlvl and not the usual +15/+30. Those monsters that get this extra bonus are all set to appear on dlvl 0, that is they are ONLY placed by special code (just as the Black Knight for example). When this happens for the bosses (that have dlvl appearance of 0) the game will also trace into this special code segment and as can be seen from step 2 and 3 gets the +15/+30 BIT it then goes on to the normal difficulty updates and there gets a further +15/+30 bonus to the mlvl. If this is intentional or a bug I can't say though. Note that bosses automatically get an activation number of 0 for the activation test as the game has not filled in the activation number into the active monster table which is the one being tested.

For those of you interested in activating the random mlvl bonus for all monsters with an activation number of 2, try changing byte 432936 (hex) from 1e to 00 and you should see the effect immediately.

Well, that's it for today, it is waaaay over midnight here.

Bolty's Note: and finally, after the buzz died down:

The truth is out there!

What!? Me playing a joke? How can you even suspect such a thing? :)

Seriously though, most of it is actually totally true and correct, but I have to admit, there is no special code that make the Black Knight (or any other monster) drop better items. As for weird calculations, I spent a long time on them (well, a few minutes at least) and they were as far as I could see more or less accurate but I never really checked. There are a few other inconsistencies and errors, but why spend time fixing something that does not exist!

As for setting up Varaya, well, I had actually thought of doing that at first, especially since the post was about technical stuff related to mods. Fortunately, he himself brought up the subject of the Black Knight, first in an email to me, then on the Forum. I just smiled and thought I was lucky, I had nothing to do with it, I promise. Da O'Toth was in on it though, I tested the idea on him first. I had a much more complicated plan at first, but settled for just making a simple post about it.

Well, I am off to my Easter vacation now, happy first April every one, and don't forget, there might actually be some unknown things about the Black Knight, so why not pay him a visit every now and then, some of you already seem to have started doing that...