Simple Miner
Introduction
A Minecraft-like 3D voxel world built with chunk-based architecture and multithreaded world generation. It features procedural terrain with biome systems, advanced rendering techniques including SSR water and procedural sky.
Platform:
Engine:
Duration:
Role:
PC
Custom Engine
2025.9 - 2025.11
Sole Developer
-
Chunk-based Voxel World: 32×32×128 block chunks with dynamic loading/unloading
-
Complex Terrain Generation: Biome-driven generation using continentalness, erosion, peaks/valleys, temperature, and humidity parameters with procedural tree placement
-
Multithreaded Chunk Management: Asynchronous chunk generation via Job System with separate queues for generation, loading, and saving
-
Water Rendering: SSR with refraction, depth-based fog effects, and multi-layer normal-mapped wave animations
-
Procedural Sky Rendering: Gradient-based atmospheric shader with dynamic sun positioning and view-angle dependent color blending
-
Dynamic Lighting System: Indoor and outdoor light propagation with smooth brightness transitions
-
Entity Physics: Swept AABB collision detection using raycast, supporting walking/flying/noclip modes
Procedural World Generation
This is a multi-layered noise-based voxel terrain generation system in Minecraft style. Through 2D Perlin noises with piecewise linear curve mapping, combined with layered 3D noise calculations, it generates diverse terrain features including oceans, beaches, plains, hills, mountains, plateaus and multiple caves; along with rich biomes such as deserts, forests, taigas, jungles, savannas, snowy plains, and frozen oceans.
Phase 1: 2D Noise Sampling & Biome Determination
Generate five 2D Perlin noises for each (x, y) coordinate column, and map raw noise values into terrain parameters (height offset, 3D amplitude, etc.) via piecewise linear curves. Determine the biome type for each column through a 5D lookup table based on discretized noise level classification.

Phase 2: 3D Density Field & Terrain Generation
Calculate 3D density values for each (x, y, z) block by combining base 3D Perlin noise with parameters from the previous phase (continent offset, erosion amplitude, peak elevation, etc.), where density ≥0 produces solid blocks and <0 produces air.
Phase 3: Cave Carving
Cheese Cave
-
Single 3D Perlin noise (scale 32, 4 octaves)
-
cheeseNoise > threshold → large cavities
Spaghetti Cave
-
Two ridge noises: ridge = |Perlin3D|
-
ridge1 + ridge2 < thickness → tunnels
-
Ridge noise forms 2D surfaces in 3D; intersection of two surfaces creates 1D winding tunnels
-
Scale 24, thicker tunnels (3-8 blocks wide)
Noodle Cave
-
Also uses intersection of two ridge noises
-
Smaller scale (16) and stricter threshold
-
Produces thinner tunnels
Phase 4: Surface Replacement & Ore Distribution
Replace surface and subsurface blocks (grass blocks, sand, snow blocks, dirt, etc.) based on the highest solid block position and biome type for each (x, y) column. Distribute ores (diamond, gold, iron, coal, etc.) in deep underground layers according to depth and noise patterns, and place special blocks like bedrock, obsidian, and lava at specific levels.
Phase 5: Vegetation & Structure Generation
Perform 3×3 local maxima detection using tree noise to filter tree generation candidates. Select tree type (oak, birch, spruce, jungle tree, acacia, cactus, etc.) and size (small, medium, large) based on biome type and noise values, then place trees on the surface using predefined block templates (stamps).
High-Performence Chunk Management System
Core Architecture Design
-
Three-Tier Job System: Chunk lifecycle divided into three independent job queues: Generation, Loading, and Saving
-
State Machine Management: Designed chunk states (CONSTRUCTING → ACTIVATING → ACTIVE → DEACTIVATING → DECONSTRUCTING) with std::atomic<ChunkState> ensuring thread-safe state transitions
-
Concurrency Control: Configurable concurrency limits (100 generating, 4 loading, 2 saving) to prevent thread contention and resource exhaustion
-
Distance-Based Priority Sorting: All job queues sorted by player distance in real-time, prioritizing chunks within view
-
Dynamic Culling Mechanism: Distance checks before job submission; tasks beyond activation range are discarded to avoid wasted computation

Memory & Performance Optimization
-
Face Culling Algorithm: Uses BlockIterator to detect adjacent blocks, generating only visible faces (~20% vertex rate)
-
Neighbor Pointer System: Four-directional pointers (East/West/North/South) enable O(1) cross-chunk access
-
Pre-allocation Strategy: Vertex count estimated based on VISIBLE_FACE_RATIO to reduce dynamic reallocation
-
RLE Compression Storage: Chunk files use Run-Length Encoding, significantly reducing disk usage
-
Deferred Release Strategy: CPU buffers cleared immediately after GPU upload (clear() + shrink_to_fit()), minimizing memory peak

Data Consistency Guarantees
-
Dynamic Neighbor Hooking: Automatically establishes neighbor relationships on activation (HookUpChunkNeighbors), safely unlinks on destruction
-
Boundary Propagation System: Block modifications trigger Dirty flags in neighboring chunks, ensuring mesh coherence
-
Versioned File Format: Header structure includes FourCC identifier, version number, dimension parameters for backward compatibility
-
File Integrity Validation: Loads verify block count, run length, boundary overflow with detailed error logging

Performance Metrics
-
Activation Range: 480-unit radius (~30×30 chunks, containing 100 million blocks, maintaining 200+ FPS)
-
Concurrency Capacity: Maximum 106 chunks processed simultaneously (100 generating + 4 loading + 2 saving)
-
Mesh Efficiency: Post-culling retains only 20% vertices, ~6K vertices per chunk

Water Rendering
Screen-Space Reflection (SSR)
-
Custom ray tracing algorithm
-
Precise depth buffer collision detection
-
Reversed - Z Matrix
-
Edge fade + confidence system to avoid artifacts
-
Fallback to sky color on miss

Screen-Space Refraction
-
Screen UV distortion based on surface normals
-
Real-time sampling of background scene color
-
Adjustable refraction strength for water surface distortion
Physically-Based Lighting
-
Fresnel effect (Schlick approximation) controlling reflection/refraction ratio
-
Blinn-Phong specular + ambient + directional lighting
-
View-dependent dynamic reflection/transmission blending
Depth-Aware Shading
-
Reads scene depth buffer to calculate underwater distance
-
Shallow-to-deep water color gradient
-
Exponential decay simulating light absorption in water
Voxel-based Lighting
Dual-Channel Lighting System
-
Indoor Light
-
Light-emitting blocks (e.g., Glowstone) with brightness values 0-15
-
Six-directional propagation with 1-level attenuation per block
-
Dynamic flickering effects (Perlin Noise modulated intensity)
-
-
Outdoor Light
-
Skylight column system: vertical projection from world top
-
Sky Flag marking: identifies blocks receiving direct sunlight
-
Day-night cycle with dynamic adjustment (4-keyframe interpolation)
-
Light Propagation Algorithm
-
Queue-Driven BFS Propagation
-
Dirty Queue: maintains blocks requiring lighting recalculation
-
Six-directional neighbor detection: efficient cross-chunk access via BlockIterator
-
Incremental updates: only recalculates blocks with changed lighting values and their influence range
-
-
Cross-Chunk Boundary Synchronization
-
Boundary block modifications automatically mark neighbor chunks as Dirty
-
Neighbor hooking system ensures seamless light propagation
-

Procedural Sky
Celestial Rendering
-
Sun System: Implemented sun disk masking with glow effects and atmospheric rim lighting
-
Moon System: Achieved realistic moon phase rendering through sphere intersection detection, featuring texture sampling and sunlight illumination calculations to display authentic lunar brightness variations
-
Gradient Sky Shading: Smooth sky color transitions achieved through view direction interpolation, supporting four control points (horizon, zenith, below horizon, and nadir) for natural sky color gradients



























