New dev log posted a couple days ago!
Just to update TIG Forums specifically, I've been going through a lot of my previous code and structuring and basically just optimizing and re-structuring things. I felt like now was a good time to do it, and I had some structure issues that I wanted to resolve. Namely, I'm using object pooling and I want to keep the amount of different prefab objects to a minimum, because each new object means I need to account for it in the pool.
So for things like crates, crafting tables, furnaces, signs, etc... These all initially had their own prefab object to define them. This can get costly because again, if a player moves into an area with a bunch of crates, it needs to generate new crates and add them to the pool. If the player then leaves the area and goes to an area with a bunch of other objects like a crafting table, furnace, sign, doors, etc... Then it needs to go and create instances for each one of those different objects, while still just sitting on a bunch of crate objects in the pool which are sitting in memory.
So I've been doing my best to start combining like-objects together. Now doors, crates, furnaces, anvils, crafting tables and signs all share one object. I grouped these together because these are all player-made structures which usually have only 1-2 different states and some form of interaction. Most of the objects allow the player to interact with them and then change their state to visualize that.
So now instead of a ton of crate objects just sitting in the pool off to the side, those objects get re-used more efficiently and get loaded in as other types of objects.
While it's true I could probably make a single "master" prefab with every object inside, there becomes a different issue of having all of that stuff in every single object for no real reason other than to not have to instantiate as many things.
The end result is I get a cleaner and simpler structure for things on my end, and the game has less to load into memory.
Unity is a tricky beast because of it's garbage collection and how some of the most important functions/commands are the ones that eat up the most performance.
When I first started making the game I would just instantiate things and destroy them as needed. This proved to be extremely BAD for optimization and garbage collection. Especially because my game uses chunk loading which is loading and unloading hundreds of objects quickly. Object pooling was a no brainer, but it presents it's own little issues, like having to properly reset any object you put back into the queue, and then properly set it all again when you use it. Anyway, that's all for my rant/information dump on structure and object pooling.