[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 120: preg_filter(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 120: preg_filter(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 120: preg_filter(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 120: preg_filter(): The /e modifier is no longer supported, use preg_replace_callback instead
QCF Design Community • View topic - Ok, so how does the shop algorithm actually work?


Ok, so how does the shop algorithm actually work?

All things Desktop Dungeons

Re: Ok, so how does the shop algorithm actually work?

Postby Tinker on Sat Jan 16, 2016 12:04 pm

So here's an illustrated explanation of how the shop spawn works, using today's Daily (DERP-16/01/2016, Gnome Tinker in Rock Garden):

I charted it up in a spreadsheet, I hope it's not impossible to read.

Image

So how things work...
1. The default lookup indexes for today are: -3, -8, -13, -15, -19, -22, -24, -26, -28, -30 (it's quite rare by the way, how few big numbers there are, due to the square-root thingy bigger numbers are most likely)
2. The default list uses Basic Items -> Quest Items -> Elite Items sequence

I. No shop items prepared
1. As the list length stays 38 items, the default lookup indexes do not change and stay -3, -8, -13, -15, -19, -22, -24, -26, -28, -30
2. As no items are removed from the list, they will correspond to the following items: Spoon (7), Hero's Helm (9), Venom Dagger (11), Vampiric Blade (13), Martyr Wraps (15), Gloves of Midas (18), Mage Plate (22), Viper Ward (24), Witchalok Pendant (29), Alchemist's Scroll (34).

II. One shop item prepared
1. The default indexes get re-calculated based on the new list length of 37 items (as we took out one item, the one we prepared). This is impossible to predict, but generally, lookup indexes will either stay what they were, or get shifted one number closer to zero. In this particular case, the new indexes will be: -3, -8, -13, -15, -19, -21, -23, -25, -28, -29. Higher lookup indexes are more likely to "round down", whereas lower indexes are almost guaranteed to stay what they were (key word, "almost"... :) ).
2. Now, depending on which item you prepared, the list gets "cut" at a different point. For example, if you prepared the Battlemage Ring, you see that lookup indexes -28 and -29 will pick up an earlier item, as they skip the "no longer existing" Battlemage Ring. Conversely, if you prepare the Crystal Ball, which is much lower in the list, only the first two lookup indexes (-3 and -8) will pick up the item they are supposed to, all other lookup indexes will point to an item that is one slot higher, as they skip the (no longer listed) Crystal Ball.

III. Two shop items prepared
1. The default indexes get re-calculated based on list length 36, again resulting in some indexes getting rounded closer to zero. In this particular case, they become: -3, -8, -12, -15, -18, -21, -22, -25, -27, -28.
2. Now, you will have two items taken out of the list, in this case it will be the Crystal Ball and one of (Battlemage Ring / Bloody Sigil / Whurrgarbl). So you see how the list is now "cut" in two places: where the Crystal Ball would normally be, and in one other place (corresponding to the other item you prepped). You will see that this will result in the lookup indexes picking up what they are supposed to pick up only at the very end of the list (i.e. below where the Crystal Ball would have been); above that, they will skip 1 slot (or, above the other prepared item's original place, they will actually skip 2 slots).

There were no item group preparations today (Quest Items / Elite Items), but all they would do really is re-arrange the listing of the item groups, and so the lookup indexes would pick up the same slots, modified only by what they skip... ;)
"Thinker", just without the "ache".
User avatar
Tinker
 
Posts: 2000
Joined: Fri Oct 31, 2014 8:51 am

Re: Ok, so how does the shop algorithm actually work?

Postby ~'(^ + ^)'~ on Sat Feb 13, 2016 7:25 am

User avatar
~'(^ + ^)'~
 
Posts: 774
Joined: Wed Mar 05, 2014 2:51 pm

Re: Ok, so how does the shop algorithm actually work?

Postby Tinker on Sat Feb 13, 2016 8:17 pm

"Thinker", just without the "ache".
User avatar
Tinker
 
Posts: 2000
Joined: Fri Oct 31, 2014 8:51 am

Re: Ok, so how does the shop algorithm actually work?

Postby ~'(^ + ^)'~ on Sun Feb 14, 2016 5:22 am

User avatar
~'(^ + ^)'~
 
Posts: 774
Joined: Wed Mar 05, 2014 2:51 pm

Re: Ok, so how does the shop algorithm actually work?

Postby Tinker on Sun Feb 14, 2016 8:33 am

"Thinker", just without the "ache".
User avatar
Tinker
 
Posts: 2000
Joined: Fri Oct 31, 2014 8:51 am

PreviousNext

Return to Desktop Dungeons

Who is online

Users browsing this forum: No registered users and 118 guests