https://github.com/jsoulier/blocks
Tiny Minecraft clone in C and GLSL using the new SDL3 GPU API
https://github.com/jsoulier/blocks
3d c example examples game glsl gpu minecraft sdl sdl3 shaders voxel
Last synced: 30 days ago
JSON representation
Tiny Minecraft clone in C and GLSL using the new SDL3 GPU API
- Host: GitHub
- URL: https://github.com/jsoulier/blocks
- Owner: jsoulier
- License: unlicense
- Created: 2024-10-19T16:07:41.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-09-20T17:43:54.000Z (about 2 months ago)
- Last Synced: 2025-09-20T19:26:27.822Z (about 2 months ago)
- Topics: 3d, c, example, examples, game, glsl, gpu, minecraft, sdl, sdl3, shaders, voxel
- Language: C
- Homepage:
- Size: 11.6 MB
- Stars: 184
- Watchers: 2
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Blocks

Tiny Minecraft clone in C and GLSL using the new SDL3 GPU API
### Features
- Procedural world generation
- Parallel chunk loading
- Blocks and plants
- Transparency (limited)
- Deferred rendering
- Directional shadows
- SSAO (ish)
- Water depth shading
- Persistent worlds
### Building
#### Windows
Install the [Vulkan SDK](https://www.lunarg.com/vulkan-sdk/) for glslc
```bash
git clone https://github.com/jsoulier/blocks --recurse-submodules
cd blocks
mkdir build
cd build
cmake ..
cmake --build . --parallel 8 --config Release
cd bin
./blocks.exe
```
#### Linux
```bash
sudo apt install glslc
```
```bash
git clone https://github.com/jsoulier/blocks --recurse-submodules
cd blocks
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . --parallel 8
cd bin
./blocks
```
### Controls
- `WASDEQ` to move
- `Escape` to unfocus
- `LClick` to break a block
- `RClick` to place a block
- `B` to toggle blocks
- `F11` to toggle fullscreen
- `LControl` to move quickly
- `LShift` to move slowly
### Rendering
1. Draw the sky to the g-buffer
2. Draw the world from the sun's perspective to a depth texture (shadows)
3. Draw the world (opaque only) to the g-buffer
4. Calculate SSAO using the g-buffer
5. Combine the g-buffer, SSAO, and shadows together to create a composite texture
6. Draw the world (transparent only) with blending to the composite texture
7. Draw the raycast block to the composite texture
8. Upscale the composite texture to the swapchain texture
9. Draw the UI over the swapchain texture
10. Submit