Talk:Optimal Use of Stack Expanders


 * Someone had a decent suggestion on the forums about including some simpler, more non-math-geek friendly ways to display this information, such as a table. The math of it can be pushed down into a second section for those that are interested, but most people just want the answers without doing the work. I'm not sure of the best way to implement this, and there is the obvious issue that a room can have a large amount of tiles, and we don't want the table to get too gigantic. I may come back later and figure it out once I feel up to it, but for now, here's a basic idea of what I'm thinking:

Obviously, this design has its issues. Maybe just give information for square rooms? (Who, in their right mind, builds single-tile rooms anyways?)
 * ~n47h4n


 * I just had another thought. Do all the Stack Expanders (other than the Jewelry Case and Treasure Chest) give a 25% bonus? If so, there's no reason to have all those separate columns.
 * ~n47h4n


 * Storage crates and storage shelves give different bonuses. Also Rickety Cart and Sturdy Cart.
 * ~PeteD


 * The Storage Room furniture doesn't really apply to this, because nothing drops there, but I was unaware of the Sturdy Cart. I guess there's need for at least two columns, then.
 * ~n47h4n


 * Not specifically, but it is an indication that furniture gets upgrades as the tech tree advances. We might get even more furniture eventually. I'm going to autogenerate the table, so don't bother editing it.
 * ~PeteD


 * Awesome. So, I was thinking... Perhaps it would be better to have the columns be the number of tiles, and the rows be the different rooms and furniture. The reason being that the columns don't need to be very wide if they only contain a number, so a lot of space can be saved that way. I'll leave it up to you though, since you're the one doing it.
 * ~n47h4n


 * You're overthinking it. There are only two variables, the number of cells and the bonus. So you account for the level sizes 4, 9, 16 and 25, and maybe in increments of 5 after that. There are bonuses for 25, 50, 75 and 100%. What room they are applied to is irrelevant. That makes 5 columns.
 * ~PeteD


 * Is the base stack size not a factor? Hmm... actually, now that I look at the formula, I see that it isn't. Ok. It's all good.
 * ~n47h4n


 * It's not :) I've moved the math to here, and put a pretty table on the page.
 * ~PeteD

To calculate the total bonus from furniture for a room: $$T_{bonus}=1+bn$$

To calculate the total capacity for a room: $$T_{max}=z(s-n)T_{bonus}$$

Where z is the stack base size, b is the bonus (0.25 for a Rickety Cart), n is the number of pieces of furniture, and s is the number of squares that can be used to either form a stack or place furniture.

In order to find an equilibrium, we can find out at what point a room with n-1 pieces of furniture no longer has a lower maximum capacity than a room with n pieces of furniture:

$$z(s-(n-1))(1+b(n-1)) < z(s-n)(1+bn)$$ $$(s-n+1)(1+bn-b) < s+sbn-n-bn^2$$ $$s+sbn-sb-n-bn^2+bn+1+bn-b < s+sbn-n-bn^2$$ $$-sb+2bn+1-b < 0$$ $$-s+2n+1/b-1 < 0$$ $$2n < s-1/b+1$$ (I've left the algebra in so it can be checked should an error be found, when everyone is satisfied it can be removed along with this line) $$n < \frac{s+1}{2} - \frac{1}{2b}$$

For example, the Vault (z=200,s=8,b=1), this means the optimal number of Treasure Chests is 3, since $$\frac{8}{2}+\frac{1}{2}-\frac{1}{2} = 4$$, and the highest integer n in $$n < 4$$ is 3.

A level 1 Farm of 2x2 with Slop Buckets is also interesting (z=200,s=4,b=0.25): $$\frac{5}{2} - \frac{1}{0.5} = \frac{5}{2} - 2 = \frac{1}{2}$$. So you should not put any slop buckets in a 2x2 farm! (In fact, you REQUIRE a level 3 farm to use a slop bucket, which requires a 3x3 room, so this is a moot point).

By the way, I realized later that $$z(s-n)(1+bn)$$ solved for n is quadratic, which means the exact optimal value can be derived from the vertex of the parabola: $$n = \frac{s-\frac{1}{b}}{2}$$. Rounded down, this means the same thing. Also, if you find yourself manually calculating these values for a new expander value, poke me on Facebook instead; I'll rerun the script and save you some time. PeteD 15:43, February 8, 2011 (EST)

Level 5 mine in starter dungeon - observations
Once you upgrade to a level 5 mine, you will find out that you can only stack resources 3 spaces away from each mine able spot on the map. So, in your starter dungeon, you can not utilize 2 of the rows of 5 for stacking resources. This provides 10 places to put stack bonus items which can not be utilized for mining (12 if you place it in the middle). In my expansion dungeon, I did not have this issue, as I was able to place it right in the middle between two resources.

I was trying to figure out why my iron was stacking to 292 and how to increase it with stack expanders, and this page is the top reference and one of the few things that mention optimizing stack size. I think it's worth mentioning here that the Vault task master provides a stack bonus of 10% per lvl and this applies to all stacks (vault, mines, farm) multiplicative with the sum of the stack expanders. So in my case 150 base rate + 2 rickety carts (50% bonus) + lvl 3 vault task master (30% bonus) makes for 292 = 150 * 1.5 * 1.3.
 * ~dfrankson