{"id":285,"date":"2018-01-03T14:29:44","date_gmt":"2018-01-03T14:29:44","guid":{"rendered":"http:\/\/blog.qubekwest.com\/?p=285"},"modified":"2018-01-03T14:29:44","modified_gmt":"2018-01-03T14:29:44","slug":"block-spatial-data","status":"publish","type":"post","link":"https:\/\/blog.qubekwest.com\/?p=285","title":{"rendered":"Block Spatial Data"},"content":{"rendered":"<p>Apparently both &#8220;spatial&#8221; and &#8220;spacial&#8221; are valid ways of spelling the word that describes things that exist or occur in space.\u00a0 I&#8217;ve chosen to use the &#8220;T&#8221; even though my fingers often choose the &#8220;C&#8221; for some reason.\u00a0 I think it&#8217;s because part of me thinks I&#8217;m spelling &#8220;special&#8221; or something.\u00a0 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.<\/p>\n<p>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.\u00a0 At first glance there aren&#8217;t <em>any<\/em> ways of laying blocks in space.\u00a0 They are simply there, or they aren&#8217;t (which means air is there instead, which is still a block).\u00a0 Upon thinking about it some more, there are bunches of things that need more information.\u00a0 Thus, back when I created the Block data structure, I left 8 bits for holding spatial information.\u00a0 The problem at the time was that I wasn&#8217;t sure how that data would be used, and that&#8217;s what I spent my time over the last few days trying to figure out.<\/p>\n<p>The first thing I thought of was torches.\u00a0 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.\u00a0 Even though torches actually appear to be mounted to another block next to where they are, that&#8217;s not really what is happening.\u00a0 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.<\/p>\n<p>The torch problem inspired the concept of placing multiple identical wall mounted items in a single block.\u00a0 To orchestrate that, the first type of spatial data captures which of the 6 &#8220;walls&#8221; of a block have something mounted to them.\u00a0 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.\u00a0 You must keep in mind that this doesn&#8217;t allow a block to consist of multiple different types of material.\u00a0 For example, if a block is a torch block, it can have multiple torches, but it can&#8217;t have both a torch and a ladder.<\/p>\n<p>The next thing that came to mind was trees, or more specifically, wood blocks.\u00a0 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.\u00a0 To a world made up of blocks, there are only three ways a piece of wood that looks like a tree can be facing.\u00a0 That means they are aligned with a single axis of the world.\u00a0 For example, logs that are lined up with the Y axis and then stacked on top of each other would resemble a tree.\u00a0 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.<\/p>\n<p>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.\u00a0 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&#8217;s actually facing since only one side actually has the face on it.\u00a0 This information is also included in the axis alignment.<\/p>\n<p>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.\u00a0 The two ideas I had were what I called slices and microblocks.\u00a0 Both concepts allows a block to appear to be less than whole and give you a lot of flexibility for earning those presentation points.<\/p>\n<p>Slices represent a block cut into 8 slices like a stack of pancakes.\u00a0 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.\u00a0 These can be created within world space with special tools.\u00a0 I&#8217;m thinking something like a saw would allow you to make these.<\/p>\n<p>Microblocks represent a block cut into 8 smaller cubes in a 2x2x2 arrangement.\u00a0 As with things like torches, you can&#8217;t have these be made of more than one material.\u00a0 If you are dealing with microblocks made of rock in a single block, then all of them are made of rock.\u00a0 Like slices, these can also be created in the world with special tools.\u00a0 A tool like a chisel should do nicely.<\/p>\n<p>Next I thought about water and how it flows.\u00a0 For this one, I&#8217;m not sure yet how I will approach it.\u00a0 Is flowing water that is near its limit of how far it can flow spatial data?\u00a0 Is it a variant of water that contains information about how it is flowing?\u00a0 Perhaps it&#8217;s special properties of flowing things that live in the extra data area of a block.\u00a0 I have lots of choices and I&#8217;ll have to figure it out eventually, but this is not that time.\u00a0 Things that flow will likely be a full production release to add it, so I figure I can worry about it later.<\/p>\n<p>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.\u00a0 I don&#8217;t love this concept because it makes every single block a whole byte bigger.\u00a0 While that may seem like no big deal, it means that a fully populated cluster just grew by over two million bytes, so it&#8217;s not a decision I make lightly.\u00a0\u00a0Perhaps I can come up with something to make this not as horrible.<\/p>\n<p>And just like that, I&#8217;ve got concepts of how to lay things out in the world (no matter how you spell spatial) with a bit more finesse.\u00a0 I&#8217;ve got more things to think about and more still to code, but at least I&#8217;ve started to unravel this particular ball of string.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Apparently both &#8220;spatial&#8221; and &#8220;spacial&#8221; are valid ways of spelling the word that describes things that exist or occur in space.\u00a0 I&#8217;ve chosen to use the &#8220;T&#8221; even though my fingers often choose the &#8220;C&#8221; for some reason.\u00a0 I think it&#8217;s because part of me thinks I&#8217;m spelling &#8220;special&#8221; or something.\u00a0 In the future if &hellip; <a href=\"https:\/\/blog.qubekwest.com\/?p=285\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Block Spatial Data<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-285","post","type-post","status-publish","format-standard","hentry","category-dev"],"_links":{"self":[{"href":"https:\/\/blog.qubekwest.com\/index.php?rest_route=\/wp\/v2\/posts\/285","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.qubekwest.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.qubekwest.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.qubekwest.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.qubekwest.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=285"}],"version-history":[{"count":9,"href":"https:\/\/blog.qubekwest.com\/index.php?rest_route=\/wp\/v2\/posts\/285\/revisions"}],"predecessor-version":[{"id":298,"href":"https:\/\/blog.qubekwest.com\/index.php?rest_route=\/wp\/v2\/posts\/285\/revisions\/298"}],"wp:attachment":[{"href":"https:\/\/blog.qubekwest.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=285"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qubekwest.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=285"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qubekwest.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=285"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}