"dynamic?" stockpile mesh

Like the tile says, how would I go about creating a banished like stockpile where a NPC can carry wood into the stockpile and then have a small stack of wood in it? I know that I can’t just create a mesh for every single possible combination of resources that would be in the stockpile. Basically my question is how would i go about creating a stockpile that has for example 20% wood, 20% stone, 30% iron and 30% clay and have it show up in that order? The resources should be able to be alllocated in whatever order but still be organized in a way that each resource has it’s own section.

So let’s say 10% of the wood was allocated before anything else and then everything else was carried there until there was only capacity for another 10% of wood. I still want the new wood to be stacked with the old wood. Like this:

249920-stockpileexample.png

Looks like youre off by one, missing the last index of your array or something

I’m more looking for an answer that can push me in the right direction to actually creating this. I currently have no idea how to do it and would be grateful if someone could show me some resource of someone doing something like this. The hard part is the visual not the storing values or w/e, so specifically what i’m looking for is how to create such a mesh that can change based on % or values of ingame resources stored in it.

I’ve thought about one way of doing this. I have a selection tool that i could use to snap every 100 units, how would I go about spawning one 100x100 “tile” every snap that has a socket and then merge all tiles into 1 mesh and keep all the sockets? I need to do this at runtime and the meshes has to keep all the sockets.

So I would create one “plane” for each size available and then spawn the correct one based on the size of the selection?

i wouldnt even bother merging things. i would create a actor that is the stockpile and it would basically consist of several containers or sockets. then each time you add a resource you would add a item to an array and create a static mesh and place it in the socket location. using this method you would just need a mesh for each of the individual resources or depending on the art style you could just use different materials.

i wasnt really reading / understanding your question right at first. yes you could do some scale setting but what i was really meaning was that if you knew the increment size beforehand then you could just have that many meshes. so for example if you wanted your stockpile to be 100 resources and you knew it would com in increments of 10 then you could just have 10 meshes. then you could just set the mesh depending on the value. i made a little example of this that i will post below. though im not sure this is the best solution to your issue, there may be a better solution since it seems in your case that its more of a widget kind of thing than something to make with meshes. the example below however does show adding resources and limiting how many can be added, it shows how you can combine allocations for storage as you put it, and can be expanded upon. i made this using 10 cube meshes lined up in a row and a map variable to hold the resources.

252488-selectionsystem.png

My selection tool is 100% in worldspace and though i didn’t in this example i can set my cursor to snap every 100 units. So what would be the the best way to set the mesh based on the seleciton? I don’t think it would be too much off an issue to create 1 mesh for each size and rotate when needed if i limited the stockpile to a max size of 1515 snaps and min of 33. I’m not worried about allocation or things like that. It’s the act of spawning the actor that I am unsure how I want to do. But if you are saying merging is really annoying to debug etc I could easily just create the combinations and rotate them if i need it o be bigger in the X or Y axis for 10*3.

So i could get my selection and divide X and Y values by 100 to determine which stockpile mesh to spawn as well as the transform. And if you are telling me that making one mesh for each combination is a valid solution you have probably given me all the help i need! :slight_smile: