explaingit

fogleman/craft

10,999CAudience · developerComplexity · 3/5Setup · moderate

TLDR

A Minecraft-style voxel sandbox game written from scratch in a few thousand lines of C, with procedural terrain, multiplayer, and block building, designed as a clean, readable implementation.

Mindmap

mindmap
  root((Craft))
    What it does
      Voxel sandbox
      Block building
      Multiplayer
    Rendering
      OpenGL shaders
      Chunk system
      Face culling
    World
      Procedural terrain
      Day night cycle
      SQLite saves
    Tech stack
      C language
      OpenGL
      Python server
      SQLite
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Study a minimal voxel game in C to learn how procedural terrain generation and chunk-based rendering work.

USE CASE 2

Self-host the Python multiplayer server and play online with friends by passing a hostname at launch.

USE CASE 3

Use the codebase as a starting point for building your own block-based sandbox game without engine overhead.

Tech stack

COpenGLPythonSQLite

Getting it running

Difficulty · moderate Time to first run · 30min

Requires a C build toolchain and OpenGL, the original multiplayer server is offline, so self-hosting the Python server is needed for online play.

In plain English

Craft is a Minecraft-style sandbox game written from scratch in C, kept deliberately small at just a few thousand lines of code. It runs on Windows, Mac, and Linux and uses modern graphics techniques (shaders via OpenGL) rather than older fixed-function approaches. Pre-built binaries were available from the author's website, though the original multiplayer server has since been taken down and players now need to self-host if they want online play. The game includes most features you would expect from a voxel sandbox: procedurally generated terrain using noise functions, more than ten block types, plants like grass and flowers and trees, glass blocks with transparency, simple clouds, and a day and night cycle. Everything a player builds or destroys is saved to a local SQLite database. Only the changes from the default world are stored, so the database stays compact. Multiplayer is supported through a Python-based server. The client and server communicate over plain sockets using a simple text protocol. Players can connect to a server by passing a hostname at launch or by typing a command inside the game. The server sends chunk data on demand and broadcasts block changes and player positions to all connected clients in real time. Controls follow familiar conventions: WASD to move, spacebar to jump, left click to break blocks, right click to place them. Players can toggle between walking and flying with Tab, zoom with left shift, and write text on blocks to create signs. Chat commands let players teleport to other users, switch usernames, or move to specific coordinates. The implementation splits the world into 32-by-32 block columns called chunks. Only faces that are actually exposed to air are sent to the graphics card, and only chunks currently visible to the camera are drawn, which keeps performance reasonable. The terrain is deterministic: the same position always generates the same landscape. Text on screen is drawn using a bitmap atlas, and player models are built from simple rectangular primitives defined in code.

Copy-paste prompts

Prompt 1
Walk me through how Craft generates terrain procedurally using noise functions and what variables control the landscape shape.
Prompt 2
How does Craft's chunk system limit rendering to only visible block faces and what data structure represents the world?
Prompt 3
Show me how to set up Craft's Python multiplayer server and connect two clients to the same game session.
Prompt 4
How does Craft store player-made block changes in SQLite and what does the database schema look like?
Prompt 5
I want to add a new block type to Craft. Which files do I need to edit and what data does each block type require?
Open on GitHub → Explain another repo

← fogleman on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.