A Minecraft-like voxel game with both C/OpenGL and Python/Pyglet implementations. Features infinite terrain generation, multiplayer support, and modern graphics rendering.
๐ Website: http://www.michaelfogleman.com/craft/
Choose your implementation:
| C/OpenGL Version (Original) | Python Version (Modern Port) |
|---|---|
| โ Full-featured and optimized | โ Easy to modify and extend |
| โ High performance | โ Cross-platform Python |
| โ Production ready | ๐ง In active development |
| ๐ Full C Documentation | ๐ Python Documentation |
# Install dependencies pip install pyglet numpy pillow # Run the game python3 craft.py# Install dependencies (see detailed instructions below) # Then build and run: git clone https://github.com/hackolite/Craft.git cd Craft cmake . make ./craft- Infinite terrain using Perlin/Simplex noise algorithms
- Chunk-based loading (32x32 blocks) for optimal performance
- 10+ block types with easy extensibility
- Natural structures: grass, flowers, trees, and landscapes
- Building & destruction with left/right click mechanics
- Flying and walking modes with realistic physics
- Day/night cycles with dynamic lighting
- Transparent blocks (glass) and natural plants
- World persistence via SQLite3 database
- Client-server architecture with Python server
- Real-time synchronization of player actions
- Chat system with commands
- Player observation modes (main view + picture-in-picture)
- Modern OpenGL with vertex/fragment shaders
- Ambient occlusion for realistic lighting
- Textured sky dome with time-based transitions
- Frustum culling and optimization for smooth performance
This repository contains two complete implementations of the Craft game:
- Language: C99 with OpenGL
- Performance: Highly optimized, production-ready
- Features: Complete feature set, mature codebase
- Best for: Playing the game, high-performance needs
- Location:
src/directory, built with CMake
- Language: Python 3.7+ with Pyglet
- Performance: Good performance, easier to modify
- Features: Core features implemented, actively developed
- Best for: Learning, modding, experimentation
- Location:
craft*.pyfiles - Documentation: README_PYTHON.md
Both implementations are compatible with the same:
- ๐บ๏ธ World save format
- ๐ Multiplayer server
- ๐จ Texture assets
- ๐ฎ Game mechanics
Dependencies needed:
- CMake 2.8+
- OpenGL development libraries
- CURL development libraries
# Using Homebrew (recommended) brew install cmake # Or download from: http://www.cmake.org/cmake/resources/software.htmlsudo apt-get update sudo apt-get install cmake libglew-dev xorg-dev libcurl4-openssl-dev sudo apt-get build-dep glfw-
Install dependencies:
-
Build with MinGW:
cmake -G "MinGW Makefiles" mingw32-make
git clone https://github.com/hackolite/Craft.git cd Craft cmake . make ./craftRequirements:
- Python 3.7+
- Pyglet 2.0+
- NumPy
- Pillow
# Install Python dependencies pip install pyglet numpy pillow # Clone repository (if not already done) git clone https://github.com/hackolite/Craft.git cd Craft # Run Python version python3 craft.py # Or test modules python3 launcher.py test๐ Detailed Python Documentation: See README_PYTHON.md for complete Python implementation details.
Note: The original craft.michaelfogleman.com server has been taken down. You'll need to run your own server for multiplayer.
Compile the world generation library:
gcc -std=c99 -O3 -fPIC -shared -o world -I src -I deps/noise deps/noise/noise.c src/world.cRun the Python server:
python server.py [HOST [PORT]]Command line:
./craft [HOST [PORT]]In-game command:
/online [HOST [PORT]] | Key | Action |
|---|---|
| WASD | Move forward, left, backward, right |
| Space | Jump |
| Tab | Toggle between walking and flying |
| ZXCVBN | Move in exact XYZ directions |
| Key | Action |
|---|---|
| Left Click | Destroy block |
| Right Click | Create block (or Cmd + Left Click on Mac) |
| Ctrl + Right Click | Toggle block as light source |
| 1-9 | Select block type to create |
| E | Cycle through block types |
| Key | Action |
|---|---|
| Mouse | Look around |
| Left Shift | Zoom |
| F | Orthographic mode |
| O | Observe players in main view |
| P | Observe players in picture-in-picture |
| Arrow Keys | Emulate mouse movement |
| Enter | Emulate mouse click |
| Key | Action |
|---|---|
| T | Type into chat |
| / | Enter command |
| ` | Write text on blocks (signs) |
| Command | Description |
|---|---|
/goto [NAME] | Teleport to another user (random if NAME unspecified) |
/list | Display connected users |
/login NAME | Switch to registered username (case-sensitive) |
/logout | Become guest user |
/offline [FILE] | Switch to offline mode (default save: "craft") |
/online HOST [PORT] | Connect to specified server |
/pq P Q | Teleport to specified chunk coordinates |
/spawn | Return to spawn point |
- Algorithm: Simplex noise for deterministic, position-based terrain
- Architecture: 32x32 block chunks with XZ plane organization
- Persistence: SQLite3 database stores only player modifications (delta)
- Optimization: Only exposed block faces are rendered
- API: Modern OpenGL with vertex/fragment shaders
- Performance: Frustum culling, VBO optimization
- Effects: Ambient occlusion, transparency, sky dome texturing
- Text: Bitmap atlas rendering on 2D rectangles
- Transport: Plain TCP sockets with ASCII line-based protocol
- Synchronization: Real-time player positions, block updates, chat
- Caching: Client-side chunk caching with delta updates
- Performance: Background SQLite writes, transaction batching
C Implementation:
- GLEW - OpenGL extension management
- GLFW - Cross-platform window management
- CURL - HTTPS/SSL for authentication
- lodepng - PNG texture loading
- sqlite3 - World persistence
- tinycthread - Cross-platform threading
Python Implementation:
- Pyglet - OpenGL graphics and windowing
- NumPy - Mathematical operations
- Pillow - Image processing
- Fork the repository
- Clone your fork
- Test both implementations:
# Test C build cmake . && make # Test Python modules python3 launcher.py test
- ๐ฏ Focus on minimal changes for maximum compatibility
- ๐งช Test both C and Python implementations when possible
- ๐ Update documentation for any new features
- ๐ Maintain compatibility between implementations
- ๐ Bug reports: Please include OS, implementation (C/Python), and steps to reproduce
- โจ Feature requests: Consider implementation in both C and Python versions
- ๐ค Pull requests: Test thoroughly and update relevant documentation
Licensed under the MIT License - see LICENSE.md for details.
Copyright (C) 2013 Michael Fogleman Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software... Original Author: Michael Fogleman
Python Port: Community contributions
Inspiration: Minecraft by Mojang Studios
- ๐ Project Website: http://www.michaelfogleman.com/craft/
- ๐ Python Documentation: README_PYTHON.md
- ๐ง Technical Blog Post: Original implementation details
โญ Star this repository if you found it useful!

