malloc-craft screenshot

A Minecraft-like voxel game written in C using OpenGL. This project focuses on memory management and modern graphics programming techniques to create a block-based 3D world where players can build and explore.

Key Features

World Generation & Terrain

  • Procedural terrain generation with Perlin noise
  • Multiple biomes with distinct characteristics (configurable via JSON)
  • Dynamic chunk loading and management with configurable render distance
  • Procedural tree generation with JSON-based definitions
  • Water physics with water level simulation and fluid flow mechanics

Block System

  • Extensive block types with JSON-based configuration
  • Support for opaque, transparent, liquid, and foliage block types
  • Custom block models using Blockbench format
  • Block placement and destruction with raycast-based selection
  • Oriented blocks (blocks that can face different directions)

Rendering & Graphics

  • Texture atlas support for efficient block rendering
  • Advanced water rendering with reflections and refraction
  • Dynamic shadow mapping with softened shadows
  • Screen-space reflections for water surfaces
  • Liquid renderer with caustic effects
  • Foliage renderer with alpha blending
  • Skybox and sun rendering
  • UI system with configurable FPS counter and hotbar display

Configuration

malloc-craft is highly configurable through JSON files:

  • Display Settings: Window dimensions, fullscreen mode, V-sync, FOV, render distance
  • Blocks: Block types, textures, properties (transparent, liquid, foliage, oriented)
  • Biomes: Biome types with surface/subsurface/underground/underwater block types
  • Trees: Procedural tree generation rules and variations
  • UI: HUD layout including FPS counter position and hotbar styling

Controls

  • WASD: Move
  • Space: Jump
  • Mouse: Look around
  • Left Click: Destroy block
  • Right Click: Place block
  • 0-9: Select from inventory
  • V: No clip mode
  • F1: Toggle FPS counter
  • F11: Toggle fullscreen
  • ESC: Exit

Built With

  • C — core engine and game logic
  • OpenGL — rendering
  • GLFW — window and input management
  • cglm — graphics math library
  • stb_image — image loading
  • glad — OpenGL loading library