← Back to Documentation Index

🧱 Voxel Engine

Minecraft-style voxel world with chunk management and block manipulation

📋 Overview

The Voxel Engine provides a complete Minecraft-style block world system with efficient chunk-based rendering, block types, and world generation.

💡 Key Features
  • Chunk System - Efficient 16×16×16 chunk loading
  • Block Types - Multiple block materials (grass, stone, wood, etc.)
  • Meshing - Optimized face culling and greedy meshing
  • World Gen - Procedural terrain generation
  • Dig/Place - Interactive block manipulation

🧱 Voxel Functions

createVoxelWorld(size)

Creates a new voxel world.

size number - World size in chunks (e.g., 8 = 8×8×8 chunks)
Returns: object - Voxel world object
Example:
const world = createVoxelWorld(8);
setBlock(x, y, z, blockType)

Places or removes a block.

x, y, z number - Block coordinates
blockType number - Block ID (0=air, 1=grass, 2=stone, etc.)
Returns: void - No return value
Example:
setBlock(10, 5, 10, 1); // Place grass block
getBlock(x, y, z)

Gets the block type at coordinates.

x, y, z number - Block coordinates
Returns: number - Block type ID
Example:
if (getBlock(x, y, z) === 0) { /* air */ }