SS3D
SS3D copied to clipboard
Show Contents of Containers
Summary
Containers always show as empty right now, regardless of contents, so we should probably fix that for immersion and QoL reasons.
Due to performance reasons, we should probably at least hide item models that are inside things like closed lockers, to improve performance on maps with lots of items inside containers.
We could take this one step further and completely despawn the items, but that should only be done for containers with small amounts of items, or only despawn certain items, I feel, as reinitialising items can take a few ms depending on what their contents are, and their attached scripts and models,
We could also hide items over a certain amount in containers with easily viewable contents, like lockers and crates, but hide everything inside things such as medical bags, dustbin carts and paper bins, instead using an empty/slightly filled/full model instead.
Goal
Make the game still run well, while making sure the player isn't shown an empty container at all times, for immersion and QoL reasons.
Context
None so far. I am not a good drawer or example giver, but I feel my explanation is apt.
Another possibility would be to display items with their icons instead of the actual object, as @dcxgame (Flikr on discord) suggested. It could be interesting to consider if displaying the actual items causes too much trouble.
Since stacks are a thing, stacked objects should have a particular representation inside containers. That would limit the number of models represented inside a container. It could show as a box with a picture of the item inside it for example.
I believe checking "3d bin packing" problems and algorithm to solve it could be very useful for our case. What we want is to display items in container with as little overlap as possible, and at the same time, we want to visually pack as much items as we can in a container.
We need to approximate every object shape with a rectangular one, and containers as a set of rectangular bins, and then we can apply some 3d bin packing algorithms. An example of a java implementation here : https://github.com/skjolber/3d-bin-container-packing