This is an idea I have had in previous text based designs, that I think I shall finally implement in my zombies project:
It is a system for determining how much stuff can fit inside a storage container;
It works by using hard coded dimensions for the sizes of objects and containers, (rather than a “size” attribute that directly determines how much storage it occupies.)
Then two processes occur to check to see if it could probably fit in:
First it checks to see if the object could fit into the container if the container were completely empty:
- Arrange the dimensions of the container in descending order, have a biggest, middle and smallest.
- Do the same for the object being fitted.
- Compare the respective sizes,
if any of the three object dimensions are greater than their respective container dimension, the object doesn’t fit.
Then it performs a check which is equivalent to the usual “size” attribute check, using the volume of the object and the volume of all other objects and the liquid capacity of the container to check the plausibility of the object fitting.
If both checks succeed then the object fits fine. This system isn’t quite perfect, but it is very good.
Of course not all objects are a simple cubic three dimensions, so three dimensions must be chosen that encompass the object for the sake of the algorithm, although most objects will have square or circular bases (buckets, sticks, kitchenware) and the latter can simply be translated to the former.
The empty space that is ‘wasted’ in this process by rounding circles up into square objects compensates very well for the fact that some situations are completely impossible but pass both tests anyway. In other words, since there is no actual tetris involved in the storage process, there is a space penalty.
Now in terms of benefits, this system provides variety, in fact, this system can create gameplay by providing situations in which the size of containers needs to make you think about how you are going to sort your possessions to deal with them.
Now all I need to do is think of something to make that a good thing, and not just completely annoying.