Wizardry 8

Wizardry 8

kaymarciy May 25, 2020 @ 8:08am
Mechanic of the vendor merchandise update.
I saw the discussion about books being sold by Crock and it got me curious to find out how this works. I googled around and didn't find any info (unlike the loot drop mechanic which even has a guide here on steam). So.

As you may or may not know, every merchant has a list of items s/he can sell and some of those entries are marked as "always in stock". Every merchant also has 2 timers; those timers store the date when the merchandise list was refreshed last time - 1st timer is for "always on" items, the 2nd timer is for other items. "Always on" items are refreshed if the more than 12 hours has passed since the 1st timer while regular items are refreshed if more than 24 hours has passed since the 2nd timer. The check occurs when you start a discussion with the merchant however; that means if you didn't visit the merchant in 5 years, he's never refreshed his stock since then.

The most interesting and important part here is the chance for non-"always on" items to appear in the stock. It depends on 2 parameters: Average Party Level (let's call it APL) and the item property which in the CosmicForge is called "Curio level" (let's call it CL). First off, the game calculates

L = floor (APL * 10/15, 16)

I don't know why it doesn't simply multply by 2/3, but whatever. Then it compares L with CL. I kind of wanna know what sort of the source code was implemented to compile this pile of assembly garbage, but it all comes down to:

If CL > L+4 then the chance is 0%
If L+4 > CL >= L then the chance is 75%
If CL <= L < CL+4 then the chance is 50%
If CL +4 <= L then the chance is 25%

If you look closely, the chance first jumps from 0% to 75% and then starts going dowm, so you need to catch that sweet spot.
Crock's books have Curio Level 11 for the most part, so to have 75% chance to spawn them you'd need the average part lvl from 11 to 16
Last edited by kaymarciy; May 25, 2020 @ 3:17pm
< >
Showing 1-9 of 9 comments
Horpner Sneed May 25, 2020 @ 10:12am 
Really cool! Thanks for this most interesting explanation. I always thought some items simply stopped appearing once you out-level them. But unless I'm reading this wrong nothing should ever completely stop appearing. Maybe they get pushed out by other factors.
mpnorman10 May 25, 2020 @ 10:27am 
Wonderful you are looking into this.

On the second equation:

L > CL >= L + 4

are the inequality signs correct? I believe as stated it will always resolve to false.
Last edited by mpnorman10; May 25, 2020 @ 2:48pm
CeterumCenseo May 25, 2020 @ 2:37pm 
I found another mechanic both with Crock and Ferro. I found that they both offered spells only I already had. It worked like this:

Enter Crock's hut, with 2 level-ups to go. I do not remember exactly the level it was.
Nothing was offered, I tried 20 times.
Then I took 1 level-up of the 2 available, and chose one L4 spell. Crock offered exactly this spell, and nothing else. I restarted the sequence a couple of times by reloading and talking to him again, same result.
Then I reloaded before the level-up, took another spell. Again Crock offered exactly the spell I had picked, nothing else. Tried this 5 times again, same result.
Then took the second level up, blam, Crock offered not all spells, but 5 of them or so.

I think these observations are in line with the described curio concept. The only thing not explained is why I got the spell I already had a couple of times.

I speculate there is some kind of bug in the item randomization. Sometimes I think the random roll is not clean when it comes to item selection. Otherwise it is not explainable why eg in Arnika, you get 3 Monstrances from the bank chests or none, 3 Stun Maces from the lockers in HLL Police HQ, but never one, same with mesh leggings and other items.

I also would add that there seems to be a maximum curio level. When Crock is visited too early at too low level, he offers L1 spellbooks, like Acid Splash (not 100% sure which one). Later they don't show up anymore.

Same with Ferro. Visiting him at L16 he only offers Summon Elemental (which I already had), Toxic Cloud and Body of Stone (both from the Queen's Chest), and nothing else of L5, but Elemental Shield, a L4 spell. At L18, I got everything L5 from him except Instant Death, which I do not know if it was just bad luck or you need to get it from somewhere else (eg Wilderness clearing or some random drops), but no Elemental Shield anymore.
mpnorman10 May 25, 2020 @ 2:45pm 
For the bank chests I have seen that as well (several or no claymores, several or no tarnished mail, etc.). It is almost as if the chests there are treated as a group with two randomizations, the first which creates a short list for all of the chests and the second determines which items off of the short list are actually in each chest.
Last edited by mpnorman10; May 25, 2020 @ 2:46pm
kaymarciy May 25, 2020 @ 3:17pm 
Originally posted by mpnorman10:
On the second equation:

L > CL >= L + 4

are the inequality signs correct? I believe as stated it will always resolve to false.
Oops, you are totally right with this one.

Originally posted by CeterumCenseo:
I found another mechanic both with Crock and Ferro. I found that they both offered spells only I already had. It worked like this:

Enter Crock's hut, with 2 level-ups to go. I do not remember exactly the level it was.
Nothing was offered, I tried 20 times.
Then I took 1 level-up of the 2 available, and chose one L4 spell. Crock offered exactly this spell, and nothing else. I restarted the sequence a couple of times by reloading and talking to him again, same result.
This is very strange. I was doing my research on Braffit (I simply have a save file right next to him...) and saw nothing which would indicate this (I got a Book of Blessing and Book of Removal).I'll run to Crock tomorrow to double-check.


Originally posted by mpnorman10:
Originally posted by CeterumCenseo:
Otherwise it is not explainable why eg in Arnika, you get 3 Monstrances from the bank chests or none, 3 Stun Maces from the lockers in HLL Police HQ, but never one, same with mesh leggings and other items.
For the bank chests I have seen that as well (several or no claymores, several or no tarnished mail, etc.). It is almost as if the chests there are treated as a group with two randomizations, the first which creates a short list for all of the chests and the second determines which items off of the short list are actually in each chest.
Huh, this actually sounds plausible.
Last edited by kaymarciy; May 25, 2020 @ 3:46pm
kaymarciy May 26, 2020 @ 7:31am 
So, I went to Crock and he offered me a lot of Books for spells no one on my party knew before. There wasn't a single attempt from the code to access my characters aside from taking the average lvl. I don't know wat was going on in your case, CC.

Btw. A curious trivia about the loot drop. Every entry on the loot table has a weighted chance to drop. But the game doesn't decide everything with a single roll like it does for, say, chance to hit a certain body part. For body parts, if (theoretically) every part had the chance weight of 10 and you rolled 25, then the third part would be chosen (first part is 0-9, second is 10-19, third is 20-29). But in case of the loot drop the game makes a series of two rolls. First roll picks a random entry on the short list of items that can drop. Second roll checks whether the item dropped or not. So, if (theoretically) every item on the list have the weighted chance of 10 and you roll 25, nothing happens and the game proceeds to the next randomly chosen entry. Consdering that usually the chance is 1 or 2 out of ~120, it may take a small FOREVER for the game to actually bring together the drop from a monster.
mpnorman10 May 26, 2020 @ 9:40am 
Originally posted by kaymarciy:
Consdering that usually the chance is 1 or 2 out of ~120, it may take a small FOREVER for the game to actually bring together the drop from a monster.

Throughout this process of investigations into the code I have generally been more and more impressed by the code and formula designers who made this game. It is surprising that you have run across something so inefficient. It is not immediately clear why it is necessary. Combats, without mods, are slow, but (not using any mods) I always pinned the slowness on the game intentionally slowing down each action and movement of foes and especially allies so the player can see each one taking place. I never noticed delays surrounding the dropping of an item when a foe dies, but forever in code can also be faster than the blink of an eye on a macro scale.
Last edited by mpnorman10; May 26, 2020 @ 9:41am
kaymarciy May 26, 2020 @ 9:50am 
Originally posted by mpnorman10:
I never noticed delays surrounding the dropping of an item when a foe dies, but forever in code can also be faster than the blink of an eye on a macro scale.
Really? You might never pay attention to it actually. There's a significant delay, but not because of this procedure. The killed monster isn't removed RAM immediately upon the death animation, but keeps existing with the "dead" flag for couple more seconds. I think this is made for cases when you kill a big number of foes with an AoE spell, so that the game had it easier to re-size the monster table and free the heap memory.
Last edited by kaymarciy; May 26, 2020 @ 9:50am
mpnorman10 May 26, 2020 @ 2:09pm 
You are right of course. Two seconds is a lot of time at the code level but not a problem for the player. My words were never intended to doubt your findings. I just, as you surmised, just never noticed the delay.

Tough battles with "allies" can take over an hour of real time to play out. That, I notice.
< >
Showing 1-9 of 9 comments
Per page: 1530 50

Date Posted: May 25, 2020 @ 8:08am
Posts: 9