Voxel engine made in OpenGL and C++, using GLFW and GLAD. It has recently become my pet project. Runs on both Linux and Windows (64-bit only).
- Use
W,A,S,D
to fly inside the world. - Use your mouse to rotate the camera, and your scrollwheel to zoom.
- You can press
x
for a wireframe view of the currently generated world. - Press
q
to remove blocks, ande
to place a wooden plank.
To compile and run in Linux, simply use the following commands:
mkdir build
cd build
cmake .. && make
and that's pretty much it.
On Windows, using CMake, the compilation setup is a bit more tedius. Provided that you're using MinGW
as your compiler, follow these steps:
-
Install the libraries
glfw3
andglm
manually, by downloading them from their official page (remember to download the proper archive for your CPU architecture!). -
Unzip them and place them into your User folder (i.e.
C:\[your_user_name]\
). Rename toglfw
andglm
respectively. -
After that, go to your extracted
glfw
folder and copy the contents oflib-mingw-w64
inside yourMinGW/lib
folder (you'll need to find the path of theMinGW
compiler yourself). -
Open a Windows terminal and use the commands:
mkdir build
cd build
cmake .. -G "MinGW Makefiles"; make -j8
This project uses the following libraries:
- GLFW
- glad
- glm - the openGL math library
- FastNoiseLite - A single header lib to generate the Perlin noise map
Both GLFW and glm can be easily downloaded with pacman
or apt-get
on Linux. On Windows, you'll have to install them manually (see 'How to compile').
The project also uses two additional libraries: json.hpp
and gltext.h
, which are both included in the project.
- It is missing some key features, that will be added sooner or later.
- The code is very rough, and could use some refactoring. This is due to some GLUT quirks and the fact that some workarounds have been applied to solve some problems encountered during development. Also, I was extremely strict on time.
- Blocks removal is not persistent, so if you delete a cube and roam around the map, you won't be able to see the effect.
On Linux, I suggest using MangoHud to analyze the game's framerate:
export MANGOHUD_DLSYM=1
mangohud ./littlecraftGL
Originally, this was essentially my second project for the Computer Graphics course at the University Of Bologna. The goal was to make an interactable 3D scene in OpenGL. At the time, I decided to make a clone of the popular game "Minecraft", in order to challenge my knowledge and capabilities.
You can take a look at the original version of this project, made using GLUT, in this fork.
As of now, this project functions as a way to improve my C++ skills and knowledge, as well as a way to explore the fascinating world of Voxel engines.