Where are the block definitions in the Voxel Game Demo? (Official demo)

Godot Version

Godot v4.6

Question

Where are the block definitions in the Official Voxel Game Demo

I want to add a new block.

There are no ‘block definitions’, it is just a demo, not Minecraft.

It uses a ‘block id’ which is just a tile index (in texture_sheet.png, and using Chunk.TEXTURE_SHEET_WIDTH to (indirectly) specify tile size).

Special casing is then done in Chunk._draw_block_mesh() for certain blocks, e.g. block id 3 will use the tile at index 3 for the sides, but tile 0 for the top and tile 2 for the bottom.

That is how blocks are defined in the demo, if you want something more generic and extensible, you would need to build that yourself.

Thanks for letting me know! So when i put a new block texture tile, it automatically creates the block?

Essentially, yes. With a few complications though :slight_smile:

It comes with 32 tiles, but only lets the player select from 1 < - > 29, which appears to be excluding two textures used for logs top/bottom and I guess the furnace(?) top/bottom.

You could move those tiles down to make room for your new tile(s), but that would mean updating all references to id 30 and 31 to wherever you moved them too. So, maybe better to just accept they will become place-able blocks, add your new block tiles below everything and then update this line in player.gd (line 53):

		_selected_block = wrapi(_selected_block, 1, 30)

the first tile below that funny yellow one is index 32, so if you add one tile, change the 30 to 33 (wrapi() third param is exclusive), 34 if you add two, etc.

Thanks for letting me know again! You are the BEST! I like you! Also i needed this information for adding more content to make more builds in my game have more variants.