A master thesis project. Basically a Minecraft clone, I was focusing on accelerating things on GPU. There is a master thesis text in the repository, however it is in Czech. I might eventually document some of the techniques on a blog or something.
Feel free to get inspired by the code. I'd be glad if you noticed me if you intend to use the code, no real limitations from my side, though. I probably won't be continuing on this project unless I get paid :D
Used texture pack: C-tetra by canna (under CC BY-NC 4.0 licence); downloaded from https://www.planetminecraft.com/texture_pack/16x-c-tetra-1-13/
- GPU with GL 4.5+ (+ some ARBs, basically 4.6), 2 GB VRAM (4+ GB recommended)
- 2 GB available RAM (4+ GB recommended)
Videos & screenshots
Interesting technical stuff
- Minecraft-like lighting system, but RGB and accelerated on GPU (light spread computing). Deferred shading. The way the model is designed results in a native ambient occlusion. (I'm sampling from a 3D light map texture, nodes are in centers of blocks, I offset the sampling position by half of the normal.
- Block face aggergation. I am optimizing the rendered primitive count by aggregating neighbouring faces of blocks into one larger primitive. Calculation of this (together with calculation of which block faces are actually drawn) is done on GPU.
- GPU-accelerated frustum culling.
- Depth peeling (3 layers).
- GPU-accelerated terrain generation. You program the generator on the CPU though (I have a wrapper for that). There are 2D/3D Perlin noise and Voronoi diagram thread cooperation shaders implemented. The generation is however quite slow, loading from a disc is like 10x faster and does not lag the game.
- Even though a lot of stuff is accelerated on the GPU, you can still have custom block shapes and have practically a full control from CPU.
- You can go to view distances up to 64 chunks and it still works quite well if you have a decent graphics card (you'll need 6 GB of VRAM for that though).
- Memory requirements: 4 B per block on both RAM and VRAM. Chunk size is the same as in Minecraft.
- I'm storing the save game in a SQLite database, which works quite well (compressed with zlib).
How to build
There are Windows x64 and x86 binaries in the repository. It should compile on Linux, however there seems to be some problems.
- Install a D compiler (preferably
sudo apt-get install dmd-compiler)
- (Already done for you for Windows) Download appropriate CSFML binaries from https://www.sfml-dev.org/download/csfml/ (version 2.4; or build them, whatever makes you comfy).
- (Already done for you for Windows) Put the shared libraries in the bin_XX folder & the static libraries in the lib_XX folder (the XX is for example x86, x86_64 or so depending on the architecture).
- (Already done for you for Windows) Download official sqlite3 binaries, put the dll in the bin_XX folder. For windows, generate .lib file to the lib_xx folder from the .dll using the implib tool downloaded here: https://digitalmars.com/download/freecompiler.html (basic utilites); command:
implib /system sqlite3.lib sqlite3.dll( https://digitalmars.com/ctg/implib.html ). Alternatively, you can download it from here: https://github.com/buggins/ddbc/tree/master/libs (Also already present for windows)
dub build --build=release --arch=x86_64(or without the
--arch=x86_64for x86 build) in the root project folder (where dub.sdl is)
- A binary should appear in the bin_XX folder
Subscribe to Python Awesome
Get the latest posts delivered right to your inbox