Home About Contact

BLOCK BUILDER
UNITY
CUSTOM PACKAGE

BlOCK BUILDER

A Unity package for generating, placing, editing 3D tile. This is great for fast prototype, grid-based, games. This package also supports custom path-finding that I makes.

GITHUB LINK

Features

Block Builder Custom Window

The package also includes a custom window for editing blocks in the scene editor. Initially, the project involved simple automated blob tile placement on a basic grid, but later on, marching cubes were introduced to enable tile placement on a dual-grid. The package is still a work in progress, driven by my interest and the ideas I wish to implement. Additionally, support for wave function collapse will be included in the future.

GRID DATA SETTING

With this package, you have the option to set a custom map and grid unit size to generate tiles. The map is composed of an array of grid units, but if you prefer, you can choose to use just the grid unit and ignore the map altogether."

BLOCK GENERATOR

If you choose to use "BLOB TILE" as your preferred method for generating tiles, this section will guide you through the process. "BLOB TILE" uses 8-bit to represent the 8 neighboring tiles that surround each tile, and a bitmask is stored in each tile to update its mesh. This method can only update tiles in a 2D horizontal plane. This is because accounting for neighbor tiles in the top and bottom planes would result in a large number of permutations of mesh types to match the number of bitmasks, making it impractical. If you want to update meshes in 3D, "MARCHING CUBE" mode is more suitable. However, this mode uses two different grids - one for updating the corner mesh and another for the actual tile position (for use in gameplay). Having two different types of tiles can be confusing for players. If that is the case, "BLOB TILE" is the better choice.

GRID ELEMENT GENERATOR

If you prefer to use 'MARCHING CUBE' in your project, this section is where you can generate tiles using the concept of dual-grid tile implementation. This involves generating both grid elements and volume points. The grid element is similar to the blob-tile version but holds a reference to eight corners of volume points, which are offset by half a tile. A volume point is derived from the marching cube concept, where we check each point to determine whether it's inside or outside a tile by storing 8 bits, each representing an adjacent tile where it's either on or off. Using the stored bitmask, a volume point can update itself and select a mesh corner that matches the bitmask value. The actual corner mesh is stored in a scriptable object named 'CornerMeshData'.

BLOCK EDITOR

This section can be used to edit blocks in both 'BLOB TILE' and 'MARCHING CUBE' modes within the scene editor. Editing functionalities include adding and removing blocks, adding and removing paths, and placing assets on the grid.

AUTO MESH GENERATOR

The package also includes an automated mesh generation tool for creating corner meshes used in the 'MARCHING CUBE' algorithm. This tool is designed to simplify the process of building corner meshes by generating duplicates that are automatically flipped and rotated. Each corner mesh is labeled with its corresponding bitmask, and a default material is applied to clearly indicate which side is inside or outside for better understanding.

By using this tool, the number of corner meshes, having to build manually is down to 28 corner mesh. The tool let you preview gernerated meshed in scene view and once you are satisfied with the result. The system let you automatically create 'CornerMeshData' scriptable object, store all preview mesh into it and save to project. Which will be later used to update mesh during edit mode or play mode.

[Below is an example of my game prototype using this package]