huge_mountains_2-final.mp4
The concept for this game is to create it "by hand", meaning no game engine is used. My goal is to write code optimized specifically for this game, minimizing the use of external code. When external code is used, it is highly specific and unlikely to need further optimization.
For now, this is a simple voxel-based, Minecraft-like early version of an open-world adventure game. A fairly good map (planet) generator has also been implemented.
I have many plans for the game's content, but I prefer not to reveal too much until I have time to implement them, as I develop this code in my spare time.
All I can say for now is that the space in this game is going to be weird.
Currently, the world consists only of deserts. Basic lighting and a fog effect have been implemented.
Each chunk is preprocessed before rendering in such a way that only potentially visible block faces are sent to the GPU. Such batch of faces is drawn using instancing to minimize data transfer. A chunk is rendered only if it fits within the view frustum.
One of the weird concepts of this game is to mix 3D with 2D, so the player moves only in the XY plane.
walking_and_collisions.mp4
The map generator can create maps with many continents of variable shapes and sizes using Voronoi Diagrams. The landscapes are varied thanks to Fractal Brownian Motion. River networks are also present. Humidity and temperature values are calculated using parameters like altitude, latitude, and distance from oceans and rivers. These values will help determine biomes in the future.
Maps are cyclic in the X-axis, allowing them to be projected onto a cylinder. This feature aligns with the weird concept of mixing 2D and 3D.
Note: Many map generator features are not yet reflected in the rendered world.
The humidity map is also shown.
It is planned that the player will move not just in an XY plane but along a curve, as visualized in the generator playground, making the game even weirder:
continents_with_rivers_1.mp4
Generating maps on a GPU, instead of a CPU, allows for interesting features like dynamically evolving maps. This enables the creation of worlds that gradually change throughout gameplay (weird, isn't it?).
evolving_GPU_continents1.mp4
evolving_GPU_continents2.mp4
Do not hesitate to try some features yourself! A GUI tool is available in the executables to tweak the settings. There are predefined presets with interesting settings and maps. Some settings are best viewed in the weird_space
executable and others in the generator_playground
executable, although both are compatible with both executables.
All binaries for both Linux and Windows are available on the Releases page (note that the Windows binary requires a runtime to be installed as described there).
First, clone the repository:
git clone --recurse-submodules https://github.com/SomePersonFromMars/WeirdSpace.git
cd WeirdSpace
Then follow the platform-specific instructions.
# Required dependencies:
sudo apt-get install cmake make g++ libx11-dev libxi-dev libgl1-mesa-dev libglu1-mesa-dev libxrandr-dev libxext-dev libxcursor-dev libxinerama-dev libxi-dev
# Generate Makefiles:
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
To build and run the game:
cd game
make # Append -j for faster multicore compilation
./weird_space
To build and run the generator playground:
cd tools/generator_playground
make # Append -j for faster multicore compilation
./generator_playground
As the repository uses symbolic links for compilation simplicity, you need to enable them:
- Enable "Developer Mode" in Windows 10/11 - this gives
mklink
permissions. - Inside the repository directory, execute:
git config core.symlinks true git reset --hard
Install Visual Studio 2022 with the "Desktop development with C++" packages.
Open the "x64 Native Tools Command Prompt for VS 2022" app and then:
- Navigate to the cloned repository.
- Create a build directory:
mkdir build
- Enter the build directory:
cd build
- Generate project files:
cmake -G "Visual Studio 17 2022" ..
- Open the Visual Studio Solution file:
start WeirdSpace.sln
- In the Solution Explorer, right-click on the
weird_space
orgenerator_playground
target and click "Set as Startup Project." - You can now build the executable or build and run it.
Instructions from this tutorial will probably work.
- OpenGL extension loading: GLEW
- Windows, input: GLFW
- Math library: GLM
- Temporary debug GUI: Dear ImGui
- Image loading: stb
- CPU noise generation: siv::PerlinNoise
- Delaunay triangulation: delaunator-cpp
- OpenGL knowledge:
- OpenGL Superbible: Comprehensive Tutorial and Reference (7th Edition)
- OpenGL Tutorial
- Learn OpenGL
- Procedural generation:
- Polygon Map Generation by Red Blob Games
- GPU noise: webgl-noise by Ashima
- River networks inspired by Daniel Andrino
- Fractal Brownian Motion from The Book of Shaders
- Fog effect by Inigo Quilez
Copyright (C) 2024, Kacper Orszulak
GNU General Public License v3.0+ (see LICENSE.txt or https://www.gnu.org/licenses/gpl-3.0.txt)