Skip to content

OfficialPixelBrush/Betrock

Repository files navigation

Betrock

C++ Application for exploring Minecraft Beta 1.7.3 Worlds

Screenshot

Betrock Screenshot

Build Instructions

Install the required programs

Setup

# Getting utilities
sudo apt install git cmake ninja-build g++
# Getting libraries
sudo apt install libgl1-mesa-dev libglfw3-dev libzip-dev libdeflate-dev libglm-dev libstb-dev

# Setting up the repo
git clone --recurse-submodules https://github.com/OfficialPixelBrush/Betrock.git
cd Betrock
cmake -B build -S.

Compilation

cmake --build build --config Debug --target all

Running

cd build
./Betrock glacier

Tested on Linux Mint 22 and Ubuntu 20.04

(Optional) Packing as tar.gz

cpack --config build/CPackConfig.cmake -G TGZ

(Optional) Packing as AppImage

Note: The AppImage still requires all the folders inside src/external/ else it will not run.

wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy-x86_64.AppImage
./linuxdeploy-x86_64.AppImage --appdir AppDir \
    --executable build/Betrock \
    --desktop-file Betrock.desktop \
    --icon-file icon.png \
    --output appimage
mv Betrock-x86_64.AppImage ./src/external/
cd ./src/external
zip -r Betrock_AppImage.zip *
rm *.AppImage
mv Betrock_AppImage.zip ../../
cd ../../

Background

This project was an idea I had around the middle of 2023 but due to various factors, mainly me being busy with school and work, I was unable to realize it. As I'm unemployed right now, I figured I may as well get busy and learn some proper C++ and finally delve into OpenGL. This project is the result of that.

As a first step, I decided to see how far I could get with Python, to see how difficult it'd be to decypher Minecraft Beta's McRegion file format. Soon enough, I was able to extract the raw block data and dump it into a binary file. I reused the code of an old voxel world gen attempt I made in Godot, and reworked it to accept said binary files. Lo and behold, a chunk was loaded.

The next day I rewrote that code directly in GDScript to load whole McRegion files entirely in Godot, now allowing arbitrary regions to be loaded. However, due to each cube being rendered individually, the performance was rather abysmal. As a result, I figured I'd challenge myself and recreate something like it from scratch in C++ and OpenGL.

The Python and Godot experiments of this project are linked here.

Code Style

I'm new to C++!

This is moreso a disclaimer. I'm new to C++, so there'll be lots of C-isms as I try to get a proper grip on how C++ works and how to properly work with various OOP-isms. If there's code that looks out of place or outright bad, feel free to give tips as to how to improve it. I'd love to learn more!

Never Nesting Rules

In an attempt to keep this Code somewhat readable for other people (and for me in the future), I've chosen to employ the Never Nest design pattern.

Please refer to the following video as to why: "Why You Shouldn't Nest Your Code" by CodeAesthetic

Progress

Goals for Version 0.3.0

  • Make fog act in world space, not view space!
  • Smooth Lighting Fixes
  • Sky
  • Biome Visuals
  • Fix Chunk Loading Memory leak
  • Windows Version - stb causing issues here

Goals for Version 0.2.0

  • Visual Flair
    • Fog
    • Smooth Lighting
    • Ambient Occlusion
  • Gameplay
    • Chunk Loading
      • Chunk Queue
      • Fix Chunk Loading Crash
      • Fix Chunk Loading Memory leak
        • Caused by NBT Data
      • Threaded Chunk Loading
    • Dynamic Chunk Loading as one moves
    • Gravity
    • Smooth Movement

Goals for Version 0.1.0

  • Import Beta 1.7.3 compliant Minecraft worlds
    • Decode Chunk Offset
    • Decompress Chunk Data
      • Gzip
      • Zlib
    • Decode NBT Data
    • Turn NBT Data into C++ Objects
    • Extract Block Data
  • Render Block Data (via OpenGL)
    • Render something
    • Render a Texture
    • Render a Cube
    • Have a Camera that's keyboard and mouse controlled
    • Add Lighting
    • Model Importing
      • OBJ
      • [ ] glTF
    • Render a Chunk
    • Render a Region
    • Render Multiple Regions
    • Render per-face Block lighting
      • Render Sky Lighting
      • Render Block Lighting

Resources

Minecraft Wiki

wiki.vg

YouTube

Other

About

C++ Application for exploring Minecraft Beta 1.7.3 Worlds

Resources

Stars

Watchers

Forks

Packages

No packages published