Voxel Game

Voxel Game

C++ OpenGL Voxel Multi-threading

Voxel game inspired by Minecraft written in C++ using OpenGL 4.5.

Overview

This is a demo of a Minecraft-inspired voxel game. It contains basic movement and interaction (placing and removing cubes). The world is procedurally generated and only contains one biome at the moment.

The plan going forward is to extend the features: adding multi-block placement, multi biomes, caves, light-emitting blocks, etc…

Features

This demo includes the following features:

  • Chunk-based rendering
  • Infinite world generation using basic thread pool for chunk generation
  • Basic player movement
  • Basic block interaction (placing and removing blocks)
  • Ambient occlusion
  • Day/Night cycle

Technical Details

Chunk System

The world is partitioned into fixed-size chunks used as the main world unit. This keeps updates localized and makes streaming terrain around the player manageable. In its current form, this system is intentionally simple, but it already allows the world to stream in progressively without freezing the application.

Greedy Meshing

To avoid the cost of generating one cube mesh per voxel, the project uses greedy meshing. Adjacent faces of the same block type are merged into larger quads, which greatly reduces mesh complexity and improves rendering performance.

Asynchronous Chunk Generation

Chunk generation is offloaded to a small thread pool. This allows terrain data to be created in the background while the main thread continues handling rendering and player interaction, reducing visible stalls during world streaming.

Voxel Ambient Occlusion

Ambient occlusion is computed from neighboring block occupancy during mesh generation and stored directly in the generated vertices.

Future Improvements

Next steps include better chunk streaming priority, stronger multithreading architecture, visibility culling, more efficient chunk rebuilds, and more advanced world generation.