/MinecraftC

A Raytraced Minecraft Classic 0.0.30a port to C

Primary LanguageCMIT LicenseMIT

MinecraftC - A Raytraced Minecraft Classic Port to C

Features:

  • True to the original version (0.0.30a)
  • Implemented fully in C using SDL2 and OpenGL 1.1
  • Original music and sounds
  • A modded and vanilla version
  • Works on Windows, Linux, and MacOS
  • CMake build system

Raytracing:

  • Uses an 8-bit distance field as an acceleration structure
  • In some cases, performance is better than the original
    • 60+ fps at 1080p on the integrated graphics cards I've tested
  • To enable raytracing, download the modded binary and enable it in the mods screen under options

Screenshots

Screen Shot 2022-07-31 at 12 57 49 PM

Screen Shot 2022-07-31 at 12 57 54 PM

Screen Shot 2022-07-31 at 12 43 33 PM

Screen Shot 2022-07-31 at 12 43 39 PM

Downloads

Building

Note: if you would like to build the vanilla version, remove -DMINECRAFTC_MODS=1 from the cmake command

Requirements:

  • git
  • cmake
  • A compiler of your choice

Windows instructions for Visual Studio:

  1. Run the following commands:
git clone --recursive https://github.com/johnpayne-dev/MinecraftC.git
cd MinecraftC
mkdir Build
cd Build
cmake -DMINECRAFTC_MODS=1 -G"Visual Studio 17" .. # replace "Visual Studio 17" with your version
  1. You should now have MinecraftC.sln in your directory that you can open with Visual Studio and build

MacOS instructions for Xcode:

  1. Run the following commands:
git clone --recursive https://github.com/johnpayne-dev/MinecraftC.git
cd MinecraftC
mkdir Build && cd Build
cmake -DMINECRAFTC_MODS -GXcode ..
  1. You should now have MinecraftC.xcodeproj in your directory that you open with Xcode and build

  2. (optional) If you would like it in a .app format, you can run this command to convert your executable:

python3 Scripts/MacOS-App.py <path-to-executable> [developer-id]

Providing the developer id will sign the .app, which you can find by running security find-identity

Linux instructions (untested):

  1. If you don't have SDL2 already, run these commands:
sudo apt-get update
sudo apt-get install libsdl2-dev
  1. Run the following commands:
git clone --recursive https://github.com/johnpayne-dev/MinecraftC.git
cd MinecraftC
mkdir Build && cd Build
cmake -DMINECRAFTC_MODS=1 ..
make

Modifying Resources

If you're creating a mod and want to change or add any .png or .ogg resouces, then run this script to update the resource headers:

python3 Scripts/EmbedResources.py

It will recursively go through all .png and .ogg files in Resources/, and convert them to .h

Known Issues

  • There is no survival mode, it was removed for simplicity and compatibility with raytracing
  • A few sounds have the incorrect pitch, I'm waiting for cute_sound.h to implement pitch shifting
  • Load file and save file are not implemented
  • If raytracing doesn't turn on, then something is going wrong with OpenCL, report an issue and I can help troubleshoot