Apparently both “spatial” and “spacial” are valid ways of spelling the word that describes things that exist or occur in space. I’ve chosen to use the “T” even though my fingers often choose the “C” for some reason. I think it’s because part of me thinks I’m spelling “special” or something. In the future if anyone is looking over the JavaDocs for the project and sees it spelled in different ways, I apologize for that in advance.
When I first started the project I spent a bit of time trying to determine the different ways of placing a block in its spot of space. At first glance there aren’t any ways of laying blocks in space. They are simply there, or they aren’t (which means air is there instead, which is still a block). Upon thinking about it some more, there are bunches of things that need more information. Thus, back when I created the Block data structure, I left 8 bits for holding spatial information. The problem at the time was that I wasn’t sure how that data would be used, and that’s what I spent my time over the last few days trying to figure out.
The first thing I thought of was torches. They get mounted inside the space of a block but sometimes you feel like you need more than one in single block to make things look right. Even though torches actually appear to be mounted to another block next to where they are, that’s not really what is happening. The problem is that you spend a lot of time trying to make your torches look like they were placed the way they are on purpose and then you get to a narrow place where there is one empty block that needs a couple of torches to finish the pattern properly.
The torch problem inspired the concept of placing multiple identical wall mounted items in a single block. To orchestrate that, the first type of spatial data captures which of the 6 “walls” of a block have something mounted to them. With that information handy, there is now no restriction on there being more than one torch in a block and you can complete your patterns as accurately as you want. You must keep in mind that this doesn’t allow a block to consist of multiple different types of material. For example, if a block is a torch block, it can have multiple torches, but it can’t have both a torch and a ladder.
The next thing that came to mind was trees, or more specifically, wood blocks. If you picture a tree or branch after it has been cut off, there are rings and the edge of bark visible on the side that was cut, but from the other sides all you see is bark. To a world made up of blocks, there are only three ways a piece of wood that looks like a tree can be facing. That means they are aligned with a single axis of the world. For example, logs that are lined up with the Y axis and then stacked on top of each other would resemble a tree. If you line them up with either the X or the Z axis, you get something that looks like a log laying on the ground or a branch going horizontally.
This type of spatial data is called axis alignment and allows things like a block of wood to be placed facing whichever direction you want. Related to this, something like a jack-o-lantern carved up for Halloween works the same way, but it also needs information to specify which way along the axis it’s actually facing since only one side actually has the face on it. This information is also included in the axis alignment.
Next I started thinking about ways to make things decorative, and the easiest way to improve how nice things can look is to provide more options for how a block can look. The two ideas I had were what I called slices and microblocks. Both concepts allows a block to appear to be less than whole and give you a lot of flexibility for earning those presentation points.
Slices represent a block cut into 8 slices like a stack of pancakes. These can be aligned along any axis in the world so they are only really a stack of pancakes when they are aligned on the Y axis, but you get the idea. These can be created within world space with special tools. I’m thinking something like a saw would allow you to make these.
Microblocks represent a block cut into 8 smaller cubes in a 2x2x2 arrangement. As with things like torches, you can’t have these be made of more than one material. If you are dealing with microblocks made of rock in a single block, then all of them are made of rock. Like slices, these can also be created in the world with special tools. A tool like a chisel should do nicely.
Next I thought about water and how it flows. For this one, I’m not sure yet how I will approach it. Is flowing water that is near its limit of how far it can flow spatial data? Is it a variant of water that contains information about how it is flowing? Perhaps it’s special properties of flowing things that live in the extra data area of a block. I have lots of choices and I’ll have to figure it out eventually, but this is not that time. Things that flow will likely be a full production release to add it, so I figure I can worry about it later.
Related to flowing things and microblocks, there is at least some chance that I will revise the spatial data to be 16 bits instead of only 8. I don’t love this concept because it makes every single block a whole byte bigger. While that may seem like no big deal, it means that a fully populated cluster just grew by over two million bytes, so it’s not a decision I make lightly. Perhaps I can come up with something to make this not as horrible.
And just like that, I’ve got concepts of how to lay things out in the world (no matter how you spell spatial) with a bit more finesse. I’ve got more things to think about and more still to code, but at least I’ve started to unravel this particular ball of string.