StrangeLoopGames / EcoIssues

131 stars 21 forks source link

[0.9.0.3 br-78] Stockpiles are inconsistent with small item volume #18619

Open ThePiachu opened 4 years ago

ThePiachu commented 4 years ago

After playing around with the Large Lumber Stockpiles, I'm really digging them for how convenient they are. However, I noticed that while they do double the amount of big items you can have in each tile (so 40 Iron Bars instead of 20 Iron Bars for the traditional Stockpile) they do not do the same for small items (nails, paper, etc.). After looking into it, it seems the Stockpile storage has never been consistent. Here are 100 sheets of paper in each of the Stockpiles:

image

In Tiny Stockpile, they take up 3 crates. In normal Stockpile, they take up 5 crates. In the Large Lumber Stockpile, they take up 10 crates. It would be really nice if the ratios were consistent across all Stockpiles.

Since you can store about 16 stacks of 100 in a Storage Chest that takes up 2 cubic metres, technically the ratio would be 800 items per crate. Of course, that can be a bit excessive, so lets say we do 100 items in 1 crate. This would give us stack sizes of:

This should make this kind of bulk storage really shine until #17430 and other type of storage is completed. It wouldn't replace Storage Chests which would still be 8 times more compact still, but would make the lives of farmers and shop owners much easier.

ThePiachu commented 4 years ago

Somewhat related - Carts are also a bit off if you want to keep the m3 consistent.

First of all, all truck types can carry twice as much volume of dirt-like materials than rock-like materials per inventory slot. So you can have 10 sand but only 20 sandstone. You usually run into the weight limit of carrying rocks before you run out of inventory anyway, so it wouldn't be too bad to bump the stack size to 40 in case you are carrying one big rock load and a lot of misc stuff or something.

Secondly, the small item stack is similarly 100. You pretty much always run out of slots before you hit the weight limit with those. To keep things consistent with the previously listed suggested stack sizes per stockpile, the vehicle stack size for those items would be either 500 items per slot (equivalent to 20 rock on a Stockpile), or 1000 items per slot (equivalent to 10 sand on a Large Lumber Stockpile).

500 items per slot would align with Tractor's seed storage density.

Then you also have even weirder ratios if you're dealing with Skids and such, but probably just applying whatever small item storage density you'd have from a normal vehicle would be good enough. We don't need a Skid transporting 2000 nails per slot or something weird.

ThePiachu commented 4 years ago

So the stockpile inconsistency stems from public class StockpileStackRestriction : InventoryRestriction. In the MaxAccepted function for non-Block items returns item.MaxStackSize but should (in my opinion) return item.MaxStackSize * this.maxStackHeight. This would auto-balance these blocks.

For vehicles, it's because CreateBlockStackSizeMaps() uses default block stack sizes for everything as a default. Diggables have a default stack of 10, Minables of 20, thus letting you store twice as much Sand as Sandstone, ignoring the difference in m3. Similarly, normal items are completely ignored as well, so their default stack size is just 100. You would have to add some extra rules to multiply the stack size for all the various items and adjust them accordingly.

ThePiachu commented 4 years ago

Trying to work out how to submit a PR for this issue. In the meantime, this is the fix for stockpiles:

image

First change is to display 1 "box" per 100 items, second one is to actually stack 100*height items.

Looked into what vehicle fix would require and that would be expanding the vehicle mapping to all items and all vehicles, plus there isn't an easy way to fetch all non-block items I don't think. One day maybe ;).

johnkslg commented 3 years ago

Reopening since the fix got reverted.

ThePiachu commented 3 years ago

@johnkslg - any guidelines on how the fix should look / behave? I remember someone mentioning awhile back that the last fix was about 2x too strong so I have some fix that makes 1 crate equal 50 items. Other ratios are similarly possible but might not make the stacks as neat.

SlayksWood commented 3 years ago

@ThePiachu It was reverted because this caused a tool exploit. Although 100 items in 1 crate looks very overpowered for me if it's not a special storage.