Wednesday, December 7, 2016

Treehaus Complete

Big step completed!  All the Treehaus block shapes are in the game, and I came up with an Anker-style packing plan for the inventory space.  That was a fun challenge in itself, and I'm really  happy with how it came out.  This is the exact size of all the Anker layouts, so it fits perfectly without sticking out along side the rest of the block sets.  There is a lot more variety in shape and size with these blocks compared to the Anker blocks so getting them all to fit just-so was tricky.  I even tried to get a good balance and selection of blocks so you could certainly build something good with this set.

Sunday, December 4, 2016

Quick Update



The round blocks are a challenge, but they look good.  I still have a few more Treehaus blocks to go, but thought I'd share a quick update.
Old time farmin'

Monday, November 28, 2016

Still alive...

Treehaus wood blocks with the Anker Stone material textures
It's been awhile again since I posted any progress on the game, and the expected new playable version still isn't ready to go, but I figured some news was better than nothing.  I've had some time off work over the Thanksgiving holiday, and I used that to get back to work on Blockitect.  The main thing I've been having difficulties with since my last post has been the texturing for the wood blocks.  Mostly because it's very tedious, which led to me losing motivation/ambition.

The process involves scanning all the sides of the blocks in gray scale, cropping out the edges so I have clean textures with no rough corners, etc..  I then have to size them and put them into a texture atlas, which is a single image with all the block's sides arranged in a specific layout.  Then to implement that onto the block in Unity, I have to very carefully map the faces of the 3d model onto that texture image so the faces are correct (a process called UV unwrapping), get all the wood grain to line up from one side to the next, and lastly I have to tweak the color shading to get it looking accurate to the real blocks.

Wood textures mapped onto the same 3d shapes (easily selectable in-game)
This use of a texture atlas has been an improvement over my earlier methods however, both for the game's performance, and it should also ease some of the difficulty and time as I continue to scan in additional textures to allow for multiple versions of every block.  Previously I was creating a separate texture and material for each individual side of the block, which while it has some extra flexibility, is much more tedious than even the above described method.  With the atlas method I just have the one texture, and once UV work is completed for a block shape, I can make additional texture atlases for that same block and they are going to automatically map correctly onto the 3d model.
 
Texture atlas

Just to be clear, the texture for the Anker Stone blocks is incredibly easy by comparison.  I use a single texture that tiles perfectly, meaning it repeats seamlessly.  I just have to create the 3d model and make minor tweaks to get a nice and realistic looking textured block.  Wood is just too chaotic and distinct to work like this, at least if you want it to look realistic.  The hardest blocks to texture are ones with round sides, because I use a flatbed scanner to get the textures into the computer.  This requires a lot more scans, gradually turning the block for each scan.  Then I have to stitch these scans together, taking just the in-focus part of each to make a single image of the entire outer surface of the curved face (the way the scanner works it only gets a clear image on the part of the block that is touching the glass).

I hope to continue with the progress I've made over the last week or so, to be able to get the new version ready, and get a new video to along with it.  The blocks that remain to be implemented are mostly the round ones, which I've put off for last due to the extra challenges they create.
Freestyle build

Wednesday, June 29, 2016

Progress Update


I think an update is long overdue, just in case anybody has been following the progress of my block game.  I haven't really added any amazing new features but what I have been doing is adding lots of small features and subtle improvements.  I'm gradually working towards getting a new version worth uploading, and hope to have that done in a couple weeks if not sooner.

The most significant feature that I've added since my last post is the block palette.  This allows you to build much more efficiently, and you're not limited to build with just the blocks that are in the scene.  You can see an example of the palette on the left side of these images.  This palette is completely customizable, you can add and remove blocks from it at any time.  You're also not limited to just the 10 blocks contained in the palette.  There are actually 10 palettes which you can switch to by pressing the numbers on the keypad, or by pressing B you can simply cycle through them (in case your keyboard doesn't have a numeric keypad).  This allows you quick access to up to 100 block shapes.  The colors are independent of shape, so you can place a block in any color without taking up multiple slots in the palette. (The color is cycled by pressing R)

To add blocks to the palette, you can go to the inventory space by pressing Tab (a feature I've talked about before).  You just pick up a block, then move the mouse scroll wheel in either direction and if the block is not already in the palette, it will be added. 

I've worked on this inventory space quite a bit as well.  In a prior post I described the use of clear plastic bins that would auto-fill with blocks, but I've changed my mind about this.  While it's neat, ultimately I felt it was going to be rather resource intense, and not really necessary.  Maybe I'll revisit it at some point.  For now I've decided just to provide the blocks organized into the packing arrangements as I've shown earlier, which you may have seen in the previous downloadable version.

A look at the inventory space (nothing too special)
The mechanics of adding and removing blocks from the palette and spawning a block from the palette are really simple and intuitive.  You can scroll up and down through the palette with the mouse scroll wheel, and doing so spawns a block of the highlighted shape, already grabbed and ready to place.  One minor cool feature is that the highlighted block slowly spins, so it's easy to discern the details of the shape (making it distinguishable from other similar looking blocks).


I've also worked on the save and load functionality quite extensively.  The game features autosave now, so that when you start the game you'll be exactly where you left off last time you played.  You can also still make a manual save as well.  Besides the block positions and the player position, many other settings are being saved now, including all the block palettes you've made, the music volume and whether it's switched on or off, and the floor and sky textures that you prefer (so you don't have to switch them back each time). 

Some other improvements have been made to block placement/positioning, and how the blocks spawn when you get them from the palette so that they won't disrupt your structures (they look for a clear place to spawn, and if there's no space available you'll get a sound to indicate you need to re-position yourself to enable the block to spawn). 

I added an angle snap feature which really simplifies the building process.  You toggle it with the caps lock key.  In angle snap mode, the block you're holding will maintain it's rotation relative to the world, no matter how you turn, and is locked at 90 degree angles.  You can change the angle in all 3 axes (again by 90 degree increments), and you'll see the block smoothly transition/spin to the new angle orientation.  There are some minor bugs to work out, so I consider this a beta feature at the moment, but it works well as it is.  I also intend to implement grid snapping which should further speed up the process of trying to align blocks perfectly with one another.

That's pretty much it.  I've set the lego blocks aside for the time being, as the work still needed to get that up to snuff is considerable.  I'd rather work on getting a fully functional and polished version of the game with stackable blocks, more complex stuff can come later on.  My main focus for now will be on adding more stone blocks, getting the wood blocks working as well as the stone blocks, and getting more instruction booklets into the game. 

Saturday, January 2, 2016

First look at lego bricks in Blockitect


Well, it's been quite awhile since I've updated my blog, but that doesn't mean I stopped working on the game, or have lost any interest in my block hobby.  Mostly I've just not had enough working additions of any merit to share, and also I'm not getting much traffic here, so I doubt anybody is really too concerned about my lack of activity.  So all of that said, tonight I felt like I made a pretty big step that's worth sharing, and I'll also include a bit of an update on all the features that I've been working on as well.

Lego.  In Blockitect.  That's frickin' huge.  I definitely did not start this project with that in mind.  But as I've improved the game, I've found more and more things I want to do with it, and I've been impressed and surprised at how capable Unity is for doing what I want (and how relatively easy it is). My vision for what this game/toy box is just continues to expand (so much so that it's hard to remain focused on any one thing for long).

The image above doesn't really do anything to show the building capabilities.  It's just cool to see all the colors laid out like that.  I think I got them pretty close, and I know that there are some missing, I did this entirely from my head without looking at a single brick, so accuracy may be lacking, I don't care.  They look incredible in the game.  I think the scale is interesting, which you can't really get a sense of unless I put up a video, which I will do when I get things ironed out better.  The bricks are pretty big.  These are 2 stud by 2 stud plates, and they are the size, relative to the player, of a minecraft block (if you stack four of them they form a cube).  These simple 3d models are not lego accurate in proportions actually.  I'm pretty sure that when I release a playable version, I'll use correctly proportioned/scaled bricks, just because I want you to be able to build any actual set that lego has put out (that will be a massive undertaking, and won't happen any time soon of course).

Now one thing that excites me about getting lego into the game is the fact that I expect more people will be interested in the game now.  I haven't done any substantial promoting of it so far, just a few posts here and there, but even with that I was a bit disappointed that it hasn't gotten much attention, particularly from the community of people who are into the Anchor Stone blocks.  But with lego that potential fan base is huge.  And no one has done a building game like this that I'm aware of.  Sure there is minecraft, and there is an official lego game that is very much derivative of minecraft called Lego Worlds, but those don't have physics.  They don't simulate the actual act of putting bricks together, or stacking them and turning them and so on.  I have Lego Digital Designer, but was never that impressed by it.  That's not a game in any sense either, just a specialized 3d modeling type program.   What I'm getting at is that seeing how the lego works in this space I feel like this has the potential to draw people in, more so than with the Anchor blocks or the wood blocks as much as I love them.

That's enough of that now I want to mention the features that are at least semi-functional in my latest dev build.  The main and most critical feature as far as lego is concerned is the ability to "glue" blocks to one another.  That was the essential part of making lego work, and I always figured it could be done, but getting it to this point was a massive pain compared with pretty much every other aspect of the game to this point.  And the worst part is that joining blocks together is actually not nearly as complicated as taking them apart.  I never would have thought that going into it, but the logistics are really hard, and made more hard by the actual method that I was forced to use to get the blocks to join solidly together.  I don't want to go to indepth, but basically it's harder than you might think to get the game to recognize what blocks you want to disconnect from an assembly and in what way.  It's not hard to take one block off the top of a connected stack, but what happens when you want to separate it in the middle?  And how do you handle lego bricks that are actually connected to more than one brick.  How do you get one assembly to correctly separate into multiple assemblies when you take away the one brick that was holding them together? 

I have ideas.  For now I put that challenge aside to focus on other things.  But finishing up with "gluing" blocks together, I don't yet have a mechanism for having the lego blocks connect simply by pushing them together.  That's coming, and I think it will work great, but for now, you push them together and then you press "C" to connect them.  This works with any of the blocks that I have in the game as long as they have touching surfaces.  There's really no restrictions on how you can connect the stacking blocks together other than that they have those 2 touching surfaces, so you can have some odd looking constructs, and then it's fun to toss them around and see them bounce and tumble.

The other really significant advancement that I've made is the beginnings of an inventory system.  So right now the playable version I've uploaded only allows you to build with the blocks that are in the scene.  There's no method for selecting the blocks from an inventory like you would with minecraft for example.  I've debated the need for that but ultimately decided that it was worthwhile to allow you to quickly pick a specific block, no matter where you're at, it's just more convenient and it makes sense.  So that all said, I don't want a UI in this game.  At this point I'm committed to a very minimal at most or preferably the complete absence of any UI elements.  Not sure why that is, partly I don't want to learn how to do it, it's just time taken away from the more enjoyable stuff that I could be working on, but also I like the challenge and the way it forces me to think outside the box, and it also fits my vision for what this game is becoming.

That being the case, here's the rather clever method I've devised for having an inventory type system in the game (if I do say so myself).  By pressing Tab (I re-mapped the instructions key which was using tab), you instantly move to another space within the level, an area that is strictly devoted to storing/making available all of the blocks that you can build with.  Press tab again and you instantly move back to the spot you were prior to going to the storage area.  Rather importantly as well, the game keeps track of exactly where you were at and the exact direction and angle that you were facing as well as the selected height that you were in in both the inventory and the build areas.


It's not too impressive yet, but what I have in the image to the left is what I would call a parts bin, or container.  It's the type of thing that I use to store my actual lego and my wood blocks.  There are some unique features that are either already working, or will soon be that make this pretty neat.  It's a "bottomless" box.  By that I mean that it will never run out of blocks.  Well, I shouldn't say never because there are some limitations in Unity and I might have to cap the individual block count to save resources, but in essence, as you take the blocks out, the box will fill back up.  It's extra neat because the blocks actually slide or force their way into the container.  They don't just pop into existence.  When you take the blocks out of the back row, it detects they're missing and pushes more in from the back.  If you have the whole column empty, it fills the whole thing back in, otherwise it just pushes as many in as will fit in the box.  I think it's pretty ingenious. 

Another aspect of this concept that I'm working on is allowing you to pick up the drawers and re-arrange them however you like.  I even intend to allow you to choose different sized drawers and to determine what blocks you want to put in them.  In addition, though this is further out, I want to put these relative small containers on slide-out trays or shelves inside a cabinet of some type.  This would allow you to store different sizes and colors and even types of blocks on different levels and in separate cabinets to further allow for customization and organization.  And because I already have the adjustable player height feature, you can easily select your viewing height to reach whichever shelf you want to sort through.

Those are the 2 main features that I've added, the connecting/gluing of blocks and the beginnings of an inventory system, but I've also added a few important but minor features that I will also mention here.  First off I have a randomized texture and block shading system working.  In the public build I just assigned each block in the scene/level a given color and chose from a small set of "shades" of each of the 3 Anchor Stone block colors.  These shades make the blocks look more realistic, it's a small touch that I also used in my Sketchup renders.  Now though blocks randomly pick a shade when they are "spawned" into the scene.  The wood blocks also have the capability to pick from a set of similar but not identical textures.  I scan my blocks with a flatbed scanner, and I scan all sides of 9 identical blocks.  This ensures realistic variety, as not all the wood blocks should be identical.  Such things are noticeable and small touches like that go a long way.  In addition, with the Anchor blocks I have a key mapped to toggle the block color itself between the 3 colors.

I think that's pretty much it.  This turned out to be a really long post.  I had some other things I've been working on that I would like to share, but I think I'll keep those for a later post more specific to the topic when I have more to show.